@ -1,23 +1,25 @@
/ * *
/ * *
* @ package Dynamic Script Forum
* @ file wyzz . js
* @ version 1.0 . x , 19 - 10 - 2007 , 18 : 03
* @ copyright 2008 ( c ) DSF Team
* @ author -- -- -- -- -- -- -- -- --
* @ link http : //dsf.gim2przemysl.int.pl/
* @ package uForum
* @ file images / wyzz . js
* @ version $Id$
* @ copyright 2009 ( c ) The Mouse Whisperer
* @ author The Mouse Whisperer
* @ modified PioDer < pioder @ wp . pl >
* @ link http : //pioder.gim2przemysl.int.pl/
* @ license GNU GPL v3
* @ license GNU GPL v3
* * /
* * /
// Editor Width and Height
// Editor Width and Height
wyzzW = 600 ;
wyzzW = 600 ;
wyzzH = 200 ;
wyzzH = 200 ;
image_path = skin_path + 'images/' ;
// Number of toolbars - must be either 1 or 2
image_path = skin_path + 'images/' ; // Number of toolbars - must be either 1 or 2
// If set to 1, the first tooolbar (defined in array buttonName below) will be ignored
// If set to 1, the first tooolbar (defined in array buttonName below) will be ignored
toolbarCount = 2 ;
toolbarCount = 2 ;
// Edit region stylesheet
// Edit region stylesheet
editstyle = skin_path + 'wyzz_editarea.css' ;
editstyle = skin_path + 'wyzz_editarea.css' ;
// Do we want to try to clean the code to emulate xhtml? 1=Yes, 0=No
// Do we want to try to clean the code to emulate xhtml? 1=Yes, 0=No
xhtml_out = 0 ;
xhtml_out = 0 ;
@ -29,11 +31,9 @@ document.write('
// Remove from this any buttons not required in your application
// Remove from this any buttons not required in your application
var buttonName = new Array ( "font" , "headers" , "separator" , "bold" , "italic" , "underline" , "strikethrough" , "separator" , "cut" , "copy" , "paste" , "separator" , "subscript" , "superscript" , "separator" , "justifyleft" , "justifycenter" , "justifyright" , "justifyfull" , "indent" , "outdent" , "separator" , "insertunorderedlist" , "insertorderedlist" , "separator" , "link" , "insertimage" , "separator" , "undo" , "redo" ) ;
var buttonName = new Array ( "font" , "headers" , "separator" , "bold" , "italic" , "underline" , "strikethrough" , "separator" , "cut" , "copy" , "paste" , "separator" , "subscript" , "superscript" , "separator" , "justifyleft" , "justifycenter" , "justifyright" , "justifyfull" , "indent" , "outdent" , "separator" , "insertunorderedlist" , "insertorderedlist" , "separator" , "link" , "insertimage" , "separator" , "undo" , "redo" ) ;
// Order of available commands in toolbar2
// Order of available commands in toolbar2
// Remove from this any buttons not required in your application
// Remove from this any buttons not required in your application
var buttonName2 = new Array ( "specialchar" , "separator" , "forecolor" , "backcolor" , "separator" , "inserthorizontalrule" , "separator" , "removeformat" , "separator" , "upsize" , "downsize" , "separator" , "htmlmode" , "separator" ) ;
var buttonName2 = new Array ( "specialchar" , "separator" , "forecolor" , "backcolor" , "separator" , "inserthorizontalrule" , "separator" , "removeformat" , "separator" , "upsize" , "downsize" , "separator" , "htmlmode" , "separator" , "help" ) ;
var myFonts = new Array ( "Andale Mono" , "Georgia" , "Verdana" , "Arial" , "Arial Black" , "impact" , "Times New Roman" , "Courier New" , "Comic Sans MS" , "Helvetica" , "Trebuchet MS" , "Tahoma" ) ;
var myFonts = new Array ( "Andale Mono" , "Georgia" , "Verdana" , "Arial" , "Arial Black" , "impact" , "Times New Roman" , "Courier New" , "Comic Sans MS" , "Helvetica" , "Trebuchet MS" , "Tahoma" ) ;
@ -42,7 +42,7 @@ var specialChars = new Array("©","®","","à","á","&c
// DON'T MODIFY BEYOND THIS LINE unless you know what you are doing //////////////
// DON'T MODIFY BEYOND THIS LINE unless you know what you are doing //////////////
/********************************************************************************/
/********************************************************************************/
version = "0.62 " ; // Please leave this
version = "0.65 " ; // Please leave this
var Headers = new Array ( "P" , "PRE" , "H1" , "H2" , "H3" , "H4" , "H5" , "H6" ) ;
var Headers = new Array ( "P" , "PRE" , "H1" , "H2" , "H3" , "H4" , "H5" , "H6" ) ;
@ -52,6 +52,21 @@ mode = 1;
// Get browser
// Get browser
browserName = navigator . appName ;
browserName = navigator . appName ;
// New code for additional browser support
if ( navigator . userAgent . indexOf ( 'Safari' ) != - 1 )
{
browserName = "Safari" ;
}
if ( navigator . userAgent . indexOf ( 'Chrome' ) != - 1 )
{
browserName = "Chrome" ;
}
if ( navigator . userAgent . indexOf ( 'Firefox' ) != - 1 )
{
browserName = "Firefox" ;
}
nlBefore = new Array ( "div" , "p" , "li" , "h1" , "h2" , "h3" , "h4" , "h5" , "h6" , "hr" , "ul" , "ol" ) ;
nlBefore = new Array ( "div" , "p" , "li" , "h1" , "h2" , "h3" , "h4" , "h5" , "h6" , "hr" , "ul" , "ol" ) ;
function h2x ( node , inPre ) { // we will pass the node containing the Wyzz-generated html
function h2x ( node , inPre ) { // we will pass the node containing the Wyzz-generated html
@ -187,7 +202,7 @@ function indexOf(thisarray, value)
// Color picker - here we make an array of all websafe colors
// Color picker - here we make an array of all websafe colors
// If you want to limit the colors available to users (e.g. to fit in with
// If you want to limit the colors available to users (e.g. to fit in with
// a site design) then use a restricted array of colors
// a site design) then use a restricted array of colors
// e.g. var buttonName = new Array("336699","66abff", .... etc
// e.g. var buttonColors = new Array("336699","66abff", .... etc
var buttonColors = new Array ( 216 ) ;
var buttonColors = new Array ( 216 ) ;
// Colors - replace this function with your own if you have special requirements for colors
// Colors - replace this function with your own if you have special requirements for colors
@ -216,39 +231,43 @@ getColorArray();
/ * E m u l a t e s i n s e r t A d j a c e n t H T M L ( ) , i n s e r t A d j a c e n t T e x t ( ) a n d i n s e r t A d j a c e n t E l e m e n t ( ) t h r e e f u n c t i o n s
/ * E m u l a t e s i n s e r t A d j a c e n t H T M L ( ) , i n s e r t A d j a c e n t T e x t ( ) a n d i n s e r t A d j a c e n t E l e m e n t ( ) t h r e e f u n c t i o n s
so they work with Netscape 6 / Mozilla - By Thor Larholm me @ jscript . dk * /
so they work with Netscape 6 / Mozilla - By Thor Larholm me @ jscript . dk * /
if ( typeof HTMLElement != "undefined" && ! HTMLElement . prototype . insertAdjacentElement ) {
HTMLElement . prototype . insertAdjacentElement = function ( where , parsedNode ) {
switch ( where ) {
case 'beforeBegin' :
this . parentNode . insertBefore ( parsedNode , this )
break ;
case 'afterBegin' :
this . insertBefore ( parsedNode , this . firstChild ) ;
break ;
case 'beforeEnd' :
this . appendChild ( parsedNode ) ;
break ;
case 'afterEnd' :
if ( this . nextSibling ) {
this . parentNode . insertBefore ( parsedNode , this . nextSibling ) ;
} else {
this . parentNode . appendChild ( parsedNode ) ;
break ;
}
}
}
HTMLElement . prototype . insertAdjacentHTML = function ( where , htmlStr ) {
var r = this . ownerDocument . createRange ( ) ;
r . setStartBefore ( this ) ;
var parsedHTML = r . createContextualFragment ( htmlStr ) ;
this . insertAdjacentElement ( where , parsedHTML )
}
HTMLElement . prototype . insertAdjacentText = function ( where , txtStr ) {
var parsedText = document . createTextNode ( txtStr )
this . insertAdjacentElement ( where , parsedText )
}
if ( typeof HTMLElement != 'undefined' ) {
if ( typeof HTMLElement . insertAdjacentHTML == 'undefined' ) {
HTMLElement . prototype . insertAdjacentElement = function ( where , parsedNode ) {
switch ( where ) {
case 'beforeBegin' :
this . parentNode . insertBefore ( parsedNode , this ) ;
break ;
case 'afterBegin' :
this . insertBefore ( parsedNode , this . firstChild ) ;
break ;
case 'beforeEnd' :
this . appendChild ( parsedNode ) ;
break ;
case 'afterEnd' :
if ( this . nextSibling ) {
this . parentNode . insertBefore ( parsedNode , this . nextSibling ) ;
} else {
this . parentNode . appendChild ( parsedNode ) ;
}
break ;
}
} ;
}
if ( typeof HTMLElement . insertAdjacentHTML == 'undefined' ) {
HTMLElement . prototype . insertAdjacentHTML = function ( where , htmlStr ) {
var r = this . ownerDocument . createRange ( ) ;
r . setStartBefore ( this ) ;
var parsedHTML = r . createContextualFragment ( htmlStr ) ;
this . insertAdjacentElement ( where , parsedHTML ) ;
} ;
}
if ( typeof HTMLElement . insertAdjacentText == 'undefined' ) {
HTMLElement . prototype . insertAdjacentText = function ( where , txtStr ) {
var parsedText = document . createTextNode ( txtStr ) ;
this . insertAdjacentElement ( where , parsedText ) ;
} ;
}
}
}
function closeColorPicker ( thisid ) {
function closeColorPicker ( thisid ) {
@ -273,7 +292,8 @@ function insertLink(n) {
}
}
function insertImage ( n ) {
function insertImage ( n ) {
var imgurl = prompt ( editor_lng4 ) ;
alert ( n ) ;
var imgurl = prompt ( editor_lng4 ) ;
var imgtitle = 'image' ;
var imgtitle = 'image' ;
var theImage = '<img src="' + imgurl + '" title="' + imgtitle + '" alt="' + imgtitle + '" />' ;
var theImage = '<img src="' + imgurl + '" title="' + imgtitle + '" alt="' + imgtitle + '" />' ;
insertHTML ( theImage , n ) ; }
insertHTML ( theImage , n ) ; }
@ -314,7 +334,7 @@ function make_wyzz(textareaID) {
toolbar += '<td style="width: 22px;"><img src="' + image_path + 'wyzz/' + buttonName [ btn ] + '.gif" border=0 unselectable="on" title="' + buttonNameLng [ btn ] + '" id="' + buttonName [ btn ] + '" class="button" onClick="formatText(this.id,\'' + n + '\');" onmouseover="if(className==\'button\'){className=\'buttonOver\'};" onmouseout="if(className==\'buttonOver\'){className=\'button\'};" unselectable="on" width="20" height="20"></td>' ;
toolbar += '<td style="width: 22px;"><img src="' + image_path + 'wyzz/' + buttonName [ btn ] + '.gif" border=0 unselectable="on" title="' + buttonNameLng [ btn ] + '" id="' + buttonName [ btn ] + '" class="button" onClick="formatText(this.id,\'' + n + '\');" onmouseover="if(className==\'button\'){className=\'buttonOver\'};" onmouseout="if(className==\'buttonOver\'){className=\'button\'};" unselectable="on" width="20" height="20"></td>' ;
}
}
}
}
toolbar += '<td > </td></tr></table>' ;
toolbar += '<td> </td></tr></table>' ;
}
}
@ -384,7 +404,7 @@ function make_wyzz(textareaID) {
// The help/about box
// The help/about box
// The copyright and link must remain unaltered
// The copyright and link must remain unaltered
toolbar2 += '<div id="helpbox' + n + '" class="helpbox" style="display:none">' ;
toolbar2 += '<div id="helpbox' + n + '" class="helpbox" style="display:none">' ;
toolbar2 += '<div class="help"><h4><img src="' + image_path + 'wyzz/wyzzicon.gif" align="middle">Wyzz v' + version + '</h4><br>© 2007 <a href="http://www.wyzz.info" target=_blank>www.wyzz.info</a><br><br></div>' ;
toolbar2 += '<div class="help"><h4>Wyzz v' + version + '</h4><br>Running on ' + browserName + '<br>© 2009 <a href="http://www.wyzz.info" target=_blank>www.wyzz.info</a><br><br></div>' ;
toolbar2 += '<img class="closebutton" src="' + image_path + 'wyzz/close.gif" border=0 onclick="closeColorPicker(\'helpbox' + n + '\')"></div></td></tr></table>' ;
toolbar2 += '<img class="closebutton" src="' + image_path + 'wyzz/close.gif" border=0 onclick="closeColorPicker(\'helpbox' + n + '\')"></div></td></tr></table>' ;
// Create iframe for editor
// Create iframe for editor
@ -412,8 +432,7 @@ var iframe = '
}
}
doc . close ( ) ;
doc . close ( ) ;
// var browserName = navigator.appName;
if ( browserName == "Microsoft Internet Explorer" || browserName == "Opera" ) {
if ( browserName == "Microsoft Internet Explorer" ) {
// Make the iframe editable
// Make the iframe editable
doc . body . contentEditable = true ;
doc . body . contentEditable = true ;
} else {
} else {
@ -421,14 +440,12 @@ var iframe = '
doc . designMode = "on" ;
doc . designMode = "on" ;
}
}
// Update the textarea with content in WYSIWYG when user submits form
// var browserName = navigator.appName;
// Update the textarea with content in WYSIWYG when user submits form
if ( browserName == "Microsoft Internet Explorer" || browserName == "Opera" ) {
if ( browserName == "Microsoft Internet Explorer" || browserName == "Opera" ) {
for ( var idx = 0 ; idx < document . forms . length ; idx ++ ) {
for ( var idx = 0 ; idx < document . forms . length ; idx ++ ) {
document . forms [ idx ] . attachEvent ( 'onsubmit' , function ( ) { updateTextArea ( n ) ; } ) ;
document . forms [ idx ] . attachEvent ( 'onsubmit' , function ( ) { updateTextArea ( n ) ; } ) ;
}
}
}
else {
} else {
for ( var idx = 0 ; idx < document . forms . length ; idx ++ ) {
for ( var idx = 0 ; idx < document . forms . length ; idx ++ ) {
document . forms [ idx ] . addEventListener ( 'submit' , function OnSumbmit ( ) { updateTextArea ( n ) ; } , true ) ;
document . forms [ idx ] . addEventListener ( 'submit' , function OnSumbmit ( ) { updateTextArea ( n ) ; } , true ) ;
}
}
@ -436,11 +453,13 @@ var iframe = '
}
}
function formatTextColor ( color , n , selected ) {
function formatTextColor ( color , n , selected ) {
if ( browserName == "Microsoft Internet Explorer" || browserName == "Chrome" ) { color = '#' + color ; }
document . getElementById ( 'wysiwyg' + n ) . contentWindow . document . execCommand ( 'forecolor' , false , color ) ;
document . getElementById ( 'wysiwyg' + n ) . contentWindow . document . execCommand ( 'forecolor' , false , color ) ;
document . getElementById ( 'colorpicker' + n ) . style . display = "none" ;
document . getElementById ( 'colorpicker' + n ) . style . display = "none" ;
}
}
function formatBackColor ( color , n , selected ) {
function formatBackColor ( color , n , selected ) {
if ( browserName == "Microsoft Internet Explorer" || browserName == "Chrome" ) { color = '#' + color ; }
if ( browserName == "Microsoft Internet Explorer" ) {
if ( browserName == "Microsoft Internet Explorer" ) {
document . getElementById ( 'wysiwyg' + n ) . contentWindow . document . execCommand ( 'backcolor' , false , color ) ;
document . getElementById ( 'wysiwyg' + n ) . contentWindow . document . execCommand ( 'backcolor' , false , color ) ;
} else {
} else {
@ -557,8 +576,7 @@ function formatText(id, n, selected) {
document . getElementById ( 'helpbox' + n ) . style . display = "" ;
document . getElementById ( 'helpbox' + n ) . style . display = "" ;
}
}
}
}
else if ( id == "link" ) {
// var browserName = navigator.appName;
else if ( id == "link" ) {
if ( browserName == "Microsoft Internet Explorer" ) {
if ( browserName == "Microsoft Internet Explorer" ) {
var target = confirm ( 'Should this link open in a new window?\n\nOK = Open in NEW Window\nCancel = Open in THIS window' ) ;
var target = confirm ( 'Should this link open in a new window?\n\nOK = Open in NEW Window\nCancel = Open in THIS window' ) ;
document . getElementById ( "wysiwyg" + n ) . contentWindow . document . execCommand ( 'createLink' , true , ' ' ) ;
document . getElementById ( "wysiwyg" + n ) . contentWindow . document . execCommand ( 'createLink' , true , ' ' ) ;
@ -570,8 +588,7 @@ function formatText(id, n, selected) {
insertLink ( n ) ;
insertLink ( n ) ;
}
}
}
}
else if ( id == "insertimage" ) {
// var browserName = navigator.appName;
else if ( id == "insertimage" ) {
if ( browserName == "Microsoft Internet Explorer" ) {
if ( browserName == "Microsoft Internet Explorer" ) {
document . getElementById ( "wysiwyg" + n ) . contentWindow . document . execCommand ( id , true , null ) ;
document . getElementById ( "wysiwyg" + n ) . contentWindow . document . execCommand ( id , true , null ) ;
} else {
} else {
@ -584,9 +601,8 @@ function formatText(id, n, selected) {
}
}
}
}
function insertHTML ( html , n ) {
// var browserName = navigator.appName;
if ( browserName == "Microsoft Internet Explorer" ) {
function insertHTML ( html , n ) {
if ( browserName == "Microsoft Internet Explorer" ) {
document . getElementById ( 'wysiwyg' + n ) . contentWindow . document . selection . createRange ( ) . pasteHTML ( html ) ;
document . getElementById ( 'wysiwyg' + n ) . contentWindow . document . selection . createRange ( ) . pasteHTML ( html ) ;
}
}
@ -619,19 +635,15 @@ function insertNodeAtSelection(insertNode, n) {
range = document . createRange ( ) ;
range = document . createRange ( ) ;
if ( container . nodeType == 3 && insertNode . nodeType == 3 ) {
if ( container . nodeType == 3 && insertNode . nodeType == 3 ) {
// if we insert text in a textnode, do optimized insertion
// if we insert text in a textnode, do optimized insertion
container . insertData ( pos , insertNode . nodeValue ) ;
container . insertData ( pos , insertNode . nodeValue ) ;
// put cursor after inserted text
// put cursor after inserted text
range . setEnd ( container , pos + insertNode . length ) ;
range . setEnd ( container , pos + insertNode . length ) ;
range . setStart ( container , pos + insertNode . length ) ;
range . setStart ( container , pos + insertNode . length ) ;
}
else {
var afterNode ;
if ( container . nodeType == 3 ) {
} else {
var afterNode ;
if ( container . nodeType == 3 ) {
// when inserting into a textnode we create 2 new textnodes and put the insertNode in between
// when inserting into a textnode we create 2 new textnodes and put the insertNode in between
var textNode = container ;
var textNode = container ;
container = textNode . parentNode ;
container = textNode . parentNode ;
@ -653,18 +665,14 @@ function insertNodeAtSelection(insertNode, n) {
// remove the old node
// remove the old node
container . removeChild ( textNode ) ;
container . removeChild ( textNode ) ;
}
else {
} else {
// else simply insert the node
// else simply insert the node
afterNode = container . childNodes [ pos ] ;
afterNode = container . childNodes [ pos ] ;
container . insertBefore ( insertNode , afterNode ) ;
container . insertBefore ( insertNode , afterNode ) ;
}
}
range . setEnd ( afterNode , 0 ) ;
range . setEnd ( afterNode , 0 ) ;
range . setStart ( afterNode , 0 ) ;
range . setStart ( afterNode , 0 ) ;
}
}
sel . addRange ( range ) ;
sel . addRange ( range ) ;
}
}
@ -675,10 +683,9 @@ function updateTextArea(n) {
document . getElementById ( n ) . value = document . getElementById ( "wysiwyg" + n ) . contentWindow . document . body . innerHTML ;
document . getElementById ( n ) . value = document . getElementById ( "wysiwyg" + n ) . contentWindow . document . body . innerHTML ;
}
}
}
}
function grabSelectedText ( n ) {
function grabSelectedText ( n ) {
// var browserName = navigator.appName;
var selectedText = '' ;
var selectedText = '' ;
// for IE
// for IE
if ( browserName == "Microsoft Internet Explorer" || browserName == "Opera" ) {
if ( browserName == "Microsoft Internet Explorer" || browserName == "Opera" ) {
Before
After
Width: 80
|
Height: 80
|
Size: 2.5 KiB
@ -78,7 +78,7 @@ while($item=DataBase::fetch($query))
alt = " edit " onMouseOver = " this.style.cursor= \ 'hand \ '; this.src= \ 'skins/'. $default_skin .'/images/lng_'. $default_lang .'/edit_small_active.gif \ ' "
alt = " edit " onMouseOver = " this.style.cursor= \ 'hand \ '; this.src= \ 'skins/'. $default_skin .'/images/lng_'. $default_lang .'/edit_small_active.gif \ ' "
onMouseOut = " this.src= \ 'skins/'. $default_skin .'/images/lng_'. $default_lang .'/edit_small.gif \ ' " ></ a >< br > ' : ' ' : ' ' ,
onMouseOut = " this.src= \ 'skins/'. $default_skin .'/images/lng_'. $default_lang .'/edit_small.gif \ ' " ></ a >< br > ' : ' ' : ' ' ,
'userrank' => User :: UserRank ( $item [ 'rank' ]),
'userrank' => User :: UserRank ( $item [ 'rank' ]),
'avatar' => ( $item [ 'avatar' ] != '' ) ? '<img src="' . $item [ 'avatar' ] . '" alt="av">' : '<br><br><br><br >' ,
'avatar' => ( $item [ 'avatar' ] != '' ) ? '<img src="' . $item [ 'avatar' ] . '" alt="av">' : '<img src="skins/' . $default_skin . '/images/no_av.gif" alt="av" >' ,
'posttext' => Topic :: PostText ( $item [ 'text' ], $item [ 'moderated' ], $item [ 'p_id' ]),
'posttext' => Topic :: PostText ( $item [ 'text' ], $item [ 'moderated' ], $item [ 'p_id' ]),
'sig' => ( $item [ 'sig' ] != '' ) ? '<br><br>----------------<br>' . $item [ 'sig' ] : '' ,
'sig' => ( $item [ 'sig' ] != '' ) ? '<br><br>----------------<br>' . $item [ 'sig' ] : '' ,
'posts' => $item [ 'posts' ],
'posts' => $item [ 'posts' ],