2009-01-16 07:58:38 -05:00
//core
2009-04-24 11:26:00 -04:00
var tinymce = { majorVersion : "3" , minorVersion : "2.3" , releaseDate : "2009-04-23" , _init : function ( ) { var o = this , k = document , l = window , j = navigator , b = j . userAgent , h , a , g , f , e , m ; o . isOpera = l . opera && opera . buildNumber ; o . isWebKit = /WebKit/ . test ( b ) ; o . isIE = ! o . isWebKit && ! o . isOpera && ( /MSIE/gi ) . test ( b ) && ( /Explorer/gi ) . test ( j . appName ) ; o . isIE6 = o . isIE && /MSIE [56]/ . test ( b ) ; o . isGecko = ! o . isWebKit && /Gecko/ . test ( b ) ; o . isMac = b . indexOf ( "Mac" ) != - 1 ; o . isAir = /adobeair/i . test ( b ) ; if ( l . tinyMCEPreInit ) { o . suffix = tinyMCEPreInit . suffix ; o . baseURL = tinyMCEPreInit . base ; o . query = tinyMCEPreInit . query ; return } o . suffix = "" ; a = k . getElementsByTagName ( "base" ) ; for ( h = 0 ; h < a . length ; h ++ ) { if ( m = a [ h ] . href ) { if ( /^https?:\/\/[^\/]+$/ . test ( m ) ) { m += "/" } f = m ? m . match ( /.*\// ) [ 0 ] : "" } } function c ( d ) { if ( d . src && /tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/ . test ( d . src ) ) { if ( /_(src|dev)\.js/g . test ( d . src ) ) { o . suffix = "_src" } if ( ( e = d . src . indexOf ( "?" ) ) != - 1 ) { o . query = d . src . substring ( e + 1 ) } o . baseURL = d . src . substring ( 0 , d . src . lastIndexOf ( "/" ) ) ; if ( f && o . baseURL . indexOf ( "://" ) == - 1 ) { o . baseURL = f + o . baseURL } return o . baseURL } return null } a = k . getElementsByTagName ( "script" ) ; for ( h = 0 ; h < a . length ; h ++ ) { if ( c ( a [ h ] ) ) { return } } g = k . getElementsByTagName ( "head" ) [ 0 ] ; if ( g ) { a = g . getElementsByTagName ( "script" ) ; for ( h = 0 ; h < a . length ; h ++ ) { if ( c ( a [ h ] ) ) { return } } } return } , is : function ( b , a ) { var c = typeof ( b ) ; if ( ! a ) { return c != "undefined" } if ( a == "array" && ( b . hasOwnProperty && b instanceof Array ) ) { return true } return c == a } , each : function ( d , a , c ) { var e , b ; if ( ! d ) { return 0 } c = c || d ; if ( typeof ( d . length ) != "undefined" ) { for ( e = 0 , b = d . length ; e < b ; e ++ ) { if ( a . call ( c , d [ e ] , e , d ) === false ) { return 0 } } } else { for ( e in d ) { if ( d . hasOwnProperty ( e ) ) { if ( a . call ( c , d [ e ] , e , d ) === false ) { return 0 } } } } return 1 } , map : function ( b , c ) { var d = [ ] ; tinymce . each ( b , function ( a ) { d . push ( c ( a ) ) } ) ; return d } , grep : function ( b , c ) { var d = [ ] ; tinymce . each ( b , function ( a ) { if ( ! c || c ( a ) ) { d . push ( a ) } } ) ; return d } , inArray : function ( c , d ) { var e , b ; if ( c ) { for ( e = 0 , b = c . length ; e < b ; e ++ ) { if ( c [ e ] === d ) { return e } } } return - 1 } , extend : function ( f , d ) { var c , b = arguments ; for ( c = 1 ; c < b . length ; c ++ ) { d = b [ c ] ; tinymce . each ( d , function ( a , e ) { if ( typeof ( a ) !== "undefined" ) { f [ e ] = a } } ) } return f } , trim : function ( a ) { return ( a ? "" + a : "" ) . replace ( /^\s*|\s*$/g , "" ) } , create : function ( j , a ) { var i = this , b , e , f , g , d , h = 0 ; j = /^((static) )?([\w.]+)(:([\w.]+))?/ . exec ( j ) ; f = j [ 3 ] . match ( /(^|\.)(\w+)$/i ) [ 2 ] ; e = i . createNS ( j [ 3 ] . replace ( /\.\w+$/ , "" ) ) ; if ( e [ f ] ) { return } if ( j [ 2 ] == "static" ) { e [ f ] = a ; if ( this . onCreate ) { this . onCreate ( j [ 2 ] , j [ 3 ] , e [ f ] ) } return } if ( ! a [ f ] ) { a [ f ] = function ( ) { } ; h = 1 } e [ f ] = a [ f ] ; i . extend ( e [ f ] . prototype , a ) ; if ( j [ 5 ] ) { b = i . resolve ( j [ 5 ] ) . prototype ; g = j [ 5 ] . match ( /\.(\w+)$/i ) [ 1 ] ; d = e [ f ] ; if ( h ) { e [ f ] = function ( ) { return b [ g ] . apply ( this , arguments ) } } else { e [ f ] = function ( ) { this . parent = b [ g ] ; return d . apply ( this , arguments ) } } e [ f ] . prototype [ f ] = e [ f ] ; i . each ( b , function ( c , k ) { e [ f ] . prototype [ k ] = b [ k ] } ) ; i . each ( a , function ( c , k ) { if ( b [ k ] ) { e [ f ] . prototype [ k ] = function ( ) { this . parent = b [ k ] ; return c . apply ( this , arguments ) } } else { if ( k != f ) { e [ f ] . prototype [ k ] = c } } } ) } i . each ( a [ "static" ] , function ( c , k ) { e [ f ] [ k ] = c } ) ; if ( this . onCreate ) { this . onCreate ( j [ 2 ] , j [ 3 ] , e [ f ] . prototype ) } } , walk : function ( c , b , d , a ) { a = a || this ; if ( c ) { if ( d ) { c = c [ d ] } tinymce . each ( c , function ( f , e ) { if ( b . call ( a , f , e , d ) === false ) { return false } tinymce . walk ( f , b , d , a ) } ) } } , createNS : function ( d , c ) { var b , a ; c = c || window ; d = d . split ( "." ) ; for ( b = 0 ; b < d . length ; b ++ ) { a = d [ b ] ; if ( ! c [ a ] ) { c [ a ] = { } } c = c [ a ] } return c } , resolve : function ( d , c ) { var b , a ; c = c || window ; d = d . split ( "." ) ; for ( b = 0 , a = d . length ; b < a ; b ++ ) { c = c [ d [ b ] ] ; if ( ! c ) { break } } return c } , addUnload : function ( e , d ) { var c = this , a = window ; e = { func : e , scope : d || this } ; if ( ! c . unloads ) { function b ( ) { var f = c . unloads , h , i ; if ( f ) { for ( i in f ) { h = f [ i ] ; if ( h && h . func ) { h . func . call ( h . scope , 1 ) } } if ( a . detachEvent ) { a . detachEvent ( "onbeforeunload" , g ) ; a . detachEvent ( "onunload" , b ) } else { if ( a . removeEventListener ) { a . removeEventListener ( "unload" , b , false ) } } c . unloads = h = f = a = b = 0 ; if ( window . CollectGarbage ) { window . CollectGarbage ( ) } } } function g ( ) { var h = document ; if ( h . readyState == "interactive" ) { function f ( ) { h . detachEvent ( "onstop" , f ) ; if ( b ) { b ( ) } h = 0 } if ( h ) { h . attachEvent ( "onstop" , f ) } window . setTimeout ( function ( ) { if ( h ) { h . detachEvent ( "onstop" , f ) } } , 0 ) } } if ( a . attachEvent ) { a . attachEvent ( "onunload" , b ) ; a . attachEvent ( "onbeforeunload" , g ) } else { if ( a . addEventListener )
2009-01-16 07:58:38 -05:00
// advanced/editor_template.js
2009-03-15 12:55:49 -04:00
( function ( e ) { var d = e . DOM , b = e . dom . Event , h = e . extend , f = e . each , a = e . util . Cookie , g , c = e . explode ; e . ThemeManager . requireLangPack ( "advanced" ) ; e . create ( "tinymce.themes.AdvancedTheme" , { sizes : [ 8 , 10 , 12 , 14 , 18 , 24 , 36 ] , controls : { bold : [ "bold_desc" , "Bold" ] , italic : [ "italic_desc" , "Italic" ] , underline : [ "underline_desc" , "Underline" ] , strikethrough : [ "striketrough_desc" , "Strikethrough" ] , justifyleft : [ "justifyleft_desc" , "JustifyLeft" ] , justifycenter : [ "justifycenter_desc" , "JustifyCenter" ] , justifyright : [ "justifyright_desc" , "JustifyRight" ] , justifyfull : [ "justifyfull_desc" , "JustifyFull" ] , bullist : [ "bullist_desc" , "InsertUnorderedList" ] , numlist : [ "numlist_desc" , "InsertOrderedList" ] , outdent : [ "outdent_desc" , "Outdent" ] , indent : [ "indent_desc" , "Indent" ] , cut : [ "cut_desc" , "Cut" ] , copy : [ "copy_desc" , "Copy" ] , paste : [ "paste_desc" , "Paste" ] , undo : [ "undo_desc" , "Undo" ] , redo : [ "redo_desc" , "Redo" ] , link : [ "link_desc" , "mceLink" ] , unlink : [ "unlink_desc" , "unlink" ] , image : [ "image_desc" , "mceImage" ] , cleanup : [ "cleanup_desc" , "mceCleanup" ] , help : [ "help_desc" , "mceHelp" ] , code : [ "code_desc" , "mceCodeEditor" ] , hr : [ "hr_desc" , "InsertHorizontalRule" ] , removeformat : [ "removeformat_desc" , "RemoveFormat" ] , sub : [ "sub_desc" , "subscript" ] , sup : [ "sup_desc" , "superscript" ] , forecolor : [ "forecolor_desc" , "ForeColor" ] , forecolorpicker : [ "forecolor_desc" , "mceForeColor" ] , backcolor : [ "backcolor_desc" , "HiliteColor" ] , backcolorpicker : [ "backcolor_desc" , "mceBackColor" ] , charmap : [ "charmap_desc" , "mceCharMap" ] , visualaid : [ "visualaid_desc" , "mceToggleVisualAid" ] , anchor : [ "anchor_desc" , "mceInsertAnchor" ] , newdocument : [ "newdocument_desc" , "mceNewDocument" ] , blockquote : [ "blockquote_desc" , "mceBlockQuote" ] } , stateControls : [ "bold" , "italic" , "underline" , "strikethrough" , "bullist" , "numlist" , "justifyleft" , "justifycenter" , "justifyright" , "justifyfull" , "sub" , "sup" , "blockquote" ] , init : function ( j , k ) { var l = this , m , i , n ; l . editor = j ; l . url = k ; l . onResolveName = new e . util . Dispatcher ( this ) ; l . settings = m = h ( { theme _advanced _path : true , theme _advanced _toolbar _location : "bottom" , theme _advanced _buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect" , theme _advanced _buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code" , theme _advanced _buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap" , theme _advanced _blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6" , theme _advanced _toolbar _align : "center" , theme _advanced _fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats" , theme _advanced _more _colors : 1 , theme _advanced _row _height : 23 , theme _advanced _resize _horizontal : 1 , theme _advanced _resizing _use _cookie : 1 , theme _advanced _font _sizes : "1,2,3,4,5,6,7" , readonly : j . settings . readonly } , j . settings ) ; if ( ! m . font _size _style _values ) { m . font _size _style _values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt" } if ( e . is ( m . theme _advanced _font _sizes , "string" ) ) { m . font _size _style _values = e . explode ( m . font _size _style _values ) ; m . font _size _classes = e . explode ( m . font _size _classes || "" ) ; n = { } ; j . settings . theme _advanced _font _sizes = m . theme _advanced _font _sizes ; f ( j . getParam ( "theme_advanced_font_sizes" , "" , "hash" ) , function ( q , p ) { var o ; if ( p == q && q >= 1 && q <= 7 ) { p = q + " (" + l . sizes [ q - 1 ] + "pt)" ; if ( j . settings . convert _fonts _to _spans ) { o = m . font _size _classes [ q - 1 ] ; q = m . font _size _style _values [ q - 1 ] || ( l . sizes [ q - 1 ] + "pt" ) } } if ( /^\s*\./ . test ( q ) ) { o = q . replace ( /\./g , "" ) } n [ p ] = o ? { "class" : o } : { fontSize : q } } ) ; m . theme _advanced _font _sizes = n } if ( ( i = m . theme _advanced _path _location ) && i != "none" ) { m . theme _advanced _statusbar _location = m . theme _advanced _path _location } if ( m . theme _advanced _statusbar _location == "none" ) { m . theme _advanced _statusbar _location = 0 } j . onInit . add ( function ( ) { j . onNodeChange . add ( l . _nodeChanged , l ) ; if ( j . settings . content _css !== false ) { j . dom . loadCSS
2009-01-16 07:58:38 -05:00
// plugins/autosave
2009-03-15 12:55:49 -04:00
( function ( ) { tinymce . create ( "tinymce.plugins.AutoSavePlugin" , { init : function ( a , b ) { var c = this ; c . editor = a ; window . onbeforeunload = tinymce . plugins . AutoSavePlugin . _beforeUnloadHandler } , getInfo : function ( ) { return { longname : "Auto save" , author : "Moxiecode Systems AB" , authorurl : "http://tinymce.moxiecode.com" , infourl : "http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave" , version : tinymce . majorVersion + "." + tinymce . minorVersion } } , "static" : { _beforeUnloadHandler : function ( ) { var a ; tinymce . each ( tinyMCE . editors , function ( b ) { if ( b . getParam ( "fullscreen_is_enabled" ) ) { return } if ( b . isDirty ( ) ) { a = b . getLang ( "autosave.unload_msg" ) ; return false } } ) ; return a } } } ) ; tinymce . PluginManager . add ( "autosave" , tinymce . plugins . AutoSavePlugin ) } ) ( ) ;
2009-01-16 07:58:38 -05:00
// plugins/directionality
2009-03-15 12:55:49 -04:00
( function ( ) { tinymce . create ( "tinymce.plugins.Directionality" , { init : function ( a , b ) { var c = this ; c . editor = a ; a . addCommand ( "mceDirectionLTR" , function ( ) { var d = a . dom . getParent ( a . selection . getNode ( ) , a . dom . isBlock ) ; if ( d ) { if ( a . dom . getAttrib ( d , "dir" ) != "ltr" ) { a . dom . setAttrib ( d , "dir" , "ltr" ) } else { a . dom . setAttrib ( d , "dir" , "" ) } } a . nodeChanged ( ) } ) ; a . addCommand ( "mceDirectionRTL" , function ( ) { var d = a . dom . getParent ( a . selection . getNode ( ) , a . dom . isBlock ) ; if ( d ) { if ( a . dom . getAttrib ( d , "dir" ) != "rtl" ) { a . dom . setAttrib ( d , "dir" , "rtl" ) } else { a . dom . setAttrib ( d , "dir" , "" ) } } a . nodeChanged ( ) } ) ; a . addButton ( "ltr" , { title : "directionality.ltr_desc" , cmd : "mceDirectionLTR" } ) ; a . addButton ( "rtl" , { title : "directionality.rtl_desc" , cmd : "mceDirectionRTL" } ) ; a . onNodeChange . add ( c . _nodeChange , c ) } , getInfo : function ( ) { return { longname : "Directionality" , author : "Moxiecode Systems AB" , authorurl : "http://tinymce.moxiecode.com" , infourl : "http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality" , version : tinymce . majorVersion + "." + tinymce . minorVersion } } , _nodeChange : function ( b , a , e ) { var d = b . dom , c ; e = d . getParent ( e , d . isBlock ) ; if ( ! e ) { a . setDisabled ( "ltr" , 1 ) ; a . setDisabled ( "rtl" , 1 ) ; return } c = d . getAttrib ( e , "dir" ) ; a . setActive ( "ltr" , c == "ltr" ) ; a . setDisabled ( "ltr" , 0 ) ; a . setActive ( "rtl" , c == "rtl" ) ; a . setDisabled ( "rtl" , 0 ) } } ) ; tinymce . PluginManager . add ( "directionality" , tinymce . plugins . Directionality ) } ) ( ) ;
2009-01-16 07:58:38 -05:00
// plugins/fullscreen
2009-03-15 12:55:49 -04:00
( function ( ) { var a = tinymce . DOM ; tinymce . create ( "tinymce.plugins.FullScreenPlugin" , { init : function ( c , d ) { var e = this , f = { } , b ; e . editor = c ; c . addCommand ( "mceFullScreen" , function ( ) { var h , i = a . doc . documentElement ; if ( c . getParam ( "fullscreen_is_enabled" ) ) { if ( c . getParam ( "fullscreen_new_window" ) ) { closeFullscreen ( ) } else { a . win . setTimeout ( function ( ) { tinymce . dom . Event . remove ( a . win , "resize" , e . resizeFunc ) ; tinyMCE . get ( c . getParam ( "fullscreen_editor_id" ) ) . setContent ( c . getContent ( { format : "raw" } ) , { format : "raw" } ) ; tinyMCE . remove ( c ) ; a . remove ( "mce_fullscreen_container" ) ; i . style . overflow = c . getParam ( "fullscreen_html_overflow" ) ; a . setStyle ( a . doc . body , "overflow" , c . getParam ( "fullscreen_overflow" ) ) ; a . win . scrollTo ( c . getParam ( "fullscreen_scrollx" ) , c . getParam ( "fullscreen_scrolly" ) ) ; tinyMCE . settings = tinyMCE . oldSettings } , 10 ) } return } if ( c . getParam ( "fullscreen_new_window" ) ) { h = a . win . open ( d + "/fullscreen.htm" , "mceFullScreenPopup" , "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen . availWidth + ",height=" + screen . availHeight ) ; try { h . resizeTo ( screen . availWidth , screen . availHeight ) } catch ( g ) { } } else { tinyMCE . oldSettings = tinyMCE . settings ; f . fullscreen _overflow = a . getStyle ( a . doc . body , "overflow" , 1 ) || "auto" ; f . fullscreen _html _overflow = a . getStyle ( i , "overflow" , 1 ) ; b = a . getViewPort ( ) ; f . fullscreen _scrollx = b . x ; f . fullscreen _scrolly = b . y ; if ( tinymce . isOpera && f . fullscreen _overflow == "visible" ) { f . fullscreen _overflow = "auto" } if ( tinymce . isIE && f . fullscreen _overflow == "scroll" ) { f . fullscreen _overflow = "auto" } if ( tinymce . isIE && ( f . fullscreen _html _overflow == "visible" || f . fullscreen _html _overflow == "scroll" ) ) { f . fullscreen _html _overflow = "auto" } if ( f . fullscreen _overflow == "0px" ) { f . fullscreen _overflow = "" } a . setStyle ( a . doc . body , "overflow" , "hidden" ) ; i . style . overflow = "hidden" ; b = a . getViewPort ( ) ; a . win . scrollTo ( 0 , 0 ) ; if ( tinymce . isIE ) { b . h -= 1 } n = a . add ( a . doc . body , "div" , { id : "mce_fullscreen_container" , style : "position:" + ( tinymce . isIE6 || ( tinymce . isIE && ! a . boxModel ) ? "absolute" : "fixed" ) + ";top:0;left:0;width:" + b . w + "px;height:" + b . h + "px;z-index:200000;" } ) ; a . add ( n , "div" , { id : "mce_fullscreen" } ) ; tinymce . each ( c . settings , function ( j , k ) { f [ k ] = j } ) ; f . id = "mce_fullscreen" ; f . width = n . clientWidth ; f . height = n . clientHeight - 15 ; f . fullscreen _is _enabled = true ; f . fullscreen _editor _id = c . id ; f . theme _advanced _resizing = false ; f . save _onsavecallback = function ( ) { c . setContent ( tinyMCE . get ( f . id ) . getContent ( { format : "raw" } ) , { format : "raw" } ) ; c . execCommand ( "mceSave" ) } ; tinymce . each ( c . getParam ( "fullscreen_settings" ) , function ( l , j ) { f [ j ] = l } ) ; if ( f . theme _advanced _toolbar _location === "external" ) { f . theme _advanced _toolbar _location = "top" } e . fullscreenEditor = new tinymce . Editor ( "mce_fullscreen" , f ) ; e . fullscreenEditor . onInit . add ( function ( ) { e . fullscreenEditor . setContent ( c . getContent ( ) ) ; e . fullscreenEditor . focus ( ) } ) ; e . fullscreenEditor . render ( ) ; tinyMCE . add ( e . fullscreenEditor ) ; e . fullscreenElement = new tinymce . dom . Element ( "mce_fullscreen_container" ) ; e . fullscreenElement . update ( ) ; e . resizeFunc = tinymce . dom . Event . add ( a . win , "resize" , function ( ) { var j = tinymce . DOM . getViewPort ( ) ; e . fullscreenEditor . theme . resizeTo ( j . w , j . h ) } ) } } ) ; c . addButton ( "fullscreen" , { title : "fullscreen.desc" , cmd : "mceFullScreen" } ) ; c . onNodeChange . add ( function ( h , g ) { g . setActive ( "fullscreen" , h . getParam ( "fullscreen_is_enabled" ) ) } ) } , getInfo : function ( ) { return { longname : "Fullscreen" , author : "Moxiecode Systems AB" , authorurl : "http://tinymce.moxiecode.com" , infourl : "http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen" , version : tinymce . majorVersion + "." + tinymce . minorVersion } } } ) ; tinymce . PluginManager . add ( "fullscreen" , tinymce . plugins . FullScreenPlugin ) } ) ( ) ;
2009-01-16 07:58:38 -05:00
// plugins/inlinepopups
2009-03-15 12:55:49 -04:00
( function ( ) { var d = tinymce . DOM , b = tinymce . dom . Element , a = tinymce . dom . Event , e = tinymce . each , c = tinymce . is ; tinymce . create ( "tinymce.plugins.InlinePopups" , { init : function ( f , g ) { f . onBeforeRenderUI . add ( function ( ) { f . windowManager = new tinymce . InlineWindowManager ( f ) ; d . loadCSS ( g + "/skins/" + ( f . settings . inlinepopups _skin || "clearlooks2" ) + "/window.css" ) } ) } , getInfo : function ( ) { return { longname : "InlinePopups" , author : "Moxiecode Systems AB" , authorurl : "http://tinymce.moxiecode.com" , infourl : "http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups" , version : tinymce . majorVersion + "." + tinymce . minorVersion } } } ) ; tinymce . create ( "tinymce.InlineWindowManager:tinymce.WindowManager" , { InlineWindowManager : function ( f ) { var g = this ; g . parent ( f ) ; g . zIndex = 300000 ; g . count = 0 ; g . windows = { } } , open : function ( r , j ) { var y = this , i , k = "" , q = y . editor , g = 0 , s = 0 , h , m , n , o , l , v , x ; r = r || { } ; j = j || { } ; if ( ! r . inline ) { return y . parent ( r , j ) } if ( ! r . type ) { y . bookmark = q . selection . getBookmark ( "simple" ) } i = d . uniqueId ( ) ; h = d . getViewPort ( ) ; r . width = parseInt ( r . width || 320 ) ; r . height = parseInt ( r . height || 240 ) + ( tinymce . isIE ? 8 : 0 ) ; r . min _width = parseInt ( r . min _width || 150 ) ; r . min _height = parseInt ( r . min _height || 100 ) ; r . max _width = parseInt ( r . max _width || 2000 ) ; r . max _height = parseInt ( r . max _height || 2000 ) ; r . left = r . left || Math . round ( Math . max ( h . x , h . x + ( h . w / 2 ) - ( r . width / 2 ) ) ) ; r . top = r . top || Math . round ( Math . max ( h . y , h . y + ( h . h / 2 ) - ( r . height / 2 ) ) ) ; r . movable = r . resizable = true ; j . mce _width = r . width ; j . mce _height = r . height ; j . mce _inline = true ; j . mce _window _id = i ; j . mce _auto _focus = r . auto _focus ; y . features = r ; y . params = j ; y . onOpen . dispatch ( y , r , j ) ; if ( r . type ) { k += " mceModal" ; if ( r . type ) { k += " mce" + r . type . substring ( 0 , 1 ) . toUpperCase ( ) + r . type . substring ( 1 ) } r . resizable = false } if ( r . statusbar ) { k += " mceStatusbar" } if ( r . resizable ) { k += " mceResizable" } if ( r . minimizable ) { k += " mceMinimizable" } if ( r . maximizable ) { k += " mceMaximizable" } if ( r . movable ) { k += " mceMovable" } y . _addAll ( d . doc . body , [ "div" , { id : i , "class" : q . settings . inlinepopups _skin || "clearlooks2" , style : "width:100px;height:100px" } , [ "div" , { id : i + "_wrapper" , "class" : "mceWrapper" + k } , [ "div" , { id : i + "_top" , "class" : "mceTop" } , [ "div" , { "class" : "mceLeft" } ] , [ "div" , { "class" : "mceCenter" } ] , [ "div" , { "class" : "mceRight" } ] , [ "span" , { id : i + "_title" } , r . title || "" ] ] , [ "div" , { id : i + "_middle" , "class" : "mceMiddle" } , [ "div" , { id : i + "_left" , "class" : "mceLeft" } ] , [ "span" , { id : i + "_content" } ] , [ "div" , { id : i + "_right" , "class" : "mceRight" } ] ] , [ "div" , { id : i + "_bottom" , "class" : "mceBottom" } , [ "div" , { "class" : "mceLeft" } ] , [ "div" , { "class" : "mceCenter" } ] , [ "div" , { "class" : "mceRight" } ] , [ "span" , { id : i + "_status" } , "Content" ] ] , [ "a" , { "class" : "mceMove" , tabindex : "-1" , href : "javascript:;" } ] , [ "a" , { "class" : "mceMin" , tabindex : "-1" , href : "javascript:;" , onmousedown : "return false;" } ] , [ "a" , { "class" : "mceMax" , tabindex : "-1" , href : "javascript:;" , onmousedown : "return false;" } ] , [ "a" , { "class" : "mceMed" , tabindex : "-1" , href : "javascript:;" , onmousedown : "return false;" } ] , [ "a" , { "class" : "mceClose" , tabindex : "-1" , href : "javascript:;" , onmousedown : "return false;" } ] , [ "a" , { id : i + "_resize_n" , "class" : "mceResize mceResizeN" , tabindex : "-1" , href : "javascript:;" } ] , [ "a" , { id : i + "_resize_s" , "class" : "mceResize mceResizeS" , tabindex : "-1" , href : "javascript:;" } ] , [ "a" , { id : i + "_resize_w" , "class" : "mceResize mceResizeW" , tabindex : "-1" , href : "javascript:;" } ] , [ "a" , { id : i + "_resize_e" , "class" : "mceResize mceResizeE" , tabindex : "-1" , href : "javascript:;" } ] , [ "a" , { id : i + "_resize_nw" , "class" : "mceResize mceResizeNW" , tabindex : "-1" , href : "javascript:;" } ] , [ "a" , { id : i + "_resize_ne" , "class" : "mceResize mceResizeNE" , tabindex : "-1" , href : "javascript:;" } ] , [ "a" , { id : i + "_resize_sw" , "class" : "mceResize mceResizeSW" , tabindex : "-1" , href : "javascript:;" } ] , [ "a" , { id : i + "_resize_se" , "class" : "mceResize mceResizeSE" , tabindex : "-1" , href : "javascript:;" } ] ] ] ) ; d . setStyles ( i , { top : - 10000 , left : - 10000 } ) ; if ( tinymce . isGecko ) { d . setStyle ( i , "overflow" , "auto" ) } if ( ! r . type ) { g += d . get ( i + "_left" ) . clientWidth ; g += d . get ( i + "_right" ) . clientWidth ; s += d . get ( i + "_top" ) . clientHeight ; s += d . get ( i + "_bottom" ) . clientHeight } d . setStyles ( i , { top : r . top , left : r . left , width : r . width + g , height : r . height + s } ) ; x = r . url || r . file ; if ( x ) { if ( tinymce . relaxedDomain ) { x += ( x . indexOf ( "?" ) == - 1 ? "?" : "&" ) + "mce_rdomain=" + tinymce . relaxedDomain } x = tinymce . _addVer ( x ) } if ( ! r . type ) { d . add ( i + " _content
2009-01-16 07:58:38 -05:00
// plugins/media
2009-03-15 12:55:49 -04:00
( function ( ) { var a = tinymce . each ; tinymce . create ( "tinymce.plugins.MediaPlugin" , { init : function ( b , c ) { var e = this ; e . editor = b ; e . url = c ; function f ( g ) { return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/ . test ( g . className ) } b . onPreInit . add ( function ( ) { b . serializer . addRules ( "param[name|value|_mce_value]" ) } ) ; b . addCommand ( "mceMedia" , function ( ) { b . windowManager . open ( { file : c + "/media.htm" , width : 430 + parseInt ( b . getLang ( "media.delta_width" , 0 ) ) , height : 470 + parseInt ( b . getLang ( "media.delta_height" , 0 ) ) , inline : 1 } , { plugin _url : c } ) } ) ; b . addButton ( "media" , { title : "media.desc" , cmd : "mceMedia" } ) ; b . onNodeChange . add ( function ( h , g , i ) { g . setActive ( "media" , i . nodeName == "IMG" && f ( i ) ) } ) ; b . onInit . add ( function ( ) { var g = { mceItemFlash : "flash" , mceItemShockWave : "shockwave" , mceItemWindowsMedia : "windowsmedia" , mceItemQuickTime : "quicktime" , mceItemRealMedia : "realmedia" } ; b . selection . onSetContent . add ( function ( ) { e . _spansToImgs ( b . getBody ( ) ) } ) ; b . selection . onBeforeSetContent . add ( e . _objectsToSpans , e ) ; if ( b . settings . content _css !== false ) { b . dom . loadCSS ( c + "/css/content.css" ) } if ( b . theme . onResolveName ) { b . theme . onResolveName . add ( function ( h , i ) { if ( i . name == "img" ) { a ( g , function ( l , j ) { if ( b . dom . hasClass ( i . node , j ) ) { i . name = l ; i . title = b . dom . getAttrib ( i . node , "title" ) ; return false } } ) } } ) } if ( b && b . plugins . contextmenu ) { b . plugins . contextmenu . onContextMenu . add ( function ( i , h , j ) { if ( j . nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/ . test ( j . className ) ) { h . add ( { title : "media.edit" , icon : "media" , cmd : "mceMedia" } ) } } ) } } ) ; b . onBeforeSetContent . add ( e . _objectsToSpans , e ) ; b . onSetContent . add ( function ( ) { e . _spansToImgs ( b . getBody ( ) ) } ) ; b . onPreProcess . add ( function ( g , i ) { var h = g . dom ; if ( i . set ) { e . _spansToImgs ( i . node ) ; a ( h . select ( "IMG" , i . node ) , function ( k ) { var j ; if ( f ( k ) ) { j = e . _parse ( k . title ) ; h . setAttrib ( k , "width" , h . getAttrib ( k , "width" , j . width || 100 ) ) ; h . setAttrib ( k , "height" , h . getAttrib ( k , "height" , j . height || 100 ) ) } } ) } if ( i . get ) { a ( h . select ( "IMG" , i . node ) , function ( m ) { var l , j , k ; if ( g . getParam ( "media_use_script" ) ) { if ( f ( m ) ) { m . className = m . className . replace ( /mceItem/g , "mceTemp" ) } return } switch ( m . className ) { case "mceItemFlash" : l = "d27cdb6e-ae6d-11cf-96b8-444553540000" ; j = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" ; k = "application/x-shockwave-flash" ; break ; case "mceItemShockWave" : l = "166b1bca-3f9c-11cf-8075-444553540000" ; j = "http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0" ; k = "application/x-director" ; break ; case "mceItemWindowsMedia" : l = g . getParam ( "media_wmp6_compatible" ) ? "05589fa1-c356-11ce-bf01-00aa0055595a" : "6bf52a52-394a-11d3-b153-00c04f79faa6" ; j = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ; k = "application/x-mplayer2" ; break ; case "mceItemQuickTime" : l = "02bf25d5-8c17-4b23-bc80-d3488abddc6b" ; j = "http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" ; k = "video/quicktime" ; break ; case "mceItemRealMedia" : l = "cfcdaa03-8be4-11cf-b84b-0020afbbccfa" ; j = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" ; k = "audio/x-pn-realaudio-plugin" ; break } if ( l ) { h . replace ( e . _buildObj ( { classid : l , codebase : j , type : k } , m ) , m ) } } ) } } ) ; b . onPostProcess . add ( function ( g , h ) { h . content = h . content . replace ( /_mce_value=/g , "value=" ) } ) ; function d ( g , h ) { h = new RegExp ( h + '="([^"]+)"' , "g" ) . exec ( g ) ; return h ? b . dom . decode ( h [ 1 ] ) : "" } b . onPostProcess . add ( function ( g , h ) { if ( g . getParam ( "media_use_script" ) ) { h . content = h . content . replace ( /<img[^>]+>/g , function ( j ) { var i = d ( j , "class" ) ; if ( /^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/ . test ( i ) ) { at = e . _parse ( d ( j , "title" ) ) ; at . width = d ( j , "width" ) ; at . height = d ( j , "height" ) ; j = '<script type="text/javascript">write' + i . substring ( 7 ) + "({" + e . _serialize ( at ) + "});<\/script>" } return j } ) } } ) } , getInfo : function ( ) { return { longname : "Media" , author : "Moxiecode Systems AB" , authorurl : "http://tinymce.moxiecode.com" , infourl : "http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media" , version : tinymce . majorVersion + "." + tinymce . minorVersion } } , _objectsToSpans : function ( b , e ) { var c = this , d = e . content ; d = d . replace ( / < s c r i p t [ ^ > ] * > \ s * w r i t e ( F l a s h | S h o c k W a v e | W i n d o w s M e d i a | Q u i c k T i m e | R e a
2009-01-16 07:58:38 -05:00
// plugins/paste
2009-04-24 11:26:00 -04:00
( function ( ) { var a = tinymce . each ; tinymce . create ( "tinymce.plugins.PastePlugin" , { init : function ( c , d ) { var e = this , b ; e . editor = c ; e . url = d ; e . onPreProcess = new tinymce . util . Dispatcher ( e ) ; e . onPostProcess = new tinymce . util . Dispatcher ( e ) ; e . onPreProcess . add ( e . _preProcess ) ; e . onPostProcess . add ( e . _postProcess ) ; e . onPreProcess . add ( function ( h , i ) { c . execCallback ( "paste_preprocess" , h , i ) } ) ; e . onPostProcess . add ( function ( h , i ) { c . execCallback ( "paste_postprocess" , h , i ) } ) ; function g ( i ) { var k = c . dom , j = { content : i } ; e . onPreProcess . dispatch ( e , j ) ; j . node = k . create ( "div" , 0 , j . content ) ; e . onPostProcess . dispatch ( e , j ) ; j . content = c . serializer . serialize ( j . node , { getInner : 1 } ) ; if ( /<(p|h[1-6]|ul|ol)/ . test ( j . content ) ) { e . _insertBlockContent ( c , k , j . content ) } else { e . _insert ( j . content ) } } c . addCommand ( "mceInsertClipboardContent" , function ( i , h ) { g ( h ) } ) ; function f ( l ) { var p , k , i , j = c . selection , o = c . dom , h = c . getBody ( ) , m ; if ( o . get ( "_mcePaste" ) ) { return } p = o . add ( h , "div" , { id : "_mcePaste" } , " " ) ; if ( h != c . getDoc ( ) . body ) { m = o . getPos ( c . selection . getStart ( ) , h ) . y } else { m = h . scrollTop } o . setStyles ( p , { position : "absolute" , left : - 10000 , top : m , width : 1 , height : 1 , overflow : "hidden" } ) ; if ( tinymce . isIE ) { i = o . doc . body . createTextRange ( ) ; i . moveToElementText ( p ) ; i . execCommand ( "Paste" ) ; o . remove ( p ) ; g ( p . innerHTML ) ; return tinymce . dom . Event . cancel ( l ) } else { k = c . selection . getRng ( ) ; p = p . firstChild ; i = c . getDoc ( ) . createRange ( ) ; i . setStart ( p , 0 ) ; i . setEnd ( p , 1 ) ; j . setRng ( i ) ; window . setTimeout ( function ( ) { var r = o . get ( "_mcePaste" ) , q ; r . id = "_mceRemoved" ; o . remove ( r ) ; r = o . get ( "_mcePaste" ) || r ; q = ( o . select ( "> span.Apple-style-span div" , r ) [ 0 ] || o . select ( "> span.Apple-style-span" , r ) [ 0 ] || r ) . innerHTML ; o . remove ( r ) ; if ( k ) { j . setRng ( k ) } g ( q ) } , 0 ) } } if ( c . getParam ( "paste_auto_cleanup_on_paste" , true ) ) { if ( tinymce . isOpera || /Firefox\/2/ . test ( navigator . userAgent ) ) { c . onKeyDown . add ( function ( h , i ) { if ( ( ( tinymce . isMac ? i . metaKey : i . ctrlKey ) && i . keyCode == 86 ) || ( i . shiftKey && i . keyCode == 45 ) ) { f ( i ) } } ) } else { c . onPaste . addToTop ( function ( h , i ) { return f ( i ) } ) } } e . _legacySupport ( ) } , getInfo : function ( ) { return { longname : "Paste text/word" , author : "Moxiecode Systems AB" , authorurl : "http://tinymce.moxiecode.com" , infourl : "http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste" , version : tinymce . majorVersion + "." + tinymce . minorVersion } } , _preProcess : function ( c , e ) { var b = e . content , d ; function d ( f ) { a ( f , function ( g ) { if ( g . constructor == RegExp ) { b = b . replace ( g , "" ) } else { b = b . replace ( g [ 0 ] , g [ 1 ] ) } } ) } d ( [ /^\s*( )+/g , /( |<br[^>]*>)+\s*$/g ] ) ; if ( /(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/ . test ( b ) ) { e . wordContent = true ; d ( [ /<!--[\s\S]+?-->/gi , /<\/?(img|font|meta|link|style|span|div|v:\w+)[^>]*>/gi , /<\\?\?xml[^>]*>/gi , /<\/?o:[^>]*>/gi , / (id|name|class|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi , / (id|name|class|language|type|on\w+|v:\w+)=(\w+)/gi , [ /<(\/?)s>/gi , "<$1strike>" ] , /<script[^>]+>[\s\S]*?<\/script>/gi , [ / /g , "\u00a0" ] ] ) } e . content = b } , _postProcess : function ( c , e ) { var b = this , d = b . editor . dom ; if ( e . wordContent ) { a ( d . select ( "a" , e . node ) , function ( f ) { if ( ! f . href || f . href . indexOf ( "#_Toc" ) != - 1 ) { d . remove ( f , 1 ) } } ) ; if ( b . editor . getParam ( "paste_convert_middot_lists" , true ) ) { b . _convertLists ( c , e ) } a ( d . select ( "*" , e . node ) , function ( f ) { d . setAttrib ( f , "style" , "" ) } ) } if ( tinymce . isWebKit ) { a ( d . select ( "*" , e . node ) , function ( f ) { f . removeAttribute ( "mce_style" ) } ) } } , _convertLists : function ( e , c ) { var g = e . editor . dom , f , i , b = - 1 , d , j = [ ] , h ; a ( g . select ( "p" , c . node ) , function ( q ) { var m , r = "" , o , n , k , l ; for ( m = q . firstChild ; m && m . nodeType == 3 ; m = m . nextSibling ) { r += m . nodeValue } if ( /^[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0\u00a0*/ . test ( r ) ) { o = "ul" } if ( /^[\s\S]*\w+\.[\s\S]*\u00a0{2,}/ . test ( r ) ) { o = "ol" } if ( o ) { d = parseFloat ( q . style . marginLeft || 0 ) ; if ( d > b ) { j . push ( d ) } if ( ! f || o != h ) { f = g . create ( o ) ; g . insertAfter ( f , q ) } else { if ( d > b ) { f = i . appendChild ( g . create ( o ) ) } else { if ( d < b ) { k = tinymce . inArray ( j , d ) ; l = g . getParents ( f . parentNode , o ) ; f = l [ l . length - 1 - k ] || f } } } if ( o == "ul" ) { n = q . innerHTML . replace ( /^[\u2022\u00b7\u00a7\u00d8o]\s*( |\u00a0)+\s*/ , "" ) } else { n = q . innerHTML . replace ( /^[\s\S]*\w+\.( |\u00a0)+\s*/ , "" ) } i = f . appendChild ( g . create ( "li" , 0 , n ) ) ; g . remove ( q ) ; b = d ; h = o } else { f = b = 0 } } ) } , _insertBlockContent : function ( h , e , i ) { var c , g , d = h . selection , m , j , b , k , f ; function l ( p ) { var o ; if ( tinymce . isIE ) { o = h . getDoc ( ) . body . createTextRan
2009-01-16 07:58:38 -05:00
// plugins/safari
2009-04-24 11:26:00 -04:00
( function ( ) { var a = tinymce . dom . Event , c = tinymce . grep , d = tinymce . each , b = tinymce . inArray ; function e ( j , i , h ) { var g , k ; g = j . createTreeWalker ( i , NodeFilter . SHOW _ALL , null , false ) ; while ( k = g . nextNode ( ) ) { if ( h ) { if ( ! h ( k ) ) { return false } } if ( k . nodeType == 3 && k . nodeValue && /[^\s\u00a0]+/ . test ( k . nodeValue ) ) { return false } if ( k . nodeType == 1 && /^(HR|IMG|TABLE)$/ . test ( k . nodeName ) ) { return false } } return true } tinymce . create ( "tinymce.plugins.Safari" , { init : function ( f ) { var g = this , h ; if ( ! tinymce . isWebKit ) { return } g . editor = f ; g . webKitFontSizes = [ "x-small" , "small" , "medium" , "large" , "x-large" , "xx-large" , "-webkit-xxx-large" ] ; g . namedFontSizes = [ "xx-small" , "x-small" , "small" , "medium" , "large" , "x-large" , "xx-large" ] ; f . addCommand ( "CreateLink" , function ( k , j ) { var m = f . selection . getNode ( ) , l = f . dom , i ; if ( m && ( /^(left|right)$/i . test ( l . getStyle ( m , "float" , 1 ) ) || /^(left|right)$/i . test ( l . getAttrib ( m , "align" ) ) ) ) { i = l . create ( "a" , { href : j } , m . cloneNode ( ) ) ; m . parentNode . replaceChild ( i , m ) ; f . selection . select ( i ) } else { f . getDoc ( ) . execCommand ( "CreateLink" , false , j ) } } ) ; f . onKeyUp . add ( function ( j , o ) { var l , i , m , p , k ; if ( o . keyCode == 46 || o . keyCode == 8 ) { i = j . getBody ( ) ; l = i . innerHTML ; k = j . selection ; if ( i . childNodes . length == 1 && ! /<(img|hr)/ . test ( l ) && tinymce . trim ( l . replace ( /<[^>]+>/g , "" ) ) . length == 0 ) { j . setContent ( '<p><br mce_bogus="1" /></p>' , { format : "raw" } ) ; p = i . firstChild ; m = k . getRng ( ) ; m . setStart ( p , 0 ) ; m . setEnd ( p , 0 ) ; k . setRng ( m ) } } } ) ; f . addCommand ( "FormatBlock" , function ( j , i ) { var l = f . dom , k = l . getParent ( f . selection . getNode ( ) , l . isBlock ) ; if ( k ) { l . replace ( l . create ( i ) , k , 1 ) } else { f . getDoc ( ) . execCommand ( "FormatBlock" , false , i ) } } ) ; f . addCommand ( "mceInsertContent" , function ( j , i ) { f . getDoc ( ) . execCommand ( "InsertText" , false , "mce_marker" ) ; f . getBody ( ) . innerHTML = f . getBody ( ) . innerHTML . replace ( /mce_marker/g , f . dom . processHTML ( i ) + '<span id="_mce_tmp">XX</span>' ) ; f . selection . select ( f . dom . get ( "_mce_tmp" ) ) ; f . getDoc ( ) . execCommand ( "Delete" , false , " " ) } ) ; f . onKeyPress . add ( function ( o , p ) { var q , v , r , l , j , k , i , u , m , t , s ; if ( p . keyCode == 13 ) { i = o . selection ; q = i . getNode ( ) ; if ( p . shiftKey || o . settings . force _br _newlines && q . nodeName != "LI" ) { g . _insertBR ( o ) ; a . cancel ( p ) } if ( v = h . getParent ( q , "LI" ) ) { r = h . getParent ( v , "OL,UL" ) ; u = o . getDoc ( ) ; s = h . create ( "p" ) ; h . add ( s , "br" , { mce _bogus : "1" } ) ; if ( e ( u , v ) ) { if ( k = h . getParent ( r . parentNode , "LI,OL,UL" ) ) { return } k = h . getParent ( r , "p,h1,h2,h3,h4,h5,h6,div" ) || r ; l = u . createRange ( ) ; l . setStartBefore ( k ) ; l . setEndBefore ( v ) ; j = u . createRange ( ) ; j . setStartAfter ( v ) ; j . setEndAfter ( k ) ; m = l . cloneContents ( ) ; t = j . cloneContents ( ) ; if ( ! e ( u , t ) ) { h . insertAfter ( t , k ) } h . insertAfter ( s , k ) ; if ( ! e ( u , m ) ) { h . insertAfter ( m , k ) } h . remove ( k ) ; k = s . firstChild ; l = u . createRange ( ) ; l . setStartBefore ( k ) ; l . setEndBefore ( k ) ; i . setRng ( l ) ; return a . cancel ( p ) } } } } ) ; f . onExecCommand . add ( function ( i , k ) { var j , m , n , l ; if ( k == "InsertUnorderedList" || k == "InsertOrderedList" ) { j = i . selection ; m = i . dom ; if ( n = m . getParent ( j . getNode ( ) , function ( o ) { return /^(H[1-6]|P|ADDRESS|PRE)$/ . test ( o . nodeName ) } ) ) { l = j . getBookmark ( ) ; m . remove ( n , 1 ) ; j . moveToBookmark ( l ) } } } ) ; f . onClick . add ( function ( i , j ) { j = j . target ; if ( j . nodeName == "IMG" ) { g . selElm = j ; i . selection . select ( j ) } else { g . selElm = null } } ) ; f . onInit . add ( function ( ) { g . _fixWebKitSpans ( ) } ) ; f . onSetContent . add ( function ( ) { h = f . dom ; d ( [ "strong" , "b" , "em" , "u" , "strike" , "sub" , "sup" , "a" ] , function ( i ) { d ( c ( h . select ( i ) ) . reverse ( ) , function ( l ) { var k = l . nodeName . toLowerCase ( ) , j ; if ( k == "a" ) { if ( l . name ) { h . replace ( h . create ( "img" , { mce _name : "a" , name : l . name , "class" : "mceItemAnchor" } ) , l ) } return } switch ( k ) { case "b" : case "strong" : if ( k == "b" ) { k = "strong" } j = "font-weight: bold;" ; break ; case "em" : j = "font-style: italic;" ; break ; case "u" : j = "text-decoration: underline;" ; break ; case "sub" : j = "vertical-align: sub;" ; break ; case "sup" : j = "vertical-align: super;" ; break ; case "strike" : j = "text-decoration: line-through;" ; break } h . replace ( h . create ( "span" , { mce _name : k , style : j , "class" : "Apple-style-span" } ) , l , 1 ) } ) } ) } ) ; f . onPreProcess . add ( function ( i , j ) { h = i . dom ; d ( c ( j . node . getElementsByTagName ( "span" ) ) . reverse ( ) , function ( m ) { var k , l ; if ( j . get ) { if ( h . hasClass ( m , "Apple-style-span" ) ) { l = m . style . backgroundColor ; switch ( h . getAttrib ( m , "mce_name" ) ) { case "font" : if ( ! i . settings . convert _fonts _to _spans ) { h . setAttrib ( m , "style" , "" ) } break ; case "strong" : case "em" : case "sub" : case "sup" : h . setAttrib ( m , "style" , "" ) ; break ; case "strike" :
2009-01-16 07:58:38 -05:00
// plugins/spellchecker
( function ( ) { var JSONRequest = tinymce . util . JSONRequest , each = tinymce . each , DOM = tinymce . DOM ; tinymce . create ( 'tinymce.plugins.SpellcheckerPlugin' , { getInfo : function ( ) { return { longname : 'Spellchecker' , author : 'Moxiecode Systems AB' , authorurl : 'http://tinymce.moxiecode.com' , infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker' , version : tinymce . majorVersion + "." + tinymce . minorVersion } ; } , init : function ( ed , url ) { var t = this , cm ; t . url = url ; t . editor = ed ; ed . addCommand ( 'mceSpellCheck' , function ( ) { if ( ! t . active ) { ed . setProgressState ( 1 ) ; t . _sendRPC ( 'checkWords' , [ t . selectedLang , t . _getWords ( ) ] , function ( r ) { if ( r . length > 0 ) { t . active = 1 ; t . _markWords ( r ) ; ed . setProgressState ( 0 ) ; ed . nodeChanged ( ) ; } else { ed . setProgressState ( 0 ) ; ed . windowManager . alert ( 'spellchecker.no_mpell' ) ; } } ) ; } else t . _done ( ) ; } ) ; ed . onInit . add ( function ( ) { if ( ed . settings . content _css !== false ) ed . dom . loadCSS ( url + '/css/content.css' ) ; } ) ; ed . onClick . add ( t . _showMenu , t ) ; ed . onContextMenu . add ( t . _showMenu , t ) ; ed . onBeforeGetContent . add ( function ( ) { if ( t . active ) t . _removeWords ( ) ; } ) ; ed . onNodeChange . add ( function ( ed , cm ) { cm . setActive ( 'spellchecker' , t . active ) ; } ) ; ed . onSetContent . add ( function ( ) { t . _done ( ) ; } ) ; ed . onBeforeGetContent . add ( function ( ) { t . _done ( ) ; } ) ; ed . onBeforeExecCommand . add ( function ( ed , cmd ) { if ( cmd == 'mceFullScreen' ) t . _done ( ) ; } ) ; t . languages = { } ; each ( ed . getParam ( 'spellchecker_languages' , '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv' , 'hash' ) , function ( v , k ) { if ( k . indexOf ( '+' ) === 0 ) { k = k . substring ( 1 ) ; t . selectedLang = v ; } t . languages [ k ] = v ; } ) ; } , createControl : function ( n , cm ) { var t = this , c , ed = t . editor ; if ( n == 'spellchecker' ) { c = cm . createSplitButton ( n , { title : 'spellchecker.desc' , cmd : 'mceSpellCheck' , scope : t } ) ; c . onRenderMenu . add ( function ( c , m ) { m . add ( { title : 'spellchecker.langs' , 'class' : 'mceMenuItemTitle' } ) . setDisabled ( 1 ) ; each ( t . languages , function ( v , k ) { var o = { icon : 1 } , mi ; o . onclick = function ( ) { mi . setSelected ( 1 ) ; t . selectedItem . setSelected ( 0 ) ; t . selectedItem = mi ; t . selectedLang = v ; } ; o . title = k ; mi = m . add ( o ) ; mi . setSelected ( v == t . selectedLang ) ; if ( v == t . selectedLang ) t . selectedItem = mi ; } ) } ) ; return c ; } } , _walk : function ( n , f ) { var d = this . editor . getDoc ( ) , w ; if ( d . createTreeWalker ) { w = d . createTreeWalker ( n , NodeFilter . SHOW _TEXT , null , false ) ; while ( ( n = w . nextNode ( ) ) != null ) f . call ( this , n ) ; } else tinymce . walk ( n , f , 'childNodes' ) ; } , _getSeparators : function ( ) { var re = '' , i , str = this . editor . getParam ( 'spellchecker_word_separator_chars' , '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}<7D> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \u201d\u201c' ) ; for ( i = 0 ; i < str . length ; i ++ ) re += '\\' + str . charAt ( i ) ; return re ; } , _getWords : function ( ) { var ed = this . editor , wl = [ ] , tx = '' , lo = { } ; this . _walk ( ed . getBody ( ) , function ( n ) { if ( n . nodeType == 3 ) tx += n . nodeValue + ' ' ; } ) ; tx = tx . replace ( new RegExp ( '([0-9]|[' + this . _getSeparators ( ) + '])' , 'g' ) , ' ' ) ; tx = tinymce . trim ( tx . replace ( /(\s+)/g , ' ' ) ) ; each ( tx . split ( ' ' ) , function ( v ) { if ( ! lo [ v ] ) { wl . push ( v ) ; lo [ v ] = 1 ; } } ) ; return wl ; } , _removeWords : function ( w ) { var ed = this . editor , dom = ed . dom , se = ed . selection , b = se . getBookmark ( ) ; each ( dom . select ( 'span' ) . reverse ( ) , function ( n ) { if ( n && ( dom . hasClass ( n , 'mceItemHiddenSpellWord' ) || dom . hasClass ( n , 'mceItemHidden' ) ) ) { if ( ! w || dom . decode ( n . innerHTML ) == w ) dom . remove ( n , 1 ) ; } } ) ; se . moveToBookmark ( b ) ; } , _markWords : function ( wl ) { var r1 , r2 , r3 , r4 , r5 , w = '' , ed = this . editor , re = this . _getSeparators ( ) , dom = ed . dom , nl = [ ] ; var se = ed . selection , b = se . getBookmark ( ) ; each ( wl , function ( v ) { w += ( w ? '|' : '' ) + v ; } ) ; r1 = new RegExp ( '([' + re + '])(' + w + ')([' + re + '])' , 'g' ) ; r2 = new RegExp ( '^(' + w + ')' , 'g' ) ; r3 = new RegExp ( '(' + w + ')([' + re + ']?)$' , 'g' ) ; r4 = new RegExp ( '^(' + w + ')([' + re + ']?)$' , 'g' ) ; r5 = new RegExp ( '(' + w + ')([' + re + '])' , 'g' ) ; this . _walk ( this . editor . getBody ( ) , function ( n ) { if ( n . nodeType == 3 ) { nl . push ( n ) ; } } ) ; each ( nl , function ( n ) { var v ; if ( n . nodeType == 3 ) { v = n . nodeValue ; if ( r1 . test ( v ) || r2 . test ( v ) || r3 . test ( v ) || r4 . test ( v ) ) { v = dom . encode ( v ) ; v = v . replace ( r5 , '<span class="mceItemHiddenSpellWord">$1</span>$2' ) ; v = v . replace ( r3 , '<span class="mceItemHiddenSpellWord">$1</span>$2' ) ; dom . replace ( dom . create ( 'span' , { 'class' : 'mceItemHidden' } , v ) , n ) ; } } } ) ; se . moveToBookmark ( b ) ; } , _showMenu : function ( ed , e ) { var t = this , ed = t . editor , m = t . _menu , p1 , dom = ed . dom , vp = dom . getViewPort ( ed . getWin ( ) ) ; if ( ! m ) { p1
2009-03-15 12:55:49 -04:00
// plugins/tabfocus
2009-04-17 18:43:57 -04:00
( function ( ) { var c = tinymce . DOM , a = tinymce . dom . Event , d = tinymce . each , b = tinymce . explode ; tinymce . create ( "tinymce.plugins.TabFocusPlugin" , { init : function ( f , g ) { function e ( i , j ) { if ( j . keyCode === 9 ) { return a . cancel ( j ) } } function h ( l , p ) { var j , m , o , n , k ; function q ( i ) { o = c . getParent ( l . id , "form" ) ; n = o . elements ; if ( o ) { d ( n , function ( s , r ) { if ( s . id == l . id ) { j = r ; return false } } ) ; if ( i > 0 ) { for ( m = j + 1 ; m < n . length ; m ++ ) { if ( n [ m ] . type != "hidden" ) { return n [ m ] } } } else { for ( m = j - 1 ; m >= 0 ; m -- ) { if ( n [ m ] . type != "hidden" ) { return n [ m ] } } } } return null } if ( p . keyCode === 9 ) { k = b ( l . getParam ( "tab_focus" , l . getParam ( "tabfocus_elements" , ":prev,:next" ) ) ) ; if ( k . length == 1 ) { k [ 1 ] = k [ 0 ] ; k [ 0 ] = ":prev" } if ( p . shiftKey ) { if ( k [ 0 ] == ":prev" ) { n = q ( - 1 ) } else { n = c . get ( k [ 0 ] ) } } else { if ( k [ 1 ] == ":next" ) { n = q ( 1 ) } else { n = c . get ( k [ 1 ] ) } } if ( n ) { if ( l = tinymce . EditorManager . get ( n . id || n . name ) ) { l . focus ( ) } else { window . setTimeout ( function ( ) { window . focus ( ) ; n . focus ( ) } , 10 ) } return a . cancel ( p ) } } } f . onKeyUp . add ( e ) ; if ( tinymce . isGecko ) { f . onKeyPress . add ( h ) ; f . onKeyDown . add ( e ) } else { f . onKeyDown . add ( h ) } f . onInit . add ( function ( ) { d ( c . select ( "a:first,a:last" , f . getContainer ( ) ) , function ( i ) { a . add ( i , "focus" , function ( ) { f . focus ( ) } ) } ) } ) } , getInfo : function ( ) { return { longname : "Tabfocus" , author : "Moxiecode Systems AB" , authorurl : "http://tinymce.moxiecode.com" , infourl : "http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus" , version : tinymce . majorVersion + "." + tinymce . minorVersion } } } ) ; tinymce . PluginManager . add ( "tabfocus" , tinymce . plugins . TabFocusPlugin ) } ) ( ) ;
2009-01-16 07:58:38 -05:00
// plugins/wordpress
2009-02-08 13:37:47 -05:00
( function ( ) { var a = tinymce . DOM ; tinymce . create ( "tinymce.plugins.WordPress" , { init : function ( c , d ) { var e = this , h = c . getParam ( "wordpress_adv_toolbar" , "toolbar2" ) , g = 0 , f , b ; f = '<img src="' + d + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="' + c . getLang ( "wordpress.wp_more_alt" ) + '" />' ; b = '<img src="' + d + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="' + c . getLang ( "wordpress.wp_page_alt" ) + '" />' ; if ( getUserSetting ( "hidetb" , "0" ) == "1" ) { c . settings . wordpress _adv _hidden = 0 } c . onPostRender . add ( function ( ) { if ( c . getParam ( "wordpress_adv_hidden" , 1 ) ) { a . hide ( c . controlManager . get ( h ) . id ) ; e . _resizeIframe ( c , h , 28 ) } } ) ; c . addCommand ( "WP_More" , function ( ) { c . execCommand ( "mceInsertContent" , 0 , f ) } ) ; c . addCommand ( "WP_Page" , function ( ) { c . execCommand ( "mceInsertContent" , 0 , b ) } ) ; c . addCommand ( "WP_Help" , function ( ) { c . windowManager . open ( { url : tinymce . baseURL + "/wp-mce-help.php" , width : 450 , height : 420 , inline : 1 } ) } ) ; c . addCommand ( "WP_Adv" , function ( ) { var j = c . controlManager . get ( h ) . id , i = c . controlManager ; if ( a . isHidden ( j ) ) { i . setActive ( "wp_adv" , 1 ) ; a . show ( j ) ; e . _resizeIframe ( c , h , - 28 ) ; c . settings . wordpress _adv _hidden = 0 ; setUserSetting ( "hidetb" , "1" ) } else { i . setActive ( "wp_adv" , 0 ) ; a . hide ( j ) ; e . _resizeIframe ( c , h , 28 ) ; c . settings . wordpress _adv _hidden = 1 ; setUserSetting ( "hidetb" , "0" ) } } ) ; c . addButton ( "wp_more" , { title : "wordpress.wp_more_desc" , image : d + "/img/more.gif" , cmd : "WP_More" } ) ; c . addButton ( "wp_page" , { title : "wordpress.wp_page_desc" , image : d + "/img/page.gif" , cmd : "WP_Page" } ) ; c . addButton ( "wp_help" , { title : "wordpress.wp_help_desc" , image : d + "/img/help.gif" , cmd : "WP_Help" } ) ; c . addButton ( "wp_adv" , { title : "wordpress.wp_adv_desc" , image : d + "/img/toolbars.gif" , cmd : "WP_Adv" } ) ; c . addButton ( "add_media" , { title : "wordpress.add_media" , image : d + "/img/media.gif" , onclick : function ( ) { tb _show ( "" , tinymce . DOM . get ( "add_media" ) . href ) ; tinymce . DOM . setStyle ( [ "TB_overlay" , "TB_window" , "TB_load" ] , "z-index" , "999999" ) } } ) ; c . addButton ( "add_image" , { title : "wordpress.add_image" , image : d + "/img/image.gif" , onclick : function ( ) { tb _show ( "" , tinymce . DOM . get ( "add_image" ) . href ) ; tinymce . DOM . setStyle ( [ "TB_overlay" , "TB_window" , "TB_load" ] , "z-index" , "999999" ) } } ) ; c . addButton ( "add_video" , { title : "wordpress.add_video" , image : d + "/img/video.gif" , onclick : function ( ) { tb _show ( "" , tinymce . DOM . get ( "add_video" ) . href ) ; tinymce . DOM . setStyle ( [ "TB_overlay" , "TB_window" , "TB_load" ] , "z-index" , "999999" ) } } ) ; c . addButton ( "add_audio" , { title : "wordpress.add_audio" , image : d + "/img/audio.gif" , onclick : function ( ) { tb _show ( "" , tinymce . DOM . get ( "add_audio" ) . href ) ; tinymce . DOM . setStyle ( [ "TB_overlay" , "TB_window" , "TB_load" ] , "z-index" , "999999" ) } } ) ; c . onBeforeExecCommand . add ( function ( i , k , j , l ) { if ( "mceFullScreen" != k ) { return } if ( "mce_fullscreen" != i . id ) { i . settings . theme _advanced _buttons1 += ",|,add_image,add_video,add_audio,add_media" } } ) ; c . addCommand ( "JustifyLeft" , function ( ) { var i = c . selection . getNode ( ) ; if ( i . nodeName != "IMG" ) { c . editorCommands . mceJustify ( "JustifyLeft" , "left" ) } else { c . plugins . wordpress . do _align ( i , "alignleft" ) } } ) ; c . addCommand ( "JustifyRight" , function ( ) { var i = c . selection . getNode ( ) ; if ( i . nodeName != "IMG" ) { c . editorCommands . mceJustify ( "JustifyRight" , "right" ) } else { c . plugins . wordpress . do _align ( i , "alignright" ) } } ) ; c . addCommand ( "JustifyCenter" , function ( ) { var k = c . selection . getNode ( ) , j = c . dom . getParent ( k , "p" ) , i = c . dom . getParent ( k , "dl" ) ; if ( k . nodeName == "IMG" && ( j || i ) ) { c . plugins . wordpress . do _align ( k , "aligncenter" ) } else { c . editorCommands . mceJustify ( "JustifyCenter" , "center" ) } } ) ; if ( "undefined" != typeof wpWordCount ) { c . onKeyUp . add ( function ( i , j ) { if ( j . keyCode == g ) { return } if ( 13 == j . keyCode || 8 == g || 46 == g ) { wpWordCount . wc ( i . getContent ( { format : "raw" } ) ) } g = j . keyCode } ) } e . _handleMoreBreak ( c , d ) ; c . addShortcut ( "alt+shift+c" , c . getLang ( "justifycenter_desc" ) , "JustifyCenter" ) ; c . addShortcut ( "alt+shift+r" , c . getLang ( "justifyright_desc" ) , "JustifyRight" ) ; c . addShortcut ( "alt+shift+l" , c . getLang ( "justifyleft_desc" ) , "JustifyLeft" ) ; c . addShortcut ( "alt+shift+j" , c . getLang ( "justifyfull_desc" ) , "JustifyFull" ) ; c . addShortcut ( "alt+shift+q" , c . getLang ( "blockquote_desc" ) , "mceBlockQuote" ) ; c . addShortcut ( "alt+shift+u" , c . getLang ( "bullist_desc" ) , "InsertUnorderedList" ) ; c . addShortcut ( "alt+shift+o" , c . getLang ( "numlist_desc" ) , "InsertOrderedList" ) ; c . addShortcut ( "alt+shift+d" , c . g
2009-01-16 07:58:38 -05:00
// plugins/wpeditimage
( function ( ) { tinymce . create ( "tinymce.plugins.wpEditImage" , { init : function ( a , b ) { var c = this ; c . url = b ; c . _createButtons ( ) ; a . addCommand ( "WP_EditImage" , function ( ) { var h = a . selection . getNode ( ) , f = tinymce . DOM . getViewPort ( ) , g = f . h , d = ( 720 < f . w ) ? 720 : f . w , e = a . dom . getAttrib ( h , "class" ) ; if ( e . indexOf ( "mceItem" ) != - 1 || e . indexOf ( "wpGallery" ) != - 1 || h . nodeName != "IMG" ) { return } tb _show ( "" , b + "/editimage.html?ver=321&TB_iframe=true" ) ; tinymce . DOM . setStyles ( "TB_window" , { width : ( d - 50 ) + "px" , height : ( g - 45 ) + "px" , "margin-left" : "-" + parseInt ( ( ( d - 50 ) / 2 ) , 10 ) + "px" } ) ; if ( ! tinymce . isIE6 ) { tinymce . DOM . setStyles ( "TB_window" , { top : "20px" , marginTop : "0" } ) } tinymce . DOM . setStyles ( "TB_iframeContent" , { width : ( d - 50 ) + "px" , height : ( g - 75 ) + "px" } ) ; tinymce . DOM . setStyle ( [ "TB_overlay" , "TB_window" , "TB_load" ] , "z-index" , "999999" ) } ) ; a . onInit . add ( function ( d ) { tinymce . dom . Event . add ( d . getWin ( ) , "scroll" , function ( f ) { d . plugins . wpeditimage . hideButtons ( ) } ) } ) ; a . onBeforeExecCommand . add ( function ( d , f , e , g ) { d . plugins . wpeditimage . hideButtons ( ) } ) ; a . onSaveContent . add ( function ( d , e ) { d . plugins . wpeditimage . hideButtons ( ) } ) ; a . onMouseUp . add ( function ( d , g ) { var h , f ; if ( tinymce . isOpera ) { if ( g . target . nodeName == "IMG" ) { d . plugins . wpeditimage . showButtons ( g . target ) } } else { if ( ! tinymce . isWebKit ) { h = d . selection . getNode ( ) ; if ( h . nodeName == "IMG" && ( f = d . dom . getParent ( h , "DL" ) ) ) { window . setTimeout ( function ( ) { var e = tinyMCE . activeEditor , j = e . selection . getNode ( ) , i = e . dom . getParent ( j , "DL" ) ; if ( j . width != ( parseInt ( e . dom . getStyle ( i , "width" ) ) - 10 ) ) { e . dom . setStyle ( i , "width" , parseInt ( j . width ) + 10 ) ; e . execCommand ( "mceRepaint" ) } } , 100 ) } } } } ) ; a . onMouseDown . add ( function ( d , f ) { if ( tinymce . isOpera || f . target . nodeName != "IMG" ) { c . hideButtons ( ) ; return } d . plugins . wpeditimage . showButtons ( f . target ) } ) ; a . onKeyPress . add ( function ( d , i ) { var f , h , g ; if ( i . keyCode == 13 && ( f = d . dom . getParent ( d . selection . getNode ( ) , "DL" ) ) ) { g = d . dom . create ( "p" , { } , " " ) ; if ( ( h = f . parentNode ) && h . nodeName == "DIV" ) { d . dom . insertAfter ( g , h ) } else { d . dom . insertAfter ( g , f ) } tinymce . dom . Event . cancel ( i ) ; d . selection . select ( g ) ; return false } } ) ; a . onBeforeSetContent . add ( function ( d , e ) { e . content = c . _do _shcode ( e . content ) } ) ; a . onPostProcess . add ( function ( d , e ) { if ( e . get ) { e . content = c . _get _shcode ( e . content ) } } ) } , _do _shcode : function ( a ) { return a . replace ( /\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g , function ( g , d , k ) { var j , f , e , h , i ; d = d . replace ( /\\'|\\'|\\'/g , "'" ) . replace ( /\\"|\\"/g , """ ) ; k = k . replace ( /\\'|\\'/g , "'" ) . replace ( /\\"/g , """ ) ; j = d . match ( /id=['"]([^'"]+)/i ) ; f = d . match ( /align=['"]([^'"]+)/i ) ; e = d . match ( /width=['"]([0-9]+)/ ) ; h = d . match ( /caption=['"]([^'"]+)/i ) ; j = ( j && j [ 1 ] ) ? j [ 1 ] : "" ; f = ( f && f [ 1 ] ) ? f [ 1 ] : "alignnone" ; e = ( e && e [ 1 ] ) ? e [ 1 ] : "" ; h = ( h && h [ 1 ] ) ? h [ 1 ] : "" ; if ( ! e || ! h ) { return k } i = ( f == "aligncenter" ) ? "mceTemp mceIEcenter" : "mceTemp" ; return '<div class="' + i + '"><dl id="' + j + '" class="wp-caption ' + f + '" style="width: ' + ( 10 + parseInt ( e ) ) + 'px"><dt class="wp-caption-dt">' + k + '</dt><dd class="wp-caption-dd">' + h + "</dd></dl></div>" } ) } , _get _shcode : function ( a ) { return a . replace ( /<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi , function ( g , d , j , h ) { var i , f , e ; i = d . match ( /id=['"]([^'"]+)/i ) ; f = d . match ( /class=['"]([^'"]+)/i ) ; e = j . match ( /width=['"]([0-9]+)/ ) ; i = ( i && i [ 1 ] ) ? i [ 1 ] : "" ; f = ( f && f [ 1 ] ) ? f [ 1 ] : "alignnone" ; e = ( e && e [ 1 ] ) ? e [ 1 ] : "" ; if ( ! e || ! h ) { return j } f = f . match ( /align[^ '"]+/ ) || "alignnone" ; h = h . replace ( /<\S[^<>]*>/gi , "" ) . replace ( /'/g , "'" ) . replace ( /"/g , """ ) ; return '[caption id="' + i + '" align="' + f + '" width="' + e + '" caption="' + h + '"]' + j + "[/caption]" } ) } , showButtons : function ( d ) { var j = this , e = tinyMCE . activeEditor , g , f , a , i = tinymce . DOM , c , b , h = e . dom . getAttrib ( d , "class" ) ; if ( h . indexOf ( "mceItem" ) != - 1 || h . indexOf ( "wpGallery" ) != - 1 ) { return } a = e . dom . getViewPort ( e . getWin ( ) ) ; g = i . getPos ( e . getContentAreaContainer ( ) ) ; f = e . dom . getPos ( d ) ; c = Math . max ( f . x - a . x , 0 ) + g . x ; b = Math . max ( f . y - a . y , 0 ) + g . y ; i . setStyles ( "wp_editbtns" , { top : b + 5 + "px" , left : c + 5 + "px" , display : "block" } ) ; j . btnsTout = window . setTimeout ( function ( ) { e . plugins . wpeditimage . hideButtons ( ) } , 5000 ) } , hideButtons : function ( ) { if ( tinymce . DOM . isHidden ( "wp_editbtns" ) ) { return } tinymce . DOM . hide ( "wp_editbtns" ) ; window . clearTimeout ( this . btnsTout ) } , _createB
// plugins/wpgallery
( function ( ) { tinymce . create ( "tinymce.plugins.wpGallery" , { init : function ( a , b ) { var c = this ; c . url = b ; c . _createButtons ( ) ; a . addCommand ( "WP_Gallery" , function ( ) { var e = a . selection . getNode ( ) , d ; if ( e . nodeName != "IMG" ) { return } if ( a . dom . getAttrib ( e , "class" ) . indexOf ( "wpGallery" ) == - 1 ) { return } d = tinymce . DOM . get ( "post_ID" ) . value ; tb _show ( "" , tinymce . documentBaseURL + "/media-upload.php?post_id=" + d + "&tab=gallery&TB_iframe=true" ) ; tinymce . DOM . setStyle ( [ "TB_overlay" , "TB_window" , "TB_load" ] , "z-index" , "999999" ) } ) ; a . onInit . add ( function ( d ) { tinymce . dom . Event . add ( d . getWin ( ) , "scroll" , function ( f ) { d . plugins . wpgallery . hideButtons ( ) } ) } ) ; a . onBeforeExecCommand . add ( function ( d , f , e , g ) { d . plugins . wpgallery . hideButtons ( ) } ) ; a . onSaveContent . add ( function ( d , e ) { d . plugins . wpgallery . hideButtons ( ) } ) ; a . onMouseUp . add ( function ( d , f ) { if ( tinymce . isOpera ) { if ( f . target . nodeName == "IMG" ) { d . plugins . wpgallery . showButtons ( f . target ) } } } ) ; a . onMouseDown . add ( function ( d , f ) { if ( tinymce . isOpera || f . target . nodeName != "IMG" ) { c . hideButtons ( ) ; return } d . plugins . wpgallery . showButtons ( f . target ) } ) ; a . onBeforeSetContent . add ( function ( d , e ) { e . content = c . _do _gallery ( e . content ) } ) ; a . onPostProcess . add ( function ( d , e ) { if ( e . get ) { e . content = c . _get _gallery ( e . content ) } } ) } , _do _gallery : function ( a ) { return a . replace ( /\[gallery([^\]]*)\]/g , function ( d , c ) { return '<img src="' + tinymce . baseURL + '/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery' + tinymce . DOM . encode ( c ) + '" />' } ) } , _get _gallery : function ( b ) { function a ( c , d ) { d = new RegExp ( d + '="([^"]+)"' , "g" ) . exec ( c ) ; return d ? tinymce . DOM . decode ( d [ 1 ] ) : "" } return b . replace ( /(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g , function ( e , d ) { var c = a ( d , "class" ) ; if ( c . indexOf ( "wpGallery" ) != - 1 ) { return "<p>[" + tinymce . trim ( a ( d , "title" ) ) + "]</p>" } return e } ) } , showButtons : function ( d ) { var i = this , e = tinyMCE . activeEditor , g , f , a , h = tinymce . DOM , c , b ; if ( e . dom . getAttrib ( d , "class" ) . indexOf ( "wpGallery" ) == - 1 ) { return } a = e . dom . getViewPort ( e . getWin ( ) ) ; g = h . getPos ( e . getContentAreaContainer ( ) ) ; f = e . dom . getPos ( d ) ; c = Math . max ( f . x - a . x , 0 ) + g . x ; b = Math . max ( f . y - a . y , 0 ) + g . y ; h . setStyles ( "wp_gallerybtns" , { top : b + 5 + "px" , left : c + 5 + "px" , display : "block" } ) ; i . btnsTout = window . setTimeout ( function ( ) { e . plugins . wpgallery . hideButtons ( ) } , 5000 ) } , hideButtons : function ( ) { if ( tinymce . DOM . isHidden ( "wp_gallerybtns" ) ) { return } tinymce . DOM . hide ( "wp_gallerybtns" ) ; window . clearTimeout ( this . btnsTout ) } , _createButtons : function ( ) { var d = this , b = tinyMCE . activeEditor , e = tinymce . DOM , c , f , a ; e . remove ( "wp_gallerybtns" ) ; c = e . add ( document . body , "div" , { id : "wp_gallerybtns" , style : "display:none;" } ) ; f = e . add ( "wp_gallerybtns" , "img" , { src : d . url + "/img/edit.png" , id : "wp_editgallery" , width : "24" , height : "24" , title : b . getLang ( "wordpress.editgallery" ) } ) ; f . onmousedown = function ( h ) { var g = tinyMCE . activeEditor ; g . windowManager . bookmark = g . selection . getBookmark ( "simple" ) ; g . execCommand ( "WP_Gallery" ) ; this . parentNode . style . display = "none" } ; a = e . add ( "wp_gallerybtns" , "img" , { src : d . url + "/img/delete.png" , id : "wp_delgallery" , width : "24" , height : "24" , title : b . getLang ( "wordpress.delgallery" ) } ) ; a . onmousedown = function ( i ) { var g = tinyMCE . activeEditor , h = g . selection . getNode ( ) ; if ( h . nodeName == "IMG" && g . dom . getAttrib ( h , "class" ) . indexOf ( "wpGallery" ) != - 1 ) { g . dom . remove ( h ) ; this . parentNode . style . display = "none" ; g . execCommand ( "mceRepaint" ) ; return false } } } , getInfo : function ( ) { return { longname : "Gallery Settings" , author : "WordPress" , authorurl : "http://wordpress.org" , infourl : "" , version : "1.0" } } } ) ; tinymce . PluginManager . add ( "wpgallery" , tinymce . plugins . wpGallery ) } ) ( ) ;
// mark as loaded
tinyMCEPreInit . go = function ( ) { var b = this , a = tinymce . ScriptLoader , f = b . mceInit . language , e = b . mceInit . theme , c = b . mceInit . plugins , d = b . suffix ; a . markDone ( b . base + "/langs/" + f + ".js" ) ; a . markDone ( b . base + "/themes/" + e + "/editor_template" + d + ".js" ) ; a . markDone ( b . base + "/themes/" + e + "/langs/" + f + ".js" ) ; a . markDone ( b . base + "/themes/" + e + "/langs/" + f + "_dlg.js" ) ; tinymce . each ( c . split ( "," ) , function ( g ) { if ( g && g . charAt ( 0 ) != "-" ) { a . markDone ( b . base + "/plugins/" + g + "/editor_plugin" + d + ".js" ) ; a . markDone ( b . base + "/plugins/" + g + "/langs/" + f + ".js" ) ; a . markDone ( b . base + "/plugins/" + g + "/langs/" + f + "_dlg.js" ) } } ) } ;