mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
Add files via upload
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
function Dispatcher(target, newEventName, argsMap, defaultScope) {
|
||||
target = target || this;
|
||||
var cbs = [];
|
||||
|
||||
if (!newEventName) {
|
||||
this.add = this.addToTop = this.remove = this.dispatch = noop;
|
||||
@@ -51,7 +52,7 @@
|
||||
argsMap = argsMap.split(" ");
|
||||
}
|
||||
|
||||
if (argsMap && typeof argsMap != "function") {
|
||||
if (argsMap && typeof argsMap !== "function") {
|
||||
for (var i = 0; i < argsMap.length; i++) {
|
||||
callbackArgs.push(e[argsMap[i]]);
|
||||
}
|
||||
@@ -77,6 +78,12 @@
|
||||
|
||||
target.on(newEventName, patchedEventCallback, prepend);
|
||||
|
||||
var handlers = {
|
||||
original: callback,
|
||||
patched: patchedEventCallback
|
||||
};
|
||||
|
||||
cbs.push(handlers);
|
||||
return patchedEventCallback;
|
||||
};
|
||||
|
||||
@@ -85,12 +92,18 @@
|
||||
};
|
||||
|
||||
this.remove = function (callback) {
|
||||
cbs.forEach(function (item, i) {
|
||||
if (item.original === callback) {
|
||||
cbs.splice(i, 1);
|
||||
return target.off(newEventName, item.patched);
|
||||
}
|
||||
});
|
||||
|
||||
return target.off(newEventName, callback);
|
||||
};
|
||||
|
||||
this.dispatch = function () {
|
||||
target.fire(newEventName);
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
@@ -105,6 +118,15 @@
|
||||
};
|
||||
|
||||
function patchEditor(editor) {
|
||||
|
||||
function translate(str) {
|
||||
var prefix = editor.settings.language || "en";
|
||||
var prefixedStr = [prefix, str].join('.');
|
||||
var translatedStr = tinymce.i18n.translate(prefixedStr);
|
||||
|
||||
return prefixedStr !== translatedStr ? translatedStr : tinymce.i18n.translate(str);
|
||||
}
|
||||
|
||||
function patchEditorEvents(oldEventNames, argsMap) {
|
||||
tinymce.each(oldEventNames.split(" "), function (oldName) {
|
||||
editor["on" + oldName] = new Dispatcher(editor, oldName, argsMap);
|
||||
@@ -215,7 +237,7 @@
|
||||
editor.controlManager.buttons[name] = this;
|
||||
|
||||
if (originalOnPostRender) {
|
||||
return originalOnPostRender.call(this);
|
||||
return originalOnPostRender.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +253,7 @@
|
||||
}
|
||||
|
||||
if (settings.title) {
|
||||
settings.title = tinymce.i18n.translate((editor.settings.language || "en") + "." + settings.title);
|
||||
settings.title = translate(settings.title);
|
||||
}
|
||||
|
||||
return originalAddButton.call(this, name, settings);
|
||||
@@ -265,7 +287,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
tinymce.on('SetupEditor', patchEditor);
|
||||
tinymce.on('SetupEditor', function (e) {
|
||||
patchEditor(e.editor);
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add("compat3x", patchEditor);
|
||||
|
||||
tinymce.addI18n = function (prefix, o) {
|
||||
|
@@ -1 +1 @@
|
||||
!function(a){function b(){}function c(a){!f&&window&&window.console&&(f=!0,console.log("Deprecated TinyMCE API call: "+a))}function d(a,d,e,f){return a=a||this,d?(this.add=function(b,g,h){function i(c){var h=[];if("string"==typeof e&&(e=e.split(" ")),e&&"function"!=typeof e)for(var i=0;i<e.length;i++)h.push(c[e[i]]);("function"!=typeof e||(h=e(d,c,a)))&&(e||(h=[c]),h.unshift(f||a),b.apply(g||f||a,h)===!1&&c.stopImmediatePropagation())}return c("<target>.on"+d+".add(..)"),a.on(d,i,h),i},this.addToTop=function(a,b){this.add(a,b,!0)},this.remove=function(b){return a.off(d,b)},void(this.dispatch=function(){return a.fire(d),!0})):void(this.add=this.addToTop=this.remove=this.dispatch=b)}function e(e){function f(b,c){a.each(b.split(" "),function(a){e["on"+a]=new d(e,a,c)})}function g(a,b,c){return[b.level,c]}function h(a){return function(b,c){return!c.selection&&!a||c.selection==a?[c]:void 0}}function i(){function b(){return i()}var d={},e="add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update";return c("editor.controlManager.*"),a.each(e.split(" "),function(a){d[a]=b}),d}if(!e.controlManager){e.controlManager={buttons:{},setDisabled:function(a,b){c("controlManager.setDisabled(..)"),this.buttons[a]&&this.buttons[a].disabled(b)},setActive:function(a,b){c("controlManager.setActive(..)"),this.buttons[a]&&this.buttons[a].active(b)},onAdd:new d,onPostRender:new d,add:function(a){return a},createButton:i,createColorSplitButton:i,createControl:i,createDropMenu:i,createListBox:i,createMenuButton:i,createSeparator:i,createSplitButton:i,createToolbar:i,createToolbarGroup:i,destroy:b,get:b,setControlType:i},f("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),f("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),f("BeforeExecCommand ExecCommand","command ui value args"),f("PreProcess PostProcess LoadContent SaveContent Change"),f("BeforeSetContent BeforeGetContent SetContent GetContent",h(!1)),f("SetProgressState","state time"),f("VisualAid","element hasVisual"),f("Undo Redo",g),f("NodeChange",function(a,b){return[e.controlManager,b.element,e.selection.isCollapsed(),b]});var j=e.addButton;e.addButton=function(b,c){function d(){return e.controlManager.buttons[b]=this,f?f.call(this):void 0}var f;for(var g in c)"onpostrender"===g.toLowerCase()&&(f=c[g],c.onPostRender=d);return f||(c.onPostRender=d),c.title&&(c.title=a.i18n.translate((e.settings.language||"en")+"."+c.title)),j.call(this,b,c)},e.on("init",function(){var a=e.undoManager,b=e.selection;a.onUndo=new d(e,"Undo",g,null,a),a.onRedo=new d(e,"Redo",g,null,a),a.onBeforeAdd=new d(e,"BeforeAddUndo",null,a),a.onAdd=new d(e,"AddUndo",null,a),b.onBeforeGetContent=new d(e,"BeforeGetContent",h(!0),b),b.onGetContent=new d(e,"GetContent",h(!0),b),b.onBeforeSetContent=new d(e,"BeforeSetContent",h(!0),b),b.onSetContent=new d(e,"SetContent",h(!0),b)}),e.on("BeforeRenderUI",function(){var b=e.windowManager;b.onOpen=new d,b.onClose=new d,b.createInstance=function(b,d,e,f,g,h){c("windowManager.createInstance(..)");var i=a.resolve(b);return new i(d,e,f,g,h)}})}}var f;a.util.Dispatcher=d,a.onBeforeUnload=new d(a,"BeforeUnload"),a.onAddEditor=new d(a,"AddEditor","editor"),a.onRemoveEditor=new d(a,"RemoveEditor","editor"),a.util.Cookie={get:b,getHash:b,remove:b,set:b,setHash:b},a.on("SetupEditor",e),a.PluginManager.add("compat3x",e),a.addI18n=function(b,c){var d=a.util.I18n,e=a.each;return"string"==typeof b&&-1===b.indexOf(".")?void d.add(b,c):void(a.is(b,"string")?e(c,function(a,c){d.data[b+"."+c]=a}):e(b,function(a,b){e(a,function(a,c){e(a,function(a,e){"common"===c?d.data[b+"."+e]=a:d.data[b+"."+c+"."+e]=a})})}))}}(tinymce);
|
||||
!function(u){var t;function l(){}function f(e){!t&&window&&window.console&&(t=!0,console.log("Deprecated TinyMCE API call: "+e))}function i(i,a,d,s){i=i||this;var c=[];a?(this.add=function(o,r,e){function t(e){var t=[];if("string"==typeof d&&(d=d.split(" ")),d&&"function"!=typeof d)for(var n=0;n<d.length;n++)t.push(e[d[n]]);("function"!=typeof d||(t=d(a,e,i)))&&(d||(t=[e]),t.unshift(s||i),!1===o.apply(r||s||i,t)&&e.stopImmediatePropagation())}f("<target>.on"+a+".add(..)"),i.on(a,t,e);var n={original:o,patched:t};return c.push(n),t},this.addToTop=function(e,t){this.add(e,t,!0)},this.remove=function(n){return c.forEach(function(e,t){if(e.original===n)return c.splice(t,1),i.off(a,e.patched)}),i.off(a,n)},this.dispatch=function(){return i.fire(a),!0}):this.add=this.addToTop=this.remove=this.dispatch=l}function n(s){function e(e,t){u.each(e.split(" "),function(e){s["on"+e]=new i(s,e,t)})}function n(e,t,n){return[t.level,n]}function o(n){return function(e,t){if(!t.selection&&!n||t.selection==n)return[t]}}if(!s.controlManager){s.controlManager={buttons:{},setDisabled:function(e,t){f("controlManager.setDisabled(..)"),this.buttons[e]&&this.buttons[e].disabled(t)},setActive:function(e,t){f("controlManager.setActive(..)"),this.buttons[e]&&this.buttons[e].active(t)},onAdd:new i,onPostRender:new i,add:function(e){return e},createButton:r,createColorSplitButton:r,createControl:r,createDropMenu:r,createListBox:r,createMenuButton:r,createSeparator:r,createSplitButton:r,createToolbar:r,createToolbarGroup:r,destroy:l,get:l,setControlType:r},e("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),e("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),e("BeforeExecCommand ExecCommand","command ui value args"),e("PreProcess PostProcess LoadContent SaveContent Change"),e("BeforeSetContent BeforeGetContent SetContent GetContent",o(!1)),e("SetProgressState","state time"),e("VisualAid","element hasVisual"),e("Undo Redo",n),e("NodeChange",function(e,t){return[s.controlManager,t.element,s.selection.isCollapsed(),t]});var c=s.addButton;s.addButton=function(e,t){var n,o,r,i;function a(){if(s.controlManager.buttons[e]=this,n)return n.apply(this,arguments)}for(var d in t)"onpostrender"===d.toLowerCase()&&(n=t[d],t.onPostRender=a);return n||(t.onPostRender=a),t.title&&(t.title=(o=t.title,r=[s.settings.language||"en",o].join("."),i=u.i18n.translate(r),r!==i?i:u.i18n.translate(o))),c.call(this,e,t)},s.on("init",function(){var e=s.undoManager,t=s.selection;e.onUndo=new i(s,"Undo",n,null,e),e.onRedo=new i(s,"Redo",n,null,e),e.onBeforeAdd=new i(s,"BeforeAddUndo",null,e),e.onAdd=new i(s,"AddUndo",null,e),t.onBeforeGetContent=new i(s,"BeforeGetContent",o(!0),t),t.onGetContent=new i(s,"GetContent",o(!0),t),t.onBeforeSetContent=new i(s,"BeforeSetContent",o(!0),t),t.onSetContent=new i(s,"SetContent",o(!0),t)}),s.on("BeforeRenderUI",function(){var e=s.windowManager;e.onOpen=new i,e.onClose=new i,e.createInstance=function(e,t,n,o,r,i){return f("windowManager.createInstance(..)"),new(u.resolve(e))(t,n,o,r,i)}})}function r(){var t={};function n(){return r()}return f("editor.controlManager.*"),u.each("add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update".split(" "),function(e){t[e]=n}),t}}u.util.Dispatcher=i,u.onBeforeUnload=new i(u,"BeforeUnload"),u.onAddEditor=new i(u,"AddEditor","editor"),u.onRemoveEditor=new i(u,"RemoveEditor","editor"),u.util.Cookie={get:l,getHash:l,remove:l,set:l,setHash:l},u.on("SetupEditor",function(e){n(e.editor)}),u.PluginManager.add("compat3x",n),u.addI18n=function(n,e){var r=u.util.I18n,t=u.each;"string"!=typeof n||-1!==n.indexOf(".")?u.is(n,"string")?t(e,function(e,t){r.data[n+"."+t]=e}):t(n,function(e,o){t(e,function(e,n){t(e,function(e,t){"common"===n?r.data[o+"."+t]=e:r.data[o+"."+n+"."+t]=e})})}):r.add(n,e)}}(tinymce);
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Popup.js
|
||||
* tinymce_mce_popup.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -107,7 +107,7 @@ var tinyMCEPopup = {
|
||||
* Returns a window argument/parameter by name.
|
||||
*
|
||||
* @method getWindowArg
|
||||
* @param {String} name Name of the window argument to retrive.
|
||||
* @param {String} name Name of the window argument to retrieve.
|
||||
* @param {String} defaultValue Optional default value to return.
|
||||
* @return {String} Argument value or default value if it wasn't found.
|
||||
*/
|
||||
@@ -121,7 +121,7 @@ var tinyMCEPopup = {
|
||||
* Returns a editor parameter/config option value.
|
||||
*
|
||||
* @method getParam
|
||||
* @param {String} name Name of the editor config option to retrive.
|
||||
* @param {String} name Name of the editor config option to retrieve.
|
||||
* @param {String} defaultValue Optional default value to return.
|
||||
* @return {String} Parameter value or default value if it wasn't found.
|
||||
*/
|
||||
@@ -359,7 +359,7 @@ var tinyMCEPopup = {
|
||||
"browse": "Browse"
|
||||
};
|
||||
|
||||
var langCode = tinymce.settings.language || 'en';
|
||||
var langCode = (tinymce.settings ? tinymce.settings : t.editor.settings).language || 'en';
|
||||
for (var key in map) {
|
||||
tinymce.i18n.data[langCode + "." + key] = tinymce.i18n.translate(map[key]);
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* editable_selects.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -52,8 +52,9 @@ var TinyMCE_EditableSelects = {
|
||||
if (se.previousSibling.value != '') {
|
||||
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
||||
selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
||||
} else
|
||||
} else {
|
||||
selectByValue(document.forms[0], se.id, '');
|
||||
}
|
||||
|
||||
se.style.display = 'inline';
|
||||
se.parentNode.removeChild(se.previousSibling);
|
||||
@@ -64,7 +65,8 @@ var TinyMCE_EditableSelects = {
|
||||
onKeyDown : function (e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 13)
|
||||
if (e.keyCode == 13) {
|
||||
TinyMCE_EditableSelects.onBlurEditableSelectInput();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* form_utils.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -37,8 +37,9 @@ function setBrowserDisabled(id, state) {
|
||||
lnk.removeAttribute("href");
|
||||
tinyMCEPopup.dom.addClass(img, 'disabled');
|
||||
} else {
|
||||
if (lnk.getAttribute("realhref"))
|
||||
if (lnk.getAttribute("realhref")) {
|
||||
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
||||
}
|
||||
|
||||
tinyMCEPopup.dom.removeClass(img, 'disabled');
|
||||
}
|
||||
@@ -50,8 +51,9 @@ function getBrowserHTML(id, target_form_element, type, prefix) {
|
||||
|
||||
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
|
||||
|
||||
if (!cb)
|
||||
if (!cb) {
|
||||
return "";
|
||||
}
|
||||
|
||||
html = "";
|
||||
html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
|
||||
@@ -63,16 +65,19 @@ function getBrowserHTML(id, target_form_element, type, prefix) {
|
||||
function openBrowser(img_id, target_form_element, type, option) {
|
||||
var img = document.getElementById(img_id);
|
||||
|
||||
if (img.className != "mceButtonDisabled")
|
||||
if (img.className != "mceButtonDisabled") {
|
||||
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
||||
}
|
||||
}
|
||||
|
||||
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||
if (!form_obj || !form_obj.elements[field_name])
|
||||
if (!form_obj || !form_obj.elements[field_name]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!value)
|
||||
if (!value) {
|
||||
value = "";
|
||||
}
|
||||
|
||||
var sel = form_obj.elements[field_name];
|
||||
|
||||
@@ -83,9 +88,10 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
||||
option.selected = true;
|
||||
found = true;
|
||||
} else
|
||||
} else {
|
||||
option.selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && add_custom && value != '') {
|
||||
var option = new Option(value, value);
|
||||
@@ -100,8 +106,9 @@ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||
function getSelectValue(form_obj, field_name) {
|
||||
var elm = form_obj.elements[field_name];
|
||||
|
||||
if (elm == null || elm.options == null || elm.selectedIndex === -1)
|
||||
if (elm == null || elm.options == null || elm.selectedIndex === -1) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
@@ -184,15 +191,18 @@ function trimSize(size) {
|
||||
function getCSSSize(size) {
|
||||
size = trimSize(size);
|
||||
|
||||
if (size == "")
|
||||
if (size == "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Add px
|
||||
if (/^[0-9]+$/.test(size))
|
||||
if (/^[0-9]+$/.test(size)) {
|
||||
size += 'px';
|
||||
}
|
||||
// Sanity check, IE doesn't like broken values
|
||||
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))
|
||||
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size))) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -200,11 +210,13 @@ function getCSSSize(size) {
|
||||
function getStyle(elm, attrib, style) {
|
||||
var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
|
||||
|
||||
if (val != '')
|
||||
if (val != '') {
|
||||
return '' + val;
|
||||
}
|
||||
|
||||
if (typeof(style) == 'undefined')
|
||||
if (typeof (style) == 'undefined') {
|
||||
style = attrib;
|
||||
}
|
||||
|
||||
return tinyMCEPopup.dom.getStyle(elm, style);
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* mctabs.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -13,7 +13,7 @@
|
||||
function MCTabs() {
|
||||
this.settings = [];
|
||||
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
|
||||
};
|
||||
}
|
||||
|
||||
MCTabs.prototype.init = function (settings) {
|
||||
this.settings = settings;
|
||||
@@ -25,8 +25,9 @@ MCTabs.prototype.getParam = function(name, default_value) {
|
||||
value = (typeof (this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||
|
||||
// Fix bool values
|
||||
if (value == "true" || value == "false")
|
||||
if (value == "true" || value == "false") {
|
||||
return (value == "true");
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
@@ -94,9 +95,10 @@ MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
||||
|
||||
// Hide all other panels
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "DIV")
|
||||
if (nodes[i].nodeName == "DIV") {
|
||||
t.hidePanel(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!avoid_focus) {
|
||||
tabElm.focus();
|
||||
@@ -110,8 +112,9 @@ MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
||||
MCTabs.prototype.getAnchor = function () {
|
||||
var pos, url = document.location.href;
|
||||
|
||||
if ((pos = url.lastIndexOf('#')) != -1)
|
||||
if ((pos = url.lastIndexOf('#')) != -1) {
|
||||
return url.substring(pos + 1);
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
@@ -160,5 +163,6 @@ tinyMCEPopup.onInit.add(function() {
|
||||
enableLeftRight: true,
|
||||
enableUpDown: true
|
||||
}, tinyMCEPopup.dom);*/
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* validate.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
@@ -42,17 +42,20 @@ var Validator = {
|
||||
isEmpty : function (s) {
|
||||
var nl, i;
|
||||
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (s.type == 'checkbox' && !s.checked)
|
||||
if (s.type == 'checkbox' && !s.checked) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (s.type == 'radio') {
|
||||
for (i = 0, nl = s.form.elements; i < nl.length; i++) {
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -88,8 +91,9 @@ var AutoValidator = {
|
||||
init : function (s) {
|
||||
var n;
|
||||
|
||||
for (n in s)
|
||||
for (n in s) {
|
||||
this.settings[n] = s[n];
|
||||
}
|
||||
},
|
||||
|
||||
validate : function (f) {
|
||||
@@ -143,8 +147,9 @@ var AutoValidator = {
|
||||
var t = ['label', 'input', 'select', 'textarea'];
|
||||
var i, j, nl, s = this.settings;
|
||||
|
||||
if (e == null)
|
||||
if (e == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < t.length; i++) {
|
||||
nl = this.tags(e.form ? e.form : e, t[i]);
|
||||
@@ -164,41 +169,50 @@ var AutoValidator = {
|
||||
|
||||
this.removeClass(n, s.invalid_cls);
|
||||
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.min_cls, true)) {
|
||||
v = this.getNum(n, s.min_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.max_cls, true)) {
|
||||
v = this.getNum(n, s.max_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) > parseInt(v))
|
||||
if (isNaN(v) || parseInt(n.value) > parseInt(v)) {
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return st;
|
||||
},
|
||||
@@ -216,12 +230,12 @@ var AutoValidator = {
|
||||
|
||||
addClass : function (n, c, b) {
|
||||
var o = this.removeClass(n, c);
|
||||
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
|
||||
n.className = b ? c + (o !== '' ? (' ' + o) : '') : (o !== '' ? (o + ' ') : '') + c;
|
||||
},
|
||||
|
||||
removeClass : function (n, c) {
|
||||
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
||||
return n.className = c != ' ' ? c : '';
|
||||
return n.className = c !== ' ' ? c : '';
|
||||
},
|
||||
|
||||
tags : function (f, s) {
|
||||
@@ -243,9 +257,10 @@ var AutoValidator = {
|
||||
|
||||
nl = this.tags(f, "label");
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id) {
|
||||
this.addClass(nl[i], ic);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user