studio2011 initial commit
No files matched your search
@@ -0,0 +1 @@
|
||||
(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)})();
|
||||
@@ -0,0 +1 @@
|
||||
(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();e.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");e.fullscreenElement.update();e.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var m=tinymce.DOM.getViewPort(),k=e.fullscreenEditor,j,l;j=k.dom.getSize(k.getContainer().firstChild);l=k.dom.getSize(k.getContainer().getElementsByTagName("iframe")[0]);k.theme.resizeTo(m.w-j.w+l.w,m.h-j.h+l.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)})();
|
||||
@@ -0,0 +1,109 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
<script type="text/javascript" src="../../tiny_mce.js?ver=3392"></script>
|
||||
<script type="text/javascript">
|
||||
function patchCallback(settings, key) {
|
||||
if (settings[key])
|
||||
settings[key] = "window.opener." + settings[key];
|
||||
}
|
||||
|
||||
var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
|
||||
|
||||
// Clone array
|
||||
for (var n in paSe)
|
||||
settings[n] = paSe[n];
|
||||
|
||||
// Override options for fullscreen
|
||||
for (var n in paSe.fullscreen_settings)
|
||||
settings[n] = paSe.fullscreen_settings[n];
|
||||
|
||||
// Patch callbacks, make them point to window.opener
|
||||
patchCallback(settings, 'urlconverter_callback');
|
||||
patchCallback(settings, 'insertlink_callback');
|
||||
patchCallback(settings, 'insertimage_callback');
|
||||
patchCallback(settings, 'setupcontent_callback');
|
||||
patchCallback(settings, 'save_callback');
|
||||
patchCallback(settings, 'onchange_callback');
|
||||
patchCallback(settings, 'init_instance_callback');
|
||||
patchCallback(settings, 'file_browser_callback');
|
||||
patchCallback(settings, 'cleanup_callback');
|
||||
patchCallback(settings, 'execcommand_callback');
|
||||
patchCallback(settings, 'oninit');
|
||||
|
||||
// Set options
|
||||
delete settings.id;
|
||||
settings['mode'] = 'exact';
|
||||
settings['elements'] = 'fullscreenarea';
|
||||
settings['add_unload_trigger'] = false;
|
||||
settings['ask'] = false;
|
||||
settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
|
||||
settings['fullscreen_is_enabled'] = true;
|
||||
settings['fullscreen_editor_id'] = oeID;
|
||||
settings['theme_advanced_resizing'] = false;
|
||||
settings['strict_loading_mode'] = true;
|
||||
|
||||
settings.save_onsavecallback = function() {
|
||||
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
|
||||
window.opener.tinyMCE.get(oeID).execCommand('mceSave');
|
||||
window.close();
|
||||
};
|
||||
|
||||
function unloadHandler(e) {
|
||||
moveContent();
|
||||
}
|
||||
|
||||
function moveContent() {
|
||||
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
|
||||
}
|
||||
|
||||
function closeFullscreen() {
|
||||
moveContent();
|
||||
window.close();
|
||||
}
|
||||
|
||||
function doParentSubmit() {
|
||||
moveContent();
|
||||
|
||||
if (window.opener.tinyMCE.selectedInstance.formElement.form)
|
||||
window.opener.tinyMCE.selectedInstance.formElement.form.submit();
|
||||
|
||||
window.close();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function render() {
|
||||
var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
|
||||
|
||||
e.value = window.opener.tinyMCE.get(oeID).getContent();
|
||||
|
||||
vp = dom.getViewPort();
|
||||
settings.width = vp.w;
|
||||
settings.height = vp.h - 15;
|
||||
|
||||
tinymce.dom.Event.add(window, 'resize', function() {
|
||||
var vp = dom.getViewPort();
|
||||
|
||||
tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
|
||||
});
|
||||
|
||||
tinyMCE.init(settings);
|
||||
}
|
||||
|
||||
// Add onunload
|
||||
tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
|
||||
</script>
|
||||
</head>
|
||||
<body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
|
||||
<form onsubmit="doParentSubmit();">
|
||||
<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
render();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
(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(1)}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")+(tinymce.isIE&&window.getSelection?" ie9":""),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","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deLine truncated
|
||||
|
After Width: | Height: | Size: 818 B |
|
After Width: | Height: | Size: 280 B |
|
After Width: | Height: | Size: 989 B |
|
After Width: | Height: | Size: 915 B |
|
After Width: | Height: | Size: 911 B |
|
After Width: | Height: | Size: 57 B |
|
After Width: | Height: | Size: 769 B |
|
After Width: | Height: | Size: 92 B |
@@ -0,0 +1,136 @@
|
||||
/* Clearlooks 2 */
|
||||
|
||||
/* Reset */
|
||||
.clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block}
|
||||
|
||||
/* General */
|
||||
.clearlooks2 {position:absolute; direction:ltr}
|
||||
.clearlooks2 .mceWrapper {position:static}
|
||||
.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%}
|
||||
.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50)}
|
||||
.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60); display:none}
|
||||
|
||||
/* Top */
|
||||
.clearlooks2 .mceTop,
|
||||
.clearlooks2 .mceTop div {
|
||||
top:0;
|
||||
width:100%;
|
||||
height:23px
|
||||
}
|
||||
.clearlooks2 .mceTop .mceLeft {
|
||||
width:55%;
|
||||
background-image: none;
|
||||
border-style: solid none none solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
.clearlooks2 .mceTop .mceCenter {
|
||||
}
|
||||
.clearlooks2 .mceTop .mceRight {
|
||||
right:0;
|
||||
width:55%;
|
||||
height:23px;
|
||||
background-image: none;
|
||||
border-style: solid solid none none;
|
||||
border-width: 1px;
|
||||
}
|
||||
.clearlooks2 .mceTop span {
|
||||
width:100%;
|
||||
font: 12px/20px bold "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
line-height:23px;
|
||||
font-weight:bold;
|
||||
}
|
||||
.clearlooks2 .mceFocus .mceTop .mceLeft {
|
||||
background-image: none;
|
||||
border-style: solid none none solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
.clearlooks2 .mceFocus .mceTop .mceCenter {
|
||||
}
|
||||
.clearlooks2 .mceFocus .mceTop .mceRight {
|
||||
background-image: none;
|
||||
border-style: solid solid none none;
|
||||
border-width: 1px;
|
||||
}
|
||||
.clearlooks2 .mceFocus .mceTop span {
|
||||
color:#FFF
|
||||
}
|
||||
|
||||
/* Middle */
|
||||
.clearlooks2 .mceMiddle, .clearlooks2 .mceMiddle div {top:0}
|
||||
.clearlooks2 .mceMiddle {width:100%; height:100%; clip:rect(23px auto auto auto)}
|
||||
.clearlooks2 .mceMiddle .mceLeft {left:0; width:5px; height:100%; background:#E4F2FD;border-left:1px solid #c6d9e9}
|
||||
.clearlooks2 .mceMiddle span {top:23px; left:5px; width:100%; height:100%; background:#FFF}
|
||||
.clearlooks2 .mceMiddle .mceRight {right:0; width:5px; height:100%; background:#E4F2FD;border-right:1px solid #c6d9e9}
|
||||
|
||||
/* Bottom */
|
||||
.clearlooks2 .mceBottom, .clearlooks2 .mceBottom div {height:6px}
|
||||
.clearlooks2 .mceBottom {left:0; bottom:0; width:100%;background:#E4F2FD;border-bottom:1px solid #c6d9e9}
|
||||
.clearlooks2 .mceBottom div {top:0}
|
||||
.clearlooks2 .mceBottom .mceLeft {left:0; width:5px; background:#E4F2FD ;border-left:1px solid #c6d9e9}
|
||||
.clearlooks2 .mceBottom .mceCenter {left:5px; width:100%}
|
||||
.clearlooks2 .mceBottom .mceRight {right:0; width:6px; background:#E4F2FD url(img/drag.gif) no-repeat;border-right:1px solid #c6d9e9}
|
||||
.clearlooks2 .mceBottom span {display:none}
|
||||
.clearlooks2 .mceStatusbar .mceBottom, .clearlooks2 .mceStatusbar .mceBottom div {height:23px}
|
||||
.clearlooks2 .mceStatusbar .mceBottom .mceLeft {background:url(img/corners.gif) -29px 0}
|
||||
.clearlooks2 .mceStatusbar .mceBottom .mceCenter {background:url(img/horizontal.gif) 0 -52px}
|
||||
.clearlooks2 .mceStatusbar .mceBottom .mceRight {background:url(img/corners.gif) -24px 0}
|
||||
.clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px}
|
||||
|
||||
/* Actions */
|
||||
.clearlooks2 a {width:29px; height:16px; top:3px}
|
||||
.clearlooks2 .mceClose {right:6px; background:url(img/buttons.gif) -87px 0}
|
||||
.clearlooks2 .mceMin {display:none; right:68px; background:url(img/buttons.gif) 0 0}
|
||||
.clearlooks2 .mceMed {display:none; right:37px; background:url(img/buttons.gif) -29px 0}
|
||||
.clearlooks2 .mceMax {display:none; right:37px; background:url(img/buttons.gif) -58px 0}
|
||||
.clearlooks2 .mceMove {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px}
|
||||
.clearlooks2 .mceMovable .mceMove {display:block}
|
||||
.clearlooks2 .mceFocus .mceClose {right:6px; background:url(img/buttons.gif) -87px -16px}
|
||||
.clearlooks2 .mceFocus .mceMin {right:68px; background:url(img/buttons.gif) 0 -16px}
|
||||
.clearlooks2 .mceFocus .mceMed {right:37px; background:url(img/buttons.gif) -29px -16px}
|
||||
.clearlooks2 .mceFocus .mceMax {right:37px; background:url(img/buttons.gif) -58px -16px}
|
||||
.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
|
||||
.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
|
||||
.clearlooks2 .mceFocus .mceMin:hover {right:68px; background:url(img/buttons.gif) 0 -32px}
|
||||
.clearlooks2 .mceFocus .mceMed:hover {right:37px; background:url(img/buttons.gif) -29px -32px}
|
||||
.clearlooks2 .mceFocus .mceMax:hover {right:37px; background:url(img/buttons.gif) -58px -32px}
|
||||
|
||||
/* Resize */
|
||||
.clearlooks2 .mceResize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px}
|
||||
.clearlooks2 .mceResizable .mceResize {display:block}
|
||||
.clearlooks2 .mceResizable .mceMin, .clearlooks2 .mceMax {display:none}
|
||||
.clearlooks2 .mceMinimizable .mceMin {display:block}
|
||||
.clearlooks2 .mceMaximizable .mceMax {display:block}
|
||||
.clearlooks2 .mceMaximized .mceMed {display:block}
|
||||
.clearlooks2 .mceMaximized .mceMax {display:none}
|
||||
.clearlooks2 a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize}
|
||||
.clearlooks2 a.mceResizeNW {top:0; left:0; cursor:nw-resize}
|
||||
.clearlooks2 a.mceResizeNE {top:0; right:0; cursor:ne-resize}
|
||||
.clearlooks2 a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize}
|
||||
.clearlooks2 a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize}
|
||||
.clearlooks2 a.mceResizeS {bottom:0; left:0; width:100%; cursor:s-resize}
|
||||
.clearlooks2 a.mceResizeSW {bottom:0; left:0; cursor:sw-resize}
|
||||
.clearlooks2 a.mceResizeSE {bottom:0; right:0; cursor:se-resize}
|
||||
|
||||
/* Alert/Confirm */
|
||||
.clearlooks2 .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0}
|
||||
.clearlooks2 .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px}
|
||||
.clearlooks2 .mceAlert .mceMiddle span, .clearlooks2 .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal}
|
||||
.clearlooks2 a:hover {font-weight:bold;}
|
||||
.clearlooks2 .mceAlert .mceMiddle, .clearlooks2 .mceConfirm .mceMiddle {background:#E4F2FD}
|
||||
.clearlooks2 .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px}
|
||||
.clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif)}
|
||||
.clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px}
|
||||
.clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto}
|
||||
.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)}
|
||||
|
||||
/* IE9 fixes */
|
||||
.clearlooks2.ie9 .mceTop .mceCenter {clip:auto;}
|
||||
.clearlooks2.ie9 .mceMiddle {clip:auto;}
|
||||
.clearlooks2.ie9 .mceMiddle .mceLeft, .clearlooks2.ie9 .mceMiddle .mceRight {top: 23px;}
|
||||
.clearlooks2.ie9 .mceAlert .mceMiddle span, .clearlooks2.ie9 .mceConfirm .mceMiddle span {top:13px;}
|
||||
.clearlooks2.ie9 .mceModal .mceMiddle {top:23px}
|
||||
.clearlooks2.ie9 .mceModal .mceMiddle .mceLeft, .clearlooks2.ie9 .mceModal .mceMiddle .mceRight {top: 0}
|
||||
.clearlooks2.ie9 .mceMiddle .mceIcon {top:13px}
|
||||
.clearlooks2.ie9 .mceTop .mceCenter {top:0; right:auto; left:6px; width:calc(100%-12px)}
|
||||
@@ -0,0 +1,387 @@
|
||||
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Template for dialogs</title>
|
||||
<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css?ver=3392" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="mceEditor">
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:10px;">
|
||||
<div class="mceWrapper">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Blured</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:420px;">
|
||||
<div class="mceWrapper mceMovable mceFocus">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Focused</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:10px; top:120px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceStatusbar">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:420px; top:120px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceStatusbar mceResizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar, Resizable</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:10px; top:230px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceResizable mceMaximizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Resizable, Maximizable</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:420px; top:230px;">
|
||||
<div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Blurred, Maximizable, Statusbar, Resizable</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:10px; top:340px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceResizable mceMaximized mceMinimizable mceMaximizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Maximized, Maximizable, Minimizable</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:420px; top:340px;">
|
||||
<div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximized mceMinimizable mceMaximizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Blured</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:130px; left:10px; top:450px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceModal mceAlert">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Alert</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
</span>
|
||||
<div class="mceRight"></div>
|
||||
<div class="mceIcon"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceButton mceOk" href="#">Ok</a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:130px; left:420px; top:450px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceModal mceConfirm">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Confirm</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
</span>
|
||||
<div class="mceRight"></div>
|
||||
<div class="mceIcon"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceButton mceOk" href="#">Ok</a>
|
||||
<a class="mceButton mceCancel" href="#">Cancel</a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>blank_page</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link href="css/blank.css?ver=3223_1087" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
function init() {
|
||||
if (parent.tinymce.isIE)
|
||||
document.body.contentEditable = true;
|
||||
else
|
||||
document.designMode = 'on';
|
||||
|
||||
parent.initIframe(document);
|
||||
window.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
(function(){var c=tinymce.each,d=null,a={paste_auto_cleanup_on_paste:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_notifyalways:false,paste_text_linebreaktype:"p",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(e,f){return e.getParam(f,a[f])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(e,f){var g=this;g.editor=e;g.url=f;g.onPreProcess=new tinymce.util.Dispatcher(g);g.onPostProcess=new tinymce.util.Dispatcher(g);g.onPreProcess.add(g._preProcess);g.onPostProcess.add(g._postProcess);g.onPreProcess.add(function(j,k){e.execCallback("paste_preprocess",j,k)});g.onPostProcess.add(function(j,k){e.execCallback("paste_postprocess",j,k)});e.pasteAsPlainText=false;function i(l,j){var k=e.dom;g.onPreProcess.dispatch(g,l);l.node=k.create("div",0,l.content);g.onPostProcess.dispatch(g,l);l.content=e.serializer.serialize(l.node,{getInner:1});if((!j)&&(e.pasteAsPlainText)){g._insertPlainText(e,k,l.content);if(!b(e,"paste_text_sticky")){e.pasteAsPlainText=false;e.controlManager.setActive("pastetext",false)}}else{if(/<(p|h[1-6]|ul|ol)/.test(l.content)){g._insertBlockContent(e,k,l.content)}else{g._insert(l.content)}}}e.addCommand("mceInsertClipboardContent",function(j,k){i(k,true)});if(!b(e,"paste_text_use_dialog")){e.addCommand("mcePasteText",function(k,j){var l=tinymce.util.Cookie;e.pasteAsPlainText=!e.pasteAsPlainText;e.controlManager.setActive("pastetext",e.pasteAsPlainText);if((e.pasteAsPlainText)&&(!l.get("tinymcePasteText"))){if(b(e,"paste_text_sticky")){e.windowManager.alert(e.translate("paste.plaintext_mode_sticky"))}else{e.windowManager.alert(e.translate("paste.plaintext_mode_sticky"))}if(!b(e,"paste_text_notifyalways")){l.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}e.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});e.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function h(s){var m,q,k,l=e.selection,p=e.dom,r=e.getBody(),j;if(e.pasteAsPlainText&&(s.clipboardData||p.doc.dataTransfer)){s.preventDefault();i({content:(s.clipboardData||p.doc.dataTransfer).getData("Text").replace(/\r?\n/g,'<br />')});return}if(p.get("_mcePaste")){return}m=p.add(r,"div",{id:"_mcePaste","class":"mcePaste"},'\uFEFF<br _mce_bogus="1">');if(r!=e.getDoc().body){j=p.getPos(e.selection.getStart(),r).y}else{j=r.scrollTop}p.setStyles(m,{position:"absolute",left:-10000,top:j,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){k=p.doc.body.createTextRange();k.moveToElementText(m);k.execCommand("Paste");p.remove(m);if(m.innerHTML==="\uFEFF"){e.execCommand("mcePasteWord");s.preventDefault();return}i({content:m.innerHTML});return tinymce.dom.Event.cancel(s)}else{function o(n){n.preventDefault()}p.bind(e.getDoc(),"mousedown",o);p.bind(e.getDoc(),"keydown",o);q=e.selection.getRng();m=m.firstChild;k=e.getDoc().createRange();k.setStart(m,0);k.setEnd(m,1);l.setRng(k);window.setTimeout(function(){var t="",n=p.select("div.mcePaste");c(n,function(v){var u=v.firstChild;if(u&&u.nodeName=="DIV"&&u.style.marginTop&&u.style.backgroundColor){p.remove(u,1)}c(p.select("div.mcePaste",v),function(w){p.remove(w,1)});c(p.select("span.Apple-style-span",v),function(w){p.remove(w,1)});c(p.select("br[_mce_bogus]",v),function(w){p.remove(w)});t+=v.innerHTML});c(n,function(u){p.remove(u)});if(q){l.setRng(q)}i({content:t});p.unbind(e.getDoc(),"mousedown",o);p.unbind(e.getDoc(),"keydown",o)},0)}}if(b(e,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){e.onKeyDown.add(function(j,k){if(((tinymce.isMac?k.metaKey:k.ctrlKey)&&k.keyCode==86)||(k.shiftKey&&k.keyCode==45)){h(k)}})}else{e.onPaste.addToTop(function(j,k){return h(k)})}}if(b(e,"paste_block_drop")){e.onInit.add(function(){e.dom.bind(e.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(j){j.preventDefault();j.stopPropagation();return false})})}g._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(i,f){var l=this.editor,k=f.content,q=tinymce.grep,p=tinymce.explode,g=tinymce.trim,m,j;function e(h){c(h,function(o){if(o.constructor==RegExp){k=k.replace(o,"")}else{k=k.replace(o[0],o[1])}})}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(k)||f.wordContent){f.wordContent=true;e([/^\s*( )+/gi,/( |<br[^>]*>)+\s*$/gi]);if(b(l,"paste_convert_headers_to_strong")){k=k.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><stronLine truncated
|
||||
@@ -0,0 +1,36 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var PasteTextDialog = {
|
||||
init : function() {
|
||||
this.resize();
|
||||
},
|
||||
|
||||
insert : function() {
|
||||
var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;
|
||||
|
||||
// Convert linebreaks into paragraphs
|
||||
if (document.getElementById('linebreaks').checked) {
|
||||
lines = h.split(/\r?\n/);
|
||||
if (lines.length > 1) {
|
||||
h = '';
|
||||
tinymce.each(lines, function(row) {
|
||||
h += '<p>' + row + '</p>';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
resize : function() {
|
||||
var vp = tinyMCEPopup.dom.getViewPort(window), el;
|
||||
|
||||
el = document.getElementById('content');
|
||||
|
||||
el.style.width = (vp.w - 20) + 'px';
|
||||
el.style.height = (vp.h - 90) + 'px';
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);
|
||||
@@ -0,0 +1,51 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var PasteWordDialog = {
|
||||
init : function() {
|
||||
var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
|
||||
|
||||
// Create iframe
|
||||
el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
|
||||
ifr = document.getElementById('iframe');
|
||||
doc = ifr.contentWindow.document;
|
||||
|
||||
// Force absolute CSS urls
|
||||
css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
|
||||
css = css.concat(tinymce.explode(ed.settings.content_css) || []);
|
||||
tinymce.each(css, function(u) {
|
||||
cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
|
||||
});
|
||||
|
||||
// Write content into iframe
|
||||
doc.open();
|
||||
doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
|
||||
doc.close();
|
||||
|
||||
doc.designMode = 'on';
|
||||
this.resize();
|
||||
|
||||
window.setTimeout(function() {
|
||||
ifr.contentWindow.focus();
|
||||
}, 10);
|
||||
},
|
||||
|
||||
insert : function() {
|
||||
var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
|
||||
|
||||
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
resize : function() {
|
||||
var vp = tinyMCEPopup.dom.getViewPort(window), el;
|
||||
|
||||
el = document.getElementById('iframe');
|
||||
|
||||
if (el) {
|
||||
el.style.width = (vp.w - 20) + 'px';
|
||||
el.style.height = (vp.h - 90) + 'px';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);
|
||||
@@ -0,0 +1,32 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#paste.paste_text_desc}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js?ver=3392"></script>
|
||||
<script type="text/javascript" src="js/pastetext.js?ver=3392"></script>
|
||||
</head>
|
||||
<body onresize="PasteTextDialog.resize();" style="display:none; overflow:hidden;">
|
||||
<form name="source" onsubmit="return PasteTextDialog.insert();" action="#">
|
||||
<div style="float: left" class="title">{#paste.paste_text_desc}</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
|
||||
<div>{#paste_dlg.text_title}</div>
|
||||
|
||||
<textarea id="content" name="content" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="submit" name="insert" value="{#insert}" id="insert" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,26 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#paste.paste_word_desc}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js?ver=3392"></script>
|
||||
<script type="text/javascript" src="js/pasteword.js?ver=3392"></script>
|
||||
</head>
|
||||
<body onresize="PasteWordDialog.resize();" style="display:none; overflow:hidden;">
|
||||
<form name="source" onsubmit="return PasteWordDialog.insert();" action="#">
|
||||
<div class="title">{#paste.paste_word_desc}</div>
|
||||
|
||||
<div>{#paste_dlg.word_title}</div>
|
||||
|
||||
<div id="iframecontainer"></div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* This class was contributed by Michel Weimerskirch.
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class EnchantSpell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
|
||||
* @param Array $words Array of words to check.
|
||||
* @return Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$r = enchant_broker_init();
|
||||
|
||||
if (enchant_broker_dict_exists($r,$lang)) {
|
||||
$d = enchant_broker_request_dict($r, $lang);
|
||||
|
||||
$returnData = array();
|
||||
foreach($words as $key => $value) {
|
||||
$correct = enchant_dict_check($d, $value);
|
||||
if(!$correct) {
|
||||
$returnData[] = trim($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $returnData;
|
||||
enchant_broker_free_dict($d);
|
||||
} else {
|
||||
|
||||
}
|
||||
enchant_broker_free($r);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions for a specific word.
|
||||
*
|
||||
* @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
|
||||
* @param String $word Specific word to get suggestions for.
|
||||
* @return Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$r = enchant_broker_init();
|
||||
$suggs = array();
|
||||
|
||||
if (enchant_broker_dict_exists($r,$lang)) {
|
||||
$d = enchant_broker_request_dict($r, $lang);
|
||||
$suggs = enchant_dict_suggest($d, $word);
|
||||
|
||||
enchant_broker_free_dict($d);
|
||||
} else {
|
||||
|
||||
}
|
||||
enchant_broker_free($r);
|
||||
|
||||
return $suggs;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class GoogleSpell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$wordstr = implode(' ', $words);
|
||||
$matches = $this->_getMatches($lang, $wordstr);
|
||||
$words = array();
|
||||
|
||||
for ($i=0; $i<count($matches); $i++)
|
||||
$words[] = $this->_unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8"));
|
||||
|
||||
return $words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$sug = array();
|
||||
$osug = array();
|
||||
$matches = $this->_getMatches($lang, $word);
|
||||
|
||||
if (count($matches) > 0)
|
||||
$sug = explode("\t", utf8_encode($this->_unhtmlentities($matches[0][4])));
|
||||
|
||||
// Remove empty
|
||||
foreach ($sug as $item) {
|
||||
if ($item)
|
||||
$osug[] = $item;
|
||||
}
|
||||
|
||||
return $osug;
|
||||
}
|
||||
|
||||
function &_getMatches($lang, $str) {
|
||||
$server = "www.google.com";
|
||||
$port = 443;
|
||||
$path = "/tbproxy/spell?lang=" . $lang . "&hl=en";
|
||||
$host = "www.google.com";
|
||||
$url = "https://" . $server;
|
||||
|
||||
// Setup XML request
|
||||
$xml = '<?xml version="1.0" encoding="utf-8" ?><spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1"><text>' . $str . '</text></spellrequest>';
|
||||
|
||||
$header = "POST ".$path." HTTP/1.0 \r\n";
|
||||
$header .= "MIME-Version: 1.0 \r\n";
|
||||
$header .= "Content-type: application/PTI26 \r\n";
|
||||
$header .= "Content-length: ".strlen($xml)." \r\n";
|
||||
$header .= "Content-transfer-encoding: text \r\n";
|
||||
$header .= "Request-number: 1 \r\n";
|
||||
$header .= "Document-type: Request \r\n";
|
||||
$header .= "Interface-Version: Test 1.4 \r\n";
|
||||
$header .= "Connection: close \r\n\r\n";
|
||||
$header .= $xml;
|
||||
|
||||
// Use curl if it exists
|
||||
if (function_exists('curl_init')) {
|
||||
// Use curl
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL,$url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
} else {
|
||||
// Use raw sockets
|
||||
$fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30);
|
||||
if ($fp) {
|
||||
// Send request
|
||||
fwrite($fp, $header);
|
||||
|
||||
// Read response
|
||||
$xml = "";
|
||||
while (!feof($fp))
|
||||
$xml .= fgets($fp, 128);
|
||||
|
||||
fclose($fp);
|
||||
} else
|
||||
echo "Could not open SSL connection to google.";
|
||||
}
|
||||
|
||||
// Grab and parse content
|
||||
$matches = array();
|
||||
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
|
||||
|
||||
return $matches;
|
||||
}
|
||||
|
||||
function _unhtmlentities($string) {
|
||||
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
|
||||
$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
|
||||
|
||||
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
|
||||
$trans_tbl = array_flip($trans_tbl);
|
||||
|
||||
return strtr($string, $trans_tbl);
|
||||
}
|
||||
}
|
||||
|
||||
// Patch in multibyte support
|
||||
if (!function_exists('mb_substr')) {
|
||||
function mb_substr($str, $start, $len = '', $encoding="UTF-8"){
|
||||
$limit = strlen($str);
|
||||
|
||||
for ($s = 0; $start > 0;--$start) {// found the real start
|
||||
if ($s >= $limit)
|
||||
break;
|
||||
|
||||
if ($str[$s] <= "\x7F")
|
||||
++$s;
|
||||
else {
|
||||
++$s; // skip length
|
||||
|
||||
while ($str[$s] >= "\x80" && $str[$s] <= "\xBF")
|
||||
++$s;
|
||||
}
|
||||
}
|
||||
|
||||
if ($len == '')
|
||||
return substr($str, $s);
|
||||
else
|
||||
for ($e = $s; $len > 0; --$len) {//found the real end
|
||||
if ($e >= $limit)
|
||||
break;
|
||||
|
||||
if ($str[$e] <= "\x7F")
|
||||
++$e;
|
||||
else {
|
||||
++$e;//skip length
|
||||
|
||||
while ($str[$e] >= "\x80" && $str[$e] <= "\xBF" && $e < $limit)
|
||||
++$e;
|
||||
}
|
||||
}
|
||||
|
||||
return substr($str, $s, $e - $s);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class PSpell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$plink = $this->_getPLink($lang);
|
||||
|
||||
$outWords = array();
|
||||
foreach ($words as $word) {
|
||||
if (!pspell_check($plink, trim($word)))
|
||||
$outWords[] = utf8_encode($word);
|
||||
}
|
||||
|
||||
return $outWords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$words = pspell_suggest($this->_getPLink($lang), $word);
|
||||
|
||||
for ($i=0; $i<count($words); $i++)
|
||||
$words[$i] = utf8_encode($words[$i]);
|
||||
|
||||
return $words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a link for pspell.
|
||||
*/
|
||||
function &_getPLink($lang) {
|
||||
// Check for native PSpell support
|
||||
if (!function_exists("pspell_new"))
|
||||
$this->throwError("PSpell support not found in PHP installation.");
|
||||
|
||||
// Setup PSpell link
|
||||
$plink = pspell_new(
|
||||
$lang,
|
||||
$this->_config['PSpell.spelling'],
|
||||
$this->_config['PSpell.jargon'],
|
||||
$this->_config['PSpell.encoding'],
|
||||
$this->_config['PSpell.mode']
|
||||
);
|
||||
|
||||
// Setup PSpell link
|
||||
/* if (!$plink) {
|
||||
$pspellConfig = pspell_config_create(
|
||||
$lang,
|
||||
$this->_config['PSpell.spelling'],
|
||||
$this->_config['PSpell.jargon'],
|
||||
$this->_config['PSpell.encoding']
|
||||
);
|
||||
|
||||
$plink = pspell_new_config($pspell_config);
|
||||
}*/
|
||||
|
||||
if (!$plink)
|
||||
$this->throwError("No PSpell link found opened.");
|
||||
|
||||
return $plink;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class PSpellShell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$cmd = $this->_getCMD($lang);
|
||||
|
||||
if ($fh = fopen($this->_tmpfile, "w")) {
|
||||
fwrite($fh, "!\n");
|
||||
|
||||
foreach($words as $key => $value)
|
||||
fwrite($fh, "^" . $value . "\n");
|
||||
|
||||
fclose($fh);
|
||||
} else
|
||||
$this->throwError("PSpell support was not found.");
|
||||
|
||||
$data = shell_exec($cmd);
|
||||
@unlink($this->_tmpfile);
|
||||
|
||||
$returnData = array();
|
||||
$dataArr = preg_split("/[\r\n]/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach ($dataArr as $dstr) {
|
||||
$matches = array();
|
||||
|
||||
// Skip this line.
|
||||
if (strpos($dstr, "@") === 0)
|
||||
continue;
|
||||
|
||||
preg_match("/\& ([^ ]+) .*/i", $dstr, $matches);
|
||||
|
||||
if (!empty($matches[1]))
|
||||
$returnData[] = utf8_encode(trim($matches[1]));
|
||||
}
|
||||
|
||||
return $returnData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$cmd = $this->_getCMD($lang);
|
||||
|
||||
if (function_exists("mb_convert_encoding"))
|
||||
$word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8"));
|
||||
else
|
||||
$word = utf8_encode($word);
|
||||
|
||||
if ($fh = fopen($this->_tmpfile, "w")) {
|
||||
fwrite($fh, "!\n");
|
||||
fwrite($fh, "^$word\n");
|
||||
fclose($fh);
|
||||
} else
|
||||
$this->throwError("Error opening tmp file.");
|
||||
|
||||
$data = shell_exec($cmd);
|
||||
@unlink($this->_tmpfile);
|
||||
|
||||
$returnData = array();
|
||||
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach($dataArr as $dstr) {
|
||||
$matches = array();
|
||||
|
||||
// Skip this line.
|
||||
if (strpos($dstr, "@") === 0)
|
||||
continue;
|
||||
|
||||
preg_match("/\&[^:]+:(.*)/i", $dstr, $matches);
|
||||
|
||||
if (!empty($matches[1])) {
|
||||
$words = array_slice(explode(',', $matches[1]), 0, 10);
|
||||
|
||||
for ($i=0; $i<count($words); $i++)
|
||||
$words[$i] = trim($words[$i]);
|
||||
|
||||
return $words;
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
function _getCMD($lang) {
|
||||
$this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell");
|
||||
|
||||
if(preg_match("#win#i", php_uname()))
|
||||
return $this->_config['PSpellShell.aspell'] . " -a --lang=". escapeshellarg($lang) . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1";
|
||||
|
||||
return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". escapeshellarg($lang);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class SpellChecker {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param $config Configuration name/value array.
|
||||
*/
|
||||
function SpellChecker(&$config) {
|
||||
$this->_config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple loopback function everything that gets in will be send back.
|
||||
*
|
||||
* @param $args.. Arguments.
|
||||
* @return {Array} Array of all input arguments.
|
||||
*/
|
||||
function &loopback(/* args.. */) {
|
||||
return func_get_args();
|
||||
}
|
||||
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
return $words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an error message back to the user. This will stop all execution.
|
||||
*
|
||||
* @param {String} $str Message to send back to user.
|
||||
*/
|
||||
function throwError($str) {
|
||||
die('{"result":null,"id":null,"error":{"errstr":"' . addslashes($str) . '","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,595 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: JSON.php 40 2007-06-18 11:43:15Z spocke $
|
||||
*
|
||||
* @package MCManager.utils
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
define('JSON_BOOL', 1);
|
||||
define('JSON_INT', 2);
|
||||
define('JSON_STR', 3);
|
||||
define('JSON_FLOAT', 4);
|
||||
define('JSON_NULL', 5);
|
||||
define('JSON_START_OBJ', 6);
|
||||
define('JSON_END_OBJ', 7);
|
||||
define('JSON_START_ARRAY', 8);
|
||||
define('JSON_END_ARRAY', 9);
|
||||
define('JSON_KEY', 10);
|
||||
define('JSON_SKIP', 11);
|
||||
|
||||
define('JSON_IN_ARRAY', 30);
|
||||
define('JSON_IN_OBJECT', 40);
|
||||
define('JSON_IN_BETWEEN', 50);
|
||||
|
||||
class Moxiecode_JSONReader {
|
||||
var $_data, $_len, $_pos;
|
||||
var $_value, $_token;
|
||||
var $_location, $_lastLocations;
|
||||
var $_needProp;
|
||||
|
||||
function Moxiecode_JSONReader($data) {
|
||||
$this->_data = $data;
|
||||
$this->_len = strlen($data);
|
||||
$this->_pos = -1;
|
||||
$this->_location = JSON_IN_BETWEEN;
|
||||
$this->_lastLocations = array();
|
||||
$this->_needProp = false;
|
||||
}
|
||||
|
||||
function getToken() {
|
||||
return $this->_token;
|
||||
}
|
||||
|
||||
function getLocation() {
|
||||
return $this->_location;
|
||||
}
|
||||
|
||||
function getTokenName() {
|
||||
switch ($this->_token) {
|
||||
case JSON_BOOL:
|
||||
return 'JSON_BOOL';
|
||||
|
||||
case JSON_INT:
|
||||
return 'JSON_INT';
|
||||
|
||||
case JSON_STR:
|
||||
return 'JSON_STR';
|
||||
|
||||
case JSON_FLOAT:
|
||||
return 'JSON_FLOAT';
|
||||
|
||||
case JSON_NULL:
|
||||
return 'JSON_NULL';
|
||||
|
||||
case JSON_START_OBJ:
|
||||
return 'JSON_START_OBJ';
|
||||
|
||||
case JSON_END_OBJ:
|
||||
return 'JSON_END_OBJ';
|
||||
|
||||
case JSON_START_ARRAY:
|
||||
return 'JSON_START_ARRAY';
|
||||
|
||||
case JSON_END_ARRAY:
|
||||
return 'JSON_END_ARRAY';
|
||||
|
||||
case JSON_KEY:
|
||||
return 'JSON_KEY';
|
||||
}
|
||||
|
||||
return 'UNKNOWN';
|
||||
}
|
||||
|
||||
function getValue() {
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
function readToken() {
|
||||
$chr = $this->read();
|
||||
|
||||
if ($chr != null) {
|
||||
switch ($chr) {
|
||||
case '[':
|
||||
$this->_lastLocation[] = $this->_location;
|
||||
$this->_location = JSON_IN_ARRAY;
|
||||
$this->_token = JSON_START_ARRAY;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
return true;
|
||||
|
||||
case ']':
|
||||
$this->_location = array_pop($this->_lastLocation);
|
||||
$this->_token = JSON_END_ARRAY;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
|
||||
case '{':
|
||||
$this->_lastLocation[] = $this->_location;
|
||||
$this->_location = JSON_IN_OBJECT;
|
||||
$this->_needProp = true;
|
||||
$this->_token = JSON_START_OBJ;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
return true;
|
||||
|
||||
case '}':
|
||||
$this->_location = array_pop($this->_lastLocation);
|
||||
$this->_token = JSON_END_OBJ;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
|
||||
// String
|
||||
case '"':
|
||||
case '\'':
|
||||
return $this->_readString($chr);
|
||||
|
||||
// Null
|
||||
case 'n':
|
||||
return $this->_readNull();
|
||||
|
||||
// Bool
|
||||
case 't':
|
||||
case 'f':
|
||||
return $this->_readBool($chr);
|
||||
|
||||
default:
|
||||
// Is number
|
||||
if (is_numeric($chr) || $chr == '-' || $chr == '.')
|
||||
return $this->_readNumber($chr);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _readBool($chr) {
|
||||
$this->_token = JSON_BOOL;
|
||||
$this->_value = $chr == 't';
|
||||
|
||||
if ($chr == 't')
|
||||
$this->skip(3); // rue
|
||||
else
|
||||
$this->skip(4); // alse
|
||||
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _readNull() {
|
||||
$this->_token = JSON_NULL;
|
||||
$this->_value = null;
|
||||
|
||||
$this->skip(3); // ull
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _readString($quote) {
|
||||
$output = "";
|
||||
$this->_token = JSON_STR;
|
||||
$endString = false;
|
||||
|
||||
while (($chr = $this->peek()) != -1) {
|
||||
switch ($chr) {
|
||||
case '\\':
|
||||
// Read away slash
|
||||
$this->read();
|
||||
|
||||
// Read escape code
|
||||
$chr = $this->read();
|
||||
switch ($chr) {
|
||||
case 't':
|
||||
$output .= "\t";
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
$output .= "\b";
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
$output .= "\f";
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
$output .= "\r";
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
$output .= "\n";
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
$output .= $this->_int2utf8(hexdec($this->read(4)));
|
||||
break;
|
||||
|
||||
default:
|
||||
$output .= $chr;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
case '"':
|
||||
if ($chr == $quote)
|
||||
$endString = true;
|
||||
|
||||
$chr = $this->read();
|
||||
if ($chr != -1 && $chr != $quote)
|
||||
$output .= $chr;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$output .= $this->read();
|
||||
}
|
||||
|
||||
// String terminated
|
||||
if ($endString)
|
||||
break;
|
||||
}
|
||||
|
||||
$this->readAway();
|
||||
$this->_value = $output;
|
||||
|
||||
// Needed a property
|
||||
if ($this->_needProp) {
|
||||
$this->_token = JSON_KEY;
|
||||
$this->_needProp = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _int2utf8($int) {
|
||||
$int = intval($int);
|
||||
|
||||
switch ($int) {
|
||||
case 0:
|
||||
return chr(0);
|
||||
|
||||
case ($int & 0x7F):
|
||||
return chr($int);
|
||||
|
||||
case ($int & 0x7FF):
|
||||
return chr(0xC0 | (($int >> 6) & 0x1F)) . chr(0x80 | ($int & 0x3F));
|
||||
|
||||
case ($int & 0xFFFF):
|
||||
return chr(0xE0 | (($int >> 12) & 0x0F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr (0x80 | ($int & 0x3F));
|
||||
|
||||
case ($int & 0x1FFFFF):
|
||||
return chr(0xF0 | ($int >> 18)) . chr(0x80 | (($int >> 12) & 0x3F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr(0x80 | ($int & 0x3F));
|
||||
}
|
||||
}
|
||||
|
||||
function _readNumber($start) {
|
||||
$value = "";
|
||||
$isFloat = false;
|
||||
|
||||
$this->_token = JSON_INT;
|
||||
$value .= $start;
|
||||
|
||||
while (($chr = $this->peek()) != -1) {
|
||||
if (is_numeric($chr) || $chr == '-' || $chr == '.') {
|
||||
if ($chr == '.')
|
||||
$isFloat = true;
|
||||
|
||||
$value .= $this->read();
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
$this->readAway();
|
||||
|
||||
if ($isFloat) {
|
||||
$this->_token = JSON_FLOAT;
|
||||
$this->_value = floatval($value);
|
||||
} else
|
||||
$this->_value = intval($value);
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function readAway() {
|
||||
while (($chr = $this->peek()) != null) {
|
||||
if ($chr != ':' && $chr != ',' && $chr != ' ')
|
||||
return;
|
||||
|
||||
$this->read();
|
||||
}
|
||||
}
|
||||
|
||||
function read($len = 1) {
|
||||
if ($this->_pos < $this->_len) {
|
||||
if ($len > 1) {
|
||||
$str = substr($this->_data, $this->_pos + 1, $len);
|
||||
$this->_pos += $len;
|
||||
|
||||
return $str;
|
||||
} else
|
||||
return $this->_data[++$this->_pos];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function skip($len) {
|
||||
$this->_pos += $len;
|
||||
}
|
||||
|
||||
function peek() {
|
||||
if ($this->_pos < $this->_len)
|
||||
return $this->_data[$this->_pos + 1];
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class handles JSON stuff.
|
||||
*
|
||||
* @package MCManager.utils
|
||||
*/
|
||||
class Moxiecode_JSON {
|
||||
function Moxiecode_JSON() {
|
||||
}
|
||||
|
||||
function decode($input) {
|
||||
$reader = new Moxiecode_JSONReader($input);
|
||||
|
||||
return $this->readValue($reader);
|
||||
}
|
||||
|
||||
function readValue(&$reader) {
|
||||
$this->data = array();
|
||||
$this->parents = array();
|
||||
$this->cur =& $this->data;
|
||||
$key = null;
|
||||
$loc = JSON_IN_ARRAY;
|
||||
|
||||
while ($reader->readToken()) {
|
||||
switch ($reader->getToken()) {
|
||||
case JSON_STR:
|
||||
case JSON_INT:
|
||||
case JSON_BOOL:
|
||||
case JSON_FLOAT:
|
||||
case JSON_NULL:
|
||||
switch ($reader->getLocation()) {
|
||||
case JSON_IN_OBJECT:
|
||||
$this->cur[$key] = $reader->getValue();
|
||||
break;
|
||||
|
||||
case JSON_IN_ARRAY:
|
||||
$this->cur[] = $reader->getValue();
|
||||
break;
|
||||
|
||||
default:
|
||||
return $reader->getValue();
|
||||
}
|
||||
break;
|
||||
|
||||
case JSON_KEY:
|
||||
$key = $reader->getValue();
|
||||
break;
|
||||
|
||||
case JSON_START_OBJ:
|
||||
case JSON_START_ARRAY:
|
||||
if ($loc == JSON_IN_OBJECT)
|
||||
$this->addArray($key);
|
||||
else
|
||||
$this->addArray(null);
|
||||
|
||||
$cur =& $obj;
|
||||
|
||||
$loc = $reader->getLocation();
|
||||
break;
|
||||
|
||||
case JSON_END_OBJ:
|
||||
case JSON_END_ARRAY:
|
||||
$loc = $reader->getLocation();
|
||||
|
||||
if (count($this->parents) > 0) {
|
||||
$this->cur =& $this->parents[count($this->parents) - 1];
|
||||
array_pop($this->parents);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->data[0];
|
||||
}
|
||||
|
||||
// This method was needed since PHP is crapy and doesn't have pointers/references
|
||||
function addArray($key) {
|
||||
$this->parents[] =& $this->cur;
|
||||
$ar = array();
|
||||
|
||||
if ($key)
|
||||
$this->cur[$key] =& $ar;
|
||||
else
|
||||
$this->cur[] =& $ar;
|
||||
|
||||
$this->cur =& $ar;
|
||||
}
|
||||
|
||||
function getDelim($index, &$reader) {
|
||||
switch ($reader->getLocation()) {
|
||||
case JSON_IN_ARRAY:
|
||||
case JSON_IN_OBJECT:
|
||||
if ($index > 0)
|
||||
return ",";
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function encode($input) {
|
||||
switch (gettype($input)) {
|
||||
case 'boolean':
|
||||
return $input ? 'true' : 'false';
|
||||
|
||||
case 'integer':
|
||||
return (int) $input;
|
||||
|
||||
case 'float':
|
||||
case 'double':
|
||||
return (float) $input;
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'string':
|
||||
return $this->encodeString($input);
|
||||
|
||||
case 'array':
|
||||
return $this->_encodeArray($input);
|
||||
|
||||
case 'object':
|
||||
return $this->_encodeArray(get_object_vars($input));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function encodeString($input) {
|
||||
// Needs to be escaped
|
||||
if (preg_match('/[^a-zA-Z0-9]/', $input)) {
|
||||
$output = '';
|
||||
|
||||
for ($i=0; $i<strlen($input); $i++) {
|
||||
switch ($input[$i]) {
|
||||
case "\b":
|
||||
$output .= "\\b";
|
||||
break;
|
||||
|
||||
case "\t":
|
||||
$output .= "\\t";
|
||||
break;
|
||||
|
||||
case "\f":
|
||||
$output .= "\\f";
|
||||
break;
|
||||
|
||||
case "\r":
|
||||
$output .= "\\r";
|
||||
break;
|
||||
|
||||
case "\n":
|
||||
$output .= "\\n";
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
$output .= "\\\\";
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
$output .= "\\'";
|
||||
break;
|
||||
|
||||
case '"':
|
||||
$output .= '\"';
|
||||
break;
|
||||
|
||||
default:
|
||||
$byte = ord($input[$i]);
|
||||
|
||||
if (($byte & 0xE0) == 0xC0) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]));
|
||||
$i += 1;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xF0) == 0xE0) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]));
|
||||
$i += 2;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xF8) == 0xF0) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]));
|
||||
$i += 3;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xFC) == 0xF8) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]), ord($input[$i + 4]));
|
||||
$i += 4;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xFE) == 0xFC) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]), ord($input[$i + 4]), ord($input[$i + 5]));
|
||||
$i += 5;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} else if ($byte < 128)
|
||||
$output .= $input[$i];
|
||||
}
|
||||
}
|
||||
|
||||
return '"' . $output . '"';
|
||||
}
|
||||
|
||||
return '"' . $input . '"';
|
||||
}
|
||||
|
||||
function _utf82utf16($utf8) {
|
||||
if (function_exists('mb_convert_encoding'))
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
|
||||
switch (strlen($utf8)) {
|
||||
case 1:
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
return chr(0x07 & (ord($utf8[0]) >> 2)) . chr((0xC0 & (ord($utf8[0]) << 6)) | (0x3F & ord($utf8[1])));
|
||||
|
||||
case 3:
|
||||
return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2])));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function _encodeArray($input) {
|
||||
$output = '';
|
||||
$isIndexed = true;
|
||||
|
||||
$keys = array_keys($input);
|
||||
for ($i=0; $i<count($keys); $i++) {
|
||||
if (!is_int($keys[$i])) {
|
||||
$output .= $this->encodeString($keys[$i]) . ':' . $this->encode($input[$keys[$i]]);
|
||||
$isIndexed = false;
|
||||
} else
|
||||
$output .= $this->encode($input[$keys[$i]]);
|
||||
|
||||
if ($i != count($keys) - 1)
|
||||
$output .= ',';
|
||||
}
|
||||
|
||||
return $isIndexed ? '[' . $output . ']' : '{' . $output . '}';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: Logger.class.php 10 2007-05-27 10:55:12Z spocke $
|
||||
*
|
||||
* @package MCFileManager.filesystems
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
// File type contstants
|
||||
define('MC_LOGGER_DEBUG', 0);
|
||||
define('MC_LOGGER_INFO', 10);
|
||||
define('MC_LOGGER_WARN', 20);
|
||||
define('MC_LOGGER_ERROR', 30);
|
||||
define('MC_LOGGER_FATAL', 40);
|
||||
|
||||
/**
|
||||
* Logging utility class. This class handles basic logging with levels, log rotation and custom log formats. It's
|
||||
* designed to be compact but still powerful and flexible.
|
||||
*/
|
||||
class Moxiecode_Logger {
|
||||
// Private fields
|
||||
var $_path;
|
||||
var $_filename;
|
||||
var $_maxSize;
|
||||
var $_maxFiles;
|
||||
var $_maxSizeBytes;
|
||||
var $_level;
|
||||
var $_format;
|
||||
|
||||
/**
|
||||
* Constructs a new logger instance.
|
||||
*/
|
||||
function Moxiecode_Logger() {
|
||||
$this->_path = "";
|
||||
$this->_filename = "{level}.log";
|
||||
$this->setMaxSize("100k");
|
||||
$this->_maxFiles = 10;
|
||||
$this->_level = MC_LOGGER_DEBUG;
|
||||
$this->_format = "[{time}] [{level}] {message}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current log level, use the MC_LOGGER constants.
|
||||
*
|
||||
* @param int $level Log level instance for example MC_LOGGER_DEBUG.
|
||||
*/
|
||||
function setLevel($level) {
|
||||
if (is_string($level)) {
|
||||
switch (strtolower($level)) {
|
||||
case "debug":
|
||||
$level = MC_LOGGER_DEBUG;
|
||||
break;
|
||||
|
||||
case "info":
|
||||
$level = MC_LOGGER_INFO;
|
||||
break;
|
||||
|
||||
case "warn":
|
||||
case "warning":
|
||||
$level = MC_LOGGER_WARN;
|
||||
break;
|
||||
|
||||
case "error":
|
||||
$level = MC_LOGGER_ERROR;
|
||||
break;
|
||||
|
||||
case "fatal":
|
||||
$level = MC_LOGGER_FATAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
$level = MC_LOGGER_FATAL;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_level = $level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current log level for example MC_LOGGER_DEBUG.
|
||||
*
|
||||
* @return int Current log level for example MC_LOGGER_DEBUG.
|
||||
*/
|
||||
function getLevel() {
|
||||
return $this->_level;
|
||||
}
|
||||
|
||||
function setPath($path) {
|
||||
$this->_path = $path;
|
||||
}
|
||||
|
||||
function getPath() {
|
||||
return $this->_path;
|
||||
}
|
||||
|
||||
function setFileName($file_name) {
|
||||
$this->_filename = $file_name;
|
||||
}
|
||||
|
||||
function getFileName() {
|
||||
return $this->_filename;
|
||||
}
|
||||
|
||||
function setFormat($format) {
|
||||
$this->_format = $format;
|
||||
}
|
||||
|
||||
function getFormat() {
|
||||
return $this->_format;
|
||||
}
|
||||
|
||||
function setMaxSize($size) {
|
||||
// Fix log max size
|
||||
$logMaxSizeBytes = intval(preg_replace("/[^0-9]/", "", $size));
|
||||
|
||||
// Is KB
|
||||
if (strpos((strtolower($size)), "k") > 0)
|
||||
$logMaxSizeBytes *= 1024;
|
||||
|
||||
// Is MB
|
||||
if (strpos((strtolower($size)), "m") > 0)
|
||||
$logMaxSizeBytes *= (1024 * 1024);
|
||||
|
||||
$this->_maxSizeBytes = $logMaxSizeBytes;
|
||||
$this->_maxSize = $size;
|
||||
}
|
||||
|
||||
function getMaxSize() {
|
||||
return $this->_maxSize;
|
||||
}
|
||||
|
||||
function setMaxFiles($max_files) {
|
||||
$this->_maxFiles = $max_files;
|
||||
}
|
||||
|
||||
function getMaxFiles() {
|
||||
return $this->_maxFiles;
|
||||
}
|
||||
|
||||
function debug($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_DEBUG, implode(', ', $args));
|
||||
}
|
||||
|
||||
function info($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_INFO, implode(', ', $args));
|
||||
}
|
||||
|
||||
function warn($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_WARN, implode(', ', $args));
|
||||
}
|
||||
|
||||
function error($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_ERROR, implode(', ', $args));
|
||||
}
|
||||
|
||||
function fatal($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_FATAL, implode(', ', $args));
|
||||
}
|
||||
|
||||
function isDebugEnabled() {
|
||||
return $this->_level >= MC_LOGGER_DEBUG;
|
||||
}
|
||||
|
||||
function isInfoEnabled() {
|
||||
return $this->_level >= MC_LOGGER_INFO;
|
||||
}
|
||||
|
||||
function isWarnEnabled() {
|
||||
return $this->_level >= MC_LOGGER_WARN;
|
||||
}
|
||||
|
||||
function isErrorEnabled() {
|
||||
return $this->_level >= MC_LOGGER_ERROR;
|
||||
}
|
||||
|
||||
function isFatalEnabled() {
|
||||
return $this->_level >= MC_LOGGER_FATAL;
|
||||
}
|
||||
|
||||
function _logMsg($level, $message) {
|
||||
$roll = false;
|
||||
|
||||
if ($level < $this->_level)
|
||||
return;
|
||||
|
||||
$logFile = $this->toOSPath($this->_path . "/" . $this->_filename);
|
||||
|
||||
switch ($level) {
|
||||
case MC_LOGGER_DEBUG:
|
||||
$levelName = "DEBUG";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_INFO:
|
||||
$levelName = "INFO";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_WARN:
|
||||
$levelName = "WARN";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_ERROR:
|
||||
$levelName = "ERROR";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_FATAL:
|
||||
$levelName = "FATAL";
|
||||
break;
|
||||
}
|
||||
|
||||
$logFile = str_replace('{level}', strtolower($levelName), $logFile);
|
||||
|
||||
$text = $this->_format;
|
||||
$text = str_replace('{time}', date("Y-m-d H:i:s"), $text);
|
||||
$text = str_replace('{level}', strtolower($levelName), $text);
|
||||
$text = str_replace('{message}', $message, $text);
|
||||
$message = $text . "\r\n";
|
||||
|
||||
// Check filesize
|
||||
if (file_exists($logFile)) {
|
||||
$size = @filesize($logFile);
|
||||
|
||||
if ($size + strlen($message) > $this->_maxSizeBytes)
|
||||
$roll = true;
|
||||
}
|
||||
|
||||
// Roll if the size is right
|
||||
if ($roll) {
|
||||
for ($i=$this->_maxFiles-1; $i>=1; $i--) {
|
||||
$rfile = $this->toOSPath($logFile . "." . $i);
|
||||
$nfile = $this->toOSPath($logFile . "." . ($i+1));
|
||||
|
||||
if (@file_exists($rfile))
|
||||
@rename($rfile, $nfile);
|
||||
}
|
||||
|
||||
@rename($logFile, $this->toOSPath($logFile . ".1"));
|
||||
|
||||
// Delete last logfile
|
||||
$delfile = $this->toOSPath($logFile . "." . ($this->_maxFiles + 1));
|
||||
if (@file_exists($delfile))
|
||||
@unlink($delfile);
|
||||
}
|
||||
|
||||
// Append log line
|
||||
if (($fp = @fopen($logFile, "a")) != null) {
|
||||
@fputs($fp, $message);
|
||||
@fflush($fp);
|
||||
@fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Unix path to OS specific path.
|
||||
*
|
||||
* @param String $path Unix path to convert.
|
||||
*/
|
||||
function toOSPath($path) {
|
||||
return str_replace("/", DIRECTORY_SEPARATOR, $path);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* config.php
|
||||
*
|
||||
* @package MCManager.includes
|
||||
*/
|
||||
// General settings
|
||||
$config['general.engine'] = 'GoogleSpell';
|
||||
//$config['general.engine'] = 'PSpell';
|
||||
//$config['general.engine'] = 'PSpellShell';
|
||||
//$config['general.remote_rpc_url'] = 'http://some.other.site/some/url/rpc.php';
|
||||
|
||||
// PSpell settings
|
||||
$config['PSpell.mode'] = PSPELL_FAST;
|
||||
$config['PSpell.spelling'] = "";
|
||||
$config['PSpell.jargon'] = "";
|
||||
$config['PSpell.encoding'] = "";
|
||||
|
||||
// PSpellShell settings
|
||||
$config['PSpellShell.mode'] = PSPELL_FAST;
|
||||
$config['PSpellShell.aspell'] = '/usr/bin/aspell';
|
||||
$config['PSpellShell.tmp'] = '/tmp';
|
||||
|
||||
// Windows PSpellShell settings
|
||||
//$config['PSpellShell.aspell'] = '"c:\Program Files\Aspell\bin\aspell.exe"';
|
||||
//$config['PSpellShell.tmp'] = 'c:/temp';
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;}
|
||||
@@ -0,0 +1 @@
|
||||
(function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=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(e,f){var g=this,d;g.url=f;g.editor=e;g.rpcUrl=e.getParam("spellchecker_rpc_url",this.url+'/rpc.php');if(g.rpcUrl=="{backend}"){if(tinymce.isIE){return}g.hasSupport=true;e.onContextMenu.addToTop(function(h,i){if(g.active){return false}})}e.addCommand("mceSpellCheck",function(){if(g.rpcUrl=="{backend}"){g.editor.getBody().spellcheck=g.active=!g.active;return}if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);if(e.getParam("spellchecker_report_no_misspellings",true)){e.windowManager.alert("spellchecker.no_mpell")}}})}else{g._done()}});e.onInit.add(function(){if(e.settings.content_css!==false){e.dom.loadCSS(f+"/css/content.css")}});e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.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(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){if(f.rpcUrl=="{backend}"){if(f.hasSupport){g=d.createButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f})}return g}g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');for(d=0;d<f.length;d++){e+="\\"+f.charAt(d)}return e},_getWords:function(){var e=this.editor,g=[],d="",f={},h=[];this._walk(e.getBody(),function(i){if(i.nodeType==3){d+=i.nodeValue+" "}});if(e.getParam("spellchecker_word_pattern")){h=d.match("("+e.getParam("spellchecker_word_pattern")+")","gi")}else{d=d.replace(new RegExp("([0-9]|["+this._getSeparators()+"])","g")," ");d=tinymce.trim(d.replace(/(\s+)/g," "));h=d.split(" ")}c(h,function(i){if(!f[i]){g.push(i);f[i]=1}});return g},_removeWords:function(e){var f=this.editor,h=f.dom,g=f.selection,d=g.getBookmark();c(h.select("span").reverse(),function(i){if(i&&(h.hasClass(i,"mceItemHiddenSpellWord")||h.hasClass(i,"mceItemHidden"))){if(!e||h.decode(i.innerHTML)==e){h.remove(i,1)}}});g.moveToBookmark(d)},_markWords:function(o){var i,h,g,f,e,n="",k=this.editor,p=this._getSeparators(),j=k.dom,d=[];var l=k.selection,m=l.getBookmark();c(o,function(q){n+=(n?"|":"")+q});i=new RegExp("(["+p+"])("+n+")(["+p+"])","g");h=new RegExp("^("+n+")","g");g=new RegExp("("+n+")(["+p+"]?)$","g");f=new RegExp("^("+n+")(["+p+"]?)$","g");e=new RegExp("("+n+")(["+p+"])","g");this._walk(this.editor.getBody(),function(q){if(q.nodeType==3){d.push(q)}});c(d,function(r){var q;if(r.nodeType==3){q=r.nodeValue;if(i.test(q)||h.test(q)||g.test(q)||f.test(q)){q=j.encode(q);q=q.replace(e,'<span class="mceItemHiddenSpellWord">$1</span>$2');q=q.replace(g,'<span class="mceItemHiddenSpellWord">$1</span>$2');j.replace(j.create("span",{"class":"mceItemHidden"},q),r)}}});l.moveToBookmark(m)},_showMenu:function(g,i){var h=this,g=h.editor,d=h._menu,k,j=g.dom,f=j.getViewPort(g.getWin());if(!d){k=b.getPos(g.getContentAreaContainer());d=g.controlManager.createDropMenu("spellcheckermenu",{offset_x:k.x,offset_y:k.y,"class":"mceNoIcons"});h._menu=d}if(j.hasClass(i.target,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);h._sendRPC("getSuggestions",[h.selectedLang,j.decode(i.target.innerHTML)],function(l){var e;d.removeAll();if(l.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(l,function(m){d.add({title:m,oncliLine truncated
|
||||
|
After Width: | Height: | Size: 46 B |
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* general.php
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
@error_reporting(E_ALL ^ E_NOTICE);
|
||||
$config = array();
|
||||
|
||||
require_once(dirname(__FILE__) . "/../classes/utils/Logger.php");
|
||||
require_once(dirname(__FILE__) . "/../classes/utils/JSON.php");
|
||||
require_once(dirname(__FILE__) . "/../config.php");
|
||||
require_once(dirname(__FILE__) . "/../classes/SpellChecker.php");
|
||||
|
||||
if (isset($config['general.engine']))
|
||||
require_once(dirname(__FILE__) . "/../classes/" . $config["general.engine"] . ".php");
|
||||
|
||||
/**
|
||||
* Returns an request value by name without magic quoting.
|
||||
*
|
||||
* @param String $name Name of parameter to get.
|
||||
* @param String $default_value Default value to return if value not found.
|
||||
* @return String request value by name without magic quoting or default value.
|
||||
*/
|
||||
function getRequestParam($name, $default_value = false) {
|
||||
if (!isset($_REQUEST[$name]))
|
||||
return $default_value;
|
||||
|
||||
if (is_array($_REQUEST[$name])) {
|
||||
$newarray = array();
|
||||
|
||||
foreach ($_REQUEST[$name] as $name => $value)
|
||||
$newarray[$name] = $value;
|
||||
|
||||
return $newarray;
|
||||
}
|
||||
|
||||
return $_REQUEST[$name];
|
||||
}
|
||||
|
||||
function &getLogger() {
|
||||
global $mcLogger, $man;
|
||||
|
||||
if (isset($man))
|
||||
$mcLogger = $man->getLogger();
|
||||
|
||||
if (!$mcLogger) {
|
||||
$mcLogger = new Moxiecode_Logger();
|
||||
|
||||
// Set logger options
|
||||
$mcLogger->setPath(dirname(__FILE__) . "/../logs");
|
||||
$mcLogger->setMaxSize("100kb");
|
||||
$mcLogger->setMaxFiles("10");
|
||||
$mcLogger->setFormat("{time} - {message}");
|
||||
}
|
||||
|
||||
return $mcLogger;
|
||||
}
|
||||
|
||||
function debug($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->debug(implode(', ', $args));
|
||||
}
|
||||
|
||||
function info($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->info(implode(', ', $args));
|
||||
}
|
||||
|
||||
function error($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->error(implode(', ', $args));
|
||||
}
|
||||
|
||||
function warn($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->warn(implode(', ', $args));
|
||||
}
|
||||
|
||||
function fatal($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->fatal(implode(', ', $args));
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: rpc.php 915 2008-09-03 08:45:28Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
require_once("./includes/general.php");
|
||||
|
||||
// Set RPC response headers
|
||||
header('Content-Type: text/plain');
|
||||
header('Content-Encoding: UTF-8');
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
$raw = "";
|
||||
|
||||
// Try param
|
||||
if (isset($_POST["json_data"]))
|
||||
$raw = getRequestParam("json_data");
|
||||
|
||||
// Try globals array
|
||||
if (!$raw && isset($_GLOBALS) && isset($_GLOBALS["HTTP_RAW_POST_DATA"]))
|
||||
$raw = $_GLOBALS["HTTP_RAW_POST_DATA"];
|
||||
|
||||
// Try globals variable
|
||||
if (!$raw && isset($HTTP_RAW_POST_DATA))
|
||||
$raw = $HTTP_RAW_POST_DATA;
|
||||
|
||||
// Try stream
|
||||
if (!$raw) {
|
||||
if (!function_exists('file_get_contents')) {
|
||||
$fp = fopen("php://input", "r");
|
||||
if ($fp) {
|
||||
$raw = "";
|
||||
|
||||
while (!feof($fp))
|
||||
$raw = fread($fp, 1024);
|
||||
|
||||
fclose($fp);
|
||||
}
|
||||
} else
|
||||
$raw = "" . file_get_contents("php://input");
|
||||
}
|
||||
|
||||
// No input data
|
||||
if (!$raw)
|
||||
die('{"result":null,"id":null,"error":{"errstr":"Could not get raw post data.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
|
||||
|
||||
// Passthrough request to remote server
|
||||
if (isset($config['general.remote_rpc_url'])) {
|
||||
$url = parse_url($config['general.remote_rpc_url']);
|
||||
|
||||
// Setup request
|
||||
$req = "POST " . $url["path"] . " HTTP/1.0\r\n";
|
||||
$req .= "Connection: close\r\n";
|
||||
$req .= "Host: " . $url['host'] . "\r\n";
|
||||
$req .= "Content-Length: " . strlen($raw) . "\r\n";
|
||||
$req .= "\r\n" . $raw;
|
||||
|
||||
if (!isset($url['port']) || !$url['port'])
|
||||
$url['port'] = 80;
|
||||
|
||||
$errno = $errstr = "";
|
||||
|
||||
$socket = fsockopen($url['host'], intval($url['port']), $errno, $errstr, 30);
|
||||
if ($socket) {
|
||||
// Send request headers
|
||||
fputs($socket, $req);
|
||||
|
||||
// Read response headers and data
|
||||
$resp = "";
|
||||
while (!feof($socket))
|
||||
$resp .= fgets($socket, 4096);
|
||||
|
||||
fclose($socket);
|
||||
|
||||
// Split response header/data
|
||||
$resp = explode("\r\n\r\n", $resp);
|
||||
echo $resp[1]; // Output body
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
// Get JSON data
|
||||
$json = new Moxiecode_JSON();
|
||||
$input = $json->decode($raw);
|
||||
|
||||
// Execute RPC
|
||||
if (isset($config['general.engine'])) {
|
||||
$spellchecker = new $config['general.engine']($config);
|
||||
$result = call_user_func_array(array($spellchecker, $input['method']), $input['params']);
|
||||
} else
|
||||
die('{"result":null,"id":null,"error":{"errstr":"You must choose an spellchecker engine in the config.php file.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
|
||||
|
||||
// Request and response id should always be the same
|
||||
$output = array(
|
||||
"id" => $input->id,
|
||||
"result" => $result,
|
||||
"error" => null
|
||||
);
|
||||
|
||||
// Return JSON encoded string
|
||||
echo $json->encode($output);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
(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.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)})();
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
.mceWPnextpage, .mceWPmore {
|
||||
border: 0px;
|
||||
border-top: 1px dotted #cccccc;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 12px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
.mceWPmore {
|
||||
background: #ffffff url(../img/more_bug.gif) no-repeat right top;
|
||||
}
|
||||
.mceWPnextpage {
|
||||
background: #ffffff url(../img/page_bug.gif) no-repeat right top;
|
||||
}
|
||||
|
||||
img.wpGallery {
|
||||
border: 1px dashed #888;
|
||||
background: #f2f8ff url("../../wpgallery/img/gallery.png") no-repeat scroll center center;
|
||||
width: 99%;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
img.wp-oembed {
|
||||
border: 1px dashed #888;
|
||||
background: #f7f5f2 url("../img/embedded.png") no-repeat scroll center center;
|
||||
width: 300px;
|
||||
height: 250px;
|
||||
}
|
||||
@@ -0,0 +1,412 @@
|
||||
/**
|
||||
* WordPress plugin.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var DOM = tinymce.DOM;
|
||||
|
||||
tinymce.create('tinymce.plugins.WordPress', {
|
||||
mceTout : 0,
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'), last = 0, moreHTML, nextpageHTML;
|
||||
moreHTML = '<img src="' + url + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
||||
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
||||
|
||||
if ( getUserSetting('hidetb', '0') == '1' )
|
||||
ed.settings.wordpress_adv_hidden = 0;
|
||||
|
||||
// Hides the specified toolbar and resizes the iframe
|
||||
ed.onPostRender.add(function() {
|
||||
var adv_toolbar = ed.controlManager.get(tbId);
|
||||
if ( ed.getParam('wordpress_adv_hidden', 1) && adv_toolbar ) {
|
||||
DOM.hide(adv_toolbar.id);
|
||||
t._resizeIframe(ed, tbId, 28);
|
||||
}
|
||||
});
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('WP_More', function() {
|
||||
ed.execCommand('mceInsertContent', 0, moreHTML);
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Page', function() {
|
||||
ed.execCommand('mceInsertContent', 0, nextpageHTML);
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Help', function() {
|
||||
ed.windowManager.open({
|
||||
url : tinymce.baseURL + '/wp-mce-help.php',
|
||||
width : 450,
|
||||
height : 420,
|
||||
inline : 1
|
||||
});
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Adv', function() {
|
||||
var cm = ed.controlManager, id = cm.get(tbId).id;
|
||||
|
||||
if ( 'undefined' == id )
|
||||
return;
|
||||
|
||||
if ( DOM.isHidden(id) ) {
|
||||
cm.setActive('wp_adv', 1);
|
||||
DOM.show(id);
|
||||
t._resizeIframe(ed, tbId, -28);
|
||||
ed.settings.wordpress_adv_hidden = 0;
|
||||
setUserSetting('hidetb', '1');
|
||||
} else {
|
||||
cm.setActive('wp_adv', 0);
|
||||
DOM.hide(id);
|
||||
t._resizeIframe(ed, tbId, 28);
|
||||
ed.settings.wordpress_adv_hidden = 1;
|
||||
setUserSetting('hidetb', '0');
|
||||
}
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('wp_more', {
|
||||
title : 'wordpress.wp_more_desc',
|
||||
image : url + '/img/more.gif',
|
||||
cmd : 'WP_More'
|
||||
});
|
||||
|
||||
ed.addButton('wp_page', {
|
||||
title : 'wordpress.wp_page_desc',
|
||||
image : url + '/img/page.gif',
|
||||
cmd : 'WP_Page'
|
||||
});
|
||||
|
||||
ed.addButton('wp_help', {
|
||||
title : 'wordpress.wp_help_desc',
|
||||
image : url + '/img/help.gif',
|
||||
cmd : 'WP_Help'
|
||||
});
|
||||
|
||||
ed.addButton('wp_adv', {
|
||||
title : 'wordpress.wp_adv_desc',
|
||||
image : url + '/img/toolbars.gif',
|
||||
cmd : 'WP_Adv'
|
||||
});
|
||||
|
||||
// Add Media buttons
|
||||
ed.addButton('add_media', {
|
||||
title : 'wordpress.add_media',
|
||||
image : url + '/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' );
|
||||
}
|
||||
});
|
||||
|
||||
ed.addButton('add_image', {
|
||||
title : 'wordpress.add_image',
|
||||
image : url + '/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' );
|
||||
}
|
||||
});
|
||||
|
||||
ed.addButton('add_video', {
|
||||
title : 'wordpress.add_video',
|
||||
image : url + '/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' );
|
||||
}
|
||||
});
|
||||
|
||||
ed.addButton('add_audio', {
|
||||
title : 'wordpress.add_audio',
|
||||
image : url + '/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' );
|
||||
}
|
||||
});
|
||||
|
||||
// Add Media buttons to fullscreen and handle align buttons for image captions
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val, o) {
|
||||
var DOM = tinymce.DOM, n, DL, DIV, cls, a, align;
|
||||
if ( 'mceFullScreen' == cmd ) {
|
||||
if ( 'mce_fullscreen' != ed.id && DOM.get('add_audio') && DOM.get('add_video') && DOM.get('add_image') && DOM.get('add_media') )
|
||||
ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
|
||||
}
|
||||
|
||||
if ( 'JustifyLeft' == cmd || 'JustifyRight' == cmd || 'JustifyCenter' == cmd ) {
|
||||
n = ed.selection.getNode();
|
||||
|
||||
if ( n.nodeName == 'IMG' ) {
|
||||
align = cmd.substr(7).toLowerCase();
|
||||
a = 'align' + align;
|
||||
DL = ed.dom.getParent(n, 'dl.wp-caption');
|
||||
DIV = ed.dom.getParent(n, 'div.mceTemp');
|
||||
|
||||
if ( DL && DIV ) {
|
||||
cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
|
||||
DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
|
||||
ed.dom.addClass(DL, cls);
|
||||
|
||||
if (cls == 'aligncenter')
|
||||
ed.dom.addClass(DIV, 'mceIEcenter');
|
||||
else
|
||||
ed.dom.removeClass(DIV, 'mceIEcenter');
|
||||
|
||||
o.terminate = true;
|
||||
ed.execCommand('mceRepaint');
|
||||
} else {
|
||||
if ( ed.dom.hasClass(n, a) )
|
||||
ed.dom.addClass(n, 'alignnone');
|
||||
else
|
||||
ed.dom.removeClass(n, 'alignnone');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
// make sure these run last
|
||||
ed.onNodeChange.add( function(ed, cm, e) {
|
||||
var DL;
|
||||
|
||||
if ( e.nodeName == 'IMG' ) {
|
||||
DL = ed.dom.getParent(e, 'dl.wp-caption');
|
||||
} else if ( e.nodeName == 'DIV' && ed.dom.hasClass(e, 'mceTemp') ) {
|
||||
DL = e.firstChild;
|
||||
|
||||
if ( ! ed.dom.hasClass(DL, 'wp-caption') )
|
||||
DL = false;
|
||||
}
|
||||
|
||||
if ( DL ) {
|
||||
if ( ed.dom.hasClass(DL, 'alignleft') )
|
||||
cm.setActive('justifyleft', 1);
|
||||
else if ( ed.dom.hasClass(DL, 'alignright') )
|
||||
cm.setActive('justifyright', 1);
|
||||
else if ( ed.dom.hasClass(DL, 'aligncenter') )
|
||||
cm.setActive('justifycenter', 1);
|
||||
}
|
||||
});
|
||||
|
||||
// remove invalid parent paragraphs when pasting HTML and/or switching to the HTML editor and back
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
if ( o.content ) {
|
||||
o.content = o.content.replace(/<p>\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi, '<$1$2>');
|
||||
o.content = o.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, '</$1>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Word count if script is loaded
|
||||
if ( 'undefined' != typeof wpWordCount ) {
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
if ( e.keyCode == last ) return;
|
||||
if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) );
|
||||
last = e.keyCode;
|
||||
});
|
||||
};
|
||||
|
||||
ed.onSaveContent.add(function(ed, o) {
|
||||
if ( typeof(switchEditors) == 'object' ) {
|
||||
if ( ed.isHidden() )
|
||||
o.content = o.element.value;
|
||||
else
|
||||
o.content = switchEditors.pre_wpautop(o.content);
|
||||
}
|
||||
});
|
||||
|
||||
/* disable for now
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = t._setEmbed(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if ( o.get )
|
||||
o.content = t._getEmbed(o.content);
|
||||
});
|
||||
*/
|
||||
|
||||
// Add listeners to handle more break
|
||||
t._handleMoreBreak(ed, url);
|
||||
|
||||
// Add custom shortcuts
|
||||
ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter');
|
||||
ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight');
|
||||
ed.addShortcut('alt+shift+l', ed.getLang('justifyleft_desc'), 'JustifyLeft');
|
||||
ed.addShortcut('alt+shift+j', ed.getLang('justifyfull_desc'), 'JustifyFull');
|
||||
ed.addShortcut('alt+shift+q', ed.getLang('blockquote_desc'), 'mceBlockQuote');
|
||||
ed.addShortcut('alt+shift+u', ed.getLang('bullist_desc'), 'InsertUnorderedList');
|
||||
ed.addShortcut('alt+shift+o', ed.getLang('numlist_desc'), 'InsertOrderedList');
|
||||
ed.addShortcut('alt+shift+d', ed.getLang('striketrough_desc'), 'Strikethrough');
|
||||
ed.addShortcut('alt+shift+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck');
|
||||
ed.addShortcut('alt+shift+a', ed.getLang('link_desc'), 'mceLink');
|
||||
ed.addShortcut('alt+shift+s', ed.getLang('unlink_desc'), 'unlink');
|
||||
ed.addShortcut('alt+shift+m', ed.getLang('image_desc'), 'mceImage');
|
||||
ed.addShortcut('alt+shift+g', ed.getLang('fullscreen.desc'), 'mceFullScreen');
|
||||
ed.addShortcut('alt+shift+z', ed.getLang('wp_adv_desc'), 'WP_Adv');
|
||||
ed.addShortcut('alt+shift+h', ed.getLang('help_desc'), 'WP_Help');
|
||||
ed.addShortcut('alt+shift+t', ed.getLang('wp_more_desc'), 'WP_More');
|
||||
ed.addShortcut('alt+shift+p', ed.getLang('wp_page_desc'), 'WP_Page');
|
||||
ed.addShortcut('ctrl+s', ed.getLang('save_desc'), function(){if('function'==typeof autosave)autosave();});
|
||||
|
||||
if ( tinymce.isWebKit ) {
|
||||
ed.addShortcut('alt+shift+b', ed.getLang('bold_desc'), 'Bold');
|
||||
ed.addShortcut('alt+shift+i', ed.getLang('italic_desc'), 'Italic');
|
||||
}
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
});
|
||||
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
|
||||
ed.onSaveContent.add(function(ed, o) {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
if ( e.target.nodeName != 'IMG' )
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'WordPress Plugin',
|
||||
author : 'WordPress', // add Moxiecode?
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : 'http://wordpress.org',
|
||||
version : '3.0'
|
||||
};
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
_setEmbed : function(c) {
|
||||
return c.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g, function(a,b){
|
||||
return '<img width="300" height="200" src="' + tinymce.baseURL + '/plugins/wordpress/img/trans.gif" class="wp-oembed mceItemNoResize" alt="'+b+'" title="'+b+'" />';
|
||||
});
|
||||
},
|
||||
|
||||
_getEmbed : function(c) {
|
||||
return c.replace(/<img[^>]+>/g, function(a) {
|
||||
if ( a.indexOf('class="wp-oembed') != -1 ) {
|
||||
var u = a.match(/alt="([^\"]+)"/);
|
||||
if ( u[1] )
|
||||
a = '[embed]' + u[1] + '[/embed]';
|
||||
}
|
||||
return a;
|
||||
});
|
||||
},
|
||||
|
||||
_showButtons : function(n, id) {
|
||||
var ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
|
||||
|
||||
vp = ed.dom.getViewPort(ed.getWin());
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
p2 = ed.dom.getPos(n);
|
||||
|
||||
X = Math.max(p2.x - vp.x, 0) + p1.x;
|
||||
Y = Math.max(p2.y - vp.y, 0) + p1.y;
|
||||
|
||||
DOM.setStyles(id, {
|
||||
'top' : Y+5+'px',
|
||||
'left' : X+5+'px',
|
||||
'display' : 'block'
|
||||
});
|
||||
|
||||
if ( this.mceTout )
|
||||
clearTimeout(this.mceTout);
|
||||
|
||||
this.mceTout = setTimeout( function(){ed.plugins.wordpress._hideButtons();}, 5000 );
|
||||
},
|
||||
|
||||
_hideButtons : function() {
|
||||
if ( !this.mceTout )
|
||||
return;
|
||||
|
||||
if ( document.getElementById('wp_editbtns') )
|
||||
tinymce.DOM.hide('wp_editbtns');
|
||||
|
||||
if ( document.getElementById('wp_gallerybtns') )
|
||||
tinymce.DOM.hide('wp_gallerybtns');
|
||||
|
||||
clearTimeout(this.mceTout);
|
||||
this.mceTout = 0;
|
||||
},
|
||||
|
||||
// Resizes the iframe by a relative height value
|
||||
_resizeIframe : function(ed, tb_id, dy) {
|
||||
var ifr = ed.getContentAreaContainer().firstChild;
|
||||
|
||||
DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe
|
||||
ed.theme.deltaHeight += dy; // For resize cookie
|
||||
},
|
||||
|
||||
_handleMoreBreak : function(ed, url) {
|
||||
var moreHTML, nextpageHTML;
|
||||
|
||||
moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
||||
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
||||
|
||||
// Load plugin specific CSS into editor
|
||||
ed.onInit.add(function() {
|
||||
ed.dom.loadCSS(url + '/css/content.css');
|
||||
});
|
||||
|
||||
// Display morebreak instead if img in element path
|
||||
ed.onPostRender.add(function() {
|
||||
if (ed.theme.onResolveName) {
|
||||
ed.theme.onResolveName.add(function(th, o) {
|
||||
if (o.node.nodeName == 'IMG') {
|
||||
if ( ed.dom.hasClass(o.node, 'mceWPmore') )
|
||||
o.name = 'wpmore';
|
||||
if ( ed.dom.hasClass(o.node, 'mceWPnextpage') )
|
||||
o.name = 'wppage';
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Replace morebreak with images
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
if ( o.content ) {
|
||||
o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML);
|
||||
o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML);
|
||||
}
|
||||
});
|
||||
|
||||
// Replace images with morebreak
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
||||
if (im.indexOf('class="mceWPmore') !== -1) {
|
||||
var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : '';
|
||||
im = '<!--more'+moretext+'-->';
|
||||
}
|
||||
if (im.indexOf('class="mceWPnextpage') !== -1)
|
||||
im = '<!--nextpage-->';
|
||||
|
||||
return im;
|
||||
});
|
||||
});
|
||||
|
||||
// Set active buttons if user selected pagebreak or more break
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage'));
|
||||
cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress);
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.WordPress",{mceTout:0,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(){var i=c.controlManager.get(h);if(c.getParam("wordpress_adv_hidden",1)&&i){a.hide(i.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 i=c.controlManager,j=i.get(h).id;if("undefined"==j){return}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(p,m,s,l,j){var v=tinymce.DOM,k,i,r,u,t,q;if("mceFullScreen"==m){if("mce_fullscreen"!=p.id&&v.get("add_audio")&&v.get("add_video")&&v.get("add_image")&&v.get("add_media")){p.settings.theme_advanced_buttons1+=",|,add_image,add_video,add_audio,add_media"}}if("JustifyLeft"==m||"JustifyRight"==m||"JustifyCenter"==m){k=p.selection.getNode();if(k.nodeName=="IMG"){q=m.substr(7).toLowerCase();t="align"+q;i=p.dom.getParent(k,"dl.wp-caption");r=p.dom.getParent(k,"div.mceTemp");if(i&&r){u=p.dom.hasClass(i,t)?"alignnone":t;i.className=i.className.replace(/align[^ '"]+\s?/g,"");p.dom.addClass(i,u);if(u=="aligncenter"){p.dom.addClass(r,"mceIEcenter")}else{p.dom.removeClass(r,"mceIEcenter")}j.terminate=true;p.execCommand("mceRepaint")}else{if(p.dom.hasClass(k,t)){p.dom.addClass(k,"alignnone")}else{p.dom.removeClass(k,"alignnone")}}}}});c.onInit.add(function(i){i.onNodeChange.add(function(k,j,m){var l;if(m.nodeName=="IMG"){l=k.dom.getParent(m,"dl.wp-caption")}else{if(m.nodeName=="DIV"&&k.dom.hasClass(m,"mceTemp")){l=m.firstChild;if(!k.dom.hasClass(l,"wp-caption")){l=false}}}if(l){if(k.dom.hasClass(l,"alignleft")){j.setActive("justifyleft",1)}else{if(k.dom.hasClass(l,"alignright")){j.setActive("justifyright",1)}else{if(k.dom.hasClass(l,"aligncenter")){j.setActive("justifycenter",1)}}}}});i.onBeforeSetContent.add(function(j,k){if(k.content){k.content=k.content.replace(/<p>\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi,"<$1$2>");k.content=k.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi,"</$1>")}})});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})}c.onSaveContent.add(function(i,j){if(typeof(switchEditors)=="object"){if(i.isHidden()){j.content=j.element.value}else{j.content=switchEditors.pre_wpautop(j.content)}}});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("Line truncated
|
||||
|
After Width: | Height: | Size: 146 B |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 295 B |
|
After Width: | Height: | Size: 101 B |
|
After Width: | Height: | Size: 149 B |
|
After Width: | Height: | Size: 108 B |
|
After Width: | Height: | Size: 146 B |
|
After Width: | Height: | Size: 108 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 260 B |
|
After Width: | Height: | Size: 43 B |
|
After Width: | Height: | Size: 99 B |
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
var wpDialogFn = function( fn ) {
|
||||
return function() {
|
||||
if ( this.features.wpDialog )
|
||||
return fn.apply( this, arguments );
|
||||
else
|
||||
return this.parent.apply( this, arguments );
|
||||
};
|
||||
};
|
||||
|
||||
tinymce.create('tinymce.plugins.WPDialogs', {
|
||||
init : function(ed, url) {
|
||||
// Replace window manager
|
||||
ed.onBeforeRenderUI.add(function() {
|
||||
ed.windowManager = new tinymce.WPWindowManager(ed);
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'WPDialogs',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : 'http://wordpress.org',
|
||||
version : '0.1'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$.widget("wp.wpdialog", $.ui.dialog, {
|
||||
open: function() {
|
||||
// Initialize tinyMCEPopup if it exists.
|
||||
if ( tinyMCEPopup )
|
||||
tinyMCEPopup.init();
|
||||
// Open the dialog.
|
||||
$.ui.dialog.prototype.open.apply( this, arguments );
|
||||
// WebKit leaves focus in the TinyMCE editor unless we shift focus.
|
||||
this.element.focus();
|
||||
this._trigger('refresh');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', {
|
||||
WPWindowManager : function(ed) {
|
||||
this.parent(ed);
|
||||
},
|
||||
|
||||
open : function(f, p) {
|
||||
var t = this, element;
|
||||
// Can't use wpDialogFn here; this.features isn't set yet.
|
||||
if ( ! f.wpDialog )
|
||||
return this.parent( f, p );
|
||||
else if ( ! f.id )
|
||||
return;
|
||||
|
||||
element = $('#' + f.id);
|
||||
if ( ! element.length )
|
||||
return;
|
||||
|
||||
t.features = f;
|
||||
t.params = p;
|
||||
t.onOpen.dispatch(t, f, p);
|
||||
t.element = t.windows[ f.id ] = element;
|
||||
|
||||
// Store selection
|
||||
t.bookmark = t.editor.selection.getBookmark(1);
|
||||
|
||||
element.wpdialog({
|
||||
title: f.title,
|
||||
width: f.width,
|
||||
height: f.height,
|
||||
modal: true,
|
||||
dialogClass: 'wp-dialog',
|
||||
zIndex: 300000
|
||||
});
|
||||
},
|
||||
close : wpDialogFn(function() {
|
||||
this.element.wpdialog('close');
|
||||
})
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('wpdialogs', tinymce.plugins.WPDialogs);
|
||||
})(jQuery);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
(function(b){var a=function(c){return function(){if(this.features.wpDialog){return c.apply(this,arguments)}else{return this.parent.apply(this,arguments)}}};tinymce.create("tinymce.plugins.WPDialogs",{init:function(c,d){c.onBeforeRenderUI.add(function(){c.windowManager=new tinymce.WPWindowManager(c)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}});b(document).ready(function(){b.widget("wp.wpdialog",b.ui.dialog,{open:function(){if(tinyMCEPopup){tinyMCEPopup.init()}b.ui.dialog.prototype.open.apply(this,arguments);this.element.focus();this._trigger("refresh")}})});tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(c){this.parent(c)},open:function(e,g){var d=this,c;if(!e.wpDialog){return this.parent(e,g)}else{if(!e.id){return}}c=b("#"+e.id);if(!c.length){return}d.features=e;d.params=g;d.onOpen.dispatch(d,e,g);d.element=d.windows[e.id]=c;d.bookmark=d.editor.selection.getBookmark(1);c.wpdialog({title:e.title,width:e.width,height:e.height,modal:true,dialogClass:"wp-dialog",zIndex:300000})},close:a(function(){this.element.wpdialog("close")})});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})(jQuery);
|
||||
@@ -0,0 +1,432 @@
|
||||
/**
|
||||
* popup.js
|
||||
*
|
||||
* An altered version of tinyMCEPopup to work in the same window as tinymce.
|
||||
*
|
||||
* ------------------------------------------------------------------
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
// Some global instances
|
||||
|
||||
/**
|
||||
* TinyMCE popup/dialog helper class. This gives you easy access to the
|
||||
* parent editor instance and a bunch of other things. It's higly recommended
|
||||
* that you load this script into your dialogs.
|
||||
*
|
||||
* @static
|
||||
* @class tinyMCEPopup
|
||||
*/
|
||||
var tinyMCEPopup = {
|
||||
/**
|
||||
* Initializes the popup this will be called automatically.
|
||||
*
|
||||
* @method init
|
||||
*/
|
||||
init : function() {
|
||||
var t = this, w, ti;
|
||||
|
||||
// Find window & API
|
||||
w = t.getWin();
|
||||
tinymce = w.tinymce;
|
||||
tinyMCE = w.tinyMCE;
|
||||
t.editor = tinymce.EditorManager.activeEditor;
|
||||
t.params = t.editor.windowManager.params;
|
||||
t.features = t.editor.windowManager.features;
|
||||
t.dom = tinymce.dom;
|
||||
|
||||
// Setup on init listeners
|
||||
t.listeners = [];
|
||||
t.onInit = {
|
||||
add : function(f, s) {
|
||||
t.listeners.push({func : f, scope : s});
|
||||
}
|
||||
};
|
||||
|
||||
t.isWindow = false;
|
||||
t.id = t.features.id;
|
||||
t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the reference to the parent window that opened the dialog.
|
||||
*
|
||||
* @method getWin
|
||||
* @return {Window} Reference to the parent window that opened the dialog.
|
||||
*/
|
||||
getWin : function() {
|
||||
return window;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a window argument/parameter by name.
|
||||
*
|
||||
* @method getWindowArg
|
||||
* @param {String} n Name of the window argument to retrive.
|
||||
* @param {String} dv Optional default value to return.
|
||||
* @return {String} Argument value or default value if it wasn't found.
|
||||
*/
|
||||
getWindowArg : function(n, dv) {
|
||||
var v = this.params[n];
|
||||
|
||||
return tinymce.is(v) ? v : dv;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a editor parameter/config option value.
|
||||
*
|
||||
* @method getParam
|
||||
* @param {String} n Name of the editor config option to retrive.
|
||||
* @param {String} dv Optional default value to return.
|
||||
* @return {String} Parameter value or default value if it wasn't found.
|
||||
*/
|
||||
getParam : function(n, dv) {
|
||||
return this.editor.getParam(n, dv);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a language item by key.
|
||||
*
|
||||
* @method getLang
|
||||
* @param {String} n Language item like mydialog.something.
|
||||
* @param {String} dv Optional default value to return.
|
||||
* @return {String} Language value for the item like "my string" or the default value if it wasn't found.
|
||||
*/
|
||||
getLang : function(n, dv) {
|
||||
return this.editor.getLang(n, dv);
|
||||
},
|
||||
|
||||
/**
|
||||
* Executed a command on editor that opened the dialog/popup.
|
||||
*
|
||||
* @method execCommand
|
||||
* @param {String} cmd Command to execute.
|
||||
* @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not.
|
||||
* @param {Object} val Optional value to pass with the comman like an URL.
|
||||
* @param {Object} a Optional arguments object.
|
||||
*/
|
||||
execCommand : function(cmd, ui, val, a) {
|
||||
a = a || {};
|
||||
a.skip_focus = 1;
|
||||
|
||||
this.restoreSelection();
|
||||
return this.editor.execCommand(cmd, ui, val, a);
|
||||
},
|
||||
|
||||
/**
|
||||
* Resizes the dialog to the inner size of the window. This is needed since various browsers
|
||||
* have different border sizes on windows.
|
||||
*
|
||||
* @method resizeToInnerSize
|
||||
*/
|
||||
resizeToInnerSize : function() {
|
||||
var t = this;
|
||||
|
||||
// Detach it to workaround a Chrome specific bug
|
||||
// https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281
|
||||
setTimeout(function() {
|
||||
var vp = t.dom.getViewPort(window);
|
||||
|
||||
t.editor.windowManager.resizeBy(
|
||||
t.getWindowArg('mce_width') - vp.w,
|
||||
t.getWindowArg('mce_height') - vp.h,
|
||||
t.id || window
|
||||
);
|
||||
}, 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* Will executed the specified string when the page has been loaded. This function
|
||||
* was added for compatibility with the 2.x branch.
|
||||
*
|
||||
* @method executeOnLoad
|
||||
* @param {String} s String to evalutate on init.
|
||||
*/
|
||||
executeOnLoad : function(s) {
|
||||
this.onInit.add(function() {
|
||||
eval(s);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Stores the current editor selection for later restoration. This can be useful since some browsers
|
||||
* looses it's selection if a control element is selected/focused inside the dialogs.
|
||||
*
|
||||
* @method storeSelection
|
||||
*/
|
||||
storeSelection : function() {
|
||||
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Restores any stored selection. This can be useful since some browsers
|
||||
* looses it's selection if a control element is selected/focused inside the dialogs.
|
||||
*
|
||||
* @method restoreSelection
|
||||
*/
|
||||
restoreSelection : function() {
|
||||
var t = tinyMCEPopup;
|
||||
|
||||
if (!t.isWindow && tinymce.isIE)
|
||||
t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a specific dialog language pack. If you pass in plugin_url as a arugment
|
||||
* when you open the window it will load the <plugin url>/langs/<code>_dlg.js lang pack file.
|
||||
*
|
||||
* @method requireLangPack
|
||||
*/
|
||||
requireLangPack : function() {
|
||||
var t = this, u = t.getWindowArg('plugin_url') || t.getWindowArg('theme_url');
|
||||
|
||||
if (u && t.editor.settings.language && t.features.translate_i18n !== false) {
|
||||
u += '/langs/' + t.editor.settings.language + '_dlg.js';
|
||||
|
||||
if (!tinymce.ScriptLoader.isDone(u)) {
|
||||
document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
|
||||
tinymce.ScriptLoader.markDone(u);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Executes a color picker on the specified element id. When the user
|
||||
* then selects a color it will be set as the value of the specified element.
|
||||
*
|
||||
* @method pickColor
|
||||
* @param {DOMEvent} e DOM event object.
|
||||
* @param {string} element_id Element id to be filled with the color value from the picker.
|
||||
*/
|
||||
pickColor : function(e, element_id) {
|
||||
this.execCommand('mceColorPicker', true, {
|
||||
color : document.getElementById(element_id).value,
|
||||
func : function(c) {
|
||||
document.getElementById(element_id).value = c;
|
||||
|
||||
try {
|
||||
document.getElementById(element_id).onchange();
|
||||
} catch (ex) {
|
||||
// Try fire event, ignore errors
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Opens a filebrowser/imagebrowser this will set the output value from
|
||||
* the browser as a value on the specified element.
|
||||
*
|
||||
* @method openBrowser
|
||||
* @param {string} element_id Id of the element to set value in.
|
||||
* @param {string} type Type of browser to open image/file/flash.
|
||||
* @param {string} option Option name to get the file_broswer_callback function name from.
|
||||
*/
|
||||
openBrowser : function(element_id, type, option) {
|
||||
tinyMCEPopup.restoreSelection();
|
||||
this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a confirm dialog. Please don't use the blocking behavior of this
|
||||
* native version use the callback method instead then it can be extended.
|
||||
*
|
||||
* @method confirm
|
||||
* @param {String} t Title for the new confirm dialog.
|
||||
* @param {function} cb Callback function to be executed after the user has selected ok or cancel.
|
||||
* @param {Object} s Optional scope to execute the callback in.
|
||||
*/
|
||||
confirm : function(t, cb, s) {
|
||||
this.editor.windowManager.confirm(t, cb, s, window);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a alert dialog. Please don't use the blocking behavior of this
|
||||
* native version use the callback method instead then it can be extended.
|
||||
*
|
||||
* @method alert
|
||||
* @param {String} t Title for the new alert dialog.
|
||||
* @param {function} cb Callback function to be executed after the user has selected ok.
|
||||
* @param {Object} s Optional scope to execute the callback in.
|
||||
*/
|
||||
alert : function(tx, cb, s) {
|
||||
this.editor.windowManager.alert(tx, cb, s, window);
|
||||
},
|
||||
|
||||
/**
|
||||
* Closes the current window.
|
||||
*
|
||||
* @method close
|
||||
*/
|
||||
close : function() {
|
||||
var t = this;
|
||||
|
||||
// To avoid domain relaxing issue in Opera
|
||||
function close() {
|
||||
t.editor.windowManager.close(window);
|
||||
t.editor = null;
|
||||
};
|
||||
|
||||
if (tinymce.isOpera)
|
||||
t.getWin().setTimeout(close, 0);
|
||||
else
|
||||
close();
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
|
||||
_restoreSelection : function() {
|
||||
var e = window.event.srcElement;
|
||||
|
||||
if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
|
||||
tinyMCEPopup.restoreSelection();
|
||||
},
|
||||
|
||||
/* _restoreSelection : function() {
|
||||
var e = window.event.srcElement;
|
||||
|
||||
// If user focus a non text input or textarea
|
||||
if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
|
||||
tinyMCEPopup.restoreSelection();
|
||||
},*/
|
||||
|
||||
_onDOMLoaded : function() {
|
||||
var t = tinyMCEPopup, ti = document.title, bm, h, nv;
|
||||
|
||||
if (t.domLoaded)
|
||||
return;
|
||||
|
||||
t.domLoaded = 1;
|
||||
|
||||
tinyMCEPopup.init();
|
||||
|
||||
// Translate page
|
||||
if (t.features.translate_i18n !== false) {
|
||||
h = document.body.innerHTML;
|
||||
|
||||
// Replace a=x with a="x" in IE
|
||||
if (tinymce.isIE)
|
||||
h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
|
||||
|
||||
document.dir = t.editor.getParam('directionality','');
|
||||
|
||||
if ((nv = t.editor.translate(h)) && nv != h)
|
||||
document.body.innerHTML = nv;
|
||||
|
||||
if ((nv = t.editor.translate(ti)) && nv != ti)
|
||||
document.title = ti = nv;
|
||||
}
|
||||
|
||||
document.body.style.display = '';
|
||||
|
||||
// Restore selection in IE when focus is placed on a non textarea or input element of the type text
|
||||
if (tinymce.isIE) {
|
||||
document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
|
||||
|
||||
// Add base target element for it since it would fail with modal dialogs
|
||||
t.dom.add(t.dom.select('head')[0], 'base', {target : '_self'});
|
||||
}
|
||||
|
||||
t.restoreSelection();
|
||||
|
||||
// Set inline title
|
||||
if (!t.isWindow)
|
||||
t.editor.windowManager.setTitle(window, ti);
|
||||
else
|
||||
window.focus();
|
||||
|
||||
if (!tinymce.isIE && !t.isWindow) {
|
||||
tinymce.dom.Event._add(document, 'focus', function() {
|
||||
t.editor.windowManager.focus(t.id);
|
||||
});
|
||||
}
|
||||
|
||||
// Patch for accessibility
|
||||
tinymce.each(t.dom.select('select'), function(e) {
|
||||
e.onkeydown = tinyMCEPopup._accessHandler;
|
||||
});
|
||||
|
||||
// Call onInit
|
||||
// Init must be called before focus so the selection won't get lost by the focus call
|
||||
tinymce.each(t.listeners, function(o) {
|
||||
o.func.call(o.scope, t.editor);
|
||||
});
|
||||
|
||||
// Move focus to window
|
||||
if (t.getWindowArg('mce_auto_focus', true)) {
|
||||
window.focus();
|
||||
|
||||
// Focus element with mceFocus class
|
||||
tinymce.each(document.forms, function(f) {
|
||||
tinymce.each(f.elements, function(e) {
|
||||
if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
|
||||
e.focus();
|
||||
return false; // Break loop
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
|
||||
},
|
||||
|
||||
_accessHandler : function(e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 13 || e.keyCode == 32) {
|
||||
e = e.target || e.srcElement;
|
||||
|
||||
if (e.onchange)
|
||||
e.onchange();
|
||||
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
}
|
||||
},
|
||||
|
||||
_closeWinKeyHandler : function(e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 27)
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
_wait : function() {
|
||||
// Use IE method
|
||||
if (document.attachEvent) {
|
||||
document.attachEvent("onreadystatechange", function() {
|
||||
if (document.readyState === "complete") {
|
||||
document.detachEvent("onreadystatechange", arguments.callee);
|
||||
tinyMCEPopup._onDOMLoaded();
|
||||
}
|
||||
});
|
||||
|
||||
if (document.documentElement.doScroll && window == window.top) {
|
||||
(function() {
|
||||
if (tinyMCEPopup.domLoaded)
|
||||
return;
|
||||
|
||||
try {
|
||||
// If IE is used, use the trick by Diego Perini
|
||||
// http://javascript.nwbox.com/IEContentLoaded/
|
||||
document.documentElement.doScroll("left");
|
||||
} catch (ex) {
|
||||
setTimeout(arguments.callee, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
tinyMCEPopup._onDOMLoaded();
|
||||
})();
|
||||
}
|
||||
|
||||
document.attachEvent('onload', tinyMCEPopup._onDOMLoaded);
|
||||
} else if (document.addEventListener) {
|
||||
window.addEventListener('DOMContentLoaded', tinyMCEPopup._onDOMLoaded, false);
|
||||
window.addEventListener('load', tinyMCEPopup._onDOMLoaded, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
var tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=tinymce.dom;b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=false;b.id=b.features.id;b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return window},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},0)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);a.editor=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;tinyMCEPopup.init();if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
body#media-upload ul#sidemenu {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#basic .align .field label {
|
||||
display: block;
|
||||
float: right;
|
||||
padding: 0 24px 0 0;
|
||||
margin: 5px 3px 5px 5px;
|
||||
}
|
||||
|
||||
.align .field input {
|
||||
display: block;
|
||||
float: right;
|
||||
margin: 5px 15px 5px 0;
|
||||
}
|
||||
|
||||
tr.image-size label {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
tr.image-size input {
|
||||
margin: 3px 15px 0 5px;
|
||||
}
|
||||
|
||||
.image-align-none-label,
|
||||
.image-align-left-label,
|
||||
.image-align-center-label,
|
||||
.image-align-right-label {
|
||||
background-position: center right;
|
||||
}
|
||||
|
||||
#media-upload .describe th.label {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.show-align,
|
||||
.alignright,
|
||||
#img_size {
|
||||
float: left;
|
||||
}
|
||||
|
||||
tr.image-size label,
|
||||
tr.image-size input,
|
||||
#img_dim label,
|
||||
#img_dim input,
|
||||
#img_prop label,
|
||||
#img_prop input,
|
||||
#img_size_div,
|
||||
.alignleft {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#img_dim label,
|
||||
#img_prop label {
|
||||
margin: 5px 0pt;
|
||||
}
|
||||
|
||||
#img_dim input,
|
||||
#img_prop input {
|
||||
margin: 0 5px 0 10px;
|
||||
}
|
||||
|
||||
#img_size_title {
|
||||
text-align: left;
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.submit input,
|
||||
.button,
|
||||
.button-primary,
|
||||
.button-secondary,
|
||||
.button-highlighted {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
font-size: 11px !important;
|
||||
line-height: 16px;
|
||||
padding: 2px 8px;
|
||||
cursor: pointer;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
-moz-border-radius: 11px;
|
||||
-khtml-border-radius: 11px;
|
||||
-webkit-border-radius: 11px;
|
||||
border-radius: 11px;
|
||||
-moz-box-sizing: content-box;
|
||||
-webkit-box-sizing: content-box;
|
||||
-khtml-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
a.button {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
textarea,
|
||||
input,
|
||||
select {
|
||||
font: 13px Verdana, Arial, Helvetica, sans-serif;
|
||||
margin: 1px;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
p.help {
|
||||
margin: 4px 0;
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
body, td {
|
||||
font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
|
||||
}
|
||||
|
||||
abbr.required {
|
||||
color: #FF0000;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
img.alignright,
|
||||
.alignright {
|
||||
float: right;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
img.alignleft,
|
||||
.alignleft {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
img.aligncenter {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
th.label {
|
||||
width: 107px;
|
||||
}
|
||||
|
||||
#media-upload #basic th.label {
|
||||
padding: 5px 5px 5px 0;
|
||||
}
|
||||
|
||||
.show-align {
|
||||
height: 200px;
|
||||
width: 480px;
|
||||
float: right;
|
||||
background-color: #f1f1f1;
|
||||
cursor: default;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#img-edit {
|
||||
border: 1px solid #dfdfdf;
|
||||
width: 623px;
|
||||
margin: 15px auto;
|
||||
}
|
||||
|
||||
#media-upload .media-upload-form table.describe {
|
||||
border-top-style: none;
|
||||
border-top-width: 0;
|
||||
}
|
||||
|
||||
#img_demo_txt {
|
||||
font-size: 9px;
|
||||
line-height: 13px;
|
||||
font-family: Monaco,"Courier New",Courier,monospace;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#img_demo {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#saveeditimg {
|
||||
padding: 10px 0 0 5px;
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
#sidemenu,
|
||||
#sidemenu li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#sidemenu li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#sidemenu a {
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
display: block;
|
||||
float: left;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
margin: 0;
|
||||
padding: 0pt 7px;
|
||||
}
|
||||
|
||||
#sidemenu a.current {
|
||||
-moz-border-radius-topleft: 4px;
|
||||
-khtml-border-top-left-radius: 4px;
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
-moz-border-radius-topright: 4px;
|
||||
-khtml-border-top-right-radius: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#adv_settings .field label {
|
||||
padding: 0 5px 5px;
|
||||
}
|
||||
|
||||
#media-upload h3 {
|
||||
clear: both;
|
||||
padding: 0pt 0pt 3px;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
font-family: Georgia,"Times New Roman",Times,serif;
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
line-height: normal;
|
||||
margin: 0 0 10px -4px;
|
||||
padding: 15px 0 3px;
|
||||
border-bottom-color: #DADADA;
|
||||
color: #5A5A5A;
|
||||
}
|
||||
|
||||
#img_dim #width,
|
||||
#img_dim #height,
|
||||
#img_prop #border,
|
||||
#img_prop #vspace,
|
||||
#img_prop #hspace {
|
||||
width: 36px;
|
||||
}
|
||||
|
||||
#img_dim abbr {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
#show_align_sp {
|
||||
width: 115px;
|
||||
}
|
||||
|
||||
#img_dim input,
|
||||
#img_prop input {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#basic .align .field label {
|
||||
padding: 0 0 0 24px;
|
||||
}
|
||||
|
||||
#basic {
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
#img_size {
|
||||
float: right;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background-color: #f1f1f1;
|
||||
padding: 5px 0;
|
||||
width: 45px;
|
||||
}
|
||||
|
||||
#img_size div {
|
||||
font-size: 10px;
|
||||
padding: 2px;
|
||||
border: 1px solid #f1f1f1;
|
||||
line-height: 15px;
|
||||
height: 15px;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
color: #07273E;
|
||||
}
|
||||
|
||||
#img_size div#s100 {
|
||||
border-color: #A3A3A3;
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
|
||||
#img_size_div {
|
||||
width: 100px;
|
||||
float: left;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#img_size_title {
|
||||
margin: 0 7px 5px;
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#img_align_td {
|
||||
padding: 2px 0 8px;
|
||||
}
|
||||
|
||||
#media-upload tr.align td.field {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.describe td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#media-upload .describe th.label {
|
||||
padding-top: .5em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#media-upload .describe {
|
||||
border-top-width: 1px;
|
||||
border-top-style: solid;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
clear: both;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
.describe input[type="text"],
|
||||
.describe textarea {
|
||||
width: 460px;
|
||||
border: 1px solid #dfdfdf;
|
||||
-moz-border-radius: 4px;
|
||||
-khtml-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.media-upload-form label,
|
||||
.media-upload-form legend {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
color: #464646;
|
||||
}
|
||||
|
||||
.align .field label {
|
||||
display: inline;
|
||||
padding: 0 0 0 28px;
|
||||
margin: 0 1em 0 0;
|
||||
}
|
||||
.image-align-none-label {
|
||||
background: url(../../../../../../wp-admin/images/align-none.png) no-repeat center left;
|
||||
}
|
||||
|
||||
.image-align-left-label {
|
||||
background: url(../../../../../../wp-admin/images/align-left.png) no-repeat center left;
|
||||
}
|
||||
|
||||
.image-align-center-label {
|
||||
background: url(../../../../../../wp-admin/images/align-center.png) no-repeat center left;
|
||||
}
|
||||
|
||||
.image-align-right-label {
|
||||
background: url(../../../../../../wp-admin/images/align-right.png) no-repeat center left;
|
||||
}
|
||||
|
||||
div#media-upload-header {
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
height: 2.5em;
|
||||
}
|
||||
|
||||
body#media-upload ul#sidemenu {
|
||||
font-weight: normal;
|
||||
margin: 0 5px;
|
||||
position: relative;
|
||||
left: 0px;
|
||||
bottom: -4px;
|
||||
}
|
||||
|
||||
div#media-upload-error {
|
||||
margin: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
* html #sidemenu li {
|
||||
zoom: 100%;
|
||||
}
|
||||
|
||||
* html #sidemenu a {
|
||||
height: 27px;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
* html input {
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title></title>
|
||||
|
||||
<script type="text/javascript" src="js/editimage.js?ver=327"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js?ver=3223"></script>
|
||||
|
||||
<link rel="stylesheet" href="css/editimage.css?ver=327" type="text/css" media="all" />
|
||||
|
||||
<script type="text/javascript">
|
||||
if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
|
||||
document.write('<link rel="stylesheet" href="css/editimage-rtl.css?ver=3223" type="text/css" media="all" />');
|
||||
</script>
|
||||
<base target="_self" />
|
||||
</head>
|
||||
|
||||
<body id="media-upload" style="display:none;">
|
||||
<div id="media-upload-header">
|
||||
<ul id="sidemenu">
|
||||
<li><a href="javascript:;" id="tab_basic" class="current" onclick="wpImage.setTabs(this);">{#wpeditimage.edit_img}</a></li>
|
||||
<li><a href="javascript:;" id="tab_advanced" onclick="wpImage.setTabs(this);">{#wpeditimage.adv_settings}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="img-edit">
|
||||
<form class="media-upload-form" action="" onsubmit="wpImage.update();">
|
||||
<div id="img_size_div">
|
||||
<div id="img_size_title">{#wpeditimage.size}</div>
|
||||
<div id="img_size" onmouseout="wpImage.showSizeRem()">
|
||||
<div id="s130" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s130}</div>
|
||||
<div id="s120" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s120}</div>
|
||||
<div id="s110" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s110}</div>
|
||||
<div id="s100" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s100}</div>
|
||||
<div id="s90" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s90}</div>
|
||||
<div id="s80" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s80}</div>
|
||||
<div id="s70" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s70}</div>
|
||||
<div id="s60" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s60}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="show-align" id="show_align">
|
||||
<img id="img_demo" src="img/image.png" alt="" />
|
||||
<span id="img_demo_txt">
|
||||
Lorem ipsum dolor sit amet consectetuer velit pretium euismod ipsum enim. Mi cursus at a mollis senectus id arcu gravida quis urna. Sed et felis id tempus Morbi mauris tincidunt enim In mauris. Pede eu risus velit libero natoque enim lorem adipiscing ipsum consequat. In malesuada et sociis tincidunt tempus pellentesque cursus convallis ipsum Suspendisse. Risus In ac quis ut Nunc convallis laoreet ante Suspendisse Nam. Amet amet urna condimentum Vestibulum sem at Curabitur lorem et cursus. Sodales tortor fermentum leo dui habitant Nunc Sed Vestibulum.
|
||||
Ut lorem In penatibus libero id ipsum sagittis nec elit Sed. Condimentum eget Vivamus vel consectetuer lorem molestie turpis amet tellus id. Condimentum vel ridiculus Fusce sed pede Nam nunc sodales eros tempor. Sit lacus magna dictumst Curabitur fringilla auctor id vitae wisi facilisi. Fermentum eget turpis felis velit leo Nunc Proin orci molestie Praesent. Curabitur tellus scelerisque suscipit ut sem amet cursus mi Morbi eu. Donec libero Vestibulum augue et mollis accumsan ornare condimentum In enim. Leo eget ac consectetuer quis condimentum malesuada.
|
||||
Condimentum commodo et Lorem fringilla malesuada libero volutpat sem tellus enim. Tincidunt sed at Aenean nec nonummy porttitor Nam Sed Nulla ut. Auctor leo In aliquet Curabitur eros et velit Quisque justo morbi. Et vel mauris sit nulla semper vitae et quis at dui. Id at elit laoreet justo eu mauris Quisque et interdum pharetra. Nullam accumsan interdum Maecenas condimentum quis quis Fusce a sollicitudin Sed. Non Quisque Vivamus congue porttitor non semper ipsum porttitor quis vel. Donec eros lacus volutpat et tincidunt sem convallis id venenatis sit. Consectetuer odio.
|
||||
Semper faucibus Morbi nulla convallis orci Aliquam Sed porttitor et Pellentesque. Venenatis laoreet lorem id a a Morbi augue turpis id semper. Arcu volutpat ac mauris Vestibulum fringilla Aenean condimentum nibh sed id. Sagittis eu lacus orci urna tellus tellus pretium Curabitur dui nunc. Et nibh eu eu nibh adipiscing at lorem Vestibulum adipiscing augue. Magna convallis Phasellus dolor malesuada Curabitur ornare adipiscing tellus Aliquam tempus. Id Aliquam Integer augue Nulla consectetuer ac Donec Curabitur tincidunt et. Id vel Nunc amet lacus dui magna ridiculus penatibus laoreet Duis. Enim sagittis nibh quis Nulla nec laoreet vel Maecenas mattis vel.
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="div_basic">
|
||||
<table id="basic" class="describe">
|
||||
<tbody>
|
||||
|
||||
<tr class="align">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_align_td">
|
||||
<span class="alignleft">{#contextmenu.align}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field" id="img_align_td">
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('alignnone')" name="img_align" id="alignnone" value="alignnone" />
|
||||
<label for="alignnone" class="align image-align-none-label">{#wpeditimage.none}</label>
|
||||
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('alignleft')" name="img_align" id="alignleft" value="alignleft" />
|
||||
<label for="alignleft" class="align image-align-left-label">{#contextmenu.left}</label>
|
||||
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('aligncenter')" name="img_align" id="aligncenter" value="aligncenter" />
|
||||
<label for="aligncenter" class="align image-align-center-label">{#contextmenu.center}</label>
|
||||
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('alignright')" name="img_align" id="alignright" value="alignright" />
|
||||
<label for="alignright" class="align image-align-right-label">{#contextmenu.right}</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_title">
|
||||
<span class="alignleft">{#wpeditimage.img_title}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_title" name="img_title" value="" aria-required="true" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_alt">
|
||||
<span class="alignleft">{#wpeditimage.alt}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_alt" name="img_alt" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="cap_field">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_cap">
|
||||
<span class="alignleft">{#wpeditimage.caption}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_cap" name="img_cap" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_href">
|
||||
<span class="alignleft" id="lb_link_href">{#advanced_dlg.link_url}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_href" name="link_href" value="" size="60" /><br />
|
||||
<input type="button" class="button" onclick="wpImage.I('link_href').value='';" value="{#wpeditimage.none}" />
|
||||
<input type="button" class="button" id="img_url_current" onclick="wpImage.img_seturl('current')" value="{#wpeditimage.current_link}" />
|
||||
<input type="button" class="button" id="img_url_img" onclick="wpImage.img_seturl('link')" value="{#wpeditimage.link_to_img}" />
|
||||
<p class="help">{#wpeditimage.link_help}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
<div id="div_advanced" style="display:none;">
|
||||
<h3>{#wpeditimage.adv_img_settings}</h3>
|
||||
<table id="adv_settings_img" class="describe">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_src">
|
||||
<span class="alignleft">{#wpeditimage.source}</span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_src" name="img_src" value="" onblur="wpImage.checkVal(this)" aria-required="true" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="img_dim">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label>
|
||||
<span class="alignleft">{#wpeditimage.size}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<label for="width">{#wpeditimage.width}</label>
|
||||
<input type="text" maxlength="5" id="width" name="width" value="" />
|
||||
|
||||
<label for="height">{#wpeditimage.height}</label>
|
||||
<input type="text" maxlength="5" id="height" name="height" value="" />
|
||||
|
||||
<input type="button" class="button" id="orig_size" name="orig_size" value="{#wpeditimage.orig_size}" onclick="wpImage.origSize();" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_classes">
|
||||
<span class="alignleft">{#wpeditimage.css}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_classes" name="img_classes" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_style">
|
||||
<span class="alignleft">{#advanced.style_select}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_style" name="img_style" value="" size="60" onblur="wpImage.demoSetStyle();" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="img_prop">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_prop">
|
||||
<span class="alignleft">{#advanced.image_props_desc}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<label for="border">{#advanced_dlg.image_border}</label>
|
||||
<input type="text" maxlength="5" id="border" name="border" value="" onblur="wpImage.updateStyle('border')" />
|
||||
|
||||
<label for="vspace">{#advanced_dlg.image_vspace}</label>
|
||||
<input type="text" maxlength="5" id="vspace" name="vspace" value="" onblur="wpImage.updateStyle('vspace')" />
|
||||
|
||||
<label for="hspace">{#advanced_dlg.image_hspace}</label>
|
||||
<input type="text" maxlength="5" id="hspace" name="hspace" value="" onblur="wpImage.updateStyle('hspace')" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>{#wpeditimage.adv_link_settings}</h3>
|
||||
<table id="adv_settings_link" class="describe">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_title">
|
||||
<span class="alignleft">{#advanced_dlg.link_titlefield}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_title" name="link_title" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_rel">
|
||||
<span class="alignleft">{#wpeditimage.link_rel}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_rel" name="link_rel" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_classes">
|
||||
<span class="alignleft">{#wpeditimage.css}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_classes" name="link_classes" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_style">
|
||||
<span class="alignleft">{#advanced.style_select}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_style" name="link_style" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label>
|
||||
<span class="alignleft">{#advanced_dlg.link_target}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<label for="link_target">
|
||||
{#advanced_dlg.link_target_blank}
|
||||
</label>
|
||||
<input type="checkbox" id="link_target" name="link_target" value="_blank" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
<div id="saveeditimg">
|
||||
<input type="hidden" id="align" name="align" value="" />
|
||||
|
||||
<input type="submit" id="saveimg" class="button" value="{#update}" />
|
||||
<input type="button" class="button" id="cancelimg" name="cancelimg" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,219 @@
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpEditImage', {
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.url = url;
|
||||
t._createButtons();
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
|
||||
ed.addCommand('WP_EditImage', function() {
|
||||
var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), H = vp.h, W = ( 720 < vp.w ) ? 720 : vp.w, cls = ed.dom.getAttrib(el, 'class');
|
||||
|
||||
if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' )
|
||||
return;
|
||||
|
||||
tb_show('', url + '/editimage.html?ver=321&TB_iframe=true');
|
||||
tinymce.DOM.setStyles('TB_window', {
|
||||
'width':( W - 50 )+'px',
|
||||
'height':( H - 45 )+'px',
|
||||
'margin-left':'-'+parseInt((( W - 50 ) / 2),10) + 'px'
|
||||
});
|
||||
|
||||
if ( ! tinymce.isIE6 ) {
|
||||
tinymce.DOM.setStyles('TB_window', {
|
||||
'top':'20px',
|
||||
'marginTop':'0'
|
||||
});
|
||||
}
|
||||
|
||||
tinymce.DOM.setStyles('TB_iframeContent', {
|
||||
'width':( W - 50 )+'px',
|
||||
'height':( H - 75 )+'px'
|
||||
});
|
||||
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
|
||||
});
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) {
|
||||
if ( !tinymce.isGecko && e.target.nodeName == 'IMG' && ed.dom.getParent(e.target, 'dl.wp-caption') )
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
});
|
||||
});
|
||||
|
||||
// resize the caption <dl> when the image is soft-resized by the user (only possible in Firefox and IE)
|
||||
ed.onMouseUp.add(function(ed, e) {
|
||||
if ( tinymce.isWebKit || tinymce.isOpera )
|
||||
return;
|
||||
|
||||
if ( ed.dom.getParent(e.target, 'div.mceTemp') || ed.dom.is(e.target, 'div.mceTemp') ) {
|
||||
window.setTimeout(function(){
|
||||
var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL, width;
|
||||
|
||||
if ( 'IMG' == n.nodeName ) {
|
||||
DL = ed.dom.getParent(n, 'dl.wp-caption');
|
||||
width = ed.dom.getAttrib(n, 'width') || n.width;
|
||||
width = parseInt(width, 10);
|
||||
|
||||
if ( DL && width != ( parseInt(ed.dom.getStyle(DL, 'width'), 10) - 10 ) ) {
|
||||
ed.dom.setStyle(DL, 'width', 10 + width);
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
// show editimage buttons
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
var p;
|
||||
|
||||
if ( e.target.nodeName == 'IMG' && ed.dom.getAttrib(e.target, 'class').indexOf('mceItem') == -1 ) {
|
||||
ed.plugins.wordpress._showButtons(e.target, 'wp_editbtns');
|
||||
if ( tinymce.isGecko && (p = ed.dom.getParent(e.target, 'dl.wp-caption')) && ed.dom.hasClass(p.parentNode, 'mceTemp') )
|
||||
ed.selection.select(p.parentNode);
|
||||
}
|
||||
});
|
||||
|
||||
// when pressing Return inside a caption move the cursor to a new parapraph under it
|
||||
ed.onKeyPress.add(function(ed, e) {
|
||||
var n, DL, DIV, P;
|
||||
|
||||
if ( e.keyCode == 13 ) {
|
||||
n = ed.selection.getNode();
|
||||
DL = ed.dom.getParent(n, 'dl.wp-caption');
|
||||
DIV = ed.dom.getParent(DL, 'div.mceTemp');
|
||||
|
||||
if ( DL && DIV ) {
|
||||
P = ed.dom.create('p', {}, ' ');
|
||||
ed.dom.insertAfter( P, DIV );
|
||||
|
||||
if ( P.firstChild )
|
||||
ed.selection.select(P.firstChild);
|
||||
else
|
||||
ed.selection.select(P);
|
||||
|
||||
tinymce.dom.Event.cancel(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = t._do_shcode(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = t._get_shcode(o.content);
|
||||
});
|
||||
},
|
||||
|
||||
_do_shcode : function(co) {
|
||||
return co.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\s\u00a0]*/g, function(a,b,c){
|
||||
var id, cls, w, cap, div_cls;
|
||||
|
||||
b = b.replace(/\\'|\\'|\\'/g, ''').replace(/\\"|\\"/g, '"');
|
||||
c = c.replace(/\\'|\\'/g, ''').replace(/\\"/g, '"');
|
||||
id = b.match(/id=['"]([^'"]+)/i);
|
||||
cls = b.match(/align=['"]([^'"]+)/i);
|
||||
w = b.match(/width=['"]([0-9]+)/);
|
||||
cap = b.match(/caption=['"]([^'"]+)/i);
|
||||
|
||||
id = ( id && id[1] ) ? id[1] : '';
|
||||
cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
|
||||
w = ( w && w[1] ) ? w[1] : '';
|
||||
cap = ( cap && cap[1] ) ? cap[1] : '';
|
||||
if ( ! w || ! cap ) return c;
|
||||
|
||||
div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
|
||||
|
||||
return '<div class="'+div_cls+'" draggable><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+
|
||||
'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>';
|
||||
});
|
||||
},
|
||||
|
||||
_get_shcode : function(co) {
|
||||
return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi, function(a,b,c,cap){
|
||||
var id, cls, w;
|
||||
|
||||
id = b.match(/id=['"]([^'"]+)/i);
|
||||
cls = b.match(/class=['"]([^'"]+)/i);
|
||||
w = c.match(/width=['"]([0-9]+)/);
|
||||
|
||||
id = ( id && id[1] ) ? id[1] : '';
|
||||
cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
|
||||
w = ( w && w[1] ) ? w[1] : '';
|
||||
|
||||
if ( ! w || ! cap ) return c;
|
||||
cls = cls.match(/align[^ '"]+/) || 'alignnone';
|
||||
cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, ''').replace(/"/g, '"');
|
||||
|
||||
return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]';
|
||||
});
|
||||
},
|
||||
|
||||
_createButtons : function() {
|
||||
var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, editButton, dellButton;
|
||||
|
||||
DOM.remove('wp_editbtns');
|
||||
|
||||
DOM.add(document.body, 'div', {
|
||||
id : 'wp_editbtns',
|
||||
style : 'display:none;'
|
||||
});
|
||||
|
||||
editButton = DOM.add('wp_editbtns', 'img', {
|
||||
src : t.url+'/img/image.png',
|
||||
id : 'wp_editimgbtn',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wpeditimage.edit_img')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(editButton, 'mousedown', function(e) {
|
||||
var ed = tinyMCE.activeEditor;
|
||||
ed.windowManager.bookmark = ed.selection.getBookmark('simple');
|
||||
ed.execCommand("WP_EditImage");
|
||||
});
|
||||
|
||||
dellButton = DOM.add('wp_editbtns', 'img', {
|
||||
src : t.url+'/img/delete.png',
|
||||
id : 'wp_delimgbtn',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wpeditimage.del_img')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
|
||||
var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p;
|
||||
|
||||
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) {
|
||||
if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
|
||||
ed.dom.remove(p);
|
||||
else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
|
||||
ed.dom.remove(p);
|
||||
else
|
||||
ed.dom.remove(el);
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Edit Image',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage);
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
(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.getBody(),"dragstart",function(f){if(!tinymce.isGecko&&f.target.nodeName=="IMG"&&d.dom.getParent(f.target,"dl.wp-caption")){return tinymce.dom.Event.cancel(f)}})});a.onMouseUp.add(function(d,f){if(tinymce.isWebKit||tinymce.isOpera){return}if(d.dom.getParent(f.target,"div.mceTemp")||d.dom.is(f.target,"div.mceTemp")){window.setTimeout(function(){var e=tinyMCE.activeEditor,i=e.selection.getNode(),g,h;if("IMG"==i.nodeName){g=e.dom.getParent(i,"dl.wp-caption");h=e.dom.getAttrib(i,"width")||i.width;h=parseInt(h,10);if(g&&h!=(parseInt(e.dom.getStyle(g,"width"),10)-10)){e.dom.setStyle(g,"width",10+h);e.execCommand("mceRepaint")}}},100)}});a.onMouseDown.add(function(d,g){var f;if(g.target.nodeName=="IMG"&&d.dom.getAttrib(g.target,"class").indexOf("mceItem")==-1){d.plugins.wordpress._showButtons(g.target,"wp_editbtns");if(tinymce.isGecko&&(f=d.dom.getParent(g.target,"dl.wp-caption"))&&d.dom.hasClass(f.parentNode,"mceTemp")){d.selection.select(f.parentNode)}}});a.onKeyPress.add(function(d,i){var j,f,h,g;if(i.keyCode==13){j=d.selection.getNode();f=d.dom.getParent(j,"dl.wp-caption");h=d.dom.getParent(f,"div.mceTemp");if(f&&h){g=d.dom.create("p",{}," ");d.dom.insertAfter(g,h);if(g.firstChild){d.selection.select(g.firstChild)}else{d.selection.select(g)}tinymce.dom.Event.cancel(i);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(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\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+'" draggable><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]"})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_editbtns");d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});e=d.add("wp_editbtns","img",{src:b.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.edit_img")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_EditImage")});c=d.add("wp_editbtns","img",{src:b.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.del_img")});tinymce.dom.Event.add(c,"mousedown",function(i){var f=tinyMCE.activeEditor,g=f.selection.getNode(),h;if(g.nodeName=="IMG"&&f.dom.getAttrib(g,"class").indexOf("mceItem")==-1){if((h=f.dom.getParent(g,"div"))&&f.dom.hasClass(h,"mceTemp")){f.dom.remove(h)}else{if((h=f.dom.getParent(g,"A"))&&h.childNodes.length==1){f.dom.remove(h)}else{f.dom.remove(g)}}f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})();
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,613 @@
|
||||
|
||||
var tinymce = null, tinyMCEPopup, tinyMCE, wpImage;
|
||||
|
||||
tinyMCEPopup = {
|
||||
init: function() {
|
||||
var t = this, w, li, q, i, it;
|
||||
|
||||
li = ('' + document.location.search).replace(/^\?/, '').split('&');
|
||||
q = {};
|
||||
for ( i = 0; i < li.length; i++ ) {
|
||||
it = li[i].split('=');
|
||||
q[unescape(it[0])] = unescape(it[1]);
|
||||
}
|
||||
|
||||
if (q.mce_rdomain)
|
||||
document.domain = q.mce_rdomain;
|
||||
|
||||
// Find window & API
|
||||
w = t.getWin();
|
||||
tinymce = w.tinymce;
|
||||
tinyMCE = w.tinyMCE;
|
||||
t.editor = tinymce.EditorManager.activeEditor;
|
||||
t.params = t.editor.windowManager.params;
|
||||
|
||||
// Setup local DOM
|
||||
t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
|
||||
t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
|
||||
},
|
||||
|
||||
getWin : function() {
|
||||
return window.dialogArguments || opener || parent || top;
|
||||
},
|
||||
|
||||
getParam : function(n, dv) {
|
||||
return this.editor.getParam(n, dv);
|
||||
},
|
||||
|
||||
close : function() {
|
||||
var t = this, win = t.getWin();
|
||||
|
||||
// To avoid domain relaxing issue in Opera
|
||||
function close() {
|
||||
win.tb_remove();
|
||||
tinymce = tinyMCE = t.editor = t.dom = t.dom.doc = null; // Cleanup
|
||||
};
|
||||
|
||||
if (tinymce.isOpera)
|
||||
win.setTimeout(close, 0);
|
||||
else
|
||||
close();
|
||||
},
|
||||
|
||||
execCommand : function(cmd, ui, val, a) {
|
||||
a = a || {};
|
||||
a.skip_focus = 1;
|
||||
|
||||
this.restoreSelection();
|
||||
return this.editor.execCommand(cmd, ui, val, a);
|
||||
},
|
||||
|
||||
storeSelection : function() {
|
||||
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
|
||||
},
|
||||
|
||||
restoreSelection : function() {
|
||||
var t = tinyMCEPopup;
|
||||
|
||||
if (tinymce.isIE)
|
||||
t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
|
||||
}
|
||||
}
|
||||
tinyMCEPopup.init();
|
||||
|
||||
wpImage = {
|
||||
preInit : function() {
|
||||
// import colors stylesheet from parent
|
||||
var win = tinyMCEPopup.getWin(), styles = win.document.styleSheets, url, i;
|
||||
|
||||
for ( i = 0; i < styles.length; i++ ) {
|
||||
url = styles.item(i).href;
|
||||
if ( url && url.indexOf('colors') != -1 )
|
||||
document.write( '<link rel="stylesheet" href="'+url+'" type="text/css" media="all" />' );
|
||||
}
|
||||
},
|
||||
|
||||
I : function(e) {
|
||||
return document.getElementById(e);
|
||||
},
|
||||
|
||||
current : '',
|
||||
link : '',
|
||||
link_rel : '',
|
||||
target_value : '',
|
||||
current_size_sel : 's100',
|
||||
width : '',
|
||||
height : '',
|
||||
align : '',
|
||||
img_alt : '',
|
||||
|
||||
setTabs : function(tab) {
|
||||
var t = this;
|
||||
|
||||
if ( 'current' == tab.className ) return false;
|
||||
t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none';
|
||||
t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none';
|
||||
t.I('tab_basic').className = t.I('tab_advanced').className = '';
|
||||
tab.className = 'current';
|
||||
return false;
|
||||
},
|
||||
|
||||
img_seturl : function(u) {
|
||||
var t = this, rel = t.I('link_rel').value;
|
||||
|
||||
if ( 'current' == u ) {
|
||||
t.I('link_href').value = t.current;
|
||||
t.I('link_rel').value = t.link_rel;
|
||||
} else {
|
||||
t.I('link_href').value = t.link;
|
||||
if ( rel ) {
|
||||
rel = rel.replace( /attachment|wp-att-[0-9]+/gi, '' );
|
||||
t.I('link_rel').value = tinymce.trim(rel);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
imgAlignCls : function(v) {
|
||||
var t = this, cls = t.I('img_classes').value;
|
||||
|
||||
t.I('img_demo').className = t.align = v;
|
||||
|
||||
cls = cls.replace( /align[^ "']+/gi, '' );
|
||||
cls += (' ' + v);
|
||||
cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' );
|
||||
|
||||
if ( 'aligncenter' == v ) {
|
||||
t.I('hspace').value = '';
|
||||
t.updateStyle('hspace');
|
||||
}
|
||||
|
||||
t.I('img_classes').value = cls;
|
||||
},
|
||||
|
||||
showSize : function(el) {
|
||||
var t = this, demo = t.I('img_demo'), w = t.width, h = t.height, id = el.id || 's100', size;
|
||||
|
||||
size = parseInt(id.substring(1)) / 200;
|
||||
demo.width = Math.round(w * size);
|
||||
demo.height = Math.round(h * size);
|
||||
|
||||
t.showSizeClear();
|
||||
el.style.borderColor = '#A3A3A3';
|
||||
el.style.backgroundColor = '#E5E5E5';
|
||||
},
|
||||
|
||||
showSizeSet : function() {
|
||||
var t = this, s130, s120, s110;
|
||||
|
||||
if ( (t.width * 1.3) > parseInt(t.preloadImg.width) ) {
|
||||
s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110');
|
||||
|
||||
s130.onclick = s120.onclick = s110.onclick = null;
|
||||
s130.onmouseover = s120.onmouseover = s110.onmouseover = null;
|
||||
s130.style.color = s120.style.color = s110.style.color = '#aaa';
|
||||
}
|
||||
},
|
||||
|
||||
showSizeRem : function() {
|
||||
var t = this, demo = t.I('img_demo'), f = document.forms[0];
|
||||
|
||||
demo.width = Math.round(f.width.value * 0.5);
|
||||
demo.height = Math.round(f.height.value * 0.5);
|
||||
t.showSizeClear();
|
||||
t.I(t.current_size_sel).style.borderColor = '#A3A3A3';
|
||||
t.I(t.current_size_sel).style.backgroundColor = '#E5E5E5';
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
showSizeClear : function() {
|
||||
var divs = this.I('img_size').getElementsByTagName('div'), i;
|
||||
|
||||
for ( i = 0; i < divs.length; i++ ) {
|
||||
divs[i].style.borderColor = '#f1f1f1';
|
||||
divs[i].style.backgroundColor = '#f1f1f1';
|
||||
}
|
||||
},
|
||||
|
||||
imgEditSize : function(el) {
|
||||
var t = this, f = document.forms[0], W, H, w, h, id;
|
||||
|
||||
if ( ! t.preloadImg || ! t.preloadImg.width || ! t.preloadImg.height )
|
||||
return;
|
||||
|
||||
W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height), w = t.width || W, h = t.height || H, id = el.id || 's100';
|
||||
|
||||
size = parseInt(id.substring(1)) / 100;
|
||||
|
||||
w = Math.round(w * size);
|
||||
h = Math.round(h * size);
|
||||
|
||||
f.width.value = Math.min(W, w);
|
||||
f.height.value = Math.min(H, h);
|
||||
|
||||
t.current_size_sel = id;
|
||||
t.demoSetSize();
|
||||
},
|
||||
|
||||
demoSetSize : function(img) {
|
||||
var demo = this.I('img_demo'), f = document.forms[0];
|
||||
|
||||
demo.width = f.width.value ? Math.round(f.width.value * 0.5) : '';
|
||||
demo.height = f.height.value ? Math.round(f.height.value * 0.5) : '';
|
||||
},
|
||||
|
||||
demoSetStyle : function() {
|
||||
var f = document.forms[0], demo = this.I('img_demo'), dom = tinyMCEPopup.editor.dom;
|
||||
|
||||
if (demo) {
|
||||
dom.setAttrib(demo, 'style', f.img_style.value);
|
||||
dom.setStyle(demo, 'width', '');
|
||||
dom.setStyle(demo, 'height', '');
|
||||
}
|
||||
},
|
||||
|
||||
origSize : function() {
|
||||
var t = this, f = document.forms[0], el = t.I('s100');
|
||||
|
||||
f.width.value = t.width = t.preloadImg.width;
|
||||
f.height.value = t.height = t.preloadImg.height;
|
||||
t.showSizeSet();
|
||||
t.demoSetSize();
|
||||
t.showSize(el);
|
||||
},
|
||||
|
||||
init : function() {
|
||||
var ed = tinyMCEPopup.editor, h;
|
||||
|
||||
h = document.body.innerHTML;
|
||||
document.body.innerHTML = ed.translate(h);
|
||||
window.setTimeout( function(){wpImage.setup();}, 500 );
|
||||
},
|
||||
|
||||
setup : function() {
|
||||
var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor,
|
||||
d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = '', dlc, pa;
|
||||
|
||||
document.dir = tinyMCEPopup.editor.getParam('directionality','');
|
||||
|
||||
if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) )
|
||||
t.I('cap_field').style.display = 'none';
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
if (el.nodeName != 'IMG')
|
||||
return;
|
||||
|
||||
f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src');
|
||||
ed.dom.setStyle(el, 'float', '');
|
||||
t.getImageData();
|
||||
c = ed.dom.getAttrib(el, 'class');
|
||||
|
||||
if ( DL = dom.getParent(el, 'dl') ) {
|
||||
dlc = ed.dom.getAttrib(DL, 'class');
|
||||
dlc = dlc.match(/align[^ "']+/i);
|
||||
if ( dlc && ! dom.hasClass(el, dlc) ) {
|
||||
c += ' '+dlc;
|
||||
tinymce.trim(c);
|
||||
}
|
||||
|
||||
tinymce.each(DL.childNodes, function(e) {
|
||||
if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp-caption-dd') ) {
|
||||
caption = e.innerHTML;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
f.img_cap.value = caption;
|
||||
f.img_title.value = ed.dom.getAttrib(el, 'title');
|
||||
f.img_alt.value = ed.dom.getAttrib(el, 'alt');
|
||||
f.border.value = ed.dom.getAttrib(el, 'border');
|
||||
f.vspace.value = ed.dom.getAttrib(el, 'vspace');
|
||||
f.hspace.value = ed.dom.getAttrib(el, 'hspace');
|
||||
f.align.value = ed.dom.getAttrib(el, 'align');
|
||||
f.width.value = t.width = ed.dom.getAttrib(el, 'width');
|
||||
f.height.value = t.height = ed.dom.getAttrib(el, 'height');
|
||||
f.img_classes.value = c;
|
||||
f.img_style.value = ed.dom.getAttrib(el, 'style');
|
||||
|
||||
// Move attribs to styles
|
||||
if ( dom.getAttrib(el, 'hspace') )
|
||||
t.updateStyle('hspace');
|
||||
|
||||
if ( dom.getAttrib(el, 'border') )
|
||||
t.updateStyle('border');
|
||||
|
||||
if ( dom.getAttrib(el, 'vspace') )
|
||||
t.updateStyle('vspace');
|
||||
|
||||
if ( pa = ed.dom.getParent(el, 'A') ) {
|
||||
f.link_href.value = t.current = ed.dom.getAttrib(pa, 'href');
|
||||
f.link_title.value = ed.dom.getAttrib(pa, 'title');
|
||||
f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel');
|
||||
f.link_style.value = ed.dom.getAttrib(pa, 'style');
|
||||
t.target_value = ed.dom.getAttrib(pa, 'target');
|
||||
f.link_classes.value = ed.dom.getAttrib(pa, 'class');
|
||||
}
|
||||
|
||||
f.link_target.checked = ( t.target_value && t.target_value == '_blank' ) ? 'checked' : '';
|
||||
|
||||
fname = link.substring( link.lastIndexOf('/') );
|
||||
fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' );
|
||||
t.link = link.substring( 0, link.lastIndexOf('/') ) + fname;
|
||||
|
||||
if ( c.indexOf('alignleft') != -1 ) {
|
||||
t.I('alignleft').checked = "checked";
|
||||
d.className = t.align = "alignleft";
|
||||
} else if ( c.indexOf('aligncenter') != -1 ) {
|
||||
t.I('aligncenter').checked = "checked";
|
||||
d.className = t.align = "aligncenter";
|
||||
} else if ( c.indexOf('alignright') != -1 ) {
|
||||
t.I('alignright').checked = "checked";
|
||||
d.className = t.align = "alignright";
|
||||
} else if ( c.indexOf('alignnone') != -1 ) {
|
||||
t.I('alignnone').checked = "checked";
|
||||
d.className = t.align = "alignnone";
|
||||
}
|
||||
|
||||
if ( t.width && t.preloadImg.width ) t.showSizeSet();
|
||||
document.body.style.display = '';
|
||||
},
|
||||
|
||||
remove : function() {
|
||||
var ed = tinyMCEPopup.editor, p, el;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
if (el.nodeName != 'IMG') return;
|
||||
|
||||
if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
|
||||
ed.dom.remove(p);
|
||||
else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
|
||||
ed.dom.remove(p);
|
||||
else ed.dom.remove(el);
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var t = this, f = document.forms[0], ed = tinyMCEPopup.editor, el, b, fixSafari = null,
|
||||
DL, P, A, DIV, do_caption = null, img_class = f.img_classes.value, html,
|
||||
id, cap_id = '', cap, DT, DD, cap_width, div_cls, lnk = '', pa, aa;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
|
||||
if (el.nodeName != 'IMG') return;
|
||||
if (f.img_src.value === '') {
|
||||
t.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( f.img_cap.value != '' && f.width.value != '' ) {
|
||||
do_caption = 1;
|
||||
img_class = img_class.replace( /align[^ "']+\s?/gi, '' );
|
||||
}
|
||||
|
||||
A = ed.dom.getParent(el, 'a');
|
||||
P = ed.dom.getParent(el, 'p');
|
||||
DL = ed.dom.getParent(el, 'dl');
|
||||
DIV = ed.dom.getParent(el, 'div');
|
||||
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
|
||||
ed.dom.setAttribs(el, {
|
||||
src : f.img_src.value,
|
||||
title : f.img_title.value,
|
||||
alt : f.img_alt.value,
|
||||
width : f.width.value,
|
||||
height : f.height.value,
|
||||
style : f.img_style.value,
|
||||
'class' : img_class
|
||||
});
|
||||
|
||||
if ( f.link_href.value ) {
|
||||
// Create new anchor elements
|
||||
if ( A == null ) {
|
||||
if ( ! f.link_href.value.match(/https?:\/\//i) )
|
||||
f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value);
|
||||
|
||||
if ( tinymce.isWebKit && ed.dom.hasClass(el, 'aligncenter') ) {
|
||||
ed.dom.removeClass(el, 'aligncenter');
|
||||
fixSafari = 1;
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
if ( fixSafari ) ed.dom.addClass(el, 'aligncenter');
|
||||
|
||||
tinymce.each(ed.dom.select("a"), function(n) {
|
||||
if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
|
||||
|
||||
ed.dom.setAttribs(n, {
|
||||
href : f.link_href.value,
|
||||
title : f.link_title.value,
|
||||
rel : f.link_rel.value,
|
||||
target : (f.link_target.checked == true) ? '_blank' : '',
|
||||
'class' : f.link_classes.value,
|
||||
style : f.link_style.value
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ed.dom.setAttribs(A, {
|
||||
href : f.link_href.value,
|
||||
title : f.link_title.value,
|
||||
rel : f.link_rel.value,
|
||||
target : (f.link_target.checked == true) ? '_blank' : '',
|
||||
'class' : f.link_classes.value,
|
||||
style : f.link_style.value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ( do_caption ) {
|
||||
cap_width = 10 + parseInt(f.width.value);
|
||||
div_cls = (t.align == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
|
||||
|
||||
if ( DL ) {
|
||||
ed.dom.setAttribs(DL, {
|
||||
'class' : 'wp-caption '+t.align,
|
||||
style : 'width: '+cap_width+'px;'
|
||||
});
|
||||
|
||||
if ( DIV )
|
||||
ed.dom.setAttrib(DIV, 'class', div_cls);
|
||||
|
||||
if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp-caption-dd') )
|
||||
ed.dom.setHTML(DD, f.img_cap.value);
|
||||
|
||||
} else {
|
||||
if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) && id[1] )
|
||||
cap_id = 'attachment_'+id[1];
|
||||
|
||||
if ( f.link_href.value && (lnk = ed.dom.getParent(el, 'a')) ) {
|
||||
if ( lnk.childNodes.length == 1 )
|
||||
html = ed.dom.getOuterHTML(lnk);
|
||||
else {
|
||||
html = ed.dom.getOuterHTML(lnk);
|
||||
html = html.match(/<a[^>]+>/i);
|
||||
html = html+ed.dom.getOuterHTML(el)+'</a>';
|
||||
}
|
||||
} else html = ed.dom.getOuterHTML(el);
|
||||
|
||||
html = '<dl id="'+cap_id+'" class="wp-caption '+t.align+'" style="width: '+cap_width+
|
||||
'px"><dt class="wp-caption-dt">'+html+'</dt><dd class="wp-caption-dd">'+f.img_cap.value+'</dd></dl>';
|
||||
|
||||
cap = ed.dom.create('div', {'class': div_cls}, html);
|
||||
|
||||
if ( P ) {
|
||||
P.parentNode.insertBefore(cap, P);
|
||||
if ( P.childNodes.length == 1 )
|
||||
ed.dom.remove(P);
|
||||
else if ( lnk && lnk.childNodes.length == 1 )
|
||||
ed.dom.remove(lnk);
|
||||
else ed.dom.remove(el);
|
||||
} else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) {
|
||||
pa.appendChild(cap);
|
||||
if ( lnk && lnk.childNodes.length == 1 )
|
||||
ed.dom.remove(lnk);
|
||||
else ed.dom.remove(el);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( DL && DIV ) {
|
||||
if ( f.link_href.value && (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa);
|
||||
else html = ed.dom.getOuterHTML(el);
|
||||
|
||||
P = ed.dom.create('p', {}, html);
|
||||
DIV.parentNode.insertBefore(P, DIV);
|
||||
ed.dom.remove(DIV);
|
||||
}
|
||||
}
|
||||
|
||||
if ( f.img_classes.value.indexOf('aligncenter') != -1 ) {
|
||||
if ( P && ( ! P.style || P.style.textAlign != 'center' ) )
|
||||
ed.dom.setStyle(P, 'textAlign', 'center');
|
||||
} else {
|
||||
if ( P && P.style && P.style.textAlign == 'center' )
|
||||
ed.dom.setStyle(P, 'textAlign', '');
|
||||
}
|
||||
|
||||
if ( ! f.link_href.value && A ) {
|
||||
b = ed.selection.getBookmark();
|
||||
ed.dom.remove(A, 1);
|
||||
ed.selection.moveToBookmark(b);
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
ed.execCommand('mceRepaint');
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
updateStyle : function(ty) {
|
||||
var dom = tinyMCEPopup.dom, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value});
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
// Handle align
|
||||
if (ty == 'align') {
|
||||
dom.setStyle(img, 'float', '');
|
||||
dom.setStyle(img, 'vertical-align', '');
|
||||
|
||||
v = f.align.value;
|
||||
if (v) {
|
||||
if (v == 'left' || v == 'right')
|
||||
dom.setStyle(img, 'float', v);
|
||||
else
|
||||
img.style.verticalAlign = v;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle border
|
||||
if (ty == 'border') {
|
||||
dom.setStyle(img, 'border', '');
|
||||
|
||||
v = f.border.value;
|
||||
if (v || v == '0') {
|
||||
if (v == '0')
|
||||
img.style.border = '0';
|
||||
else
|
||||
img.style.border = v + 'px solid black';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle hspace
|
||||
if (ty == 'hspace') {
|
||||
dom.setStyle(img, 'marginLeft', '');
|
||||
dom.setStyle(img, 'marginRight', '');
|
||||
|
||||
v = f.hspace.value;
|
||||
if (v) {
|
||||
img.style.marginLeft = v + 'px';
|
||||
img.style.marginRight = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle vspace
|
||||
if (ty == 'vspace') {
|
||||
dom.setStyle(img, 'marginTop', '');
|
||||
dom.setStyle(img, 'marginBottom', '');
|
||||
|
||||
v = f.vspace.value;
|
||||
if (v) {
|
||||
img.style.marginTop = v + 'px';
|
||||
img.style.marginBottom = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Merge
|
||||
f.img_style.value = dom.serializeStyle(dom.parseStyle(img.style.cssText));
|
||||
this.demoSetStyle();
|
||||
}
|
||||
},
|
||||
|
||||
checkVal : function(f) {
|
||||
|
||||
if ( f.value == '' ) {
|
||||
// if ( f.id == 'width' ) f.value = this.width || this.preloadImg.width;
|
||||
// if ( f.id == 'height' ) f.value = this.height || this.preloadImg.height;
|
||||
if ( f.id == 'img_src' ) f.value = this.I('img_demo').src || this.preloadImg.src;
|
||||
}
|
||||
},
|
||||
|
||||
resetImageData : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.width.value = f.height.value = '';
|
||||
},
|
||||
|
||||
updateImageData : function() {
|
||||
var f = document.forms[0], t = wpImage, w = f.width.value, h = f.height.value;
|
||||
|
||||
if ( !w && h )
|
||||
w = f.width.value = t.width = Math.round( t.preloadImg.width / (t.preloadImg.height / h) );
|
||||
else if ( w && !h )
|
||||
h = f.height.value = t.height = Math.round( t.preloadImg.height / (t.preloadImg.width / w) );
|
||||
|
||||
if ( !w )
|
||||
f.width.value = t.width = t.preloadImg.width;
|
||||
|
||||
if ( !h )
|
||||
f.height.value = t.height = t.preloadImg.height;
|
||||
|
||||
t.showSizeSet();
|
||||
t.demoSetSize();
|
||||
if ( f.img_style.value )
|
||||
t.demoSetStyle();
|
||||
},
|
||||
|
||||
getImageData : function() {
|
||||
var t = wpImage, f = document.forms[0];
|
||||
|
||||
t.preloadImg = new Image();
|
||||
t.preloadImg.onload = t.updateImageData;
|
||||
t.preloadImg.onerror = t.resetImageData;
|
||||
t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value);
|
||||
}
|
||||
};
|
||||
|
||||
window.onload = function(){wpImage.init();}
|
||||
wpImage.preInit();
|
||||
@@ -0,0 +1 @@
|
||||
var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c<a.length;c++){e=a[c].split("=");f[unescape(e[0])]=unescape(e[1])}if(f.mce_rdomain){document.domain=f.mce_rdomain}b=d.getWin();tinymce=b.tinymce;tinyMCE=b.tinyMCE;d.editor=tinymce.EditorManager.activeEditor;d.params=d.editor.windowManager.params;d.dom=d.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);d.editor.windowManager.onOpen.dispatch(d.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getParam:function(b,a){return this.editor.getParam(b,a)},close:function(){var a=this,b=a.getWin();function c(){b.tb_remove();tinymce=tinyMCE=a.editor=a.dom=a.dom.doc=null}if(tinymce.isOpera){b.setTimeout(c,0)}else{c()}},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark("simple")},restoreSelection:function(){var a=tinyMCEPopup;if(tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}}};tinyMCEPopup.init();wpImage={preInit:function(){var d=tinyMCEPopup.getWin(),c=d.document.styleSheets,a,b;for(b=0;b<c.length;b++){a=c.item(b).href;if(a&&a.indexOf("colors")!=-1){document.write('<link rel="stylesheet" href="'+a+'" type="text/css" media="all" />')}}},I:function(a){return document.getElementById(a)},current:"",link:"",link_rel:"",target_value:"",current_size_sel:"s100",width:"",height:"",align:"",img_alt:"",setTabs:function(b){var a=this;if("current"==b.className){return false}a.I("div_advanced").style.display=("tab_advanced"==b.id)?"block":"none";a.I("div_basic").style.display=("tab_basic"==b.id)?"block":"none";a.I("tab_basic").className=a.I("tab_advanced").className="";b.className="current";return false},img_seturl:function(b){var c=this,a=c.I("link_rel").value;if("current"==b){c.I("link_href").value=c.current;c.I("link_rel").value=c.link_rel}else{c.I("link_href").value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,"");c.I("link_rel").value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I("img_classes").value;c.I("img_demo").className=c.align=b;a=a.replace(/align[^ "']+/gi,"");a+=(" "+b);a=a.replace(/\s+/g," ").replace(/^\s/,"");if("aligncenter"==b){c.I("hspace").value="";c.updateStyle("hspace")}c.I("img_classes").value=a},showSize:function(e){var c=this,f=c.I("img_demo"),a=c.width,d=c.height,g=e.id||"s100",b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor="#A3A3A3";e.style.backgroundColor="#E5E5E5"},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)>parseInt(b.preloadImg.width)){d=b.I("s130"),c=b.I("s120"),a=b.I("s110");d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color="#aaa"}},showSizeRem:function(){var a=this,c=a.I("img_demo"),b=document.forms[0];c.width=Math.round(b.width.value*0.5);c.height=Math.round(b.height.value*0.5);a.showSizeClear();a.I(a.current_size_sel).style.borderColor="#A3A3A3";a.I(a.current_size_sel).style.backgroundColor="#E5E5E5";return false},showSizeClear:function(){var b=this.I("img_size").getElementsByTagName("div"),a;for(a=0;a<b.length;a++){b[a].style.borderColor="#f1f1f1";b[a].style.backgroundColor="#f1f1f1"}},imgEditSize:function(g){var d=this,i=document.forms[0],a,c,b,e,j;if(!d.preloadImg||!d.preloadImg.width||!d.preloadImg.height){return}a=parseInt(d.preloadImg.width),c=parseInt(d.preloadImg.height),b=d.width||a,e=d.height||c,j=g.id||"s100";size=parseInt(j.substring(1))/100;b=Math.round(b*size);e=Math.round(e*size);i.width.value=Math.min(a,b);i.height.value=Math.min(c,e);d.current_size_sel=j;d.demoSetSize()},demoSetSize:function(a){var c=this.I("img_demo"),b=document.forms[0];c.width=b.width.value?Math.round(b.width.value*0.5):"";c.height=b.height.value?Math.round(b.height.value*0.5):""},demoSetStyle:function(){var b=document.forms[0],a=this.I("img_demo"),c=tinyMCEPopup.editor.dom;if(a){c.setAttrib(a,"style",b.img_style.value);c.setStyle(a,"width","");c.setStyle(a,"height","")}},origSize:function(){var a=this,c=document.forms[0],b=a.I("s100");c.width.value=a.width=a.preloadImg.width;c.height.value=a.height=a.preloadImg.height;a.showSizeSet();a.demoSetSize();a.showSize(b)},init:function(){var a=tinyMCEPopup.editor,b;b=document.body.innerHTML;document.body.innerHTML=a.translate(b);window.setTimeout(function(){wpImage.setup()},500)},setup:function(){var p=this,k,b,l,e,i=document.forms[0],h=tinyMCEPopup.editor,j=p.I("img_demo"),g=tinyMCEPopup.dom,a,o="",n,m;document.dir=tinyMCEPopup.editor.getParam("directionality","");if(tinyMCEPopup.editor.getParam("wpeditimage_disable_captions",false)){p.I("cap_field").style.display="none"}tinyMCEPopup.restoreSelection();b=h.selection.getNode();if(b.nodeName!="IMG"){Line truncated
|
||||
@@ -0,0 +1,119 @@
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpGallery', {
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.url = url;
|
||||
t._createButtons();
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
|
||||
ed.addCommand('WP_Gallery', function() {
|
||||
var el = ed.selection.getNode(), post_id, vp = tinymce.DOM.getViewPort(),
|
||||
H = vp.h - 80, W = ( 640 < vp.w ) ? 640 : vp.w;
|
||||
|
||||
if ( el.nodeName != 'IMG' ) return;
|
||||
if ( ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 ) return;
|
||||
|
||||
post_id = tinymce.DOM.get('post_ID').value;
|
||||
tb_show('', tinymce.documentBaseURL + '/media-upload.php?post_id='+post_id+'&tab=gallery&TB_iframe=true&width='+W+'&height='+H);
|
||||
|
||||
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
|
||||
});
|
||||
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
if ( e.target.nodeName == 'IMG' && ed.dom.hasClass(e.target, 'wpGallery') )
|
||||
ed.plugins.wordpress._showButtons(e.target, 'wp_gallerybtns');
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = t._do_gallery(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = t._get_gallery(o.content);
|
||||
});
|
||||
},
|
||||
|
||||
_do_gallery : function(co) {
|
||||
return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){
|
||||
return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />';
|
||||
});
|
||||
},
|
||||
|
||||
_get_gallery : function(co) {
|
||||
|
||||
function getAttr(s, n) {
|
||||
n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
|
||||
return n ? tinymce.DOM.decode(n[1]) : '';
|
||||
};
|
||||
|
||||
return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {
|
||||
var cls = getAttr(im, 'class');
|
||||
|
||||
if ( cls.indexOf('wpGallery') != -1 )
|
||||
return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>';
|
||||
|
||||
return a;
|
||||
});
|
||||
},
|
||||
|
||||
_createButtons : function() {
|
||||
var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, editButton, dellButton;
|
||||
|
||||
DOM.remove('wp_gallerybtns');
|
||||
|
||||
DOM.add(document.body, 'div', {
|
||||
id : 'wp_gallerybtns',
|
||||
style : 'display:none;'
|
||||
});
|
||||
|
||||
editButton = DOM.add('wp_gallerybtns', 'img', {
|
||||
src : t.url+'/img/edit.png',
|
||||
id : 'wp_editgallery',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wordpress.editgallery')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(editButton, 'mousedown', function(e) {
|
||||
var ed = tinyMCE.activeEditor;
|
||||
ed.windowManager.bookmark = ed.selection.getBookmark('simple');
|
||||
ed.execCommand("WP_Gallery");
|
||||
});
|
||||
|
||||
dellButton = DOM.add('wp_gallerybtns', 'img', {
|
||||
src : t.url+'/img/delete.png',
|
||||
id : 'wp_delgallery',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wordpress.delgallery')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
|
||||
var ed = tinyMCE.activeEditor, el = ed.selection.getNode();
|
||||
|
||||
if ( el.nodeName == 'IMG' && ed.dom.hasClass(el, 'wpGallery') ) {
|
||||
ed.dom.remove(el);
|
||||
|
||||
ed.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);
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_Gallery",function(){var h=a.selection.getNode(),f,e=tinymce.DOM.getViewPort(),g=e.h-80,d=(640<e.w)?640:e.w;if(h.nodeName!="IMG"){return}if(a.dom.getAttrib(h,"class").indexOf("wpGallery")==-1){return}f=tinymce.DOM.get("post_ID").value;tb_show("",tinymce.documentBaseURL+"/media-upload.php?post_id="+f+"&tab=gallery&TB_iframe=true&width="+d+"&height="+g);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onMouseDown.add(function(d,f){if(f.target.nodeName=="IMG"&&d.dom.hasClass(f.target,"wpGallery")){d.plugins.wordpress._showButtons(f.target,"wp_gallerybtns")}});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})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_gallerybtns");d.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});e=d.add("wp_gallerybtns","img",{src:b.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:a.getLang("wordpress.editgallery")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_Gallery")});c=d.add("wp_gallerybtns","img",{src:b.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:a.getLang("wordpress.delgallery")});tinymce.dom.Event.add(c,"mousedown",function(h){var f=tinyMCE.activeEditor,g=f.selection.getNode();if(g.nodeName=="IMG"&&f.dom.hasClass(g,"wpGallery")){f.dom.remove(g);f.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)})();
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 43 B |
@@ -0,0 +1 @@
|
||||
#wp-link #internal-toggle{padding-right:18px;padding-left:0;}#wp-link label span{text-align:left;padding-left:5px;padding-right:0;}#wp-link .link-search-wrapper span{float:right;}#wp-link .link-search-wrapper input[type="text"]{float:right;}#wp-link .link-search-wrapper img.waiting{margin:8px 4px 0 1px;float:right;}#wp-link .link-target{margin:0 87px 0 0;}#wp-link .item-info{left:5px;right:auto;top:4px;bottom:0;}#wp-link #search-panel{float:right;}#wp-link-cancel{float:right;}#wp-link-update{float:left;}#wp-link .toggle-arrow{background-position:bottom right;}#wp-link .toggle-arrow-active{background-position:center right;}
|
||||
@@ -0,0 +1,54 @@
|
||||
#wp-link #internal-toggle {
|
||||
padding-right: 18px;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
#wp-link label span {
|
||||
text-align: left;
|
||||
padding-left: 5px;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
#wp-link .link-search-wrapper span {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#wp-link .link-search-wrapper input[type="text"] {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#wp-link .link-search-wrapper img.waiting {
|
||||
margin: 8px 4px 0 1px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
#wp-link .link-target {
|
||||
margin: 0 87px 0 0;
|
||||
}
|
||||
|
||||
#wp-link .item-info {
|
||||
left: 5px;
|
||||
right: auto;
|
||||
top: 4px;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
#wp-link #search-panel {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#wp-link-cancel {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#wp-link-update {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#wp-link .toggle-arrow {
|
||||
background-position: bottom right;
|
||||
}
|
||||
|
||||
#wp-link .toggle-arrow-active {
|
||||
background-position: center right;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#wp-link{line-height:1.4em;font-size:12px;}#wp-link ol,#wp-link ul{list-style:none;margin:0;padding:0;}#wp-link input[type="text"]{-webkit-box-sizing:border-box;}#wp-link input[type="text"],#wp-link textarea{border-width:1px;border-style:solid;-moz-border-radius:4px;-khtml-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;font-size:12px;margin:1px;padding:3px;}#wp-link #link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link p.howto{margin:3px;}#wp-link #internal-toggle{display:inline-block;cursor:pointer;padding-left:18px;}#wp-link .toggle-arrow{background:transparent url('../img/toggle-arrow.png') top left no-repeat;height:23px;line-height:23px;}#wp-link .toggle-arrow-active{background-position:center left;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 6px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#wp-link .link-target{width:auto;padding:3px 0 0;margin:0 0 0 87px;font-size:11px;}#wp-link .query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;position:relative;}#wp-link li,#wp-link .query-notice{clear:both;margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#333;padding:4px 6px;cursor:pointer;position:relative;}#wp-link li:hover{background:#eaf2fa;color:#151515;}#wp-link li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#333;}#wp-link li.selected{background:#ddd;color:#333;}#wp-link li.selected .item-title{font-weight:bold;}#wp-link .item-title{display:inline-block;width:80%;}#wp-link .item-info{text-transform:uppercase;color:#666;font-size:11px;position:absolute;right:5px;top:4px;bottom:0;}#wp-link #search-results{display:none;}#wp-link #search-panel{float:left;width:100%;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 10px;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;}
|
||||
@@ -0,0 +1,163 @@
|
||||
#wp-link {
|
||||
line-height: 1.4em;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#wp-link ol,
|
||||
#wp-link ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#wp-link input[type="text"] {
|
||||
-webkit-box-sizing: border-box;
|
||||
}
|
||||
|
||||
#wp-link input[type="text"],
|
||||
#wp-link textarea {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
-moz-border-radius: 4px;
|
||||
-khtml-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
margin: 1px;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
#wp-link #link-options {
|
||||
padding: 10px 0 14px;
|
||||
border-bottom: 1px solid #dfdfdf;
|
||||
margin: 0 6px 14px;
|
||||
}
|
||||
#wp-link p.howto {
|
||||
margin: 3px;
|
||||
}
|
||||
#wp-link #internal-toggle {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
padding-left: 18px;
|
||||
}
|
||||
#wp-link .toggle-arrow {
|
||||
background: transparent url( '../img/toggle-arrow.png' ) top left no-repeat;
|
||||
height: 23px;
|
||||
line-height: 23px;
|
||||
}
|
||||
#wp-link .toggle-arrow-active {
|
||||
background-position: center left;
|
||||
}
|
||||
#wp-link label input[type="text"] {
|
||||
width: 360px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
#wp-link label span {
|
||||
display: inline-block;
|
||||
width: 80px;
|
||||
text-align: right;
|
||||
padding-right: 5px;
|
||||
}
|
||||
#wp-link .link-search-wrapper {
|
||||
margin: 5px 6px 9px;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
#wp-link .link-search-wrapper span {
|
||||
float: left;
|
||||
margin-top: 6px;
|
||||
}
|
||||
#wp-link .link-search-wrapper input[type="text"] {
|
||||
float: left;
|
||||
width: 220px;
|
||||
}
|
||||
#wp-link .link-search-wrapper img.waiting {
|
||||
margin: 8px 1px 0 4px;
|
||||
float: left;
|
||||
display: none;
|
||||
}
|
||||
#wp-link .link-target {
|
||||
width: auto;
|
||||
padding: 3px 0 0;
|
||||
margin: 0 0 0 87px;
|
||||
font-size: 11px;
|
||||
}
|
||||
#wp-link .query-results {
|
||||
border: 1px #dfdfdf solid;
|
||||
margin: 0 5px 5px;
|
||||
background: #fff;
|
||||
height: 185px;
|
||||
overflow: auto;
|
||||
position: relative;
|
||||
}
|
||||
#wp-link li,
|
||||
#wp-link .query-notice {
|
||||
clear: both;
|
||||
margin-bottom: 0;
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
color: #333;
|
||||
padding: 4px 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
#wp-link li:hover {
|
||||
background: #eaf2fa;
|
||||
color: #151515;
|
||||
}
|
||||
#wp-link li.unselectable {
|
||||
border-bottom: 1px solid #dfdfdf;
|
||||
}
|
||||
#wp-link li.unselectable:hover {
|
||||
background: #fff;
|
||||
cursor: auto;
|
||||
color: #333;
|
||||
}
|
||||
#wp-link li.selected {
|
||||
background: #ddd;
|
||||
color: #333;
|
||||
}
|
||||
#wp-link li.selected .item-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
#wp-link .item-title {
|
||||
display: inline-block;
|
||||
width: 80%;
|
||||
}
|
||||
#wp-link .item-info {
|
||||
text-transform: uppercase;
|
||||
color: #666;
|
||||
font-size: 11px;
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 4px;
|
||||
bottom: 0;
|
||||
}
|
||||
#wp-link #search-results {
|
||||
display: none;
|
||||
}
|
||||
#wp-link #search-panel {
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
#wp-link .river-waiting {
|
||||
display: none;
|
||||
padding: 10px 0;
|
||||
}
|
||||
#wp-link .river-waiting img.waiting {
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
}
|
||||
#wp-link .submitbox {
|
||||
padding: 5px 10px;
|
||||
font-size: 11px;
|
||||
overflow: auto;
|
||||
height: 29px;
|
||||
}
|
||||
#wp-link-cancel {
|
||||
line-height: 25px;
|
||||
float: left;
|
||||
}
|
||||
#wp-link-update {
|
||||
line-height: 23px;
|
||||
float: right;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpLink', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
var disabled = true;
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
ed.addCommand('WP_Link', function() {
|
||||
if ( disabled )
|
||||
return;
|
||||
ed.windowManager.open({
|
||||
id : 'wp-link',
|
||||
width : 480,
|
||||
height : "auto",
|
||||
wpDialog : true,
|
||||
title : ed.getLang('advlink.link_desc')
|
||||
}, {
|
||||
plugin_url : url // Plugin absolute URL
|
||||
});
|
||||
});
|
||||
|
||||
// Register example button
|
||||
ed.addButton('link', {
|
||||
title : ed.getLang('advanced.link_desc'),
|
||||
cmd : 'WP_Link'
|
||||
});
|
||||
|
||||
ed.addShortcut('alt+shift+a', ed.getLang('advanced.link_desc'), 'WP_Link');
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n, co) {
|
||||
disabled = co && n.nodeName != 'A';
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'WordPress Link Dialog',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('wplink', tinymce.plugins.wpLink);
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){var c=true;a.addCommand("WP_Link",function(){if(c){return}a.windowManager.open({id:"wp-link",width:480,height:"auto",wpDialog:true,title:a.getLang("advlink.link_desc")},{plugin_url:b})});a.addButton("link",{title:a.getLang("advanced.link_desc"),cmd:"WP_Link"});a.addShortcut("alt+shift+a",a.getLang("advanced.link_desc"),"WP_Link");a.onNodeChange.add(function(e,d,g,f){c=f&&g.nodeName!="A"})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})();
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1,455 @@
|
||||
var wpLink;
|
||||
|
||||
(function($){
|
||||
var inputs = {}, rivers = {}, ed, River, Query;
|
||||
|
||||
wpLink = {
|
||||
timeToTriggerRiver: 150,
|
||||
minRiverAJAXDuration: 200,
|
||||
riverBottomThreshold: 5,
|
||||
keySensitivity: 100,
|
||||
lastSearch: '',
|
||||
init : function() {
|
||||
inputs.dialog = $('#wp-link');
|
||||
inputs.submit = $('#wp-link-submit');
|
||||
// URL
|
||||
inputs.url = $('#url-field');
|
||||
// Secondary options
|
||||
inputs.title = $('#link-title-field');
|
||||
// Advanced Options
|
||||
inputs.openInNewTab = $('#link-target-checkbox');
|
||||
inputs.search = $('#search-field');
|
||||
// Build Rivers
|
||||
rivers.search = new River( $('#search-results') );
|
||||
rivers.recent = new River( $('#most-recent-results') );
|
||||
rivers.elements = $('.query-results', inputs.dialog);
|
||||
|
||||
// Bind event handlers
|
||||
inputs.dialog.keydown( wpLink.keydown );
|
||||
inputs.dialog.keyup( wpLink.keyup );
|
||||
inputs.submit.click( function(e){
|
||||
wpLink.update();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('#wp-link-cancel').click( wpLink.cancel );
|
||||
$('#internal-toggle').click( wpLink.toggleInternalLinking );
|
||||
|
||||
rivers.elements.bind('river-select', wpLink.updateFields );
|
||||
|
||||
inputs.search.keyup( wpLink.searchInternalLinks );
|
||||
|
||||
inputs.dialog.bind('wpdialogrefresh', wpLink.refresh);
|
||||
},
|
||||
|
||||
refresh : function() {
|
||||
var e;
|
||||
ed = tinyMCEPopup.editor;
|
||||
|
||||
// Refresh rivers (clear links, check visibility)
|
||||
rivers.search.refresh();
|
||||
rivers.recent.refresh();
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
// If link exists, select proper values.
|
||||
if ( e = ed.dom.getParent(ed.selection.getNode(), 'A') ) {
|
||||
// Set URL and description.
|
||||
inputs.url.val( e.href );
|
||||
inputs.title.val( ed.dom.getAttrib(e, 'title') );
|
||||
// Set open in new tab.
|
||||
if ( "_blank" == ed.dom.getAttrib(e, 'target') )
|
||||
inputs.openInNewTab.attr('checked','checked');
|
||||
// Update save prompt.
|
||||
inputs.submit.val( wpLinkL10n.update );
|
||||
|
||||
// If there's no link, set the default values.
|
||||
} else {
|
||||
wpLink.setDefaultValues();
|
||||
// Update save prompt.
|
||||
inputs.submit.val( wpLinkL10n.save );
|
||||
}
|
||||
|
||||
tinyMCEPopup.storeSelection();
|
||||
// Focus the URL field and highlight its contents.
|
||||
// If this is moved above the selection changes,
|
||||
// IE will show a flashing cursor over the dialog.
|
||||
inputs.url.focus()[0].select();
|
||||
// Load the most recent results if this is the first time opening the panel.
|
||||
if ( ! rivers.recent.ul.children().length )
|
||||
rivers.recent.ajax();
|
||||
},
|
||||
|
||||
cancel : function() {
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var ed = tinyMCEPopup.editor,
|
||||
attrs = {
|
||||
href : inputs.url.val(),
|
||||
title : inputs.title.val(),
|
||||
target : inputs.openInNewTab.attr('checked') ? '_blank' : ''
|
||||
}, e, b;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
e = ed.dom.getParent(ed.selection.getNode(), 'A');
|
||||
|
||||
// If the values are empty, unlink and return
|
||||
if ( ! attrs.href || attrs.href == 'http://' ) {
|
||||
if ( e ) {
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
b = ed.selection.getBookmark();
|
||||
ed.dom.remove(e, 1);
|
||||
ed.selection.moveToBookmark(b);
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
|
||||
if (e == null) {
|
||||
ed.getDoc().execCommand("unlink", false, null);
|
||||
tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
|
||||
tinymce.each(ed.dom.select("a"), function(n) {
|
||||
if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
|
||||
e = n;
|
||||
ed.dom.setAttribs(e, attrs);
|
||||
}
|
||||
});
|
||||
|
||||
// Sometimes WebKit lets a user create a link where
|
||||
// they shouldn't be able to. In this case, CreateLink
|
||||
// injects "#mce_temp_url#" into their content. Fix it.
|
||||
if ( $(e).text() == '#mce_temp_url#' ) {
|
||||
ed.dom.remove(e);
|
||||
e = null;
|
||||
}
|
||||
} else {
|
||||
ed.dom.setAttribs(e, attrs);
|
||||
}
|
||||
|
||||
// Don't move caret if selection was image
|
||||
if ( e && (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') ) {
|
||||
ed.focus();
|
||||
ed.selection.select(e);
|
||||
ed.selection.collapse(0);
|
||||
tinyMCEPopup.storeSelection();
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
updateFields : function( e, li, originalEvent ) {
|
||||
inputs.url.val( li.children('.item-permalink').val() );
|
||||
inputs.title.val( li.hasClass('no-title') ? '' : li.children('.item-title').text() );
|
||||
if ( originalEvent && originalEvent.type == "click" )
|
||||
inputs.url.focus();
|
||||
},
|
||||
setDefaultValues : function() {
|
||||
// Set URL and description to defaults.
|
||||
// Leave the new tab setting as-is.
|
||||
inputs.url.val('http://');
|
||||
inputs.title.val('');
|
||||
},
|
||||
|
||||
searchInternalLinks : function() {
|
||||
var t = $(this), waiting,
|
||||
search = t.val();
|
||||
|
||||
if ( search.length > 2 ) {
|
||||
rivers.recent.hide();
|
||||
rivers.search.show();
|
||||
|
||||
// Don't search if the keypress didn't change the title.
|
||||
if ( wpLink.lastSearch == search )
|
||||
return;
|
||||
|
||||
wpLink.lastSearch = search;
|
||||
waiting = t.siblings('img.waiting').show();
|
||||
|
||||
rivers.search.change( search );
|
||||
rivers.search.ajax( function(){ waiting.hide(); });
|
||||
} else {
|
||||
rivers.search.hide();
|
||||
rivers.recent.show();
|
||||
}
|
||||
},
|
||||
|
||||
next : function() {
|
||||
rivers.search.next();
|
||||
rivers.recent.next();
|
||||
},
|
||||
prev : function() {
|
||||
rivers.search.prev();
|
||||
rivers.recent.prev();
|
||||
},
|
||||
|
||||
keydown : function( event ) {
|
||||
var fn, key = $.ui.keyCode;
|
||||
|
||||
switch( event.which ) {
|
||||
case key.UP:
|
||||
fn = 'prev';
|
||||
case key.DOWN:
|
||||
fn = fn || 'next';
|
||||
clearInterval( wpLink.keyInterval );
|
||||
wpLink[ fn ]();
|
||||
wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity );
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
},
|
||||
keyup: function( event ) {
|
||||
var key = $.ui.keyCode;
|
||||
|
||||
switch( event.which ) {
|
||||
case key.ESCAPE:
|
||||
wpLink.cancel();
|
||||
break;
|
||||
case key.UP:
|
||||
case key.DOWN:
|
||||
clearInterval( wpLink.keyInterval );
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
delayedCallback : function( func, delay ) {
|
||||
var timeoutTriggered, funcTriggered, funcArgs, funcContext;
|
||||
|
||||
if ( ! delay )
|
||||
return func;
|
||||
|
||||
setTimeout( function() {
|
||||
if ( funcTriggered )
|
||||
return func.apply( funcContext, funcArgs );
|
||||
// Otherwise, wait.
|
||||
timeoutTriggered = true;
|
||||
}, delay);
|
||||
|
||||
return function() {
|
||||
if ( timeoutTriggered )
|
||||
return func.apply( this, arguments );
|
||||
// Otherwise, wait.
|
||||
funcArgs = arguments;
|
||||
funcContext = this;
|
||||
funcTriggered = true;
|
||||
};
|
||||
},
|
||||
|
||||
toggleInternalLinking : function( event ) {
|
||||
var panel = $('#search-panel'),
|
||||
widget = inputs.dialog.wpdialog('widget'),
|
||||
// We're about to toggle visibility; it's currently the opposite
|
||||
visible = !panel.is(':visible'),
|
||||
win = $(window);
|
||||
|
||||
$(this).toggleClass('toggle-arrow-active', visible);
|
||||
|
||||
inputs.dialog.height('auto');
|
||||
panel.slideToggle( 300, function() {
|
||||
setUserSetting('wplink', visible ? '1' : '0');
|
||||
inputs[ visible ? 'search' : 'url' ].focus();
|
||||
|
||||
// Move the box if the box is now expanded, was opened in a collapsed state,
|
||||
// and if it needs to be moved. (Judged by bottom not being positive or
|
||||
// bottom being smaller than top.)
|
||||
var scroll = win.scrollTop(),
|
||||
top = widget.offset().top,
|
||||
bottom = top + widget.outerHeight(),
|
||||
diff = bottom - win.height();
|
||||
|
||||
if ( diff > scroll ) {
|
||||
widget.animate({'top': diff < top ? top - diff : scroll }, 200);
|
||||
}
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
River = function( element, search ) {
|
||||
var self = this;
|
||||
this.element = element;
|
||||
this.ul = element.children('ul');
|
||||
this.waiting = element.find('.river-waiting');
|
||||
|
||||
this.change( search );
|
||||
this.refresh();
|
||||
|
||||
element.scroll( function(){ self.maybeLoad(); });
|
||||
element.delegate('li', 'click', function(e){ self.select( $(this), e ); });
|
||||
};
|
||||
|
||||
$.extend( River.prototype, {
|
||||
refresh: function() {
|
||||
this.deselect();
|
||||
this.visible = this.element.is(':visible');
|
||||
},
|
||||
show: function() {
|
||||
if ( ! this.visible ) {
|
||||
this.deselect();
|
||||
this.element.show();
|
||||
this.visible = true;
|
||||
}
|
||||
},
|
||||
hide: function() {
|
||||
this.element.hide();
|
||||
this.visible = false;
|
||||
},
|
||||
// Selects a list item and triggers the river-select event.
|
||||
select: function( li, event ) {
|
||||
var liHeight, elHeight, liTop, elTop;
|
||||
|
||||
if ( li.hasClass('unselectable') || li == this.selected )
|
||||
return;
|
||||
|
||||
this.deselect();
|
||||
this.selected = li.addClass('selected');
|
||||
// Make sure the element is visible
|
||||
liHeight = li.outerHeight();
|
||||
elHeight = this.element.height();
|
||||
liTop = li.position().top;
|
||||
elTop = this.element.scrollTop();
|
||||
|
||||
if ( liTop < 0 ) // Make first visible element
|
||||
this.element.scrollTop( elTop + liTop );
|
||||
else if ( liTop + liHeight > elHeight ) // Make last visible element
|
||||
this.element.scrollTop( elTop + liTop - elHeight + liHeight );
|
||||
|
||||
// Trigger the river-select event
|
||||
this.element.trigger('river-select', [ li, event, this ]);
|
||||
},
|
||||
deselect: function() {
|
||||
if ( this.selected )
|
||||
this.selected.removeClass('selected');
|
||||
this.selected = false;
|
||||
},
|
||||
prev: function() {
|
||||
if ( ! this.visible )
|
||||
return;
|
||||
|
||||
var to;
|
||||
if ( this.selected ) {
|
||||
to = this.selected.prev('li');
|
||||
if ( to.length )
|
||||
this.select( to );
|
||||
}
|
||||
},
|
||||
next: function() {
|
||||
if ( ! this.visible )
|
||||
return;
|
||||
|
||||
var to = this.selected ? this.selected.next('li') : $('li:not(.unselectable):first', this.element);
|
||||
if ( to.length )
|
||||
this.select( to );
|
||||
},
|
||||
ajax: function( callback ) {
|
||||
var self = this,
|
||||
delay = this.query.page == 1 ? 0 : wpLink.minRiverAJAXDuration,
|
||||
response = wpLink.delayedCallback( function( results, params ) {
|
||||
self.process( results, params );
|
||||
if ( callback )
|
||||
callback( results, params );
|
||||
}, delay );
|
||||
|
||||
this.query.ajax( response );
|
||||
},
|
||||
change: function( search ) {
|
||||
if ( this.query && this._search == search )
|
||||
return;
|
||||
|
||||
this._search = search;
|
||||
this.query = new Query( search );
|
||||
this.element.scrollTop(0);
|
||||
},
|
||||
process: function( results, params ) {
|
||||
var list = '', alt = true, classes = '',
|
||||
firstPage = params.page == 1;
|
||||
|
||||
if ( !results ) {
|
||||
if ( firstPage ) {
|
||||
list += '<li class="unselectable"><span class="item-title"><em>'
|
||||
+ wpLinkL10n.noMatchesFound
|
||||
+ '</em></span></li>';
|
||||
}
|
||||
} else {
|
||||
$.each( results, function() {
|
||||
classes = alt ? 'alternate' : '';
|
||||
classes += this['title'] ? '' : ' no-title';
|
||||
list += classes ? '<li class="' + classes + '">' : '<li>';
|
||||
list += '<input type="hidden" class="item-permalink" value="' + this['permalink'] + '" />';
|
||||
list += '<span class="item-title">';
|
||||
list += this['title'] ? this['title'] : wpLinkL10n.noTitle;
|
||||
list += '</span><span class="item-info">' + this['info'] + '</span></li>';
|
||||
alt = ! alt;
|
||||
});
|
||||
}
|
||||
|
||||
this.ul[ firstPage ? 'html' : 'append' ]( list );
|
||||
},
|
||||
maybeLoad: function() {
|
||||
var self = this,
|
||||
el = this.element,
|
||||
bottom = el.scrollTop() + el.height();
|
||||
|
||||
if ( ! this.query.ready() || bottom < this.ul.height() - wpLink.riverBottomThreshold )
|
||||
return;
|
||||
|
||||
setTimeout(function() {
|
||||
var newTop = el.scrollTop(),
|
||||
newBottom = newTop + el.height();
|
||||
|
||||
if ( ! self.query.ready() || newBottom < self.ul.height() - wpLink.riverBottomThreshold )
|
||||
return;
|
||||
|
||||
self.waiting.show();
|
||||
el.scrollTop( newTop + self.waiting.outerHeight() );
|
||||
|
||||
self.ajax( function() { self.waiting.hide(); });
|
||||
}, wpLink.timeToTriggerRiver );
|
||||
}
|
||||
});
|
||||
|
||||
Query = function( search ) {
|
||||
this.page = 1;
|
||||
this.allLoaded = false;
|
||||
this.querying = false;
|
||||
this.search = search;
|
||||
};
|
||||
|
||||
$.extend( Query.prototype, {
|
||||
ready: function() {
|
||||
return !( this.querying || this.allLoaded );
|
||||
},
|
||||
ajax: function( callback ) {
|
||||
var self = this,
|
||||
query = {
|
||||
action : 'wp-link-ajax',
|
||||
page : this.page,
|
||||
'_ajax_linking_nonce' : $('#_ajax_linking_nonce').val()
|
||||
};
|
||||
|
||||
if ( this.search )
|
||||
query.search = this.search;
|
||||
|
||||
this.querying = true;
|
||||
|
||||
$.post( ajaxurl, query, function(r) {
|
||||
self.page++;
|
||||
self.querying = false;
|
||||
self.allLoaded = !r;
|
||||
callback( r, query );
|
||||
}, "json" );
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready( wpLink.init );
|
||||
})(jQuery);
|
||||
@@ -0,0 +1 @@
|
||||
var wpLink;(function(f){var b={},e={},d,a,c;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",init:function(){b.dialog=f("#wp-link");b.submit=f("#wp-link-submit");b.url=f("#url-field");b.title=f("#link-title-field");b.openInNewTab=f("#link-target-checkbox");b.search=f("#search-field");e.search=new a(f("#search-results"));e.recent=new a(f("#most-recent-results"));e.elements=f(".query-results",b.dialog);b.dialog.keydown(wpLink.keydown);b.dialog.keyup(wpLink.keyup);b.submit.click(function(g){wpLink.update();g.preventDefault()});f("#wp-link-cancel").click(wpLink.cancel);f("#internal-toggle").click(wpLink.toggleInternalLinking);e.elements.bind("river-select",wpLink.updateFields);b.search.keyup(wpLink.searchInternalLinks);b.dialog.bind("wpdialogrefresh",wpLink.refresh)},refresh:function(){var g;d=tinyMCEPopup.editor;e.search.refresh();e.recent.refresh();tinyMCEPopup.restoreSelection();if(g=d.dom.getParent(d.selection.getNode(),"A")){b.url.val(g.href);b.title.val(d.dom.getAttrib(g,"title"));if("_blank"==d.dom.getAttrib(g,"target")){b.openInNewTab.attr("checked","checked")}b.submit.val(wpLinkL10n.update)}else{wpLink.setDefaultValues();b.submit.val(wpLinkL10n.save)}tinyMCEPopup.storeSelection();b.url.focus()[0].select();if(!e.recent.ul.children().length){e.recent.ajax()}},cancel:function(){tinyMCEPopup.close()},update:function(){var h=tinyMCEPopup.editor,i={href:b.url.val(),title:b.title.val(),target:b.openInNewTab.attr("checked")?"_blank":""},j,g;tinyMCEPopup.restoreSelection();j=h.dom.getParent(h.selection.getNode(),"A");if(!i.href||i.href=="http://"){if(j){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(j,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()}return}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(j==null){h.getDoc().execCommand("unlink",false,null);tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});tinymce.each(h.dom.select("a"),function(k){if(h.dom.getAttrib(k,"href")=="#mce_temp_url#"){j=k;h.dom.setAttribs(j,i)}});if(f(j).text()=="#mce_temp_url#"){h.dom.remove(j);j=null}}else{h.dom.setAttribs(j,i)}if(j&&(j.childNodes.length!=1||j.firstChild.nodeName!="IMG")){h.focus();h.selection.select(j);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},updateFields:function(i,h,g){b.url.val(h.children(".item-permalink").val());b.title.val(h.hasClass("no-title")?"":h.children(".item-title").text());if(g&&g.type=="click"){b.url.focus()}},setDefaultValues:function(){b.url.val("http://");b.title.val("")},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>2){e.recent.hide();e.search.show();if(wpLink.lastSearch==g){return}wpLink.lastSearch=g;i=h.siblings("img.waiting").show();e.search.change(g);e.search.ajax(function(){i.hide()})}else{e.search.hide();e.recent.show()}},next:function(){e.search.next();e.recent.next()},prev:function(){e.search.prev();e.recent.prev()},keydown:function(i){var h,g=f.ui.keyCode;switch(i.which){case g.UP:h="prev";case g.DOWN:h=h||"next";clearInterval(wpLink.keyInterval);wpLink[h]();wpLink.keyInterval=setInterval(wpLink[h],wpLink.keySensitivity);break;default:return}i.preventDefault()},keyup:function(h){var g=f.ui.keyCode;switch(h.which){case g.ESCAPE:wpLink.cancel();break;case g.UP:case g.DOWN:clearInterval(wpLink.keyInterval);break;default:return}h.preventDefault()},delayedCallback:function(i,g){var l,k,j,h;if(!g){return i}setTimeout(function(){if(k){return i.apply(h,j)}l=true},g);return function(){if(l){return i.apply(this,arguments)}j=arguments;h=this;k=true}},toggleInternalLinking:function(h){var g=f("#search-panel"),i=b.dialog.wpdialog("widget"),k=!g.is(":visible"),j=f(window);f(this).toggleClass("toggle-arrow-active",k);b.dialog.height("auto");g.slideToggle(300,function(){setUserSetting("wplink",k?"1":"0");b[k?"search":"url"].focus();var l=j.scrollTop(),o=i.offset().top,m=o+i.outerHeight(),n=m-j.height();if(n>l){i.animate({top:n<o?o-n:l},200)}});h.preventDefault()}};a=function(i,h){var g=this;this.element=i;this.ul=i.children("ul");this.waiting=i.find(".river-waiting");this.change(h);this.refresh();i.scroll(function(){g.maybeLoad()});i.delegate("li","click",function(j){g.select(f(this),j)})};f.extend(a.prototype,{refresh:function(){this.deselect();this.visible=this.element.is(":visible")},show:function(){if(!this.visible){this.deselect();this.element.show();this.visible=true}},hide:function(){this.element.hide();this.visible=false},select:function(h,k){var j,i,l,g;if(h.hasClass("unselectable")||h==this.selected){return}this.deselect();this.selected=h.addClass("selected");j=h.outerHeight();i=this.element.height();l=h.position().top;g=this.element.scrollTop();if(l<0){this.element.scrollTop(g+l)}else{if(l+j>i){this.element.scrollTop(g+l-i+j)}}this.element.trigger("river-select",[h,k,this])},deselect:function(){if(this.selected){thiLine truncated
|
||||