first commit
This commit is contained in:
2688
wp-content/plugins/unlimited-elements-for-elementor/js/admin.js
Normal file
2688
wp-content/plugins/unlimited-elements-for-elementor/js/admin.js
Normal file
File diff suppressed because it is too large
Load Diff
32
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/dialog.css
vendored
Normal file
32
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/dialog.css
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
.CodeMirror-dialog {
|
||||
position: absolute;
|
||||
left: 0; right: 0;
|
||||
background: inherit;
|
||||
z-index: 15;
|
||||
padding: .1em .8em;
|
||||
overflow: hidden;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog-top {
|
||||
border-bottom: 1px solid #eee;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog-bottom {
|
||||
border-top: 1px solid #eee;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog input {
|
||||
border: none;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
width: 20em;
|
||||
color: inherit;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog button {
|
||||
font-size: 70%;
|
||||
}
|
||||
163
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/dialog.js
vendored
Normal file
163
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/dialog.js
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
||||
|
||||
// Open simple dialogs on top of an editor. Relies on dialog.css.
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
function dialogDiv(cm, template, bottom) {
|
||||
var wrap = cm.getWrapperElement();
|
||||
var dialog;
|
||||
dialog = wrap.appendChild(document.createElement("div"));
|
||||
if (bottom)
|
||||
dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";
|
||||
else
|
||||
dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";
|
||||
|
||||
if (typeof template == "string") {
|
||||
dialog.innerHTML = template;
|
||||
} else { // Assuming it's a detached DOM element.
|
||||
dialog.appendChild(template);
|
||||
}
|
||||
CodeMirror.addClass(wrap, 'dialog-opened');
|
||||
return dialog;
|
||||
}
|
||||
|
||||
function closeNotification(cm, newVal) {
|
||||
if (cm.state.currentNotificationClose)
|
||||
cm.state.currentNotificationClose();
|
||||
cm.state.currentNotificationClose = newVal;
|
||||
}
|
||||
|
||||
CodeMirror.defineExtension("openDialog", function(template, callback, options) {
|
||||
if (!options) options = {};
|
||||
|
||||
closeNotification(this, null);
|
||||
|
||||
var dialog = dialogDiv(this, template, options.bottom);
|
||||
var closed = false, me = this;
|
||||
function close(newVal) {
|
||||
if (typeof newVal == 'string') {
|
||||
inp.value = newVal;
|
||||
} else {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
|
||||
dialog.parentNode.removeChild(dialog);
|
||||
me.focus();
|
||||
|
||||
if (options.onClose) options.onClose(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
var inp = dialog.getElementsByTagName("input")[0], button;
|
||||
if (inp) {
|
||||
inp.focus();
|
||||
|
||||
if (options.value) {
|
||||
inp.value = options.value;
|
||||
if (options.selectValueOnOpen !== false) {
|
||||
inp.select();
|
||||
}
|
||||
}
|
||||
|
||||
if (options.onInput)
|
||||
CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);});
|
||||
if (options.onKeyUp)
|
||||
CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);});
|
||||
|
||||
CodeMirror.on(inp, "keydown", function(e) {
|
||||
if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }
|
||||
if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {
|
||||
inp.blur();
|
||||
CodeMirror.e_stop(e);
|
||||
close();
|
||||
}
|
||||
if (e.keyCode == 13) callback(inp.value, e);
|
||||
});
|
||||
|
||||
if (options.closeOnBlur !== false) CodeMirror.on(dialog, "focusout", function (evt) {
|
||||
if (evt.relatedTarget !== null) close();
|
||||
});
|
||||
} else if (button = dialog.getElementsByTagName("button")[0]) {
|
||||
CodeMirror.on(button, "click", function() {
|
||||
close();
|
||||
me.focus();
|
||||
});
|
||||
|
||||
if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close);
|
||||
|
||||
button.focus();
|
||||
}
|
||||
return close;
|
||||
});
|
||||
|
||||
CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) {
|
||||
closeNotification(this, null);
|
||||
var dialog = dialogDiv(this, template, options && options.bottom);
|
||||
var buttons = dialog.getElementsByTagName("button");
|
||||
var closed = false, me = this, blurring = 1;
|
||||
function close() {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
|
||||
dialog.parentNode.removeChild(dialog);
|
||||
me.focus();
|
||||
}
|
||||
buttons[0].focus();
|
||||
for (var i = 0; i < buttons.length; ++i) {
|
||||
var b = buttons[i];
|
||||
(function(callback) {
|
||||
CodeMirror.on(b, "click", function(e) {
|
||||
CodeMirror.e_preventDefault(e);
|
||||
close();
|
||||
if (callback) callback(me);
|
||||
});
|
||||
})(callbacks[i]);
|
||||
CodeMirror.on(b, "blur", function() {
|
||||
--blurring;
|
||||
setTimeout(function() { if (blurring <= 0) close(); }, 200);
|
||||
});
|
||||
CodeMirror.on(b, "focus", function() { ++blurring; });
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* openNotification
|
||||
* Opens a notification, that can be closed with an optional timer
|
||||
* (default 5000ms timer) and always closes on click.
|
||||
*
|
||||
* If a notification is opened while another is opened, it will close the
|
||||
* currently opened one and open the new one immediately.
|
||||
*/
|
||||
CodeMirror.defineExtension("openNotification", function(template, options) {
|
||||
closeNotification(this, close);
|
||||
var dialog = dialogDiv(this, template, options && options.bottom);
|
||||
var closed = false, doneTimer;
|
||||
var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000;
|
||||
|
||||
function close() {
|
||||
if (closed) return;
|
||||
closed = true;
|
||||
clearTimeout(doneTimer);
|
||||
CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
|
||||
dialog.parentNode.removeChild(dialog);
|
||||
}
|
||||
|
||||
CodeMirror.on(dialog, 'click', function(e) {
|
||||
CodeMirror.e_preventDefault(e);
|
||||
close();
|
||||
});
|
||||
|
||||
if (duration)
|
||||
doneTimer = setTimeout(close, duration);
|
||||
|
||||
return close;
|
||||
});
|
||||
});
|
||||
136
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/multiplex.js
vendored
Normal file
136
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/multiplex.js
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.multiplexingMode = function(outer /*, others */) {
|
||||
// Others should be {open, close, mode [, delimStyle] [, innerStyle] [, parseDelimiters]} objects
|
||||
var others = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
function indexOf(string, pattern, from, returnEnd) {
|
||||
if (typeof pattern == "string") {
|
||||
var found = string.indexOf(pattern, from);
|
||||
return returnEnd && found > -1 ? found + pattern.length : found;
|
||||
}
|
||||
var m = pattern.exec(from ? string.slice(from) : string);
|
||||
return m ? m.index + from + (returnEnd ? m[0].length : 0) : -1;
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function() {
|
||||
return {
|
||||
outer: CodeMirror.startState(outer),
|
||||
innerActive: null,
|
||||
inner: null,
|
||||
startingInner: false
|
||||
};
|
||||
},
|
||||
|
||||
copyState: function(state) {
|
||||
return {
|
||||
outer: CodeMirror.copyState(outer, state.outer),
|
||||
innerActive: state.innerActive,
|
||||
inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner),
|
||||
startingInner: state.startingInner
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
if (!state.innerActive) {
|
||||
var cutOff = Infinity, oldContent = stream.string;
|
||||
for (var i = 0; i < others.length; ++i) {
|
||||
var other = others[i];
|
||||
var found = indexOf(oldContent, other.open, stream.pos);
|
||||
if (found == stream.pos) {
|
||||
if (!other.parseDelimiters) stream.match(other.open);
|
||||
state.startingInner = !!other.parseDelimiters
|
||||
state.innerActive = other;
|
||||
|
||||
// Get the outer indent, making sure to handle CodeMirror.Pass
|
||||
var outerIndent = 0;
|
||||
if (outer.indent) {
|
||||
var possibleOuterIndent = outer.indent(state.outer, "", "");
|
||||
if (possibleOuterIndent !== CodeMirror.Pass) outerIndent = possibleOuterIndent;
|
||||
}
|
||||
|
||||
state.inner = CodeMirror.startState(other.mode, outerIndent);
|
||||
return other.delimStyle && (other.delimStyle + " " + other.delimStyle + "-open");
|
||||
} else if (found != -1 && found < cutOff) {
|
||||
cutOff = found;
|
||||
}
|
||||
}
|
||||
if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);
|
||||
var outerToken = outer.token(stream, state.outer);
|
||||
if (cutOff != Infinity) stream.string = oldContent;
|
||||
return outerToken;
|
||||
} else {
|
||||
var curInner = state.innerActive, oldContent = stream.string;
|
||||
if (!curInner.close && stream.sol()) {
|
||||
state.innerActive = state.inner = null;
|
||||
return this.token(stream, state);
|
||||
}
|
||||
var found = curInner.close && !state.startingInner ?
|
||||
indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1;
|
||||
if (found == stream.pos && !curInner.parseDelimiters) {
|
||||
stream.match(curInner.close);
|
||||
state.innerActive = state.inner = null;
|
||||
return curInner.delimStyle && (curInner.delimStyle + " " + curInner.delimStyle + "-close");
|
||||
}
|
||||
if (found > -1) stream.string = oldContent.slice(0, found);
|
||||
var innerToken = curInner.mode.token(stream, state.inner);
|
||||
if (found > -1) stream.string = oldContent;
|
||||
else if (stream.pos > stream.start) state.startingInner = false
|
||||
|
||||
if (found == stream.pos && curInner.parseDelimiters)
|
||||
state.innerActive = state.inner = null;
|
||||
|
||||
if (curInner.innerStyle) {
|
||||
if (innerToken) innerToken = innerToken + " " + curInner.innerStyle;
|
||||
else innerToken = curInner.innerStyle;
|
||||
}
|
||||
|
||||
return innerToken;
|
||||
}
|
||||
},
|
||||
|
||||
indent: function(state, textAfter, line) {
|
||||
var mode = state.innerActive ? state.innerActive.mode : outer;
|
||||
if (!mode.indent) return CodeMirror.Pass;
|
||||
return mode.indent(state.innerActive ? state.inner : state.outer, textAfter, line);
|
||||
},
|
||||
|
||||
blankLine: function(state) {
|
||||
var mode = state.innerActive ? state.innerActive.mode : outer;
|
||||
if (mode.blankLine) {
|
||||
mode.blankLine(state.innerActive ? state.inner : state.outer);
|
||||
}
|
||||
if (!state.innerActive) {
|
||||
for (var i = 0; i < others.length; ++i) {
|
||||
var other = others[i];
|
||||
if (other.open === "\n") {
|
||||
state.innerActive = other;
|
||||
state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "", "") : 0);
|
||||
}
|
||||
}
|
||||
} else if (state.innerActive.close === "\n") {
|
||||
state.innerActive = state.inner = null;
|
||||
}
|
||||
},
|
||||
|
||||
electricChars: outer.electricChars,
|
||||
|
||||
innerMode: function(state) {
|
||||
return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
});
|
||||
264
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/search.js
vendored
Normal file
264
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/search.js
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
||||
|
||||
// Define search commands. Depends on dialog.js or another
|
||||
// implementation of the openDialog method.
|
||||
|
||||
// Replace works a little oddly -- it will do the replace on the next
|
||||
// Ctrl-G (or whatever is bound to findNext) press. You prevent a
|
||||
// replace by making sure the match is no longer selected when hitting
|
||||
// Ctrl-G.
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
// default search panel location
|
||||
CodeMirror.defineOption("search", {bottom: false});
|
||||
|
||||
function searchOverlay(query, caseInsensitive) {
|
||||
if (typeof query == "string")
|
||||
query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g");
|
||||
else if (!query.global)
|
||||
query = new RegExp(query.source, query.ignoreCase ? "gi" : "g");
|
||||
|
||||
return {token: function(stream) {
|
||||
query.lastIndex = stream.pos;
|
||||
var match = query.exec(stream.string);
|
||||
if (match && match.index == stream.pos) {
|
||||
stream.pos += match[0].length || 1;
|
||||
return "searching";
|
||||
} else if (match) {
|
||||
stream.pos = match.index;
|
||||
} else {
|
||||
stream.skipToEnd();
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
function SearchState() {
|
||||
this.posFrom = this.posTo = this.lastQuery = this.query = null;
|
||||
this.overlay = null;
|
||||
}
|
||||
|
||||
function getSearchState(cm) {
|
||||
return cm.state.search || (cm.state.search = new SearchState());
|
||||
}
|
||||
|
||||
function queryCaseInsensitive(query) {
|
||||
return typeof query == "string" && query == query.toLowerCase();
|
||||
}
|
||||
|
||||
function getSearchCursor(cm, query, pos) {
|
||||
// Heuristic: if the query string is all lowercase, do a case insensitive search.
|
||||
return cm.getSearchCursor(query, pos, {caseFold: queryCaseInsensitive(query), multiline: true});
|
||||
}
|
||||
|
||||
function persistentDialog(cm, text, deflt, onEnter, onKeyDown) {
|
||||
cm.openDialog(text, onEnter, {
|
||||
value: deflt,
|
||||
selectValueOnOpen: true,
|
||||
closeOnEnter: false,
|
||||
onClose: function() { clearSearch(cm); },
|
||||
onKeyDown: onKeyDown,
|
||||
bottom: cm.options.search.bottom
|
||||
});
|
||||
}
|
||||
|
||||
function dialog(cm, text, shortText, deflt, f) {
|
||||
if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true, bottom: cm.options.search.bottom});
|
||||
else f(prompt(shortText, deflt));
|
||||
}
|
||||
|
||||
function confirmDialog(cm, text, shortText, fs) {
|
||||
if (cm.openConfirm) cm.openConfirm(text, fs);
|
||||
else if (confirm(shortText)) fs[0]();
|
||||
}
|
||||
|
||||
function parseString(string) {
|
||||
return string.replace(/\\([nrt\\])/g, function(match, ch) {
|
||||
if (ch == "n") return "\n"
|
||||
if (ch == "r") return "\r"
|
||||
if (ch == "t") return "\t"
|
||||
if (ch == "\\") return "\\"
|
||||
return match
|
||||
})
|
||||
}
|
||||
|
||||
function parseQuery(query) {
|
||||
var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
|
||||
if (isRE) {
|
||||
try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); }
|
||||
catch(e) {} // Not a regular expression after all, do a string search
|
||||
} else {
|
||||
query = parseString(query)
|
||||
}
|
||||
if (typeof query == "string" ? query == "" : query.test(""))
|
||||
query = /x^/;
|
||||
return query;
|
||||
}
|
||||
|
||||
function startSearch(cm, state, query) {
|
||||
state.queryText = query;
|
||||
state.query = parseQuery(query);
|
||||
cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
|
||||
state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
|
||||
cm.addOverlay(state.overlay);
|
||||
if (cm.showMatchesOnScrollbar) {
|
||||
if (state.annotate) { state.annotate.clear(); state.annotate = null; }
|
||||
state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query));
|
||||
}
|
||||
}
|
||||
|
||||
function doSearch(cm, rev, persistent, immediate) {
|
||||
var state = getSearchState(cm);
|
||||
if (state.query) return findNext(cm, rev);
|
||||
var q = cm.getSelection() || state.lastQuery;
|
||||
if (q instanceof RegExp && q.source == "x^") q = null
|
||||
if (persistent && cm.openDialog) {
|
||||
var hiding = null
|
||||
var searchNext = function(query, event) {
|
||||
CodeMirror.e_stop(event);
|
||||
if (!query) return;
|
||||
if (query != state.queryText) {
|
||||
startSearch(cm, state, query);
|
||||
state.posFrom = state.posTo = cm.getCursor();
|
||||
}
|
||||
if (hiding) hiding.style.opacity = 1
|
||||
findNext(cm, event.shiftKey, function(_, to) {
|
||||
var dialog
|
||||
if (to.line < 3 && document.querySelector &&
|
||||
(dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) &&
|
||||
dialog.getBoundingClientRect().bottom - 4 > cm.cursorCoords(to, "window").top)
|
||||
(hiding = dialog).style.opacity = .4
|
||||
})
|
||||
};
|
||||
persistentDialog(cm, getQueryDialog(cm), q, searchNext, function(event, query) {
|
||||
var keyName = CodeMirror.keyName(event)
|
||||
var extra = cm.getOption('extraKeys'), cmd = (extra && extra[keyName]) || CodeMirror.keyMap[cm.getOption("keyMap")][keyName]
|
||||
if (cmd == "findNext" || cmd == "findPrev" ||
|
||||
cmd == "findPersistentNext" || cmd == "findPersistentPrev") {
|
||||
CodeMirror.e_stop(event);
|
||||
startSearch(cm, getSearchState(cm), query);
|
||||
cm.execCommand(cmd);
|
||||
} else if (cmd == "find" || cmd == "findPersistent") {
|
||||
CodeMirror.e_stop(event);
|
||||
searchNext(query, event);
|
||||
}
|
||||
});
|
||||
if (immediate && q) {
|
||||
startSearch(cm, state, q);
|
||||
findNext(cm, rev);
|
||||
}
|
||||
} else {
|
||||
dialog(cm, getQueryDialog(cm), "Search for:", q, function(query) {
|
||||
if (query && !state.query) cm.operation(function() {
|
||||
startSearch(cm, state, query);
|
||||
state.posFrom = state.posTo = cm.getCursor();
|
||||
findNext(cm, rev);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function findNext(cm, rev, callback) {cm.operation(function() {
|
||||
var state = getSearchState(cm);
|
||||
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
|
||||
if (!cursor.find(rev)) {
|
||||
cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
|
||||
if (!cursor.find(rev)) return;
|
||||
}
|
||||
cm.setSelection(cursor.from(), cursor.to());
|
||||
cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20);
|
||||
state.posFrom = cursor.from(); state.posTo = cursor.to();
|
||||
if (callback) callback(cursor.from(), cursor.to())
|
||||
});}
|
||||
|
||||
function clearSearch(cm) {cm.operation(function() {
|
||||
var state = getSearchState(cm);
|
||||
state.lastQuery = state.query;
|
||||
if (!state.query) return;
|
||||
state.query = state.queryText = null;
|
||||
cm.removeOverlay(state.overlay);
|
||||
if (state.annotate) { state.annotate.clear(); state.annotate = null; }
|
||||
});}
|
||||
|
||||
|
||||
function getQueryDialog(cm) {
|
||||
return '<span class="CodeMirror-search-label">' + cm.phrase("Search:") + '</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + cm.phrase("(Use /re/ syntax for regexp search)") + '</span>';
|
||||
}
|
||||
function getReplaceQueryDialog(cm) {
|
||||
return ' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + cm.phrase("(Use /re/ syntax for regexp search)") + '</span>';
|
||||
}
|
||||
function getReplacementQueryDialog(cm) {
|
||||
return '<span class="CodeMirror-search-label">' + cm.phrase("With:") + '</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>';
|
||||
}
|
||||
function getDoReplaceConfirm(cm) {
|
||||
return '<span class="CodeMirror-search-label">' + cm.phrase("Replace?") + '</span> <button>' + cm.phrase("Yes") + '</button> <button>' + cm.phrase("No") + '</button> <button>' + cm.phrase("All") + '</button> <button>' + cm.phrase("Stop") + '</button> ';
|
||||
}
|
||||
|
||||
function replaceAll(cm, query, text) {
|
||||
cm.operation(function() {
|
||||
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
|
||||
if (typeof query != "string") {
|
||||
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
|
||||
cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
|
||||
} else cursor.replace(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function replace(cm, all) {
|
||||
if (cm.getOption("readOnly")) return;
|
||||
var query = cm.getSelection() || getSearchState(cm).lastQuery;
|
||||
var dialogText = '<span class="CodeMirror-search-label">' + (all ? cm.phrase("Replace all:") : cm.phrase("Replace:")) + '</span>';
|
||||
dialog(cm, dialogText + getReplaceQueryDialog(cm), dialogText, query, function(query) {
|
||||
if (!query) return;
|
||||
query = parseQuery(query);
|
||||
dialog(cm, getReplacementQueryDialog(cm), cm.phrase("Replace with:"), "", function(text) {
|
||||
text = parseString(text)
|
||||
if (all) {
|
||||
replaceAll(cm, query, text)
|
||||
} else {
|
||||
clearSearch(cm);
|
||||
var cursor = getSearchCursor(cm, query, cm.getCursor("from"));
|
||||
var advance = function() {
|
||||
var start = cursor.from(), match;
|
||||
if (!(match = cursor.findNext())) {
|
||||
cursor = getSearchCursor(cm, query);
|
||||
if (!(match = cursor.findNext()) ||
|
||||
(start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
|
||||
}
|
||||
cm.setSelection(cursor.from(), cursor.to());
|
||||
cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
|
||||
confirmDialog(cm, getDoReplaceConfirm(cm), cm.phrase("Replace?"),
|
||||
[function() {doReplace(match);}, advance,
|
||||
function() {replaceAll(cm, query, text)}]);
|
||||
};
|
||||
var doReplace = function(match) {
|
||||
cursor.replace(typeof query == "string" ? text :
|
||||
text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
|
||||
advance();
|
||||
};
|
||||
advance();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
|
||||
CodeMirror.commands.findPersistent = function(cm) {clearSearch(cm); doSearch(cm, false, true);};
|
||||
CodeMirror.commands.findPersistentNext = function(cm) {doSearch(cm, false, true, true);};
|
||||
CodeMirror.commands.findPersistentPrev = function(cm) {doSearch(cm, true, true, true);};
|
||||
CodeMirror.commands.findNext = doSearch;
|
||||
CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
|
||||
CodeMirror.commands.clearSearch = clearSearch;
|
||||
CodeMirror.commands.replace = replace;
|
||||
CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
|
||||
});
|
||||
296
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/searchcursor.js
vendored
Normal file
296
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/addon/searchcursor.js
vendored
Normal file
@@ -0,0 +1,296 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"))
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod)
|
||||
else // Plain browser env
|
||||
mod(CodeMirror)
|
||||
})(function(CodeMirror) {
|
||||
"use strict"
|
||||
var Pos = CodeMirror.Pos
|
||||
|
||||
function regexpFlags(regexp) {
|
||||
var flags = regexp.flags
|
||||
return flags != null ? flags : (regexp.ignoreCase ? "i" : "")
|
||||
+ (regexp.global ? "g" : "")
|
||||
+ (regexp.multiline ? "m" : "")
|
||||
}
|
||||
|
||||
function ensureFlags(regexp, flags) {
|
||||
var current = regexpFlags(regexp), target = current
|
||||
for (var i = 0; i < flags.length; i++) if (target.indexOf(flags.charAt(i)) == -1)
|
||||
target += flags.charAt(i)
|
||||
return current == target ? regexp : new RegExp(regexp.source, target)
|
||||
}
|
||||
|
||||
function maybeMultiline(regexp) {
|
||||
return /\\s|\\n|\n|\\W|\\D|\[\^/.test(regexp.source)
|
||||
}
|
||||
|
||||
function searchRegexpForward(doc, regexp, start) {
|
||||
regexp = ensureFlags(regexp, "g")
|
||||
for (var line = start.line, ch = start.ch, last = doc.lastLine(); line <= last; line++, ch = 0) {
|
||||
regexp.lastIndex = ch
|
||||
var string = doc.getLine(line), match = regexp.exec(string)
|
||||
if (match)
|
||||
return {from: Pos(line, match.index),
|
||||
to: Pos(line, match.index + match[0].length),
|
||||
match: match}
|
||||
}
|
||||
}
|
||||
|
||||
function searchRegexpForwardMultiline(doc, regexp, start) {
|
||||
if (!maybeMultiline(regexp)) return searchRegexpForward(doc, regexp, start)
|
||||
|
||||
regexp = ensureFlags(regexp, "gm")
|
||||
var string, chunk = 1
|
||||
for (var line = start.line, last = doc.lastLine(); line <= last;) {
|
||||
// This grows the search buffer in exponentially-sized chunks
|
||||
// between matches, so that nearby matches are fast and don't
|
||||
// require concatenating the whole document (in case we're
|
||||
// searching for something that has tons of matches), but at the
|
||||
// same time, the amount of retries is limited.
|
||||
for (var i = 0; i < chunk; i++) {
|
||||
if (line > last) break
|
||||
var curLine = doc.getLine(line++)
|
||||
string = string == null ? curLine : string + "\n" + curLine
|
||||
}
|
||||
chunk = chunk * 2
|
||||
regexp.lastIndex = start.ch
|
||||
var match = regexp.exec(string)
|
||||
if (match) {
|
||||
var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
|
||||
var startLine = start.line + before.length - 1, startCh = before[before.length - 1].length
|
||||
return {from: Pos(startLine, startCh),
|
||||
to: Pos(startLine + inside.length - 1,
|
||||
inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
|
||||
match: match}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function lastMatchIn(string, regexp, endMargin) {
|
||||
var match, from = 0
|
||||
while (from <= string.length) {
|
||||
regexp.lastIndex = from
|
||||
var newMatch = regexp.exec(string)
|
||||
if (!newMatch) break
|
||||
var end = newMatch.index + newMatch[0].length
|
||||
if (end > string.length - endMargin) break
|
||||
if (!match || end > match.index + match[0].length)
|
||||
match = newMatch
|
||||
from = newMatch.index + 1
|
||||
}
|
||||
return match
|
||||
}
|
||||
|
||||
function searchRegexpBackward(doc, regexp, start) {
|
||||
regexp = ensureFlags(regexp, "g")
|
||||
for (var line = start.line, ch = start.ch, first = doc.firstLine(); line >= first; line--, ch = -1) {
|
||||
var string = doc.getLine(line)
|
||||
var match = lastMatchIn(string, regexp, ch < 0 ? 0 : string.length - ch)
|
||||
if (match)
|
||||
return {from: Pos(line, match.index),
|
||||
to: Pos(line, match.index + match[0].length),
|
||||
match: match}
|
||||
}
|
||||
}
|
||||
|
||||
function searchRegexpBackwardMultiline(doc, regexp, start) {
|
||||
if (!maybeMultiline(regexp)) return searchRegexpBackward(doc, regexp, start)
|
||||
regexp = ensureFlags(regexp, "gm")
|
||||
var string, chunkSize = 1, endMargin = doc.getLine(start.line).length - start.ch
|
||||
for (var line = start.line, first = doc.firstLine(); line >= first;) {
|
||||
for (var i = 0; i < chunkSize && line >= first; i++) {
|
||||
var curLine = doc.getLine(line--)
|
||||
string = string == null ? curLine : curLine + "\n" + string
|
||||
}
|
||||
chunkSize *= 2
|
||||
|
||||
var match = lastMatchIn(string, regexp, endMargin)
|
||||
if (match) {
|
||||
var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
|
||||
var startLine = line + before.length, startCh = before[before.length - 1].length
|
||||
return {from: Pos(startLine, startCh),
|
||||
to: Pos(startLine + inside.length - 1,
|
||||
inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
|
||||
match: match}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var doFold, noFold
|
||||
if (String.prototype.normalize) {
|
||||
doFold = function(str) { return str.normalize("NFD").toLowerCase() }
|
||||
noFold = function(str) { return str.normalize("NFD") }
|
||||
} else {
|
||||
doFold = function(str) { return str.toLowerCase() }
|
||||
noFold = function(str) { return str }
|
||||
}
|
||||
|
||||
// Maps a position in a case-folded line back to a position in the original line
|
||||
// (compensating for codepoints increasing in number during folding)
|
||||
function adjustPos(orig, folded, pos, foldFunc) {
|
||||
if (orig.length == folded.length) return pos
|
||||
for (var min = 0, max = pos + Math.max(0, orig.length - folded.length);;) {
|
||||
if (min == max) return min
|
||||
var mid = (min + max) >> 1
|
||||
var len = foldFunc(orig.slice(0, mid)).length
|
||||
if (len == pos) return mid
|
||||
else if (len > pos) max = mid
|
||||
else min = mid + 1
|
||||
}
|
||||
}
|
||||
|
||||
function searchStringForward(doc, query, start, caseFold) {
|
||||
// Empty string would match anything and never progress, so we
|
||||
// define it to match nothing instead.
|
||||
if (!query.length) return null
|
||||
var fold = caseFold ? doFold : noFold
|
||||
var lines = fold(query).split(/\r|\n\r?/)
|
||||
|
||||
search: for (var line = start.line, ch = start.ch, last = doc.lastLine() + 1 - lines.length; line <= last; line++, ch = 0) {
|
||||
var orig = doc.getLine(line).slice(ch), string = fold(orig)
|
||||
if (lines.length == 1) {
|
||||
var found = string.indexOf(lines[0])
|
||||
if (found == -1) continue search
|
||||
var start = adjustPos(orig, string, found, fold) + ch
|
||||
return {from: Pos(line, adjustPos(orig, string, found, fold) + ch),
|
||||
to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold) + ch)}
|
||||
} else {
|
||||
var cutFrom = string.length - lines[0].length
|
||||
if (string.slice(cutFrom) != lines[0]) continue search
|
||||
for (var i = 1; i < lines.length - 1; i++)
|
||||
if (fold(doc.getLine(line + i)) != lines[i]) continue search
|
||||
var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1]
|
||||
if (endString.slice(0, lastLine.length) != lastLine) continue search
|
||||
return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch),
|
||||
to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function searchStringBackward(doc, query, start, caseFold) {
|
||||
if (!query.length) return null
|
||||
var fold = caseFold ? doFold : noFold
|
||||
var lines = fold(query).split(/\r|\n\r?/)
|
||||
|
||||
search: for (var line = start.line, ch = start.ch, first = doc.firstLine() - 1 + lines.length; line >= first; line--, ch = -1) {
|
||||
var orig = doc.getLine(line)
|
||||
if (ch > -1) orig = orig.slice(0, ch)
|
||||
var string = fold(orig)
|
||||
if (lines.length == 1) {
|
||||
var found = string.lastIndexOf(lines[0])
|
||||
if (found == -1) continue search
|
||||
return {from: Pos(line, adjustPos(orig, string, found, fold)),
|
||||
to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold))}
|
||||
} else {
|
||||
var lastLine = lines[lines.length - 1]
|
||||
if (string.slice(0, lastLine.length) != lastLine) continue search
|
||||
for (var i = 1, start = line - lines.length + 1; i < lines.length - 1; i++)
|
||||
if (fold(doc.getLine(start + i)) != lines[i]) continue search
|
||||
var top = doc.getLine(line + 1 - lines.length), topString = fold(top)
|
||||
if (topString.slice(topString.length - lines[0].length) != lines[0]) continue search
|
||||
return {from: Pos(line + 1 - lines.length, adjustPos(top, topString, top.length - lines[0].length, fold)),
|
||||
to: Pos(line, adjustPos(orig, string, lastLine.length, fold))}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SearchCursor(doc, query, pos, options) {
|
||||
this.atOccurrence = false
|
||||
this.doc = doc
|
||||
pos = pos ? doc.clipPos(pos) : Pos(0, 0)
|
||||
this.pos = {from: pos, to: pos}
|
||||
|
||||
var caseFold
|
||||
if (typeof options == "object") {
|
||||
caseFold = options.caseFold
|
||||
} else { // Backwards compat for when caseFold was the 4th argument
|
||||
caseFold = options
|
||||
options = null
|
||||
}
|
||||
|
||||
if (typeof query == "string") {
|
||||
if (caseFold == null) caseFold = false
|
||||
this.matches = function(reverse, pos) {
|
||||
return (reverse ? searchStringBackward : searchStringForward)(doc, query, pos, caseFold)
|
||||
}
|
||||
} else {
|
||||
query = ensureFlags(query, "gm")
|
||||
if (!options || options.multiline !== false)
|
||||
this.matches = function(reverse, pos) {
|
||||
return (reverse ? searchRegexpBackwardMultiline : searchRegexpForwardMultiline)(doc, query, pos)
|
||||
}
|
||||
else
|
||||
this.matches = function(reverse, pos) {
|
||||
return (reverse ? searchRegexpBackward : searchRegexpForward)(doc, query, pos)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SearchCursor.prototype = {
|
||||
findNext: function() {return this.find(false)},
|
||||
findPrevious: function() {return this.find(true)},
|
||||
|
||||
find: function(reverse) {
|
||||
var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to))
|
||||
|
||||
// Implements weird auto-growing behavior on null-matches for
|
||||
// backwards-compatibility with the vim code (unfortunately)
|
||||
while (result && CodeMirror.cmpPos(result.from, result.to) == 0) {
|
||||
if (reverse) {
|
||||
if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1)
|
||||
else if (result.from.line == this.doc.firstLine()) result = null
|
||||
else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1)))
|
||||
} else {
|
||||
if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1)
|
||||
else if (result.to.line == this.doc.lastLine()) result = null
|
||||
else result = this.matches(reverse, Pos(result.to.line + 1, 0))
|
||||
}
|
||||
}
|
||||
|
||||
if (result) {
|
||||
this.pos = result
|
||||
this.atOccurrence = true
|
||||
return this.pos.match || true
|
||||
} else {
|
||||
var end = Pos(reverse ? this.doc.firstLine() : this.doc.lastLine() + 1, 0)
|
||||
this.pos = {from: end, to: end}
|
||||
return this.atOccurrence = false
|
||||
}
|
||||
},
|
||||
|
||||
from: function() {if (this.atOccurrence) return this.pos.from},
|
||||
to: function() {if (this.atOccurrence) return this.pos.to},
|
||||
|
||||
replace: function(newText, origin) {
|
||||
if (!this.atOccurrence) return
|
||||
var lines = CodeMirror.splitLines(newText)
|
||||
this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin)
|
||||
this.pos.to = Pos(this.pos.from.line + lines.length - 1,
|
||||
lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0))
|
||||
}
|
||||
}
|
||||
|
||||
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
|
||||
return new SearchCursor(this.doc, query, pos, caseFold)
|
||||
})
|
||||
CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) {
|
||||
return new SearchCursor(this, query, pos, caseFold)
|
||||
})
|
||||
|
||||
CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
|
||||
var ranges = []
|
||||
var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold)
|
||||
while (cur.findNext()) {
|
||||
if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break
|
||||
ranges.push({anchor: cur.from(), head: cur.to()})
|
||||
}
|
||||
if (ranges.length)
|
||||
this.setSelections(ranges, 0)
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,344 @@
|
||||
/* BASICS */
|
||||
|
||||
.CodeMirror {
|
||||
/* Set height, width, borders, and global font properties here */
|
||||
font-family: monospace;
|
||||
height: 300px;
|
||||
color: black;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
/* PADDING */
|
||||
|
||||
.CodeMirror-lines {
|
||||
padding: 4px 0; /* Vertical padding around content */
|
||||
}
|
||||
.CodeMirror pre.CodeMirror-line,
|
||||
.CodeMirror pre.CodeMirror-line-like {
|
||||
padding: 0 4px; /* Horizontal padding of content */
|
||||
}
|
||||
|
||||
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
background-color: white; /* The little square between H and V scrollbars */
|
||||
}
|
||||
|
||||
/* GUTTER */
|
||||
|
||||
.CodeMirror-gutters {
|
||||
border-right: 1px solid #ddd;
|
||||
background-color: #f7f7f7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.CodeMirror-linenumbers {}
|
||||
.CodeMirror-linenumber {
|
||||
padding: 0 3px 0 5px;
|
||||
min-width: 20px;
|
||||
text-align: right;
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.CodeMirror-guttermarker { color: black; }
|
||||
.CodeMirror-guttermarker-subtle { color: #999; }
|
||||
|
||||
/* CURSOR */
|
||||
|
||||
.CodeMirror-cursor {
|
||||
border-left: 1px solid black;
|
||||
border-right: none;
|
||||
width: 0;
|
||||
}
|
||||
/* Shown when moving in bi-directional text */
|
||||
.CodeMirror div.CodeMirror-secondarycursor {
|
||||
border-left: 1px solid silver;
|
||||
}
|
||||
.cm-fat-cursor .CodeMirror-cursor {
|
||||
width: auto;
|
||||
border: 0 !important;
|
||||
background: #7e7;
|
||||
}
|
||||
.cm-fat-cursor div.CodeMirror-cursors {
|
||||
z-index: 1;
|
||||
}
|
||||
.cm-fat-cursor .CodeMirror-line::selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span::selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; }
|
||||
.cm-fat-cursor .CodeMirror-line::-moz-selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span::-moz-selection,
|
||||
.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; }
|
||||
.cm-fat-cursor { caret-color: transparent; }
|
||||
@-moz-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
@-webkit-keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
@keyframes blink {
|
||||
0% {}
|
||||
50% { background-color: transparent; }
|
||||
100% {}
|
||||
}
|
||||
|
||||
/* Can style cursor different in overwrite (non-insert) mode */
|
||||
.CodeMirror-overwrite .CodeMirror-cursor {}
|
||||
|
||||
.cm-tab { display: inline-block; text-decoration: inherit; }
|
||||
|
||||
.CodeMirror-rulers {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: -50px; bottom: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.CodeMirror-ruler {
|
||||
border-left: 1px solid #ccc;
|
||||
top: 0; bottom: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* DEFAULT THEME */
|
||||
|
||||
.cm-s-default .cm-header {color: blue;}
|
||||
.cm-s-default .cm-quote {color: #090;}
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
|
||||
.cm-s-default .cm-keyword {color: #708;}
|
||||
.cm-s-default .cm-atom {color: #219;}
|
||||
.cm-s-default .cm-number {color: #164;}
|
||||
.cm-s-default .cm-def {color: #00f;}
|
||||
.cm-s-default .cm-variable,
|
||||
.cm-s-default .cm-punctuation,
|
||||
.cm-s-default .cm-property,
|
||||
.cm-s-default .cm-operator {}
|
||||
.cm-s-default .cm-variable-2 {color: #05a;}
|
||||
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
|
||||
.cm-s-default .cm-comment {color: #a50;}
|
||||
.cm-s-default .cm-string {color: #a11;}
|
||||
.cm-s-default .cm-string-2 {color: #f50;}
|
||||
.cm-s-default .cm-meta {color: #555;}
|
||||
.cm-s-default .cm-qualifier {color: #555;}
|
||||
.cm-s-default .cm-builtin {color: #30a;}
|
||||
.cm-s-default .cm-bracket {color: #997;}
|
||||
.cm-s-default .cm-tag {color: #170;}
|
||||
.cm-s-default .cm-attribute {color: #00c;}
|
||||
.cm-s-default .cm-hr {color: #999;}
|
||||
.cm-s-default .cm-link {color: #00c;}
|
||||
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
|
||||
.CodeMirror-composing { border-bottom: 2px solid; }
|
||||
|
||||
/* Default styles for common addons */
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
|
||||
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
||||
.CodeMirror-activeline-background {background: #e8f2ff;}
|
||||
|
||||
/* STOP */
|
||||
|
||||
/* The rest of this file contains styles related to the mechanics of
|
||||
the editor. You probably shouldn't touch them. */
|
||||
|
||||
.CodeMirror {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.CodeMirror-scroll {
|
||||
overflow: scroll !important; /* Things will break if this is overridden */
|
||||
/* 50px is the magic margin used to hide the element's real scrollbars */
|
||||
/* See overflow: hidden in .CodeMirror */
|
||||
margin-bottom: -50px; margin-right: -50px;
|
||||
padding-bottom: 50px;
|
||||
height: 100%;
|
||||
outline: none; /* Prevent dragging from highlighting the element */
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
.CodeMirror-sizer {
|
||||
position: relative;
|
||||
border-right: 50px solid transparent;
|
||||
}
|
||||
|
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||
before actual scrolling happens, thus preventing shaking and
|
||||
flickering artifacts. */
|
||||
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
display: none;
|
||||
outline: none;
|
||||
}
|
||||
.CodeMirror-vscrollbar {
|
||||
right: 0; top: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.CodeMirror-hscrollbar {
|
||||
bottom: 0; left: 0;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.CodeMirror-scrollbar-filler {
|
||||
right: 0; bottom: 0;
|
||||
}
|
||||
.CodeMirror-gutter-filler {
|
||||
left: 0; bottom: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-gutters {
|
||||
position: absolute; left: 0; top: 0;
|
||||
min-height: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
.CodeMirror-gutter {
|
||||
white-space: normal;
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-bottom: -50px;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper {
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
}
|
||||
.CodeMirror-gutter-background {
|
||||
position: absolute;
|
||||
top: 0; bottom: 0;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-elt {
|
||||
position: absolute;
|
||||
cursor: default;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
|
||||
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
|
||||
|
||||
.CodeMirror-lines {
|
||||
cursor: text;
|
||||
min-height: 1px; /* prevents collapsing before first draw */
|
||||
}
|
||||
.CodeMirror pre.CodeMirror-line,
|
||||
.CodeMirror pre.CodeMirror-line-like {
|
||||
/* Reset some styles that the rest of the page might have set */
|
||||
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||
border-width: 0;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
white-space: pre;
|
||||
word-wrap: normal;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-font-variant-ligatures: contextual;
|
||||
font-variant-ligatures: contextual;
|
||||
}
|
||||
.CodeMirror-wrap pre.CodeMirror-line,
|
||||
.CodeMirror-wrap pre.CodeMirror-line-like {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.CodeMirror-linebackground {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: 0; bottom: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-linewidget {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
||||
}
|
||||
|
||||
.CodeMirror-widget {}
|
||||
|
||||
.CodeMirror-rtl pre { direction: rtl; }
|
||||
|
||||
.CodeMirror-code {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Force content-box sizing for the elements where we expect it */
|
||||
.CodeMirror-scroll,
|
||||
.CodeMirror-sizer,
|
||||
.CodeMirror-gutter,
|
||||
.CodeMirror-gutters,
|
||||
.CodeMirror-linenumber {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.CodeMirror-measure {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror-cursor {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.CodeMirror-measure pre { position: static; }
|
||||
|
||||
div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
}
|
||||
div.CodeMirror-dragcursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-focused div.CodeMirror-cursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-selected { background: #d9d9d9; }
|
||||
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
||||
.CodeMirror-crosshair { cursor: crosshair; }
|
||||
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
|
||||
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
|
||||
|
||||
.cm-searching {
|
||||
background-color: #ffa;
|
||||
background-color: rgba(255, 255, 0, .4);
|
||||
}
|
||||
|
||||
/* Used to force a border model for a node */
|
||||
.cm-force-border { padding-right: .1px; }
|
||||
|
||||
@media print {
|
||||
/* Hide the cursor when printing */
|
||||
.CodeMirror div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
/* See issue #2901 */
|
||||
.cm-tab-wrap-hack:after { content: ''; }
|
||||
|
||||
/* Help users use markselection to safely style text background */
|
||||
span.CodeMirror-selectedtext { background: none; }
|
||||
File diff suppressed because it is too large
Load Diff
9800
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/codemirror.min.js
vendored
Normal file
9800
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/codemirror.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
766
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/css.js
vendored
Normal file
766
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/css.js
vendored
Normal file
@@ -0,0 +1,766 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("css", function(config, parserConfig) {
|
||||
if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
|
||||
|
||||
var indentUnit = config.indentUnit,
|
||||
tokenHooks = parserConfig.tokenHooks,
|
||||
documentTypes = parserConfig.documentTypes || {},
|
||||
mediaTypes = parserConfig.mediaTypes || {},
|
||||
mediaFeatures = parserConfig.mediaFeatures || {},
|
||||
propertyKeywords = parserConfig.propertyKeywords || {},
|
||||
nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
|
||||
fontProperties = parserConfig.fontProperties || {},
|
||||
counterDescriptors = parserConfig.counterDescriptors || {},
|
||||
colorKeywords = parserConfig.colorKeywords || {},
|
||||
valueKeywords = parserConfig.valueKeywords || {},
|
||||
allowNested = parserConfig.allowNested;
|
||||
|
||||
var type, override;
|
||||
function ret(style, tp) { type = tp; return style; }
|
||||
|
||||
// Tokenizers
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
if (tokenHooks[ch]) {
|
||||
var result = tokenHooks[ch](stream, state);
|
||||
if (result !== false) return result;
|
||||
}
|
||||
if (ch == "@") {
|
||||
stream.eatWhile(/[\w\\\-]/);
|
||||
return ret("def", stream.current());
|
||||
} else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
|
||||
return ret(null, "compare");
|
||||
} else if (ch == "\"" || ch == "'") {
|
||||
state.tokenize = tokenString(ch);
|
||||
return state.tokenize(stream, state);
|
||||
} else if (ch == "#") {
|
||||
stream.eatWhile(/[\w\\\-]/);
|
||||
return ret("atom", "hash");
|
||||
} else if (ch == "!") {
|
||||
stream.match(/^\s*\w*/);
|
||||
return ret("keyword", "important");
|
||||
} else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
|
||||
stream.eatWhile(/[\w.%]/);
|
||||
return ret("number", "unit");
|
||||
} else if (ch === "-") {
|
||||
if (/[\d.]/.test(stream.peek())) {
|
||||
stream.eatWhile(/[\w.%]/);
|
||||
return ret("number", "unit");
|
||||
} else if (stream.match(/^-[\w\\\-]+/)) {
|
||||
stream.eatWhile(/[\w\\\-]/);
|
||||
if (stream.match(/^\s*:/, false))
|
||||
return ret("variable-2", "variable-definition");
|
||||
return ret("variable-2", "variable");
|
||||
} else if (stream.match(/^\w+-/)) {
|
||||
return ret("meta", "meta");
|
||||
}
|
||||
} else if (/[,+>*\/]/.test(ch)) {
|
||||
return ret(null, "select-op");
|
||||
} else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
|
||||
return ret("qualifier", "qualifier");
|
||||
} else if (/[:;{}\[\]\(\)]/.test(ch)) {
|
||||
return ret(null, ch);
|
||||
} else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) ||
|
||||
(ch == "d" && stream.match("omain(")) ||
|
||||
(ch == "r" && stream.match("egexp("))) {
|
||||
stream.backUp(1);
|
||||
state.tokenize = tokenParenthesized;
|
||||
return ret("property", "word");
|
||||
} else if (/[\w\\\-]/.test(ch)) {
|
||||
stream.eatWhile(/[\w\\\-]/);
|
||||
return ret("property", "word");
|
||||
} else {
|
||||
return ret(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
function tokenString(quote) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, ch;
|
||||
while ((ch = stream.next()) != null) {
|
||||
if (ch == quote && !escaped) {
|
||||
if (quote == ")") stream.backUp(1);
|
||||
break;
|
||||
}
|
||||
escaped = !escaped && ch == "\\";
|
||||
}
|
||||
if (ch == quote || !escaped && quote != ")") state.tokenize = null;
|
||||
return ret("string", "string");
|
||||
};
|
||||
}
|
||||
|
||||
function tokenParenthesized(stream, state) {
|
||||
stream.next(); // Must be '('
|
||||
if (!stream.match(/\s*[\"\')]/, false))
|
||||
state.tokenize = tokenString(")");
|
||||
else
|
||||
state.tokenize = null;
|
||||
return ret(null, "(");
|
||||
}
|
||||
|
||||
// Context management
|
||||
|
||||
function Context(type, indent, prev) {
|
||||
this.type = type;
|
||||
this.indent = indent;
|
||||
this.prev = prev;
|
||||
}
|
||||
|
||||
function pushContext(state, stream, type) {
|
||||
state.context = new Context(type, stream.indentation() + indentUnit, state.context);
|
||||
return type;
|
||||
}
|
||||
|
||||
function popContext(state) {
|
||||
state.context = state.context.prev;
|
||||
return state.context.type;
|
||||
}
|
||||
|
||||
function pass(type, stream, state) {
|
||||
return states[state.context.type](type, stream, state);
|
||||
}
|
||||
function popAndPass(type, stream, state, n) {
|
||||
for (var i = n || 1; i > 0; i--)
|
||||
state.context = state.context.prev;
|
||||
return pass(type, stream, state);
|
||||
}
|
||||
|
||||
// Parser
|
||||
|
||||
function wordAsValue(stream) {
|
||||
var word = stream.current().toLowerCase();
|
||||
if (valueKeywords.hasOwnProperty(word))
|
||||
override = "atom";
|
||||
else if (colorKeywords.hasOwnProperty(word))
|
||||
override = "keyword";
|
||||
else
|
||||
override = "variable";
|
||||
}
|
||||
|
||||
var states = {};
|
||||
|
||||
states.top = function(type, stream, state) {
|
||||
if (type == "{") {
|
||||
return pushContext(state, stream, "block");
|
||||
} else if (type == "}" && state.context.prev) {
|
||||
return popContext(state);
|
||||
} else if (/@(media|supports|(-moz-)?document)/.test(type)) {
|
||||
return pushContext(state, stream, "atBlock");
|
||||
} else if (/@(font-face|counter-style)/.test(type)) {
|
||||
state.stateArg = type;
|
||||
return "restricted_atBlock_before";
|
||||
} else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
|
||||
return "keyframes";
|
||||
} else if (type && type.charAt(0) == "@") {
|
||||
return pushContext(state, stream, "at");
|
||||
} else if (type == "hash") {
|
||||
override = "builtin";
|
||||
} else if (type == "word") {
|
||||
override = "tag";
|
||||
} else if (type == "variable-definition") {
|
||||
return "maybeprop";
|
||||
} else if (type == "interpolation") {
|
||||
return pushContext(state, stream, "interpolation");
|
||||
} else if (type == ":") {
|
||||
return "pseudo";
|
||||
} else if (allowNested && type == "(") {
|
||||
return pushContext(state, stream, "parens");
|
||||
}
|
||||
return state.context.type;
|
||||
};
|
||||
|
||||
states.block = function(type, stream, state) {
|
||||
if (type == "word") {
|
||||
var word = stream.current().toLowerCase();
|
||||
if (propertyKeywords.hasOwnProperty(word)) {
|
||||
override = "property";
|
||||
return "maybeprop";
|
||||
} else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
|
||||
override = "string-2";
|
||||
return "maybeprop";
|
||||
} else if (allowNested) {
|
||||
override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
|
||||
return "block";
|
||||
} else {
|
||||
override += " error";
|
||||
return "maybeprop";
|
||||
}
|
||||
} else if (type == "meta") {
|
||||
return "block";
|
||||
} else if (!allowNested && (type == "hash" || type == "qualifier")) {
|
||||
override = "error";
|
||||
return "block";
|
||||
} else {
|
||||
return states.top(type, stream, state);
|
||||
}
|
||||
};
|
||||
|
||||
states.maybeprop = function(type, stream, state) {
|
||||
if (type == ":") return pushContext(state, stream, "prop");
|
||||
return pass(type, stream, state);
|
||||
};
|
||||
|
||||
states.prop = function(type, stream, state) {
|
||||
if (type == ";") return popContext(state);
|
||||
if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
|
||||
if (type == "}" || type == "{") return popAndPass(type, stream, state);
|
||||
if (type == "(") return pushContext(state, stream, "parens");
|
||||
|
||||
if (type == "hash" && !/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
|
||||
override += " error";
|
||||
} else if (type == "word") {
|
||||
wordAsValue(stream);
|
||||
} else if (type == "interpolation") {
|
||||
return pushContext(state, stream, "interpolation");
|
||||
}
|
||||
return "prop";
|
||||
};
|
||||
|
||||
states.propBlock = function(type, _stream, state) {
|
||||
if (type == "}") return popContext(state);
|
||||
if (type == "word") { override = "property"; return "maybeprop"; }
|
||||
return state.context.type;
|
||||
};
|
||||
|
||||
states.parens = function(type, stream, state) {
|
||||
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
||||
if (type == ")") return popContext(state);
|
||||
if (type == "(") return pushContext(state, stream, "parens");
|
||||
if (type == "word") wordAsValue(stream);
|
||||
return "parens";
|
||||
};
|
||||
|
||||
states.pseudo = function(type, stream, state) {
|
||||
if (type == "word") {
|
||||
override = "variable-3";
|
||||
return state.context.type;
|
||||
}
|
||||
return pass(type, stream, state);
|
||||
};
|
||||
|
||||
states.atBlock = function(type, stream, state) {
|
||||
if (type == "(") return pushContext(state, stream, "atBlock_parens");
|
||||
if (type == "}") return popAndPass(type, stream, state);
|
||||
if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
|
||||
|
||||
if (type == "word") {
|
||||
var word = stream.current().toLowerCase();
|
||||
if (word == "only" || word == "not" || word == "and" || word == "or")
|
||||
override = "keyword";
|
||||
else if (documentTypes.hasOwnProperty(word))
|
||||
override = "tag";
|
||||
else if (mediaTypes.hasOwnProperty(word))
|
||||
override = "attribute";
|
||||
else if (mediaFeatures.hasOwnProperty(word))
|
||||
override = "property";
|
||||
else if (propertyKeywords.hasOwnProperty(word))
|
||||
override = "property";
|
||||
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
|
||||
override = "string-2";
|
||||
else if (valueKeywords.hasOwnProperty(word))
|
||||
override = "atom";
|
||||
else
|
||||
override = "error";
|
||||
}
|
||||
return state.context.type;
|
||||
};
|
||||
|
||||
states.atBlock_parens = function(type, stream, state) {
|
||||
if (type == ")") return popContext(state);
|
||||
if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
|
||||
return states.atBlock(type, stream, state);
|
||||
};
|
||||
|
||||
states.restricted_atBlock_before = function(type, stream, state) {
|
||||
if (type == "{")
|
||||
return pushContext(state, stream, "restricted_atBlock");
|
||||
if (type == "word" && state.stateArg == "@counter-style") {
|
||||
override = "variable";
|
||||
return "restricted_atBlock_before";
|
||||
}
|
||||
return pass(type, stream, state);
|
||||
};
|
||||
|
||||
states.restricted_atBlock = function(type, stream, state) {
|
||||
if (type == "}") {
|
||||
state.stateArg = null;
|
||||
return popContext(state);
|
||||
}
|
||||
if (type == "word") {
|
||||
if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
|
||||
(state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
|
||||
override = "error";
|
||||
else
|
||||
override = "property";
|
||||
return "maybeprop";
|
||||
}
|
||||
return "restricted_atBlock";
|
||||
};
|
||||
|
||||
states.keyframes = function(type, stream, state) {
|
||||
if (type == "word") { override = "variable"; return "keyframes"; }
|
||||
if (type == "{") return pushContext(state, stream, "top");
|
||||
return pass(type, stream, state);
|
||||
};
|
||||
|
||||
states.at = function(type, stream, state) {
|
||||
if (type == ";") return popContext(state);
|
||||
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
||||
if (type == "word") override = "tag";
|
||||
else if (type == "hash") override = "builtin";
|
||||
return "at";
|
||||
};
|
||||
|
||||
states.interpolation = function(type, stream, state) {
|
||||
if (type == "}") return popContext(state);
|
||||
if (type == "{" || type == ";") return popAndPass(type, stream, state);
|
||||
if (type != "variable") override = "error";
|
||||
return "interpolation";
|
||||
};
|
||||
|
||||
return {
|
||||
startState: function(base) {
|
||||
return {tokenize: null,
|
||||
state: "top",
|
||||
stateArg: null,
|
||||
context: new Context("top", base || 0, null)};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
if (!state.tokenize && stream.eatSpace()) return null;
|
||||
var style = (state.tokenize || tokenBase)(stream, state);
|
||||
if (style && typeof style == "object") {
|
||||
type = style[1];
|
||||
style = style[0];
|
||||
}
|
||||
override = style;
|
||||
state.state = states[state.state](type, stream, state);
|
||||
return override;
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
var cx = state.context, ch = textAfter && textAfter.charAt(0);
|
||||
var indent = cx.indent;
|
||||
if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
|
||||
if (cx.prev &&
|
||||
(ch == "}" && (cx.type == "block" || cx.type == "top" || cx.type == "interpolation" || cx.type == "restricted_atBlock") ||
|
||||
ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
|
||||
ch == "{" && (cx.type == "at" || cx.type == "atBlock"))) {
|
||||
indent = cx.indent - indentUnit;
|
||||
cx = cx.prev;
|
||||
}
|
||||
return indent;
|
||||
},
|
||||
|
||||
electricChars: "}",
|
||||
blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/",
|
||||
fold: "brace"
|
||||
};
|
||||
});
|
||||
|
||||
function keySet(array) {
|
||||
var keys = {};
|
||||
for (var i = 0; i < array.length; ++i) {
|
||||
keys[array[i]] = true;
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
var documentTypes_ = [
|
||||
"domain", "regexp", "url", "url-prefix"
|
||||
], documentTypes = keySet(documentTypes_);
|
||||
|
||||
var mediaTypes_ = [
|
||||
"all", "aural", "braille", "handheld", "print", "projection", "screen",
|
||||
"tty", "tv", "embossed"
|
||||
], mediaTypes = keySet(mediaTypes_);
|
||||
|
||||
var mediaFeatures_ = [
|
||||
"width", "min-width", "max-width", "height", "min-height", "max-height",
|
||||
"device-width", "min-device-width", "max-device-width", "device-height",
|
||||
"min-device-height", "max-device-height", "aspect-ratio",
|
||||
"min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
|
||||
"min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
|
||||
"max-color", "color-index", "min-color-index", "max-color-index",
|
||||
"monochrome", "min-monochrome", "max-monochrome", "resolution",
|
||||
"min-resolution", "max-resolution", "scan", "grid"
|
||||
], mediaFeatures = keySet(mediaFeatures_);
|
||||
|
||||
var propertyKeywords_ = [
|
||||
"align-content", "align-items", "align-self", "alignment-adjust",
|
||||
"alignment-baseline", "anchor-point", "animation", "animation-delay",
|
||||
"animation-direction", "animation-duration", "animation-fill-mode",
|
||||
"animation-iteration-count", "animation-name", "animation-play-state",
|
||||
"animation-timing-function", "appearance", "azimuth", "backface-visibility",
|
||||
"background", "background-attachment", "background-clip", "background-color",
|
||||
"background-image", "background-origin", "background-position",
|
||||
"background-repeat", "background-size", "baseline-shift", "binding",
|
||||
"bleed", "bookmark-label", "bookmark-level", "bookmark-state",
|
||||
"bookmark-target", "border", "border-bottom", "border-bottom-color",
|
||||
"border-bottom-left-radius", "border-bottom-right-radius",
|
||||
"border-bottom-style", "border-bottom-width", "border-collapse",
|
||||
"border-color", "border-image", "border-image-outset",
|
||||
"border-image-repeat", "border-image-slice", "border-image-source",
|
||||
"border-image-width", "border-left", "border-left-color",
|
||||
"border-left-style", "border-left-width", "border-radius", "border-right",
|
||||
"border-right-color", "border-right-style", "border-right-width",
|
||||
"border-spacing", "border-style", "border-top", "border-top-color",
|
||||
"border-top-left-radius", "border-top-right-radius", "border-top-style",
|
||||
"border-top-width", "border-width", "bottom", "box-decoration-break",
|
||||
"box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
|
||||
"caption-side", "clear", "clip", "color", "color-profile", "column-count",
|
||||
"column-fill", "column-gap", "column-rule", "column-rule-color",
|
||||
"column-rule-style", "column-rule-width", "column-span", "column-width",
|
||||
"columns", "content", "counter-increment", "counter-reset", "crop", "cue",
|
||||
"cue-after", "cue-before", "cursor", "direction", "display",
|
||||
"dominant-baseline", "drop-initial-after-adjust",
|
||||
"drop-initial-after-align", "drop-initial-before-adjust",
|
||||
"drop-initial-before-align", "drop-initial-size", "drop-initial-value",
|
||||
"elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
|
||||
"flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
|
||||
"float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings",
|
||||
"font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust",
|
||||
"font-stretch", "font-style", "font-synthesis", "font-variant",
|
||||
"font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
|
||||
"font-variant-ligatures", "font-variant-numeric", "font-variant-position",
|
||||
"font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow",
|
||||
"grid-auto-position", "grid-auto-rows", "grid-column", "grid-column-end",
|
||||
"grid-column-start", "grid-row", "grid-row-end", "grid-row-start",
|
||||
"grid-template", "grid-template-areas", "grid-template-columns",
|
||||
"grid-template-rows", "hanging-punctuation", "height", "hyphens",
|
||||
"icon", "image-orientation", "image-rendering", "image-resolution",
|
||||
"inline-box-align", "justify-content", "left", "letter-spacing",
|
||||
"line-break", "line-height", "line-stacking", "line-stacking-ruby",
|
||||
"line-stacking-shift", "line-stacking-strategy", "list-style",
|
||||
"list-style-image", "list-style-position", "list-style-type", "margin",
|
||||
"margin-bottom", "margin-left", "margin-right", "margin-top",
|
||||
"marker-offset", "marks", "marquee-direction", "marquee-loop",
|
||||
"marquee-play-count", "marquee-speed", "marquee-style", "max-height",
|
||||
"max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
|
||||
"nav-left", "nav-right", "nav-up", "object-fit", "object-position",
|
||||
"opacity", "order", "orphans", "outline",
|
||||
"outline-color", "outline-offset", "outline-style", "outline-width",
|
||||
"overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
|
||||
"padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
|
||||
"page", "page-break-after", "page-break-before", "page-break-inside",
|
||||
"page-policy", "pause", "pause-after", "pause-before", "perspective",
|
||||
"perspective-origin", "pitch", "pitch-range", "play-during", "position",
|
||||
"presentation-level", "punctuation-trim", "quotes", "region-break-after",
|
||||
"region-break-before", "region-break-inside", "region-fragment",
|
||||
"rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
|
||||
"right", "rotation", "rotation-point", "ruby-align", "ruby-overhang",
|
||||
"ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin",
|
||||
"shape-outside", "size", "speak", "speak-as", "speak-header",
|
||||
"speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
|
||||
"tab-size", "table-layout", "target", "target-name", "target-new",
|
||||
"target-position", "text-align", "text-align-last", "text-decoration",
|
||||
"text-decoration-color", "text-decoration-line", "text-decoration-skip",
|
||||
"text-decoration-style", "text-emphasis", "text-emphasis-color",
|
||||
"text-emphasis-position", "text-emphasis-style", "text-height",
|
||||
"text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
|
||||
"text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
|
||||
"text-wrap", "top", "transform", "transform-origin", "transform-style",
|
||||
"transition", "transition-delay", "transition-duration",
|
||||
"transition-property", "transition-timing-function", "unicode-bidi",
|
||||
"vertical-align", "visibility", "voice-balance", "voice-duration",
|
||||
"voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
|
||||
"voice-volume", "volume", "white-space", "widows", "width", "word-break",
|
||||
"word-spacing", "word-wrap", "z-index",
|
||||
// SVG-specific
|
||||
"clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
|
||||
"flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
|
||||
"color-interpolation", "color-interpolation-filters",
|
||||
"color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
|
||||
"marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
|
||||
"stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
|
||||
"stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
|
||||
"baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
|
||||
"glyph-orientation-vertical", "text-anchor", "writing-mode"
|
||||
], propertyKeywords = keySet(propertyKeywords_);
|
||||
|
||||
var nonStandardPropertyKeywords_ = [
|
||||
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
|
||||
"scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
|
||||
"scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside",
|
||||
"searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
|
||||
"searchfield-results-decoration", "zoom"
|
||||
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
|
||||
|
||||
var fontProperties_ = [
|
||||
"font-family", "src", "unicode-range", "font-variant", "font-feature-settings",
|
||||
"font-stretch", "font-weight", "font-style"
|
||||
], fontProperties = keySet(fontProperties_);
|
||||
|
||||
var counterDescriptors_ = [
|
||||
"additive-symbols", "fallback", "negative", "pad", "prefix", "range",
|
||||
"speak-as", "suffix", "symbols", "system"
|
||||
], counterDescriptors = keySet(counterDescriptors_);
|
||||
|
||||
var colorKeywords_ = [
|
||||
"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
|
||||
"bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
|
||||
"burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
|
||||
"cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
|
||||
"darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
|
||||
"darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
|
||||
"darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
|
||||
"deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
|
||||
"floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
|
||||
"gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
|
||||
"hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
|
||||
"lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
|
||||
"lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
|
||||
"lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
|
||||
"lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
|
||||
"maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
|
||||
"mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
||||
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
|
||||
"navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
|
||||
"orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
|
||||
"papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
|
||||
"purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
|
||||
"salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
|
||||
"slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
|
||||
"teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
|
||||
"whitesmoke", "yellow", "yellowgreen"
|
||||
], colorKeywords = keySet(colorKeywords_);
|
||||
|
||||
var valueKeywords_ = [
|
||||
"above", "absolute", "activeborder", "additive", "activecaption", "afar",
|
||||
"after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
|
||||
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
|
||||
"arabic-indic", "armenian", "asterisks", "attr", "auto", "avoid", "avoid-column", "avoid-page",
|
||||
"avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
|
||||
"bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
|
||||
"both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
|
||||
"buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
|
||||
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
|
||||
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
|
||||
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
|
||||
"col-resize", "collapse", "column", "compact", "condensed", "contain", "content",
|
||||
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
|
||||
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "dashed", "decimal",
|
||||
"decimal-leading-zero", "default", "default-button", "destination-atop",
|
||||
"destination-in", "destination-out", "destination-over", "devanagari",
|
||||
"disc", "discard", "disclosure-closed", "disclosure-open", "document",
|
||||
"dot-dash", "dot-dot-dash",
|
||||
"dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
|
||||
"element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
|
||||
"ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
|
||||
"ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
|
||||
"ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
|
||||
"ethiopic-halehame-gez", "ethiopic-halehame-om-et",
|
||||
"ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
|
||||
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
|
||||
"ethiopic-numeric", "ew-resize", "expanded", "extends", "extra-condensed",
|
||||
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "footnotes",
|
||||
"forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
|
||||
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew",
|
||||
"help", "hidden", "hide", "higher", "highlight", "highlighttext",
|
||||
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
|
||||
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
|
||||
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
|
||||
"inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert",
|
||||
"italic", "japanese-formal", "japanese-informal", "justify", "kannada",
|
||||
"katakana", "katakana-iroha", "keep-all", "khmer",
|
||||
"korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
|
||||
"landscape", "lao", "large", "larger", "left", "level", "lighter",
|
||||
"line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
|
||||
"local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
|
||||
"lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
|
||||
"lower-roman", "lowercase", "ltr", "malayalam", "match", "matrix", "matrix3d",
|
||||
"media-controls-background", "media-current-time-display",
|
||||
"media-fullscreen-button", "media-mute-button", "media-play-button",
|
||||
"media-return-to-realtime-button", "media-rewind-button",
|
||||
"media-seek-back-button", "media-seek-forward-button", "media-slider",
|
||||
"media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
|
||||
"media-volume-slider-container", "media-volume-sliderthumb", "medium",
|
||||
"menu", "menulist", "menulist-button", "menulist-text",
|
||||
"menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
|
||||
"mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize",
|
||||
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
|
||||
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
|
||||
"ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
|
||||
"optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
|
||||
"outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
|
||||
"painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
|
||||
"pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
|
||||
"progress", "push-button", "radial-gradient", "radio", "read-only",
|
||||
"read-write", "read-write-plaintext-only", "rectangle", "region",
|
||||
"relative", "repeat", "repeating-linear-gradient",
|
||||
"repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
|
||||
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
|
||||
"rotateZ", "round", "row-resize", "rtl", "run-in", "running",
|
||||
"s-resize", "sans-serif", "scale", "scale3d", "scaleX", "scaleY", "scaleZ",
|
||||
"scroll", "scrollbar", "se-resize", "searchfield",
|
||||
"searchfield-cancel-button", "searchfield-decoration",
|
||||
"searchfield-results-button", "searchfield-results-decoration",
|
||||
"semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
|
||||
"simp-chinese-formal", "simp-chinese-informal", "single",
|
||||
"skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
|
||||
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
|
||||
"small", "small-caps", "small-caption", "smaller", "solid", "somali",
|
||||
"source-atop", "source-in", "source-out", "source-over", "space", "spell-out", "square",
|
||||
"square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
|
||||
"subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table",
|
||||
"table-caption", "table-cell", "table-column", "table-column-group",
|
||||
"table-footer-group", "table-header-group", "table-row", "table-row-group",
|
||||
"tamil",
|
||||
"telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
|
||||
"thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
|
||||
"threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
|
||||
"tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
|
||||
"trad-chinese-formal", "trad-chinese-informal",
|
||||
"translate", "translate3d", "translateX", "translateY", "translateZ",
|
||||
"transparent", "ultra-condensed", "ultra-expanded", "underline", "up",
|
||||
"upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
|
||||
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
|
||||
"var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
|
||||
"visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
|
||||
"window", "windowframe", "windowtext", "words", "x-large", "x-small", "xor",
|
||||
"xx-large", "xx-small"
|
||||
], valueKeywords = keySet(valueKeywords_);
|
||||
|
||||
var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(propertyKeywords_)
|
||||
.concat(nonStandardPropertyKeywords_).concat(colorKeywords_).concat(valueKeywords_);
|
||||
CodeMirror.registerHelper("hintWords", "css", allWords);
|
||||
|
||||
function tokenCComment(stream, state) {
|
||||
var maybeEnd = false, ch;
|
||||
while ((ch = stream.next()) != null) {
|
||||
if (maybeEnd && ch == "/") {
|
||||
state.tokenize = null;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "*");
|
||||
}
|
||||
return ["comment", "comment"];
|
||||
}
|
||||
|
||||
function tokenSGMLComment(stream, state) {
|
||||
if (stream.skipTo("-->")) {
|
||||
stream.match("-->");
|
||||
state.tokenize = null;
|
||||
} else {
|
||||
stream.skipToEnd();
|
||||
}
|
||||
return ["comment", "comment"];
|
||||
}
|
||||
|
||||
CodeMirror.defineMIME("text/css", {
|
||||
documentTypes: documentTypes,
|
||||
mediaTypes: mediaTypes,
|
||||
mediaFeatures: mediaFeatures,
|
||||
propertyKeywords: propertyKeywords,
|
||||
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
||||
fontProperties: fontProperties,
|
||||
counterDescriptors: counterDescriptors,
|
||||
colorKeywords: colorKeywords,
|
||||
valueKeywords: valueKeywords,
|
||||
tokenHooks: {
|
||||
"<": function(stream, state) {
|
||||
if (!stream.match("!--")) return false;
|
||||
state.tokenize = tokenSGMLComment;
|
||||
return tokenSGMLComment(stream, state);
|
||||
},
|
||||
"/": function(stream, state) {
|
||||
if (!stream.eat("*")) return false;
|
||||
state.tokenize = tokenCComment;
|
||||
return tokenCComment(stream, state);
|
||||
}
|
||||
},
|
||||
name: "css"
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-scss", {
|
||||
mediaTypes: mediaTypes,
|
||||
mediaFeatures: mediaFeatures,
|
||||
propertyKeywords: propertyKeywords,
|
||||
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
||||
colorKeywords: colorKeywords,
|
||||
valueKeywords: valueKeywords,
|
||||
fontProperties: fontProperties,
|
||||
allowNested: true,
|
||||
tokenHooks: {
|
||||
"/": function(stream, state) {
|
||||
if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return ["comment", "comment"];
|
||||
} else if (stream.eat("*")) {
|
||||
state.tokenize = tokenCComment;
|
||||
return tokenCComment(stream, state);
|
||||
} else {
|
||||
return ["operator", "operator"];
|
||||
}
|
||||
},
|
||||
":": function(stream) {
|
||||
if (stream.match(/\s*\{/))
|
||||
return [null, "{"];
|
||||
return false;
|
||||
},
|
||||
"$": function(stream) {
|
||||
stream.match(/^[\w-]+/);
|
||||
if (stream.match(/^\s*:/, false))
|
||||
return ["variable-2", "variable-definition"];
|
||||
return ["variable-2", "variable"];
|
||||
},
|
||||
"#": function(stream) {
|
||||
if (!stream.eat("{")) return false;
|
||||
return [null, "interpolation"];
|
||||
}
|
||||
},
|
||||
name: "css",
|
||||
helperType: "scss"
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-less", {
|
||||
mediaTypes: mediaTypes,
|
||||
mediaFeatures: mediaFeatures,
|
||||
propertyKeywords: propertyKeywords,
|
||||
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
||||
colorKeywords: colorKeywords,
|
||||
valueKeywords: valueKeywords,
|
||||
fontProperties: fontProperties,
|
||||
allowNested: true,
|
||||
tokenHooks: {
|
||||
"/": function(stream, state) {
|
||||
if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return ["comment", "comment"];
|
||||
} else if (stream.eat("*")) {
|
||||
state.tokenize = tokenCComment;
|
||||
return tokenCComment(stream, state);
|
||||
} else {
|
||||
return ["operator", "operator"];
|
||||
}
|
||||
},
|
||||
"@": function(stream) {
|
||||
if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false;
|
||||
stream.eatWhile(/[\w\\\-]/);
|
||||
if (stream.match(/^\s*:/, false))
|
||||
return ["variable-2", "variable-definition"];
|
||||
return ["variable-2", "variable"];
|
||||
},
|
||||
"&": function() {
|
||||
return ["atom", "atom"];
|
||||
}
|
||||
},
|
||||
name: "css",
|
||||
helperType: "less"
|
||||
});
|
||||
|
||||
});
|
||||
75
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/index.html
vendored
Normal file
75
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/index.html
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: CSS mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<link rel="stylesheet" href="../../addon/hint/show-hint.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="css.js"></script>
|
||||
<script src="../../addon/hint/show-hint.js"></script>
|
||||
<script src="../../addon/hint/css-hint.js"></script>
|
||||
<style>.CodeMirror {background: #f8f8f8;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">CSS</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>CSS mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
/* Some example CSS */
|
||||
|
||||
@import url("something.css");
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 3em 6em;
|
||||
font-family: tahoma, arial, sans-serif;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#navigation a {
|
||||
font-weight: bold;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.7em;
|
||||
}
|
||||
|
||||
h1:before, h2:before {
|
||||
content: "::";
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: courier, monospace;
|
||||
font-size: 80%;
|
||||
color: #418A8A;
|
||||
}
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
extraKeys: {"Ctrl-Space": "autocomplete"},
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/css</code>, <code>text/x-scss</code> (<a href="scss.html">demo</a>), <code>text/x-less</code> (<a href="less.html">demo</a>).</p>
|
||||
|
||||
<p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#css_*">normal</a>, <a href="../../test/index.html#verbose,css_*">verbose</a>.</p>
|
||||
|
||||
</article>
|
||||
152
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/less.html
vendored
Normal file
152
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/less.html
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: LESS mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="../../addon/edit/matchbrackets.js"></script>
|
||||
<script src="css.js"></script>
|
||||
<style>.CodeMirror {border: 1px solid #ddd; line-height: 1.2;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">LESS</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>LESS mode</h2>
|
||||
<form><textarea id="code" name="code">@media screen and (device-aspect-ratio: 16/9) { … }
|
||||
@media screen and (device-aspect-ratio: 1280/720) { … }
|
||||
@media screen and (device-aspect-ratio: 2560/1440) { … }
|
||||
|
||||
html:lang(fr-be)
|
||||
|
||||
tr:nth-child(2n+1) /* represents every odd row of an HTML table */
|
||||
|
||||
img:nth-of-type(2n+1) { float: right; }
|
||||
img:nth-of-type(2n) { float: left; }
|
||||
|
||||
body > h2:not(:first-of-type):not(:last-of-type)
|
||||
|
||||
html|*:not(:link):not(:visited)
|
||||
*|*:not(:hover)
|
||||
p::first-line { text-transform: uppercase }
|
||||
|
||||
@namespace foo url(http://www.example.com);
|
||||
foo|h1 { color: blue } /* first rule */
|
||||
|
||||
span[hello="Ocean"][goodbye="Land"]
|
||||
|
||||
E[foo]{
|
||||
padding:65px;
|
||||
}
|
||||
|
||||
input[type="search"]::-webkit-search-decoration,
|
||||
input[type="search"]::-webkit-search-cancel-button {
|
||||
-webkit-appearance: none; // Inner-padding issues in Chrome OSX, Safari 5
|
||||
}
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner { // Inner padding and border oddities in FF3/4
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
.btn {
|
||||
// reset here as of 2.0.3 due to Recess property order
|
||||
border-color: #ccc;
|
||||
border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);
|
||||
}
|
||||
fieldset span button, fieldset span input[type="file"] {
|
||||
font-size:12px;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.rounded-corners (@radius: 5px) {
|
||||
border-radius: @radius;
|
||||
-webkit-border-radius: @radius;
|
||||
-moz-border-radius: @radius;
|
||||
}
|
||||
|
||||
@import url("something.css");
|
||||
|
||||
@light-blue: hsl(190, 50%, 65%);
|
||||
|
||||
#menu {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: 3;
|
||||
clear: both;
|
||||
display: block;
|
||||
background-color: @blue;
|
||||
height: 42px;
|
||||
border-top: 2px solid lighten(@alpha-blue, 20%);
|
||||
border-bottom: 2px solid darken(@alpha-blue, 25%);
|
||||
.box-shadow(0, 1px, 8px, 0.6);
|
||||
-moz-box-shadow: 0 0 0 #000; // Because firefox sucks.
|
||||
|
||||
&.docked {
|
||||
background-color: hsla(210, 60%, 40%, 0.4);
|
||||
}
|
||||
&:hover {
|
||||
background-color: @blue;
|
||||
}
|
||||
|
||||
#dropdown {
|
||||
margin: 0 0 0 117px;
|
||||
padding: 0;
|
||||
padding-top: 5px;
|
||||
display: none;
|
||||
width: 190px;
|
||||
border-top: 2px solid @medium;
|
||||
color: @highlight;
|
||||
border: 2px solid darken(@medium, 25%);
|
||||
border-left-color: darken(@medium, 15%);
|
||||
border-right-color: darken(@medium, 15%);
|
||||
border-top-width: 0;
|
||||
background-color: darken(@medium, 10%);
|
||||
ul {
|
||||
padding: 0px;
|
||||
}
|
||||
li {
|
||||
font-size: 14px;
|
||||
display: block;
|
||||
text-align: left;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
a {
|
||||
display: block;
|
||||
padding: 0px 15px;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
&:hover {
|
||||
background-color: darken(@medium, 15%);
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.border-radius(5px, bottom);
|
||||
.box-shadow(0, 6px, 8px, 0.5);
|
||||
}
|
||||
}
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers : true,
|
||||
matchBrackets : true,
|
||||
mode: "text/x-less"
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>The LESS mode is a sub-mode of the <a href="index.html">CSS mode</a> (defined in <code>css.js</code>.</p>
|
||||
|
||||
<p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#less_*">normal</a>, <a href="../../test/index.html#verbose,less_*">verbose</a>.</p>
|
||||
</article>
|
||||
51
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/less_test.js
vendored
Normal file
51
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/less_test.js
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-less");
|
||||
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "less"); }
|
||||
|
||||
MT("variable",
|
||||
"[variable-2 @base]: [atom #f04615];",
|
||||
"[qualifier .class] {",
|
||||
" [property width]: [variable percentage]([number 0.5]); [comment // returns `50%`]",
|
||||
" [property color]: [variable saturate]([variable-2 @base], [number 5%]);",
|
||||
"}");
|
||||
|
||||
MT("amp",
|
||||
"[qualifier .child], [qualifier .sibling] {",
|
||||
" [qualifier .parent] [atom &] {",
|
||||
" [property color]: [keyword black];",
|
||||
" }",
|
||||
" [atom &] + [atom &] {",
|
||||
" [property color]: [keyword red];",
|
||||
" }",
|
||||
"}");
|
||||
|
||||
MT("mixin",
|
||||
"[qualifier .mixin] ([variable dark]; [variable-2 @color]) {",
|
||||
" [property color]: [variable darken]([variable-2 @color], [number 10%]);",
|
||||
"}",
|
||||
"[qualifier .mixin] ([variable light]; [variable-2 @color]) {",
|
||||
" [property color]: [variable lighten]([variable-2 @color], [number 10%]);",
|
||||
"}",
|
||||
"[qualifier .mixin] ([variable-2 @_]; [variable-2 @color]) {",
|
||||
" [property display]: [atom block];",
|
||||
"}",
|
||||
"[variable-2 @switch]: [variable light];",
|
||||
"[qualifier .class] {",
|
||||
" [qualifier .mixin]([variable-2 @switch]; [atom #888]);",
|
||||
"}");
|
||||
|
||||
MT("nest",
|
||||
"[qualifier .one] {",
|
||||
" [def @media] ([property width]: [number 400px]) {",
|
||||
" [property font-size]: [number 1.2em];",
|
||||
" [def @media] [attribute print] [keyword and] [property color] {",
|
||||
" [property color]: [keyword blue];",
|
||||
" }",
|
||||
" }",
|
||||
"}");
|
||||
})();
|
||||
157
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/scss.html
vendored
Normal file
157
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/scss.html
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: SCSS mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="css.js"></script>
|
||||
<style>.CodeMirror {background: #f8f8f8;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">SCSS</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>SCSS mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
/* Some example SCSS */
|
||||
|
||||
@import "compass/css3";
|
||||
$variable: #333;
|
||||
|
||||
$blue: #3bbfce;
|
||||
$margin: 16px;
|
||||
|
||||
.content-navigation {
|
||||
#nested {
|
||||
background-color: black;
|
||||
}
|
||||
border-color: $blue;
|
||||
color:
|
||||
darken($blue, 9%);
|
||||
}
|
||||
|
||||
.border {
|
||||
padding: $margin / 2;
|
||||
margin: $margin / 2;
|
||||
border-color: $blue;
|
||||
}
|
||||
|
||||
@mixin table-base {
|
||||
th {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
td, th {padding: 2px}
|
||||
}
|
||||
|
||||
table.hl {
|
||||
margin: 2em 0;
|
||||
td.ln {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
li {
|
||||
font: {
|
||||
family: serif;
|
||||
weight: bold;
|
||||
size: 1.2em;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin left($dist) {
|
||||
float: left;
|
||||
margin-left: $dist;
|
||||
}
|
||||
|
||||
#data {
|
||||
@include left(10px);
|
||||
@include table-base;
|
||||
}
|
||||
|
||||
.source {
|
||||
@include flow-into(target);
|
||||
border: 10px solid green;
|
||||
margin: 20px;
|
||||
width: 200px; }
|
||||
|
||||
.new-container {
|
||||
@include flow-from(target);
|
||||
border: 10px solid red;
|
||||
margin: 20px;
|
||||
width: 200px; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 3em 6em;
|
||||
font-family: tahoma, arial, sans-serif;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
@mixin yellow() {
|
||||
background: yellow;
|
||||
}
|
||||
|
||||
.big {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.nested {
|
||||
@include border-radius(3px);
|
||||
@extend .big;
|
||||
p {
|
||||
background: whitesmoke;
|
||||
a {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#navigation a {
|
||||
font-weight: bold;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.7em;
|
||||
}
|
||||
|
||||
h1:before, h2:before {
|
||||
content: "::";
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: courier, monospace;
|
||||
font-size: 80%;
|
||||
color: #418A8A;
|
||||
}
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-scss"
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>The SCSS mode is a sub-mode of the <a href="index.html">CSS mode</a> (defined in <code>css.js</code>.</p>
|
||||
|
||||
<p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#scss_*">normal</a>, <a href="../../test/index.html#verbose,scss_*">verbose</a>.</p>
|
||||
|
||||
</article>
|
||||
110
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/scss_test.js
vendored
Normal file
110
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/scss_test.js
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function() {
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-scss");
|
||||
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); }
|
||||
|
||||
MT('url_with_quotation',
|
||||
"[tag foo] { [property background]:[atom url]([string test.jpg]) }");
|
||||
|
||||
MT('url_with_double_quotes',
|
||||
"[tag foo] { [property background]:[atom url]([string \"test.jpg\"]) }");
|
||||
|
||||
MT('url_with_single_quotes',
|
||||
"[tag foo] { [property background]:[atom url]([string \'test.jpg\']) }");
|
||||
|
||||
MT('string',
|
||||
"[def @import] [string \"compass/css3\"]");
|
||||
|
||||
MT('important_keyword',
|
||||
"[tag foo] { [property background]:[atom url]([string \'test.jpg\']) [keyword !important] }");
|
||||
|
||||
MT('variable',
|
||||
"[variable-2 $blue]:[atom #333]");
|
||||
|
||||
MT('variable_as_attribute',
|
||||
"[tag foo] { [property color]:[variable-2 $blue] }");
|
||||
|
||||
MT('numbers',
|
||||
"[tag foo] { [property padding]:[number 10px] [number 10] [number 10em] [number 8in] }");
|
||||
|
||||
MT('number_percentage',
|
||||
"[tag foo] { [property width]:[number 80%] }");
|
||||
|
||||
MT('selector',
|
||||
"[builtin #hello][qualifier .world]{}");
|
||||
|
||||
MT('singleline_comment',
|
||||
"[comment // this is a comment]");
|
||||
|
||||
MT('multiline_comment',
|
||||
"[comment /*foobar*/]");
|
||||
|
||||
MT('attribute_with_hyphen',
|
||||
"[tag foo] { [property font-size]:[number 10px] }");
|
||||
|
||||
MT('string_after_attribute',
|
||||
"[tag foo] { [property content]:[string \"::\"] }");
|
||||
|
||||
MT('directives',
|
||||
"[def @include] [qualifier .mixin]");
|
||||
|
||||
MT('basic_structure',
|
||||
"[tag p] { [property background]:[keyword red]; }");
|
||||
|
||||
MT('nested_structure',
|
||||
"[tag p] { [tag a] { [property color]:[keyword red]; } }");
|
||||
|
||||
MT('mixin',
|
||||
"[def @mixin] [tag table-base] {}");
|
||||
|
||||
MT('number_without_semicolon',
|
||||
"[tag p] {[property width]:[number 12]}",
|
||||
"[tag a] {[property color]:[keyword red];}");
|
||||
|
||||
MT('atom_in_nested_block',
|
||||
"[tag p] { [tag a] { [property color]:[atom #000]; } }");
|
||||
|
||||
MT('interpolation_in_property',
|
||||
"[tag foo] { #{[variable-2 $hello]}:[number 2]; }");
|
||||
|
||||
MT('interpolation_in_selector',
|
||||
"[tag foo]#{[variable-2 $hello]} { [property color]:[atom #000]; }");
|
||||
|
||||
MT('interpolation_error',
|
||||
"[tag foo]#{[error foo]} { [property color]:[atom #000]; }");
|
||||
|
||||
MT("divide_operator",
|
||||
"[tag foo] { [property width]:[number 4] [operator /] [number 2] }");
|
||||
|
||||
MT('nested_structure_with_id_selector',
|
||||
"[tag p] { [builtin #hello] { [property color]:[keyword red]; } }");
|
||||
|
||||
MT('indent_mixin',
|
||||
"[def @mixin] [tag container] (",
|
||||
" [variable-2 $a]: [number 10],",
|
||||
" [variable-2 $b]: [number 10])",
|
||||
"{}");
|
||||
|
||||
MT('indent_nested',
|
||||
"[tag foo] {",
|
||||
" [tag bar] {",
|
||||
" }",
|
||||
"}");
|
||||
|
||||
MT('indent_parentheses',
|
||||
"[tag foo] {",
|
||||
" [property color]: [variable darken]([variable-2 $blue],",
|
||||
" [number 9%]);",
|
||||
"}");
|
||||
|
||||
MT('indent_vardef',
|
||||
"[variable-2 $name]:",
|
||||
" [string 'val'];",
|
||||
"[tag tag] {",
|
||||
" [tag inner] {",
|
||||
" [property margin]: [number 3px];",
|
||||
" }",
|
||||
"}");
|
||||
})();
|
||||
195
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/test.js
vendored
Normal file
195
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/css/test.js
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function() {
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "css");
|
||||
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
|
||||
|
||||
// Error, because "foobarhello" is neither a known type or property, but
|
||||
// property was expected (after "and"), and it should be in parenthese.
|
||||
MT("atMediaUnknownType",
|
||||
"[def @media] [attribute screen] [keyword and] [error foobarhello] { }");
|
||||
|
||||
// Soft error, because "foobarhello" is not a known property or type.
|
||||
MT("atMediaUnknownProperty",
|
||||
"[def @media] [attribute screen] [keyword and] ([error foobarhello]) { }");
|
||||
|
||||
// Make sure nesting works with media queries
|
||||
MT("atMediaMaxWidthNested",
|
||||
"[def @media] [attribute screen] [keyword and] ([property max-width]: [number 25px]) { [tag foo] { } }");
|
||||
|
||||
MT("tagSelector",
|
||||
"[tag foo] { }");
|
||||
|
||||
MT("classSelector",
|
||||
"[qualifier .foo-bar_hello] { }");
|
||||
|
||||
MT("idSelector",
|
||||
"[builtin #foo] { [error #foo] }");
|
||||
|
||||
MT("tagSelectorUnclosed",
|
||||
"[tag foo] { [property margin]: [number 0] } [tag bar] { }");
|
||||
|
||||
MT("tagStringNoQuotes",
|
||||
"[tag foo] { [property font-family]: [variable hello] [variable world]; }");
|
||||
|
||||
MT("tagStringDouble",
|
||||
"[tag foo] { [property font-family]: [string \"hello world\"]; }");
|
||||
|
||||
MT("tagStringSingle",
|
||||
"[tag foo] { [property font-family]: [string 'hello world']; }");
|
||||
|
||||
MT("tagColorKeyword",
|
||||
"[tag foo] {",
|
||||
" [property color]: [keyword black];",
|
||||
" [property color]: [keyword navy];",
|
||||
" [property color]: [keyword yellow];",
|
||||
"}");
|
||||
|
||||
MT("tagColorHex3",
|
||||
"[tag foo] { [property background]: [atom #fff]; }");
|
||||
|
||||
MT("tagColorHex6",
|
||||
"[tag foo] { [property background]: [atom #ffffff]; }");
|
||||
|
||||
MT("tagColorHex4",
|
||||
"[tag foo] { [property background]: [atom&error #ffff]; }");
|
||||
|
||||
MT("tagColorHexInvalid",
|
||||
"[tag foo] { [property background]: [atom&error #ffg]; }");
|
||||
|
||||
MT("tagNegativeNumber",
|
||||
"[tag foo] { [property margin]: [number -5px]; }");
|
||||
|
||||
MT("tagPositiveNumber",
|
||||
"[tag foo] { [property padding]: [number 5px]; }");
|
||||
|
||||
MT("tagVendor",
|
||||
"[tag foo] { [meta -foo-][property box-sizing]: [meta -foo-][atom border-box]; }");
|
||||
|
||||
MT("tagBogusProperty",
|
||||
"[tag foo] { [property&error barhelloworld]: [number 0]; }");
|
||||
|
||||
MT("tagTwoProperties",
|
||||
"[tag foo] { [property margin]: [number 0]; [property padding]: [number 0]; }");
|
||||
|
||||
MT("tagTwoPropertiesURL",
|
||||
"[tag foo] { [property background]: [atom url]([string //example.com/foo.png]); [property padding]: [number 0]; }");
|
||||
|
||||
MT("commentSGML",
|
||||
"[comment <!--comment-->]");
|
||||
|
||||
MT("commentSGML2",
|
||||
"[comment <!--comment]",
|
||||
"[comment -->] [tag div] {}");
|
||||
|
||||
MT("indent_tagSelector",
|
||||
"[tag strong], [tag em] {",
|
||||
" [property background]: [atom rgba](",
|
||||
" [number 255], [number 255], [number 0], [number .2]",
|
||||
" );",
|
||||
"}");
|
||||
|
||||
MT("indent_atMedia",
|
||||
"[def @media] {",
|
||||
" [tag foo] {",
|
||||
" [property color]:",
|
||||
" [keyword yellow];",
|
||||
" }",
|
||||
"}");
|
||||
|
||||
MT("indent_comma",
|
||||
"[tag foo] {",
|
||||
" [property font-family]: [variable verdana],",
|
||||
" [atom sans-serif];",
|
||||
"}");
|
||||
|
||||
MT("indent_parentheses",
|
||||
"[tag foo]:[variable-3 before] {",
|
||||
" [property background]: [atom url](",
|
||||
"[string blahblah]",
|
||||
"[string etc]",
|
||||
"[string ]) [keyword !important];",
|
||||
"}");
|
||||
|
||||
MT("font_face",
|
||||
"[def @font-face] {",
|
||||
" [property font-family]: [string 'myfont'];",
|
||||
" [error nonsense]: [string 'abc'];",
|
||||
" [property src]: [atom url]([string http://blah]),",
|
||||
" [atom url]([string http://foo]);",
|
||||
"}");
|
||||
|
||||
MT("empty_url",
|
||||
"[def @import] [tag url]() [tag screen];");
|
||||
|
||||
MT("parens",
|
||||
"[qualifier .foo] {",
|
||||
" [property background-image]: [variable fade]([atom #000], [number 20%]);",
|
||||
" [property border-image]: [atom linear-gradient](",
|
||||
" [atom to] [atom bottom],",
|
||||
" [variable fade]([atom #000], [number 20%]) [number 0%],",
|
||||
" [variable fade]([atom #000], [number 20%]) [number 100%]",
|
||||
" );",
|
||||
"}");
|
||||
|
||||
MT("css_variable",
|
||||
":[variable-3 root] {",
|
||||
" [variable-2 --main-color]: [atom #06c];",
|
||||
"}",
|
||||
"[tag h1][builtin #foo] {",
|
||||
" [property color]: [atom var]([variable-2 --main-color]);",
|
||||
"}");
|
||||
|
||||
MT("supports",
|
||||
"[def @supports] ([keyword not] (([property text-align-last]: [atom justify]) [keyword or] ([meta -moz-][property text-align-last]: [atom justify])) {",
|
||||
" [property text-align-last]: [atom justify];",
|
||||
"}");
|
||||
|
||||
MT("document",
|
||||
"[def @document] [tag url]([string http://blah]),",
|
||||
" [tag url-prefix]([string https://]),",
|
||||
" [tag domain]([string blah.com]),",
|
||||
" [tag regexp]([string \".*blah.+\"]) {",
|
||||
" [builtin #id] {",
|
||||
" [property background-color]: [keyword white];",
|
||||
" }",
|
||||
" [tag foo] {",
|
||||
" [property font-family]: [variable Verdana], [atom sans-serif];",
|
||||
" }",
|
||||
" }");
|
||||
|
||||
MT("document_url",
|
||||
"[def @document] [tag url]([string http://blah]) { [qualifier .class] { } }");
|
||||
|
||||
MT("document_urlPrefix",
|
||||
"[def @document] [tag url-prefix]([string https://]) { [builtin #id] { } }");
|
||||
|
||||
MT("document_domain",
|
||||
"[def @document] [tag domain]([string blah.com]) { [tag foo] { } }");
|
||||
|
||||
MT("document_regexp",
|
||||
"[def @document] [tag regexp]([string \".*blah.+\"]) { [builtin #id] { } }");
|
||||
|
||||
MT("counter-style",
|
||||
"[def @counter-style] [variable binary] {",
|
||||
" [property system]: [atom numeric];",
|
||||
" [property symbols]: [number 0] [number 1];",
|
||||
" [property suffix]: [string \".\"];",
|
||||
" [property range]: [atom infinite];",
|
||||
" [property speak-as]: [atom numeric];",
|
||||
"}");
|
||||
|
||||
MT("counter-style-additive-symbols",
|
||||
"[def @counter-style] [variable simple-roman] {",
|
||||
" [property system]: [atom additive];",
|
||||
" [property additive-symbols]: [number 10] [variable X], [number 5] [variable V], [number 1] [variable I];",
|
||||
" [property range]: [number 1] [number 49];",
|
||||
"}");
|
||||
|
||||
MT("counter-style-use",
|
||||
"[tag ol][qualifier .roman] { [property list-style]: [variable simple-roman]; }");
|
||||
|
||||
MT("counter-style-symbols",
|
||||
"[tag ol] { [property list-style]: [atom symbols]([atom cyclic] [string \"*\"] [string \"\\2020\"] [string \"\\2021\"] [string \"\\A7\"]); }");
|
||||
})();
|
||||
121
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/htmlmixed/htmlmixed.js
vendored
Normal file
121
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/htmlmixed/htmlmixed.js
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../css/css"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
|
||||
var htmlMode = CodeMirror.getMode(config, {name: "xml",
|
||||
htmlMode: true,
|
||||
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
|
||||
multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag});
|
||||
var cssMode = CodeMirror.getMode(config, "css");
|
||||
|
||||
var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes;
|
||||
scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,
|
||||
mode: CodeMirror.getMode(config, "javascript")});
|
||||
if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) {
|
||||
var conf = scriptTypesConf[i];
|
||||
scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)});
|
||||
}
|
||||
scriptTypes.push({matches: /./,
|
||||
mode: CodeMirror.getMode(config, "text/plain")});
|
||||
|
||||
function html(stream, state) {
|
||||
var tagName = state.htmlState.tagName;
|
||||
if (tagName) tagName = tagName.toLowerCase();
|
||||
var style = htmlMode.token(stream, state.htmlState);
|
||||
if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") {
|
||||
// Script block: mode to change to depends on type attribute
|
||||
var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);
|
||||
scriptType = scriptType ? scriptType[1] : "";
|
||||
if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1);
|
||||
for (var i = 0; i < scriptTypes.length; ++i) {
|
||||
var tp = scriptTypes[i];
|
||||
if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) {
|
||||
if (tp.mode) {
|
||||
state.token = script;
|
||||
state.localMode = tp.mode;
|
||||
state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, ""));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") {
|
||||
state.token = css;
|
||||
state.localMode = cssMode;
|
||||
state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
|
||||
}
|
||||
return style;
|
||||
}
|
||||
function maybeBackup(stream, pat, style) {
|
||||
var cur = stream.current();
|
||||
var close = cur.search(pat), m;
|
||||
if (close > -1) stream.backUp(cur.length - close);
|
||||
else if (m = cur.match(/<\/?$/)) {
|
||||
stream.backUp(cur.length);
|
||||
if (!stream.match(pat, false)) stream.match(cur);
|
||||
}
|
||||
return style;
|
||||
}
|
||||
function script(stream, state) {
|
||||
if (stream.match(/^<\/\s*script\s*>/i, false)) {
|
||||
state.token = html;
|
||||
state.localState = state.localMode = null;
|
||||
return null;
|
||||
}
|
||||
return maybeBackup(stream, /<\/\s*script\s*>/,
|
||||
state.localMode.token(stream, state.localState));
|
||||
}
|
||||
function css(stream, state) {
|
||||
if (stream.match(/^<\/\s*style\s*>/i, false)) {
|
||||
state.token = html;
|
||||
state.localState = state.localMode = null;
|
||||
return null;
|
||||
}
|
||||
return maybeBackup(stream, /<\/\s*style\s*>/,
|
||||
cssMode.token(stream, state.localState));
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function() {
|
||||
var state = htmlMode.startState();
|
||||
return {token: html, localMode: null, localState: null, htmlState: state};
|
||||
},
|
||||
|
||||
copyState: function(state) {
|
||||
if (state.localState)
|
||||
var local = CodeMirror.copyState(state.localMode, state.localState);
|
||||
return {token: state.token, localMode: state.localMode, localState: local,
|
||||
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
return state.token(stream, state);
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
if (!state.localMode || /^\s*<\//.test(textAfter))
|
||||
return htmlMode.indent(state.htmlState, textAfter);
|
||||
else if (state.localMode.indent)
|
||||
return state.localMode.indent(state.localState, textAfter);
|
||||
else
|
||||
return CodeMirror.Pass;
|
||||
},
|
||||
|
||||
innerMode: function(state) {
|
||||
return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
|
||||
}
|
||||
};
|
||||
}, "xml", "javascript", "css");
|
||||
|
||||
CodeMirror.defineMIME("text/html", "htmlmixed");
|
||||
|
||||
});
|
||||
89
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/htmlmixed/index.html
vendored
Normal file
89
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/htmlmixed/index.html
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: HTML mixed mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="../../addon/selection/selection-pointer.js"></script>
|
||||
<script src="../xml/xml.js"></script>
|
||||
<script src="../javascript/javascript.js"></script>
|
||||
<script src="../css/css.js"></script>
|
||||
<script src="../vbscript/vbscript.js"></script>
|
||||
<script src="htmlmixed.js"></script>
|
||||
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">HTML mixed</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>HTML mixed mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
<html style="color: green">
|
||||
<!-- this is a comment -->
|
||||
<head>
|
||||
<title>Mixed HTML Example</title>
|
||||
<style type="text/css">
|
||||
h1 {font-family: comic sans; color: #f0f;}
|
||||
div {background: yellow !important;}
|
||||
body {
|
||||
max-width: 50em;
|
||||
margin: 1em 2em 1em 5em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Mixed HTML Example</h1>
|
||||
<script>
|
||||
function jsFunc(arg1, arg2) {
|
||||
if (arg1 && arg2) document.body.innerHTML = "achoo";
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</textarea></form>
|
||||
<script>
|
||||
// Define an extended mixed-mode that understands vbscript and
|
||||
// leaves mustache/handlebars embedded templates in html mode
|
||||
var mixedMode = {
|
||||
name: "htmlmixed",
|
||||
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
|
||||
mode: null},
|
||||
{matches: /(text|application)\/(x-)?vb(a|script)/i,
|
||||
mode: "vbscript"}]
|
||||
};
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
mode: mixedMode,
|
||||
selectionPointer: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
|
||||
|
||||
<p>It takes an optional mode configuration
|
||||
option, <code>scriptTypes</code>, which can be used to add custom
|
||||
behavior for specific <code><script type="..."></code> tags. If
|
||||
given, it should hold an array of <code>{matches, mode}</code>
|
||||
objects, where <code>matches</code> is a string or regexp that
|
||||
matches the script type, and <code>mode</code> is
|
||||
either <code>null</code>, for script types that should stay in
|
||||
HTML mode, or a <a href="../../doc/manual.html#option_mode">mode
|
||||
spec</a> corresponding to the mode that should be used for the
|
||||
script.</p>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/html</code>
|
||||
(redefined, only takes effect if you load this parser after the
|
||||
XML parser).</p>
|
||||
|
||||
</article>
|
||||
114
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/javascript/index.html
vendored
Normal file
114
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/javascript/index.html
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: JavaScript mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="../../addon/edit/matchbrackets.js"></script>
|
||||
<script src="../../addon/comment/continuecomment.js"></script>
|
||||
<script src="../../addon/comment/comment.js"></script>
|
||||
<script src="javascript.js"></script>
|
||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">JavaScript</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>JavaScript mode</h2>
|
||||
|
||||
|
||||
<div><textarea id="code" name="code">
|
||||
// Demo code (the actual new parser character stream implementation)
|
||||
|
||||
function StringStream(string) {
|
||||
this.pos = 0;
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
StringStream.prototype = {
|
||||
done: function() {return this.pos >= this.string.length;},
|
||||
peek: function() {return this.string.charAt(this.pos);},
|
||||
next: function() {
|
||||
if (this.pos < this.string.length)
|
||||
return this.string.charAt(this.pos++);
|
||||
},
|
||||
eat: function(match) {
|
||||
var ch = this.string.charAt(this.pos);
|
||||
if (typeof match == "string") var ok = ch == match;
|
||||
else var ok = ch && match.test ? match.test(ch) : match(ch);
|
||||
if (ok) {this.pos++; return ch;}
|
||||
},
|
||||
eatWhile: function(match) {
|
||||
var start = this.pos;
|
||||
while (this.eat(match));
|
||||
if (this.pos > start) return this.string.slice(start, this.pos);
|
||||
},
|
||||
backUp: function(n) {this.pos -= n;},
|
||||
column: function() {return this.pos;},
|
||||
eatSpace: function() {
|
||||
var start = this.pos;
|
||||
while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
|
||||
return this.pos - start;
|
||||
},
|
||||
match: function(pattern, consume, caseInsensitive) {
|
||||
if (typeof pattern == "string") {
|
||||
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
|
||||
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
|
||||
if (consume !== false) this.pos += str.length;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var match = this.string.slice(this.pos).match(pattern);
|
||||
if (match && consume !== false) this.pos += match[0].length;
|
||||
return match;
|
||||
}
|
||||
}
|
||||
};
|
||||
</textarea></div>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
continueComments: "Enter",
|
||||
extraKeys: {"Ctrl-Q": "toggleComment"}
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>
|
||||
JavaScript mode supports several configuration options:
|
||||
<ul>
|
||||
<li><code>json</code> which will set the mode to expect JSON
|
||||
data rather than a JavaScript program.</li>
|
||||
<li><code>jsonld</code> which will set the mode to expect
|
||||
<a href="http://json-ld.org">JSON-LD</a> linked data rather
|
||||
than a JavaScript program (<a href="json-ld.html">demo</a>).</li>
|
||||
<li><code>typescript</code> which will activate additional
|
||||
syntax highlighting and some other things for TypeScript code
|
||||
(<a href="typescript.html">demo</a>).</li>
|
||||
<li><code>statementIndent</code> which (given a number) will
|
||||
determine the amount of indentation to use for statements
|
||||
continued on a new line.</li>
|
||||
<li><code>wordCharacters</code>, a regexp that indicates which
|
||||
characters should be considered part of an identifier.
|
||||
Defaults to <code>/[\w$]/</code>, which does not handle
|
||||
non-ASCII identifiers. Can be set to something more elaborate
|
||||
to improve Unicode support.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>, <code>application/ld+json</code>, <code>text/typescript</code>, <code>application/typescript</code>.</p>
|
||||
</article>
|
||||
693
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/javascript/javascript.js
vendored
Normal file
693
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/javascript/javascript.js
vendored
Normal file
@@ -0,0 +1,693 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
// TODO actually recognize syntax of TypeScript constructs
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||
var indentUnit = config.indentUnit;
|
||||
var statementIndent = parserConfig.statementIndent;
|
||||
var jsonldMode = parserConfig.jsonld;
|
||||
var jsonMode = parserConfig.json || jsonldMode;
|
||||
var isTS = parserConfig.typescript;
|
||||
var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
|
||||
|
||||
// Tokenizer
|
||||
|
||||
var keywords = function(){
|
||||
function kw(type) {return {type: type, style: "keyword"};}
|
||||
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
||||
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
||||
|
||||
var jsKeywords = {
|
||||
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
||||
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, "debugger": C,
|
||||
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
||||
"function": kw("function"), "catch": kw("catch"),
|
||||
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
||||
"in": operator, "typeof": operator, "instanceof": operator,
|
||||
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
||||
"this": kw("this"), "module": kw("module"), "class": kw("class"), "super": kw("atom"),
|
||||
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C
|
||||
};
|
||||
|
||||
// Extend the 'normal' keywords with the TypeScript language extensions
|
||||
if (isTS) {
|
||||
var type = {type: "variable", style: "variable-3"};
|
||||
var tsKeywords = {
|
||||
// object-like things
|
||||
"interface": kw("interface"),
|
||||
"extends": kw("extends"),
|
||||
"constructor": kw("constructor"),
|
||||
|
||||
// scope modifiers
|
||||
"public": kw("public"),
|
||||
"private": kw("private"),
|
||||
"protected": kw("protected"),
|
||||
"static": kw("static"),
|
||||
|
||||
// types
|
||||
"string": type, "number": type, "bool": type, "any": type
|
||||
};
|
||||
|
||||
for (var attr in tsKeywords) {
|
||||
jsKeywords[attr] = tsKeywords[attr];
|
||||
}
|
||||
}
|
||||
|
||||
return jsKeywords;
|
||||
}();
|
||||
|
||||
var isOperatorChar = /[+\-*&%=<>!?|~^]/;
|
||||
var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
|
||||
|
||||
function readRegexp(stream) {
|
||||
var escaped = false, next, inSet = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (!escaped) {
|
||||
if (next == "/" && !inSet) return;
|
||||
if (next == "[") inSet = true;
|
||||
else if (inSet && next == "]") inSet = false;
|
||||
}
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
}
|
||||
|
||||
// Used as scratch variables to communicate multiple values without
|
||||
// consing up tons of objects.
|
||||
var type, content;
|
||||
function ret(tp, style, cont) {
|
||||
type = tp; content = cont;
|
||||
return style;
|
||||
}
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
if (ch == '"' || ch == "'") {
|
||||
state.tokenize = tokenString(ch);
|
||||
return state.tokenize(stream, state);
|
||||
} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
|
||||
return ret("number", "number");
|
||||
} else if (ch == "." && stream.match("..")) {
|
||||
return ret("spread", "meta");
|
||||
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
||||
return ret(ch);
|
||||
} else if (ch == "=" && stream.eat(">")) {
|
||||
return ret("=>", "operator");
|
||||
} else if (ch == "0" && stream.eat(/x/i)) {
|
||||
stream.eatWhile(/[\da-f]/i);
|
||||
return ret("number", "number");
|
||||
} else if (/\d/.test(ch)) {
|
||||
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
||||
return ret("number", "number");
|
||||
} else if (ch == "/") {
|
||||
if (stream.eat("*")) {
|
||||
state.tokenize = tokenComment;
|
||||
return tokenComment(stream, state);
|
||||
} else if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return ret("comment", "comment");
|
||||
} else if (state.lastType == "operator" || state.lastType == "keyword c" ||
|
||||
state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) {
|
||||
readRegexp(stream);
|
||||
stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
|
||||
return ret("regexp", "string-2");
|
||||
} else {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return ret("operator", "operator", stream.current());
|
||||
}
|
||||
} else if (ch == "`") {
|
||||
state.tokenize = tokenQuasi;
|
||||
return tokenQuasi(stream, state);
|
||||
} else if (ch == "#") {
|
||||
stream.skipToEnd();
|
||||
return ret("error", "error");
|
||||
} else if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return ret("operator", "operator", stream.current());
|
||||
} else if (wordRE.test(ch)) {
|
||||
stream.eatWhile(wordRE);
|
||||
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
||||
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
||||
ret("variable", "variable", word);
|
||||
}
|
||||
}
|
||||
|
||||
function tokenString(quote) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, next;
|
||||
if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
|
||||
state.tokenize = tokenBase;
|
||||
return ret("jsonld-keyword", "meta");
|
||||
}
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next == quote && !escaped) break;
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
if (!escaped) state.tokenize = tokenBase;
|
||||
return ret("string", "string");
|
||||
};
|
||||
}
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
var maybeEnd = false, ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "/" && maybeEnd) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "*");
|
||||
}
|
||||
return ret("comment", "comment");
|
||||
}
|
||||
|
||||
function tokenQuasi(stream, state) {
|
||||
var escaped = false, next;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
return ret("quasi", "string-2", stream.current());
|
||||
}
|
||||
|
||||
var brackets = "([{}])";
|
||||
// This is a crude lookahead trick to try and notice that we're
|
||||
// parsing the argument patterns for a fat-arrow function before we
|
||||
// actually hit the arrow token. It only works if the arrow is on
|
||||
// the same line as the arguments and there's no strange noise
|
||||
// (comments) in between. Fallback is to only notice when we hit the
|
||||
// arrow, and not declare the arguments as locals for the arrow
|
||||
// body.
|
||||
function findFatArrow(stream, state) {
|
||||
if (state.fatArrowAt) state.fatArrowAt = null;
|
||||
var arrow = stream.string.indexOf("=>", stream.start);
|
||||
if (arrow < 0) return;
|
||||
|
||||
var depth = 0, sawSomething = false;
|
||||
for (var pos = arrow - 1; pos >= 0; --pos) {
|
||||
var ch = stream.string.charAt(pos);
|
||||
var bracket = brackets.indexOf(ch);
|
||||
if (bracket >= 0 && bracket < 3) {
|
||||
if (!depth) { ++pos; break; }
|
||||
if (--depth == 0) break;
|
||||
} else if (bracket >= 3 && bracket < 6) {
|
||||
++depth;
|
||||
} else if (wordRE.test(ch)) {
|
||||
sawSomething = true;
|
||||
} else if (/["'\/]/.test(ch)) {
|
||||
return;
|
||||
} else if (sawSomething && !depth) {
|
||||
++pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sawSomething && !depth) state.fatArrowAt = pos;
|
||||
}
|
||||
|
||||
// Parser
|
||||
|
||||
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
|
||||
|
||||
function JSLexical(indented, column, type, align, prev, info) {
|
||||
this.indented = indented;
|
||||
this.column = column;
|
||||
this.type = type;
|
||||
this.prev = prev;
|
||||
this.info = info;
|
||||
if (align != null) this.align = align;
|
||||
}
|
||||
|
||||
function inScope(state, varname) {
|
||||
for (var v = state.localVars; v; v = v.next)
|
||||
if (v.name == varname) return true;
|
||||
for (var cx = state.context; cx; cx = cx.prev) {
|
||||
for (var v = cx.vars; v; v = v.next)
|
||||
if (v.name == varname) return true;
|
||||
}
|
||||
}
|
||||
|
||||
function parseJS(state, style, type, content, stream) {
|
||||
var cc = state.cc;
|
||||
// Communicate our context to the combinators.
|
||||
// (Less wasteful than consing up a hundred closures on every call.)
|
||||
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
|
||||
|
||||
if (!state.lexical.hasOwnProperty("align"))
|
||||
state.lexical.align = true;
|
||||
|
||||
while(true) {
|
||||
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
||||
if (combinator(type, content)) {
|
||||
while(cc.length && cc[cc.length - 1].lex)
|
||||
cc.pop()();
|
||||
if (cx.marked) return cx.marked;
|
||||
if (type == "variable" && inScope(state, content)) return "variable-2";
|
||||
return style;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Combinator utils
|
||||
|
||||
var cx = {state: null, column: null, marked: null, cc: null};
|
||||
function pass() {
|
||||
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
||||
}
|
||||
function cont() {
|
||||
pass.apply(null, arguments);
|
||||
return true;
|
||||
}
|
||||
function register(varname) {
|
||||
function inList(list) {
|
||||
for (var v = list; v; v = v.next)
|
||||
if (v.name == varname) return true;
|
||||
return false;
|
||||
}
|
||||
var state = cx.state;
|
||||
if (state.context) {
|
||||
cx.marked = "def";
|
||||
if (inList(state.localVars)) return;
|
||||
state.localVars = {name: varname, next: state.localVars};
|
||||
} else {
|
||||
if (inList(state.globalVars)) return;
|
||||
if (parserConfig.globalVars)
|
||||
state.globalVars = {name: varname, next: state.globalVars};
|
||||
}
|
||||
}
|
||||
|
||||
// Combinators
|
||||
|
||||
var defaultVars = {name: "this", next: {name: "arguments"}};
|
||||
function pushcontext() {
|
||||
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
||||
cx.state.localVars = defaultVars;
|
||||
}
|
||||
function popcontext() {
|
||||
cx.state.localVars = cx.state.context.vars;
|
||||
cx.state.context = cx.state.context.prev;
|
||||
}
|
||||
function pushlex(type, info) {
|
||||
var result = function() {
|
||||
var state = cx.state, indent = state.indented;
|
||||
if (state.lexical.type == "stat") indent = state.lexical.indented;
|
||||
else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
|
||||
indent = outer.indented;
|
||||
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
|
||||
};
|
||||
result.lex = true;
|
||||
return result;
|
||||
}
|
||||
function poplex() {
|
||||
var state = cx.state;
|
||||
if (state.lexical.prev) {
|
||||
if (state.lexical.type == ")")
|
||||
state.indented = state.lexical.indented;
|
||||
state.lexical = state.lexical.prev;
|
||||
}
|
||||
}
|
||||
poplex.lex = true;
|
||||
|
||||
function expect(wanted) {
|
||||
function exp(type) {
|
||||
if (type == wanted) return cont();
|
||||
else if (wanted == ";") return pass();
|
||||
else return cont(exp);
|
||||
};
|
||||
return exp;
|
||||
}
|
||||
|
||||
function statement(type, value) {
|
||||
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
|
||||
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
||||
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
||||
if (type == "{") return cont(pushlex("}"), block, poplex);
|
||||
if (type == ";") return cont();
|
||||
if (type == "if") {
|
||||
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
|
||||
cx.state.cc.pop()();
|
||||
return cont(pushlex("form"), expression, statement, poplex, maybeelse);
|
||||
}
|
||||
if (type == "function") return cont(functiondef);
|
||||
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
|
||||
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
||||
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
||||
block, poplex, poplex);
|
||||
if (type == "case") return cont(expression, expect(":"));
|
||||
if (type == "default") return cont(expect(":"));
|
||||
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
||||
statement, poplex, popcontext);
|
||||
if (type == "module") return cont(pushlex("form"), pushcontext, afterModule, popcontext, poplex);
|
||||
if (type == "class") return cont(pushlex("form"), className, poplex);
|
||||
if (type == "export") return cont(pushlex("form"), afterExport, poplex);
|
||||
if (type == "import") return cont(pushlex("form"), afterImport, poplex);
|
||||
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
||||
}
|
||||
function expression(type) {
|
||||
return expressionInner(type, false);
|
||||
}
|
||||
function expressionNoComma(type) {
|
||||
return expressionInner(type, true);
|
||||
}
|
||||
function expressionInner(type, noComma) {
|
||||
if (cx.state.fatArrowAt == cx.stream.start) {
|
||||
var body = noComma ? arrowBodyNoComma : arrowBody;
|
||||
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
|
||||
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
|
||||
}
|
||||
|
||||
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
||||
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
||||
if (type == "function") return cont(functiondef, maybeop);
|
||||
if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
|
||||
if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
|
||||
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
|
||||
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
|
||||
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
|
||||
if (type == "quasi") { return pass(quasi, maybeop); }
|
||||
return cont();
|
||||
}
|
||||
function maybeexpression(type) {
|
||||
if (type.match(/[;\}\)\],]/)) return pass();
|
||||
return pass(expression);
|
||||
}
|
||||
function maybeexpressionNoComma(type) {
|
||||
if (type.match(/[;\}\)\],]/)) return pass();
|
||||
return pass(expressionNoComma);
|
||||
}
|
||||
|
||||
function maybeoperatorComma(type, value) {
|
||||
if (type == ",") return cont(expression);
|
||||
return maybeoperatorNoComma(type, value, false);
|
||||
}
|
||||
function maybeoperatorNoComma(type, value, noComma) {
|
||||
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
||||
var expr = noComma == false ? expression : expressionNoComma;
|
||||
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
||||
if (type == "operator") {
|
||||
if (/\+\+|--/.test(value)) return cont(me);
|
||||
if (value == "?") return cont(expression, expect(":"), expr);
|
||||
return cont(expr);
|
||||
}
|
||||
if (type == "quasi") { return pass(quasi, me); }
|
||||
if (type == ";") return;
|
||||
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
|
||||
if (type == ".") return cont(property, me);
|
||||
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
|
||||
}
|
||||
function quasi(type, value) {
|
||||
if (type != "quasi") return pass();
|
||||
if (value.slice(value.length - 2) != "${") return cont(quasi);
|
||||
return cont(expression, continueQuasi);
|
||||
}
|
||||
function continueQuasi(type) {
|
||||
if (type == "}") {
|
||||
cx.marked = "string-2";
|
||||
cx.state.tokenize = tokenQuasi;
|
||||
return cont(quasi);
|
||||
}
|
||||
}
|
||||
function arrowBody(type) {
|
||||
findFatArrow(cx.stream, cx.state);
|
||||
return pass(type == "{" ? statement : expression);
|
||||
}
|
||||
function arrowBodyNoComma(type) {
|
||||
findFatArrow(cx.stream, cx.state);
|
||||
return pass(type == "{" ? statement : expressionNoComma);
|
||||
}
|
||||
function maybelabel(type) {
|
||||
if (type == ":") return cont(poplex, statement);
|
||||
return pass(maybeoperatorComma, expect(";"), poplex);
|
||||
}
|
||||
function property(type) {
|
||||
if (type == "variable") {cx.marked = "property"; return cont();}
|
||||
}
|
||||
function objprop(type, value) {
|
||||
if (type == "variable" || cx.style == "keyword") {
|
||||
cx.marked = "property";
|
||||
if (value == "get" || value == "set") return cont(getterSetter);
|
||||
return cont(afterprop);
|
||||
} else if (type == "number" || type == "string") {
|
||||
cx.marked = jsonldMode ? "property" : (cx.style + " property");
|
||||
return cont(afterprop);
|
||||
} else if (type == "jsonld-keyword") {
|
||||
return cont(afterprop);
|
||||
} else if (type == "[") {
|
||||
return cont(expression, expect("]"), afterprop);
|
||||
}
|
||||
}
|
||||
function getterSetter(type) {
|
||||
if (type != "variable") return pass(afterprop);
|
||||
cx.marked = "property";
|
||||
return cont(functiondef);
|
||||
}
|
||||
function afterprop(type) {
|
||||
if (type == ":") return cont(expressionNoComma);
|
||||
if (type == "(") return pass(functiondef);
|
||||
}
|
||||
function commasep(what, end) {
|
||||
function proceed(type) {
|
||||
if (type == ",") {
|
||||
var lex = cx.state.lexical;
|
||||
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
||||
return cont(what, proceed);
|
||||
}
|
||||
if (type == end) return cont();
|
||||
return cont(expect(end));
|
||||
}
|
||||
return function(type) {
|
||||
if (type == end) return cont();
|
||||
return pass(what, proceed);
|
||||
};
|
||||
}
|
||||
function contCommasep(what, end, info) {
|
||||
for (var i = 3; i < arguments.length; i++)
|
||||
cx.cc.push(arguments[i]);
|
||||
return cont(pushlex(end, info), commasep(what, end), poplex);
|
||||
}
|
||||
function block(type) {
|
||||
if (type == "}") return cont();
|
||||
return pass(statement, block);
|
||||
}
|
||||
function maybetype(type) {
|
||||
if (isTS && type == ":") return cont(typedef);
|
||||
}
|
||||
function typedef(type) {
|
||||
if (type == "variable"){cx.marked = "variable-3"; return cont();}
|
||||
}
|
||||
function vardef() {
|
||||
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
||||
}
|
||||
function pattern(type, value) {
|
||||
if (type == "variable") { register(value); return cont(); }
|
||||
if (type == "[") return contCommasep(pattern, "]");
|
||||
if (type == "{") return contCommasep(proppattern, "}");
|
||||
}
|
||||
function proppattern(type, value) {
|
||||
if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
|
||||
register(value);
|
||||
return cont(maybeAssign);
|
||||
}
|
||||
if (type == "variable") cx.marked = "property";
|
||||
return cont(expect(":"), pattern, maybeAssign);
|
||||
}
|
||||
function maybeAssign(_type, value) {
|
||||
if (value == "=") return cont(expressionNoComma);
|
||||
}
|
||||
function vardefCont(type) {
|
||||
if (type == ",") return cont(vardef);
|
||||
}
|
||||
function maybeelse(type, value) {
|
||||
if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
|
||||
}
|
||||
function forspec(type) {
|
||||
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
|
||||
}
|
||||
function forspec1(type) {
|
||||
if (type == "var") return cont(vardef, expect(";"), forspec2);
|
||||
if (type == ";") return cont(forspec2);
|
||||
if (type == "variable") return cont(formaybeinof);
|
||||
return pass(expression, expect(";"), forspec2);
|
||||
}
|
||||
function formaybeinof(_type, value) {
|
||||
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
||||
return cont(maybeoperatorComma, forspec2);
|
||||
}
|
||||
function forspec2(type, value) {
|
||||
if (type == ";") return cont(forspec3);
|
||||
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
||||
return pass(expression, expect(";"), forspec3);
|
||||
}
|
||||
function forspec3(type) {
|
||||
if (type != ")") cont(expression);
|
||||
}
|
||||
function functiondef(type, value) {
|
||||
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
||||
if (type == "variable") {register(value); return cont(functiondef);}
|
||||
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, statement, popcontext);
|
||||
}
|
||||
function funarg(type) {
|
||||
if (type == "spread") return cont(funarg);
|
||||
return pass(pattern, maybetype);
|
||||
}
|
||||
function className(type, value) {
|
||||
if (type == "variable") {register(value); return cont(classNameAfter);}
|
||||
}
|
||||
function classNameAfter(type, value) {
|
||||
if (value == "extends") return cont(expression, classNameAfter);
|
||||
if (type == "{") return cont(pushlex("}"), classBody, poplex);
|
||||
}
|
||||
function classBody(type, value) {
|
||||
if (type == "variable" || cx.style == "keyword") {
|
||||
cx.marked = "property";
|
||||
if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody);
|
||||
return cont(functiondef, classBody);
|
||||
}
|
||||
if (value == "*") {
|
||||
cx.marked = "keyword";
|
||||
return cont(classBody);
|
||||
}
|
||||
if (type == ";") return cont(classBody);
|
||||
if (type == "}") return cont();
|
||||
}
|
||||
function classGetterSetter(type) {
|
||||
if (type != "variable") return pass();
|
||||
cx.marked = "property";
|
||||
return cont();
|
||||
}
|
||||
function afterModule(type, value) {
|
||||
if (type == "string") return cont(statement);
|
||||
if (type == "variable") { register(value); return cont(maybeFrom); }
|
||||
}
|
||||
function afterExport(_type, value) {
|
||||
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
|
||||
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
|
||||
return pass(statement);
|
||||
}
|
||||
function afterImport(type) {
|
||||
if (type == "string") return cont();
|
||||
return pass(importSpec, maybeFrom);
|
||||
}
|
||||
function importSpec(type, value) {
|
||||
if (type == "{") return contCommasep(importSpec, "}");
|
||||
if (type == "variable") register(value);
|
||||
return cont();
|
||||
}
|
||||
function maybeFrom(_type, value) {
|
||||
if (value == "from") { cx.marked = "keyword"; return cont(expression); }
|
||||
}
|
||||
function arrayLiteral(type) {
|
||||
if (type == "]") return cont();
|
||||
return pass(expressionNoComma, maybeArrayComprehension);
|
||||
}
|
||||
function maybeArrayComprehension(type) {
|
||||
if (type == "for") return pass(comprehension, expect("]"));
|
||||
if (type == ",") return cont(commasep(maybeexpressionNoComma, "]"));
|
||||
return pass(commasep(expressionNoComma, "]"));
|
||||
}
|
||||
function comprehension(type) {
|
||||
if (type == "for") return cont(forspec, comprehension);
|
||||
if (type == "if") return cont(expression, comprehension);
|
||||
}
|
||||
|
||||
function isContinuedStatement(state, textAfter) {
|
||||
return state.lastType == "operator" || state.lastType == "," ||
|
||||
isOperatorChar.test(textAfter.charAt(0)) ||
|
||||
/[,.]/.test(textAfter.charAt(0));
|
||||
}
|
||||
|
||||
// Interface
|
||||
|
||||
return {
|
||||
startState: function(basecolumn) {
|
||||
var state = {
|
||||
tokenize: tokenBase,
|
||||
lastType: "sof",
|
||||
cc: [],
|
||||
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
||||
localVars: parserConfig.localVars,
|
||||
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
||||
indented: 0
|
||||
};
|
||||
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
|
||||
state.globalVars = parserConfig.globalVars;
|
||||
return state;
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
if (stream.sol()) {
|
||||
if (!state.lexical.hasOwnProperty("align"))
|
||||
state.lexical.align = false;
|
||||
state.indented = stream.indentation();
|
||||
findFatArrow(stream, state);
|
||||
}
|
||||
if (state.tokenize != tokenComment && stream.eatSpace()) return null;
|
||||
var style = state.tokenize(stream, state);
|
||||
if (type == "comment") return style;
|
||||
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
|
||||
return parseJS(state, style, type, content, stream);
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
if (state.tokenize == tokenComment) return CodeMirror.Pass;
|
||||
if (state.tokenize != tokenBase) return 0;
|
||||
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
|
||||
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
||||
if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
|
||||
var c = state.cc[i];
|
||||
if (c == poplex) lexical = lexical.prev;
|
||||
else if (c != maybeelse) break;
|
||||
}
|
||||
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
|
||||
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
|
||||
lexical = lexical.prev;
|
||||
var type = lexical.type, closing = firstChar == type;
|
||||
|
||||
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
|
||||
else if (type == "form" && firstChar == "{") return lexical.indented;
|
||||
else if (type == "form") return lexical.indented + indentUnit;
|
||||
else if (type == "stat")
|
||||
return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
|
||||
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
|
||||
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
||||
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
||||
else return lexical.indented + (closing ? 0 : indentUnit);
|
||||
},
|
||||
|
||||
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
|
||||
blockCommentStart: jsonMode ? null : "/*",
|
||||
blockCommentEnd: jsonMode ? null : "*/",
|
||||
lineComment: jsonMode ? null : "//",
|
||||
fold: "brace",
|
||||
closeBrackets: "()[]{}''\"\"``",
|
||||
|
||||
helperType: jsonMode ? "json" : "javascript",
|
||||
jsonldMode: jsonldMode,
|
||||
jsonMode: jsonMode
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
|
||||
|
||||
CodeMirror.defineMIME("text/javascript", "javascript");
|
||||
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
||||
CodeMirror.defineMIME("application/javascript", "javascript");
|
||||
CodeMirror.defineMIME("application/x-javascript", "javascript");
|
||||
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
||||
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
||||
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
|
||||
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
|
||||
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
||||
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
||||
|
||||
});
|
||||
72
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/javascript/json-ld.html
vendored
Normal file
72
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/javascript/json-ld.html
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: JSON-LD mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="../../addon/edit/matchbrackets.js"></script>
|
||||
<script src="../../addon/comment/continuecomment.js"></script>
|
||||
<script src="../../addon/comment/comment.js"></script>
|
||||
<script src="javascript.js"></script>
|
||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
<div id="nav">
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"/></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">JSON-LD</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>JSON-LD mode</h2>
|
||||
|
||||
|
||||
<div><textarea id="code" name="code">
|
||||
{
|
||||
"@context": {
|
||||
"name": "http://schema.org/name",
|
||||
"description": "http://schema.org/description",
|
||||
"image": {
|
||||
"@id": "http://schema.org/image",
|
||||
"@type": "@id"
|
||||
},
|
||||
"geo": "http://schema.org/geo",
|
||||
"latitude": {
|
||||
"@id": "http://schema.org/latitude",
|
||||
"@type": "xsd:float"
|
||||
},
|
||||
"longitude": {
|
||||
"@id": "http://schema.org/longitude",
|
||||
"@type": "xsd:float"
|
||||
},
|
||||
"xsd": "http://www.w3.org/2001/XMLSchema#"
|
||||
},
|
||||
"name": "The Empire State Building",
|
||||
"description": "The Empire State Building is a 102-story landmark in New York City.",
|
||||
"image": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg",
|
||||
"geo": {
|
||||
"latitude": "40.75",
|
||||
"longitude": "73.98"
|
||||
}
|
||||
}
|
||||
</textarea></div>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
matchBrackets: true,
|
||||
autoCloseBrackets: true,
|
||||
mode: "application/ld+json",
|
||||
lineWrapping: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>This is a specialization of the <a href="index.html">JavaScript mode</a>.</p>
|
||||
</article>
|
||||
200
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/javascript/test.js
vendored
Normal file
200
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/javascript/test.js
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function() {
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "javascript");
|
||||
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
|
||||
|
||||
MT("locals",
|
||||
"[keyword function] [variable foo]([def a], [def b]) { [keyword var] [def c] [operator =] [number 10]; [keyword return] [variable-2 a] [operator +] [variable-2 c] [operator +] [variable d]; }");
|
||||
|
||||
MT("comma-and-binop",
|
||||
"[keyword function](){ [keyword var] [def x] [operator =] [number 1] [operator +] [number 2], [def y]; }");
|
||||
|
||||
MT("destructuring",
|
||||
"([keyword function]([def a], [[[def b], [def c] ]]) {",
|
||||
" [keyword let] {[def d], [property foo]: [def c][operator =][number 10], [def x]} [operator =] [variable foo]([variable-2 a]);",
|
||||
" [[[variable-2 c], [variable y] ]] [operator =] [variable-2 c];",
|
||||
"})();");
|
||||
|
||||
MT("class_body",
|
||||
"[keyword class] [variable Foo] {",
|
||||
" [property constructor]() {}",
|
||||
" [property sayName]() {",
|
||||
" [keyword return] [string-2 `foo${][variable foo][string-2 }oo`];",
|
||||
" }",
|
||||
"}");
|
||||
|
||||
MT("class",
|
||||
"[keyword class] [variable Point] [keyword extends] [variable SuperThing] {",
|
||||
" [property get] [property prop]() { [keyword return] [number 24]; }",
|
||||
" [property constructor]([def x], [def y]) {",
|
||||
" [keyword super]([string 'something']);",
|
||||
" [keyword this].[property x] [operator =] [variable-2 x];",
|
||||
" }",
|
||||
"}");
|
||||
|
||||
MT("module",
|
||||
"[keyword module] [string 'foo'] {",
|
||||
" [keyword export] [keyword let] [def x] [operator =] [number 42];",
|
||||
" [keyword export] [keyword *] [keyword from] [string 'somewhere'];",
|
||||
"}");
|
||||
|
||||
MT("import",
|
||||
"[keyword function] [variable foo]() {",
|
||||
" [keyword import] [def $] [keyword from] [string 'jquery'];",
|
||||
" [keyword module] [def crypto] [keyword from] [string 'crypto'];",
|
||||
" [keyword import] { [def encrypt], [def decrypt] } [keyword from] [string 'crypto'];",
|
||||
"}");
|
||||
|
||||
MT("const",
|
||||
"[keyword function] [variable f]() {",
|
||||
" [keyword const] [[ [def a], [def b] ]] [operator =] [[ [number 1], [number 2] ]];",
|
||||
"}");
|
||||
|
||||
MT("for/of",
|
||||
"[keyword for]([keyword let] [variable of] [keyword of] [variable something]) {}");
|
||||
|
||||
MT("generator",
|
||||
"[keyword function*] [variable repeat]([def n]) {",
|
||||
" [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])",
|
||||
" [keyword yield] [variable-2 i];",
|
||||
"}");
|
||||
|
||||
MT("quotedStringAddition",
|
||||
"[keyword let] [variable f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];");
|
||||
|
||||
MT("quotedFatArrow",
|
||||
"[keyword let] [variable f] [operator =] [variable a] [operator +] [string '=>'] [operator +] [variable c];");
|
||||
|
||||
MT("fatArrow",
|
||||
"[variable array].[property filter]([def a] [operator =>] [variable-2 a] [operator +] [number 1]);",
|
||||
"[variable a];", // No longer in scope
|
||||
"[keyword let] [variable f] [operator =] ([[ [def a], [def b] ]], [def c]) [operator =>] [variable-2 a] [operator +] [variable-2 c];",
|
||||
"[variable c];");
|
||||
|
||||
MT("spread",
|
||||
"[keyword function] [variable f]([def a], [meta ...][def b]) {",
|
||||
" [variable something]([variable-2 a], [meta ...][variable-2 b]);",
|
||||
"}");
|
||||
|
||||
MT("comprehension",
|
||||
"[keyword function] [variable f]() {",
|
||||
" [[([variable x] [operator +] [number 1]) [keyword for] ([keyword var] [def x] [keyword in] [variable y]) [keyword if] [variable pred]([variable-2 x]) ]];",
|
||||
" ([variable u] [keyword for] ([keyword var] [def u] [keyword of] [variable generateValues]()) [keyword if] ([variable-2 u].[property color] [operator ===] [string 'blue']));",
|
||||
"}");
|
||||
|
||||
MT("quasi",
|
||||
"[variable re][string-2 `fofdlakj${][variable x] [operator +] ([variable re][string-2 `foo`]) [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]");
|
||||
|
||||
MT("quasi_no_function",
|
||||
"[variable x] [operator =] [string-2 `fofdlakj${][variable x] [operator +] [string-2 `foo`] [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]");
|
||||
|
||||
MT("indent_statement",
|
||||
"[keyword var] [variable x] [operator =] [number 10]",
|
||||
"[variable x] [operator +=] [variable y] [operator +]",
|
||||
" [atom Infinity]",
|
||||
"[keyword debugger];");
|
||||
|
||||
MT("indent_if",
|
||||
"[keyword if] ([number 1])",
|
||||
" [keyword break];",
|
||||
"[keyword else] [keyword if] ([number 2])",
|
||||
" [keyword continue];",
|
||||
"[keyword else]",
|
||||
" [number 10];",
|
||||
"[keyword if] ([number 1]) {",
|
||||
" [keyword break];",
|
||||
"} [keyword else] [keyword if] ([number 2]) {",
|
||||
" [keyword continue];",
|
||||
"} [keyword else] {",
|
||||
" [number 10];",
|
||||
"}");
|
||||
|
||||
MT("indent_for",
|
||||
"[keyword for] ([keyword var] [variable i] [operator =] [number 0];",
|
||||
" [variable i] [operator <] [number 100];",
|
||||
" [variable i][operator ++])",
|
||||
" [variable doSomething]([variable i]);",
|
||||
"[keyword debugger];");
|
||||
|
||||
MT("indent_c_style",
|
||||
"[keyword function] [variable foo]()",
|
||||
"{",
|
||||
" [keyword debugger];",
|
||||
"}");
|
||||
|
||||
MT("indent_else",
|
||||
"[keyword for] (;;)",
|
||||
" [keyword if] ([variable foo])",
|
||||
" [keyword if] ([variable bar])",
|
||||
" [number 1];",
|
||||
" [keyword else]",
|
||||
" [number 2];",
|
||||
" [keyword else]",
|
||||
" [number 3];");
|
||||
|
||||
MT("indent_funarg",
|
||||
"[variable foo]([number 10000],",
|
||||
" [keyword function]([def a]) {",
|
||||
" [keyword debugger];",
|
||||
"};");
|
||||
|
||||
MT("indent_below_if",
|
||||
"[keyword for] (;;)",
|
||||
" [keyword if] ([variable foo])",
|
||||
" [number 1];",
|
||||
"[number 2];");
|
||||
|
||||
MT("multilinestring",
|
||||
"[keyword var] [variable x] [operator =] [string 'foo\\]",
|
||||
"[string bar'];");
|
||||
|
||||
MT("scary_regexp",
|
||||
"[string-2 /foo[[/]]bar/];");
|
||||
|
||||
MT("indent_strange_array",
|
||||
"[keyword var] [variable x] [operator =] [[",
|
||||
" [number 1],,",
|
||||
" [number 2],",
|
||||
"]];",
|
||||
"[number 10];");
|
||||
|
||||
var jsonld_mode = CodeMirror.getMode(
|
||||
{indentUnit: 2},
|
||||
{name: "javascript", jsonld: true}
|
||||
);
|
||||
function LD(name) {
|
||||
test.mode(name, jsonld_mode, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
|
||||
LD("json_ld_keywords",
|
||||
'{',
|
||||
' [meta "@context"]: {',
|
||||
' [meta "@base"]: [string "http://example.com"],',
|
||||
' [meta "@vocab"]: [string "http://xmlns.com/foaf/0.1/"],',
|
||||
' [property "likesFlavor"]: {',
|
||||
' [meta "@container"]: [meta "@list"]',
|
||||
' [meta "@reverse"]: [string "@beFavoriteOf"]',
|
||||
' },',
|
||||
' [property "nick"]: { [meta "@container"]: [meta "@set"] },',
|
||||
' [property "nick"]: { [meta "@container"]: [meta "@index"] }',
|
||||
' },',
|
||||
' [meta "@graph"]: [[ {',
|
||||
' [meta "@id"]: [string "http://dbpedia.org/resource/John_Lennon"],',
|
||||
' [property "name"]: [string "John Lennon"],',
|
||||
' [property "modified"]: {',
|
||||
' [meta "@value"]: [string "2010-05-29T14:17:39+02:00"],',
|
||||
' [meta "@type"]: [string "http://www.w3.org/2001/XMLSchema#dateTime"]',
|
||||
' }',
|
||||
' } ]]',
|
||||
'}');
|
||||
|
||||
LD("json_ld_fake",
|
||||
'{',
|
||||
' [property "@fake"]: [string "@fake"],',
|
||||
' [property "@contextual"]: [string "@identifier"],',
|
||||
' [property "user@domain.com"]: [string "@graphical"],',
|
||||
' [property "@ID"]: [string "@@ID"]',
|
||||
'}');
|
||||
})();
|
||||
@@ -0,0 +1,61 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: TypeScript mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="javascript.js"></script>
|
||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">TypeScript</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>TypeScript mode</h2>
|
||||
|
||||
|
||||
<div><textarea id="code" name="code">
|
||||
class Greeter {
|
||||
greeting: string;
|
||||
constructor (message: string) {
|
||||
this.greeting = message;
|
||||
}
|
||||
greet() {
|
||||
return "Hello, " + this.greeting;
|
||||
}
|
||||
}
|
||||
|
||||
var greeter = new Greeter("world");
|
||||
|
||||
var button = document.createElement('button')
|
||||
button.innerText = "Say Hello"
|
||||
button.onclick = function() {
|
||||
alert(greeter.greet())
|
||||
}
|
||||
|
||||
document.body.appendChild(button)
|
||||
|
||||
</textarea></div>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/typescript"
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>This is a specialization of the <a href="index.html">JavaScript mode</a>.</p>
|
||||
</article>
|
||||
64
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/php/index.html
vendored
Normal file
64
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/php/index.html
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: PHP mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="../../addon/edit/matchbrackets.js"></script>
|
||||
<script src="../htmlmixed/htmlmixed.js"></script>
|
||||
<script src="../xml/xml.js"></script>
|
||||
<script src="../javascript/javascript.js"></script>
|
||||
<script src="../css/css.js"></script>
|
||||
<script src="../clike/clike.js"></script>
|
||||
<script src="php.js"></script>
|
||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">PHP</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>PHP mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
<?php
|
||||
$a = array('a' => 1, 'b' => 2, 3 => 'c');
|
||||
|
||||
echo "$a[a] ${a[3] /* } comment */} {$a[b]} \$a[a]";
|
||||
|
||||
function hello($who) {
|
||||
return "Hello $who!";
|
||||
}
|
||||
?>
|
||||
<p>The program says <?= hello("World") ?>.</p>
|
||||
<script>
|
||||
alert("And here is some JS code"); // also colored
|
||||
</script>
|
||||
</textarea></form>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "application/x-httpd-php",
|
||||
indentUnit: 4,
|
||||
indentWithTabs: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>Simple HTML/PHP mode based on
|
||||
the <a href="../clike/">C-like</a> mode. Depends on XML,
|
||||
JavaScript, CSS, HTMLMixed, and C-like modes.</p>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
|
||||
</article>
|
||||
226
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/php/php.js
vendored
Normal file
226
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/php/php.js
vendored
Normal file
File diff suppressed because one or more lines are too long
154
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/php/test.js
vendored
Normal file
154
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/php/test.js
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function() {
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "php");
|
||||
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
|
||||
|
||||
MT('simple_test',
|
||||
'[meta <?php] ' +
|
||||
'[keyword echo] [string "aaa"]; ' +
|
||||
'[meta ?>]');
|
||||
|
||||
MT('variable_interpolation_non_alphanumeric',
|
||||
'[meta <?php]',
|
||||
'[keyword echo] [string "aaa$~$!$@$#$$$%$^$&$*$($)$.$<$>$/$\\$}$\\\"$:$;$?$|$[[$]]$+$=aaa"]',
|
||||
'[meta ?>]');
|
||||
|
||||
MT('variable_interpolation_digits',
|
||||
'[meta <?php]',
|
||||
'[keyword echo] [string "aaa$1$2$3$4$5$6$7$8$9$0aaa"]',
|
||||
'[meta ?>]');
|
||||
|
||||
MT('variable_interpolation_simple_syntax_1',
|
||||
'[meta <?php]',
|
||||
'[keyword echo] [string "aaa][variable-2 $aaa][string .aaa"];',
|
||||
'[meta ?>]');
|
||||
|
||||
MT('variable_interpolation_simple_syntax_2',
|
||||
'[meta <?php]',
|
||||
'[keyword echo] [string "][variable-2 $aaaa][[','[number 2]', ']][string aa"];',
|
||||
'[keyword echo] [string "][variable-2 $aaaa][[','[number 2345]', ']][string aa"];',
|
||||
'[keyword echo] [string "][variable-2 $aaaa][[','[number 2.3]', ']][string aa"];',
|
||||
'[keyword echo] [string "][variable-2 $aaaa][[','[variable aaaaa]', ']][string aa"];',
|
||||
'[keyword echo] [string "][variable-2 $aaaa][[','[variable-2 $aaaaa]',']][string aa"];',
|
||||
|
||||
'[keyword echo] [string "1aaa][variable-2 $aaaa][[','[number 2]', ']][string aa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $aaaa][[','[number 2345]', ']][string aa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $aaaa][[','[number 2.3]', ']][string aa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $aaaa][[','[variable aaaaa]', ']][string aa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $aaaa][[','[variable-2 $aaaaa]',']][string aa"];',
|
||||
'[meta ?>]');
|
||||
|
||||
MT('variable_interpolation_simple_syntax_3',
|
||||
'[meta <?php]',
|
||||
'[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string .aaaaaa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $aaaa][string ->][variable-2 $aaaaa][string .aaaaaa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string [[2]].aaaaaa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string ->aaaa2.aaaaaa"];',
|
||||
'[meta ?>]');
|
||||
|
||||
MT('variable_interpolation_escaping',
|
||||
'[meta <?php] [comment /* Escaping */]',
|
||||
'[keyword echo] [string "aaa\\$aaaa->aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa\\$aaaa[[2]]aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa\\$aaaa[[asd]]aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa{\\$aaaa->aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa{\\$aaaa[[2]]aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa{\\aaaaa[[asd]]aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa\\${aaaa->aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa\\${aaaa[[2]]aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa\\${aaaa[[asd]]aaa.aaa"];',
|
||||
'[meta ?>]');
|
||||
|
||||
MT('variable_interpolation_complex_syntax_1',
|
||||
'[meta <?php]',
|
||||
'[keyword echo] [string "aaa][variable-2 $]{[variable aaaa]}[string ->aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa]}[string ->aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa][[',' [number 42]',']]}[string ->aaa.aaa"];',
|
||||
'[keyword echo] [string "aaa][variable-2 $]{[variable aaaa][meta ?>]aaaaaa');
|
||||
|
||||
MT('variable_interpolation_complex_syntax_2',
|
||||
'[meta <?php] [comment /* Monsters */]',
|
||||
'[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*}?>} $aaa<?php } */]}[string ->aaa.aaa"];',
|
||||
'[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*}?>*/][[',' [string "aaa][variable-2 $aaa][string {}][variable-2 $]{[variable aaa]}[string "]',']]}[string ->aaa.aaa"];',
|
||||
'[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*} } $aaa } */]}[string ->aaa.aaa"];');
|
||||
|
||||
|
||||
function build_recursive_monsters(nt, t, n){
|
||||
var monsters = [t];
|
||||
for (var i = 1; i <= n; ++i)
|
||||
monsters[i] = nt.join(monsters[i - 1]);
|
||||
return monsters;
|
||||
}
|
||||
|
||||
var m1 = build_recursive_monsters(
|
||||
['[string "][variable-2 $]{[variable aaa] [operator +] ', '}[string "]'],
|
||||
'[comment /* }?>} */] [string "aaa][variable-2 $aaa][string .aaa"]',
|
||||
10
|
||||
);
|
||||
|
||||
MT('variable_interpolation_complex_syntax_3_1',
|
||||
'[meta <?php] [comment /* Recursive monsters */]',
|
||||
'[keyword echo] ' + m1[4] + ';',
|
||||
'[keyword echo] ' + m1[7] + ';',
|
||||
'[keyword echo] ' + m1[8] + ';',
|
||||
'[keyword echo] ' + m1[5] + ';',
|
||||
'[keyword echo] ' + m1[1] + ';',
|
||||
'[keyword echo] ' + m1[6] + ';',
|
||||
'[keyword echo] ' + m1[9] + ';',
|
||||
'[keyword echo] ' + m1[0] + ';',
|
||||
'[keyword echo] ' + m1[10] + ';',
|
||||
'[keyword echo] ' + m1[2] + ';',
|
||||
'[keyword echo] ' + m1[3] + ';',
|
||||
'[keyword echo] [string "end"];',
|
||||
'[meta ?>]');
|
||||
|
||||
var m2 = build_recursive_monsters(
|
||||
['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', '}[string .a"]'],
|
||||
'[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]',
|
||||
5
|
||||
);
|
||||
|
||||
MT('variable_interpolation_complex_syntax_3_2',
|
||||
'[meta <?php] [comment /* Recursive monsters 2 */]',
|
||||
'[keyword echo] ' + m2[0] + ';',
|
||||
'[keyword echo] ' + m2[1] + ';',
|
||||
'[keyword echo] ' + m2[5] + ';',
|
||||
'[keyword echo] ' + m2[4] + ';',
|
||||
'[keyword echo] ' + m2[2] + ';',
|
||||
'[keyword echo] ' + m2[3] + ';',
|
||||
'[keyword echo] [string "end"];',
|
||||
'[meta ?>]');
|
||||
|
||||
function build_recursive_monsters_2(mf1, mf2, nt, t, n){
|
||||
var monsters = [t];
|
||||
for (var i = 1; i <= n; ++i)
|
||||
monsters[i] = nt[0] + mf1[i - 1] + nt[1] + mf2[i - 1] + nt[2] + monsters[i - 1] + nt[3];
|
||||
return monsters;
|
||||
}
|
||||
|
||||
var m3 = build_recursive_monsters_2(
|
||||
m1,
|
||||
m2,
|
||||
['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', ' [operator +] ', '}[string .a"]'],
|
||||
'[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]',
|
||||
4
|
||||
);
|
||||
|
||||
MT('variable_interpolation_complex_syntax_3_3',
|
||||
'[meta <?php] [comment /* Recursive monsters 2 */]',
|
||||
'[keyword echo] ' + m3[4] + ';',
|
||||
'[keyword echo] ' + m3[0] + ';',
|
||||
'[keyword echo] ' + m3[3] + ';',
|
||||
'[keyword echo] ' + m3[1] + ';',
|
||||
'[keyword echo] ' + m3[2] + ';',
|
||||
'[keyword echo] [string "end"];',
|
||||
'[meta ?>]');
|
||||
|
||||
MT("variable_interpolation_heredoc",
|
||||
"[meta <?php]",
|
||||
"[string <<<here]",
|
||||
"[string doc ][variable-2 $]{[variable yay]}[string more]",
|
||||
"[string here]; [comment // normal]");
|
||||
})();
|
||||
141
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/twig/twig.js
vendored
Normal file
141
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/twig/twig.js
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"), require("../../addon/mode/multiplex"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror", "../../addon/mode/multiplex"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("twig:inner", function() {
|
||||
var keywords = ["and", "as", "autoescape", "endautoescape", "block", "do", "endblock", "else", "elseif", "extends", "for", "endfor", "embed", "endembed", "filter", "endfilter", "flush", "from", "if", "endif", "in", "is", "include", "import", "not", "or", "set", "spaceless", "endspaceless", "with", "endwith", "trans", "endtrans", "blocktrans", "endblocktrans", "macro", "endmacro", "use", "verbatim", "endverbatim"],
|
||||
operator = /^[+\-*&%=<>!?|~^]/,
|
||||
sign = /^[:\[\(\{]/,
|
||||
atom = ["true", "false", "null", "empty", "defined", "divisibleby", "divisible by", "even", "odd", "iterable", "sameas", "same as"],
|
||||
number = /^(\d[+\-\*\/])?\d+(\.\d+)?/;
|
||||
|
||||
keywords = new RegExp("((" + keywords.join(")|(") + "))\\b");
|
||||
atom = new RegExp("((" + atom.join(")|(") + "))\\b");
|
||||
|
||||
function tokenBase (stream, state) {
|
||||
var ch = stream.peek();
|
||||
|
||||
//Comment
|
||||
if (state.incomment) {
|
||||
if (!stream.skipTo("#}")) {
|
||||
stream.skipToEnd();
|
||||
} else {
|
||||
stream.eatWhile(/\#|}/);
|
||||
state.incomment = false;
|
||||
}
|
||||
return "comment";
|
||||
//Tag
|
||||
} else if (state.intag) {
|
||||
//After operator
|
||||
if (state.operator) {
|
||||
state.operator = false;
|
||||
if (stream.match(atom)) {
|
||||
return "atom";
|
||||
}
|
||||
if (stream.match(number)) {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
//After sign
|
||||
if (state.sign) {
|
||||
state.sign = false;
|
||||
if (stream.match(atom)) {
|
||||
return "atom";
|
||||
}
|
||||
if (stream.match(number)) {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
||||
if (state.instring) {
|
||||
if (ch == state.instring) {
|
||||
state.instring = false;
|
||||
}
|
||||
stream.next();
|
||||
return "string";
|
||||
} else if (ch == "'" || ch == '"') {
|
||||
state.instring = ch;
|
||||
stream.next();
|
||||
return "string";
|
||||
} else if (stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) {
|
||||
state.intag = false;
|
||||
return "tag";
|
||||
} else if (stream.match(operator)) {
|
||||
state.operator = true;
|
||||
return "operator";
|
||||
} else if (stream.match(sign)) {
|
||||
state.sign = true;
|
||||
} else {
|
||||
if (stream.eat(" ") || stream.sol()) {
|
||||
if (stream.match(keywords)) {
|
||||
return "keyword";
|
||||
}
|
||||
if (stream.match(atom)) {
|
||||
return "atom";
|
||||
}
|
||||
if (stream.match(number)) {
|
||||
return "number";
|
||||
}
|
||||
if (stream.sol()) {
|
||||
stream.next();
|
||||
}
|
||||
} else {
|
||||
stream.next();
|
||||
}
|
||||
|
||||
}
|
||||
return "variable";
|
||||
} else if (stream.eat("{")) {
|
||||
if (stream.eat("#")) {
|
||||
state.incomment = true;
|
||||
if (!stream.skipTo("#}")) {
|
||||
stream.skipToEnd();
|
||||
} else {
|
||||
stream.eatWhile(/\#|}/);
|
||||
state.incomment = false;
|
||||
}
|
||||
return "comment";
|
||||
//Open tag
|
||||
} else if (ch = stream.eat(/\{|%/)) {
|
||||
//Cache close tag
|
||||
state.intag = ch;
|
||||
if (ch == "{") {
|
||||
state.intag = "}";
|
||||
}
|
||||
stream.eat("-");
|
||||
return "tag";
|
||||
}
|
||||
}
|
||||
stream.next();
|
||||
};
|
||||
|
||||
return {
|
||||
startState: function () {
|
||||
return {};
|
||||
},
|
||||
token: function (stream, state) {
|
||||
return tokenBase(stream, state);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMode("twig", function(config, parserConfig) {
|
||||
var twigInner = CodeMirror.getMode(config, "twig:inner");
|
||||
if (!parserConfig || !parserConfig.base) return twigInner;
|
||||
return CodeMirror.multiplexingMode(
|
||||
CodeMirror.getMode(config, parserConfig.base), {
|
||||
open: /\{[{#%]/, close: /[}#%]\}/, mode: twigInner, parseDelimiters: true
|
||||
}
|
||||
);
|
||||
});
|
||||
CodeMirror.defineMIME("text/x-twig", "twig");
|
||||
});
|
||||
57
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/xml/index.html
vendored
Normal file
57
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/xml/index.html
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: XML mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="xml.js"></script>
|
||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">XML</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>XML mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
<html style="color: green">
|
||||
<!-- this is a comment -->
|
||||
<head>
|
||||
<title>HTML Example</title>
|
||||
</head>
|
||||
<body>
|
||||
The indentation tries to be <em>somewhat &quot;do what
|
||||
I mean&quot;</em>... but might not match your style.
|
||||
</body>
|
||||
</html>
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
mode: "text/html",
|
||||
lineNumbers: true
|
||||
});
|
||||
</script>
|
||||
<p>The XML mode supports two configuration parameters:</p>
|
||||
<dl>
|
||||
<dt><code>htmlMode (boolean)</code></dt>
|
||||
<dd>This switches the mode to parse HTML instead of XML. This
|
||||
means attributes do not have to be quoted, and some elements
|
||||
(such as <code>br</code>) do not require a closing tag.</dd>
|
||||
<dt><code>alignCDATA (boolean)</code></dt>
|
||||
<dd>Setting this to true will force the opening tag of CDATA
|
||||
blocks to not be indented.</dd>
|
||||
</dl>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/html</code>.</p>
|
||||
</article>
|
||||
51
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/xml/test.js
vendored
Normal file
51
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/xml/test.js
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function() {
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "xml"), mname = "xml";
|
||||
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), mname); }
|
||||
|
||||
MT("matching",
|
||||
"[tag&bracket <][tag top][tag&bracket >]",
|
||||
" text",
|
||||
" [tag&bracket <][tag inner][tag&bracket />]",
|
||||
"[tag&bracket </][tag top][tag&bracket >]");
|
||||
|
||||
MT("nonmatching",
|
||||
"[tag&bracket <][tag top][tag&bracket >]",
|
||||
" [tag&bracket <][tag inner][tag&bracket />]",
|
||||
" [tag&bracket </][tag&error tip][tag&bracket&error >]");
|
||||
|
||||
MT("doctype",
|
||||
"[meta <!doctype foobar>]",
|
||||
"[tag&bracket <][tag top][tag&bracket />]");
|
||||
|
||||
MT("cdata",
|
||||
"[tag&bracket <][tag top][tag&bracket >]",
|
||||
" [atom <![CDATA[foo]",
|
||||
"[atom barbazguh]]]]>]",
|
||||
"[tag&bracket </][tag top][tag&bracket >]");
|
||||
|
||||
// HTML tests
|
||||
mode = CodeMirror.getMode({indentUnit: 2}, "text/html");
|
||||
|
||||
MT("selfclose",
|
||||
"[tag&bracket <][tag html][tag&bracket >]",
|
||||
" [tag&bracket <][tag link] [attribute rel]=[string stylesheet] [attribute href]=[string \"/foobar\"][tag&bracket >]",
|
||||
"[tag&bracket </][tag html][tag&bracket >]");
|
||||
|
||||
MT("list",
|
||||
"[tag&bracket <][tag ol][tag&bracket >]",
|
||||
" [tag&bracket <][tag li][tag&bracket >]one",
|
||||
" [tag&bracket <][tag li][tag&bracket >]two",
|
||||
"[tag&bracket </][tag ol][tag&bracket >]");
|
||||
|
||||
MT("valueless",
|
||||
"[tag&bracket <][tag input] [attribute type]=[string checkbox] [attribute checked][tag&bracket />]");
|
||||
|
||||
MT("pThenArticle",
|
||||
"[tag&bracket <][tag p][tag&bracket >]",
|
||||
" foo",
|
||||
"[tag&bracket <][tag article][tag&bracket >]bar");
|
||||
|
||||
})();
|
||||
384
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/xml/xml.js
vendored
Normal file
384
wp-content/plugins/unlimited-elements-for-elementor/js/codemirror/mode/xml/xml.js
vendored
Normal file
@@ -0,0 +1,384 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("xml", function(config, parserConfig) {
|
||||
var indentUnit = config.indentUnit;
|
||||
var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1;
|
||||
var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag;
|
||||
if (multilineTagIndentPastTag == null) multilineTagIndentPastTag = true;
|
||||
|
||||
var Kludges = parserConfig.htmlMode ? {
|
||||
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
|
||||
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
|
||||
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
|
||||
'track': true, 'wbr': true, 'menuitem': true},
|
||||
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
|
||||
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
|
||||
'th': true, 'tr': true},
|
||||
contextGrabbers: {
|
||||
'dd': {'dd': true, 'dt': true},
|
||||
'dt': {'dd': true, 'dt': true},
|
||||
'li': {'li': true},
|
||||
'option': {'option': true, 'optgroup': true},
|
||||
'optgroup': {'optgroup': true},
|
||||
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
|
||||
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
|
||||
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
|
||||
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
|
||||
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
|
||||
'rp': {'rp': true, 'rt': true},
|
||||
'rt': {'rp': true, 'rt': true},
|
||||
'tbody': {'tbody': true, 'tfoot': true},
|
||||
'td': {'td': true, 'th': true},
|
||||
'tfoot': {'tbody': true},
|
||||
'th': {'td': true, 'th': true},
|
||||
'thead': {'tbody': true, 'tfoot': true},
|
||||
'tr': {'tr': true}
|
||||
},
|
||||
doNotIndent: {"pre": true},
|
||||
allowUnquoted: true,
|
||||
allowMissing: true,
|
||||
caseFold: true
|
||||
} : {
|
||||
autoSelfClosers: {},
|
||||
implicitlyClosed: {},
|
||||
contextGrabbers: {},
|
||||
doNotIndent: {},
|
||||
allowUnquoted: false,
|
||||
allowMissing: false,
|
||||
caseFold: false
|
||||
};
|
||||
var alignCDATA = parserConfig.alignCDATA;
|
||||
|
||||
// Return variables for tokenizers
|
||||
var type, setStyle;
|
||||
|
||||
function inText(stream, state) {
|
||||
function chain(parser) {
|
||||
state.tokenize = parser;
|
||||
return parser(stream, state);
|
||||
}
|
||||
|
||||
var ch = stream.next();
|
||||
if (ch == "<") {
|
||||
if (stream.eat("!")) {
|
||||
if (stream.eat("[")) {
|
||||
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
|
||||
else return null;
|
||||
} else if (stream.match("--")) {
|
||||
return chain(inBlock("comment", "-->"));
|
||||
} else if (stream.match("DOCTYPE", true, true)) {
|
||||
stream.eatWhile(/[\w\._\-]/);
|
||||
return chain(doctype(1));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (stream.eat("?")) {
|
||||
stream.eatWhile(/[\w\._\-]/);
|
||||
state.tokenize = inBlock("meta", "?>");
|
||||
return "meta";
|
||||
} else {
|
||||
type = stream.eat("/") ? "closeTag" : "openTag";
|
||||
state.tokenize = inTag;
|
||||
return "tag bracket";
|
||||
}
|
||||
} else if (ch == "&") {
|
||||
var ok;
|
||||
if (stream.eat("#")) {
|
||||
if (stream.eat("x")) {
|
||||
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
||||
} else {
|
||||
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
||||
}
|
||||
} else {
|
||||
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
|
||||
}
|
||||
return ok ? "atom" : "error";
|
||||
} else {
|
||||
stream.eatWhile(/[^&<]/);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function inTag(stream, state) {
|
||||
var ch = stream.next();
|
||||
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
|
||||
state.tokenize = inText;
|
||||
type = ch == ">" ? "endTag" : "selfcloseTag";
|
||||
return "tag bracket";
|
||||
} else if (ch == "=") {
|
||||
type = "equals";
|
||||
return null;
|
||||
} else if (ch == "<") {
|
||||
state.tokenize = inText;
|
||||
state.state = baseState;
|
||||
state.tagName = state.tagStart = null;
|
||||
var next = state.tokenize(stream, state);
|
||||
return next ? next + " tag error" : "tag error";
|
||||
} else if (/[\'\"]/.test(ch)) {
|
||||
state.tokenize = inAttribute(ch);
|
||||
state.stringStartCol = stream.column();
|
||||
return state.tokenize(stream, state);
|
||||
} else {
|
||||
stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
|
||||
return "word";
|
||||
}
|
||||
}
|
||||
|
||||
function inAttribute(quote) {
|
||||
var closure = function(stream, state) {
|
||||
while (!stream.eol()) {
|
||||
if (stream.next() == quote) {
|
||||
state.tokenize = inTag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "string";
|
||||
};
|
||||
closure.isInAttribute = true;
|
||||
return closure;
|
||||
}
|
||||
|
||||
function inBlock(style, terminator) {
|
||||
return function(stream, state) {
|
||||
while (!stream.eol()) {
|
||||
if (stream.match(terminator)) {
|
||||
state.tokenize = inText;
|
||||
break;
|
||||
}
|
||||
stream.next();
|
||||
}
|
||||
return style;
|
||||
};
|
||||
}
|
||||
function doctype(depth) {
|
||||
return function(stream, state) {
|
||||
var ch;
|
||||
while ((ch = stream.next()) != null) {
|
||||
if (ch == "<") {
|
||||
state.tokenize = doctype(depth + 1);
|
||||
return state.tokenize(stream, state);
|
||||
} else if (ch == ">") {
|
||||
if (depth == 1) {
|
||||
state.tokenize = inText;
|
||||
break;
|
||||
} else {
|
||||
state.tokenize = doctype(depth - 1);
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
return "meta";
|
||||
};
|
||||
}
|
||||
|
||||
function Context(state, tagName, startOfLine) {
|
||||
this.prev = state.context;
|
||||
this.tagName = tagName;
|
||||
this.indent = state.indented;
|
||||
this.startOfLine = startOfLine;
|
||||
if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
|
||||
this.noIndent = true;
|
||||
}
|
||||
function popContext(state) {
|
||||
if (state.context) state.context = state.context.prev;
|
||||
}
|
||||
function maybePopContext(state, nextTagName) {
|
||||
var parentTagName;
|
||||
while (true) {
|
||||
if (!state.context) {
|
||||
return;
|
||||
}
|
||||
parentTagName = state.context.tagName;
|
||||
if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
|
||||
!Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
||||
return;
|
||||
}
|
||||
popContext(state);
|
||||
}
|
||||
}
|
||||
|
||||
function baseState(type, stream, state) {
|
||||
if (type == "openTag") {
|
||||
state.tagStart = stream.column();
|
||||
return tagNameState;
|
||||
} else if (type == "closeTag") {
|
||||
return closeTagNameState;
|
||||
} else {
|
||||
return baseState;
|
||||
}
|
||||
}
|
||||
function tagNameState(type, stream, state) {
|
||||
if (type == "word") {
|
||||
state.tagName = stream.current();
|
||||
setStyle = "tag";
|
||||
return attrState;
|
||||
} else {
|
||||
setStyle = "error";
|
||||
return tagNameState;
|
||||
}
|
||||
}
|
||||
function closeTagNameState(type, stream, state) {
|
||||
if (type == "word") {
|
||||
var tagName = stream.current();
|
||||
if (state.context && state.context.tagName != tagName &&
|
||||
Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName))
|
||||
popContext(state);
|
||||
if (state.context && state.context.tagName == tagName) {
|
||||
setStyle = "tag";
|
||||
return closeState;
|
||||
} else {
|
||||
setStyle = "tag error";
|
||||
return closeStateErr;
|
||||
}
|
||||
} else {
|
||||
setStyle = "error";
|
||||
return closeStateErr;
|
||||
}
|
||||
}
|
||||
|
||||
function closeState(type, _stream, state) {
|
||||
if (type != "endTag") {
|
||||
setStyle = "error";
|
||||
return closeState;
|
||||
}
|
||||
popContext(state);
|
||||
return baseState;
|
||||
}
|
||||
function closeStateErr(type, stream, state) {
|
||||
setStyle = "error";
|
||||
return closeState(type, stream, state);
|
||||
}
|
||||
|
||||
function attrState(type, _stream, state) {
|
||||
if (type == "word") {
|
||||
setStyle = "attribute";
|
||||
return attrEqState;
|
||||
} else if (type == "endTag" || type == "selfcloseTag") {
|
||||
var tagName = state.tagName, tagStart = state.tagStart;
|
||||
state.tagName = state.tagStart = null;
|
||||
if (type == "selfcloseTag" ||
|
||||
Kludges.autoSelfClosers.hasOwnProperty(tagName)) {
|
||||
maybePopContext(state, tagName);
|
||||
} else {
|
||||
maybePopContext(state, tagName);
|
||||
state.context = new Context(state, tagName, tagStart == state.indented);
|
||||
}
|
||||
return baseState;
|
||||
}
|
||||
setStyle = "error";
|
||||
return attrState;
|
||||
}
|
||||
function attrEqState(type, stream, state) {
|
||||
if (type == "equals") return attrValueState;
|
||||
if (!Kludges.allowMissing) setStyle = "error";
|
||||
return attrState(type, stream, state);
|
||||
}
|
||||
function attrValueState(type, stream, state) {
|
||||
if (type == "string") return attrContinuedState;
|
||||
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return attrState;}
|
||||
setStyle = "error";
|
||||
return attrState(type, stream, state);
|
||||
}
|
||||
function attrContinuedState(type, stream, state) {
|
||||
if (type == "string") return attrContinuedState;
|
||||
return attrState(type, stream, state);
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function() {
|
||||
return {tokenize: inText,
|
||||
state: baseState,
|
||||
indented: 0,
|
||||
tagName: null, tagStart: null,
|
||||
context: null};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
if (!state.tagName && stream.sol())
|
||||
state.indented = stream.indentation();
|
||||
|
||||
if (stream.eatSpace()) return null;
|
||||
type = null;
|
||||
var style = state.tokenize(stream, state);
|
||||
if ((style || type) && style != "comment") {
|
||||
setStyle = null;
|
||||
state.state = state.state(type || style, stream, state);
|
||||
if (setStyle)
|
||||
style = setStyle == "error" ? style + " error" : setStyle;
|
||||
}
|
||||
return style;
|
||||
},
|
||||
|
||||
indent: function(state, textAfter, fullLine) {
|
||||
var context = state.context;
|
||||
// Indent multi-line strings (e.g. css).
|
||||
if (state.tokenize.isInAttribute) {
|
||||
if (state.tagStart == state.indented)
|
||||
return state.stringStartCol + 1;
|
||||
else
|
||||
return state.indented + indentUnit;
|
||||
}
|
||||
if (context && context.noIndent) return CodeMirror.Pass;
|
||||
if (state.tokenize != inTag && state.tokenize != inText)
|
||||
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
||||
// Indent the starts of attribute names.
|
||||
if (state.tagName) {
|
||||
if (multilineTagIndentPastTag)
|
||||
return state.tagStart + state.tagName.length + 2;
|
||||
else
|
||||
return state.tagStart + indentUnit * multilineTagIndentFactor;
|
||||
}
|
||||
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
|
||||
var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
|
||||
if (tagAfter && tagAfter[1]) { // Closing tag spotted
|
||||
while (context) {
|
||||
if (context.tagName == tagAfter[2]) {
|
||||
context = context.prev;
|
||||
break;
|
||||
} else if (Kludges.implicitlyClosed.hasOwnProperty(context.tagName)) {
|
||||
context = context.prev;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (tagAfter) { // Opening tag spotted
|
||||
while (context) {
|
||||
var grabbers = Kludges.contextGrabbers[context.tagName];
|
||||
if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
|
||||
context = context.prev;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (context && !context.startOfLine)
|
||||
context = context.prev;
|
||||
if (context) return context.indent + indentUnit;
|
||||
else return 0;
|
||||
},
|
||||
|
||||
electricInput: /<\/[\s\w:]+>$/,
|
||||
blockCommentStart: "<!--",
|
||||
blockCommentEnd: "-->",
|
||||
|
||||
configuration: parserConfig.htmlMode ? "html" : "xml",
|
||||
helperType: parserConfig.htmlMode ? "html" : "xml"
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/xml", "xml");
|
||||
CodeMirror.defineMIME("application/xml", "xml");
|
||||
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
||||
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,509 @@
|
||||
(function() {
|
||||
var $;
|
||||
|
||||
$ = jQuery;
|
||||
|
||||
$.widget("ui.dialogExtend", {
|
||||
version: "2.0.0",
|
||||
modes: {},
|
||||
options: {
|
||||
"closable": true,
|
||||
"dblclick": false,
|
||||
"titlebar": false,
|
||||
"icons": {
|
||||
"close": "ui-icon-closethick",
|
||||
"restore": "ui-icon-newwin"
|
||||
},
|
||||
"load": null,
|
||||
"beforeRestore": null,
|
||||
"restore": null
|
||||
},
|
||||
_create: function() {
|
||||
this._state = "normal";
|
||||
if (!$(this.element[0]).data("ui-dialog")) {
|
||||
$.error("jQuery.dialogExtend Error : Only jQuery UI Dialog element is accepted");
|
||||
}
|
||||
this._verifyOptions();
|
||||
this._initStyles();
|
||||
this._initButtons();
|
||||
this._initTitleBar();
|
||||
this._setState("normal");
|
||||
this._on("load", function(e) {
|
||||
return console.log("test", e);
|
||||
});
|
||||
return this._trigger("load");
|
||||
},
|
||||
_setState: function(state) {
|
||||
$(this.element[0]).removeClass("ui-dialog-" + this._state).addClass("ui-dialog-" + state);
|
||||
return this._state = state;
|
||||
},
|
||||
_verifyOptions: function() {
|
||||
var name, _ref, _results;
|
||||
|
||||
if (this.options.dblclick && !(this.options.dblclick in this.modes)) {
|
||||
$.error("jQuery.dialogExtend Error : Invalid <dblclick> value '" + this.options.dblclick + "'");
|
||||
this.options.dblclick = false;
|
||||
}
|
||||
if (this.options.titlebar && ((_ref = this.options.titlebar) !== "none" && _ref !== "transparent")) {
|
||||
$.error("jQuery.dialogExtend Error : Invalid <titlebar> value '" + this.options.titlebar + "'");
|
||||
this.options.titlebar = false;
|
||||
}
|
||||
_results = [];
|
||||
for (name in this.modes) {
|
||||
if (this["_verifyOptions_" + name]) {
|
||||
_results.push(this["_verifyOptions_" + name]());
|
||||
} else {
|
||||
_results.push(void 0);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
},
|
||||
_initStyles: function() {
|
||||
var name, style, _results;
|
||||
|
||||
if (!$(".dialog-extend-css").length) {
|
||||
style = '';
|
||||
style += '<style class="dialog-extend-css" type="text/css">';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-buttonpane>a { float: right; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-restore { width: 19px; height: 18px; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-restore span { display: block; margin: 1px; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-restore:hover,';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-restore:focus { padding: 0; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar ::selection { background-color: transparent; }';
|
||||
style += '</style>';
|
||||
$(style).appendTo("body");
|
||||
}
|
||||
_results = [];
|
||||
for (name in this.modes) {
|
||||
_results.push(this["_initStyles_" + name]());
|
||||
}
|
||||
return _results;
|
||||
},
|
||||
_initButtons: function() {
|
||||
var buttonPane, mode, name, titlebar, _ref,
|
||||
_this = this;
|
||||
|
||||
titlebar = $(this.element[0]).dialog("widget").find(".ui-dialog-titlebar");
|
||||
buttonPane = $('<div class="ui-dialog-titlebar-buttonpane"></div>').appendTo(titlebar);
|
||||
buttonPane.css({
|
||||
"position": "absolute",
|
||||
"top": "50%",
|
||||
"right": "0.3em",
|
||||
"margin-top": "-10px",
|
||||
"height": "18px"
|
||||
});
|
||||
titlebar.find(".ui-dialog-titlebar-close").css({
|
||||
"position": "relative",
|
||||
"float": "right",
|
||||
"top": "auto",
|
||||
"right": "auto",
|
||||
"margin": 0
|
||||
}).find(".ui-icon").removeClass("ui-icon-closethick").addClass(this.options.icons.close).end().appendTo(buttonPane).end();
|
||||
buttonPane.append('<a class="ui-dialog-titlebar-restore ui-corner-all ui-state-default" href="#"><span class="ui-icon ' + this.options.icons.restore + '" title="restore">restore</span></a>').find('.ui-dialog-titlebar-restore').attr("role", "button").mouseover(function() {
|
||||
return $(this).addClass("ui-state-hover");
|
||||
}).mouseout(function() {
|
||||
return $(this).removeClass("ui-state-hover");
|
||||
}).focus(function() {
|
||||
return $(this).addClass("ui-state-focus");
|
||||
}).blur(function() {
|
||||
return $(this).removeClass("ui-state-focus");
|
||||
}).end().find(".ui-dialog-titlebar-close").toggle(this.options.closable).end().find(".ui-dialog-titlebar-restore").hide().on("click",function(e) {
|
||||
e.preventDefault();
|
||||
return _this.restore();
|
||||
}).end();
|
||||
_ref = this.modes;
|
||||
for (name in _ref) {
|
||||
mode = _ref[name];
|
||||
this._initModuleButton(name, mode);
|
||||
}
|
||||
return titlebar.dblclick(function(evt) {
|
||||
if (_this.options.dblclick) {
|
||||
if (_this._state !== "normal") {
|
||||
return _this.restore();
|
||||
} else {
|
||||
return _this[_this.options.dblclick]();
|
||||
}
|
||||
}
|
||||
}).select(function() {
|
||||
return false;
|
||||
});
|
||||
},
|
||||
_initModuleButton: function(name, mode) {
|
||||
var buttonPane,
|
||||
_this = this;
|
||||
|
||||
buttonPane = $(this.element[0]).dialog("widget").find('.ui-dialog-titlebar-buttonpane');
|
||||
return buttonPane.append('<a class="ui-dialog-titlebar-' + name + ' ui-corner-all ui-state-default" href="#" title="' + name + '"><span class="ui-icon ' + this.options.icons[name] + '">' + name + '</span></a>').find(".ui-dialog-titlebar-" + name).attr("role", "button").mouseover(function() {
|
||||
return $(this).addClass("ui-state-hover");
|
||||
}).mouseout(function() {
|
||||
return $(this).removeClass("ui-state-hover");
|
||||
}).focus(function() {
|
||||
return $(this).addClass("ui-state-focus");
|
||||
}).blur(function() {
|
||||
return $(this).removeClass("ui-state-focus");
|
||||
}).end().find(".ui-dialog-titlebar-" + name).toggle(this.options[mode.option]).on("click",function(e) {
|
||||
e.preventDefault();
|
||||
return _this[name]();
|
||||
}).end();
|
||||
},
|
||||
_initTitleBar: function() {
|
||||
var handle;
|
||||
|
||||
switch (this.options.titlebar) {
|
||||
case false:
|
||||
return 0;
|
||||
case "none":
|
||||
if ($(this.element[0]).dialog("option", "draggable")) {
|
||||
handle = $("<div />").addClass("ui-dialog-draggable-handle").css("cursor", "move").height(5);
|
||||
$(this.element[0]).dialog("widget").prepend(handle).draggable("option", "handle", handle);
|
||||
}
|
||||
return $(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").find(".ui-dialog-title").html(" ").end().css({
|
||||
"background-color": "transparent",
|
||||
"background-image": "none",
|
||||
"border": 0,
|
||||
"position": "absolute",
|
||||
"right": 0,
|
||||
"top": 0,
|
||||
"z-index": 9999
|
||||
}).end();
|
||||
case "transparent":
|
||||
return $(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").css({
|
||||
"background-color": "transparent",
|
||||
"background-image": "none",
|
||||
"border": 0
|
||||
});
|
||||
default:
|
||||
return $.error("jQuery.dialogExtend Error : Invalid <titlebar> value '" + this.options.titlebar + "'");
|
||||
}
|
||||
},
|
||||
state: function() {
|
||||
return this._state;
|
||||
},
|
||||
restore: function() {
|
||||
this._trigger("beforeRestore");
|
||||
this._restore();
|
||||
this._toggleButtons();
|
||||
return this._trigger("restore");
|
||||
},
|
||||
_restore: function() {
|
||||
if (this._state !== "normal") {
|
||||
this["_restore_" + this._state]();
|
||||
this._setState("normal");
|
||||
return $(this.element[0]).dialog("widget").focus();
|
||||
}
|
||||
},
|
||||
_saveSnapshot: function() {
|
||||
if (this._state === "normal") {
|
||||
this.original_config_resizable = $(this.element[0]).dialog("option", "resizable");
|
||||
this.original_config_draggable = $(this.element[0]).dialog("option", "draggable");
|
||||
this.original_size_height = $(this.element[0]).dialog("widget").outerHeight();
|
||||
this.original_size_width = $(this.element[0]).dialog("option", "width");
|
||||
this.original_size_maxHeight = $(this.element[0]).dialog("option", "maxHeight");
|
||||
this.original_position_mode = $(this.element[0]).dialog("widget").css("position");
|
||||
this.original_position_left = $(this.element[0]).dialog("widget").offset().left - $('body').scrollLeft();
|
||||
this.original_position_top = $(this.element[0]).dialog("widget").offset().top - $('body').scrollTop();
|
||||
return this.original_titlebar_wrap = $(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").css("white-space");
|
||||
}
|
||||
},
|
||||
_loadSnapshot: function() {
|
||||
return {
|
||||
"config": {
|
||||
"resizable": this.original_config_resizable,
|
||||
"draggable": this.original_config_draggable
|
||||
},
|
||||
"size": {
|
||||
"height": this.original_size_height,
|
||||
"width": this.original_size_width,
|
||||
"maxHeight": this.original_size_maxHeight
|
||||
},
|
||||
"position": {
|
||||
"mode": this.original_position_mode,
|
||||
"left": this.original_position_left,
|
||||
"top": this.original_position_top
|
||||
},
|
||||
"titlebar": {
|
||||
"wrap": this.original_titlebar_wrap
|
||||
}
|
||||
};
|
||||
},
|
||||
_toggleButtons: function(newstate) {
|
||||
var mode, name, state, _ref, _ref1, _results;
|
||||
|
||||
state = newstate || this._state;
|
||||
$(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-restore").toggle(state !== "normal").css({
|
||||
"right": "1.4em"
|
||||
}).end();
|
||||
_ref = this.modes;
|
||||
for (name in _ref) {
|
||||
mode = _ref[name];
|
||||
$(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-" + name).toggle(state !== mode.state && this.options[mode.option]);
|
||||
}
|
||||
_ref1 = this.modes;
|
||||
_results = [];
|
||||
for (name in _ref1) {
|
||||
mode = _ref1[name];
|
||||
if (mode.state === state) {
|
||||
_results.push($(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-restore").insertAfter($(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-" + name)).end());
|
||||
} else {
|
||||
_results.push(void 0);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
}
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
(function() {
|
||||
var $;
|
||||
|
||||
$ = jQuery;
|
||||
|
||||
$.extend(true, $.ui.dialogExtend.prototype, {
|
||||
modes: {
|
||||
"collapse": {
|
||||
option: "collapsable",
|
||||
state: "collapsed"
|
||||
}
|
||||
},
|
||||
options: {
|
||||
"collapsable": false,
|
||||
"icons": {
|
||||
"collapse": "ui-icon-triangle-1-s"
|
||||
},
|
||||
"beforeCollapse": null,
|
||||
"collapse": null
|
||||
},
|
||||
collapse: function() {
|
||||
var newHeight, pos;
|
||||
|
||||
newHeight = $(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").height() + 15;
|
||||
this._trigger("beforeCollapse");
|
||||
if (this._state !== "normal") {
|
||||
this._restore();
|
||||
}
|
||||
this._saveSnapshot();
|
||||
pos = $(this.element[0]).dialog("widget").position();
|
||||
$(this.element[0]).dialog("option", {
|
||||
"resizable": false,
|
||||
"height": newHeight,
|
||||
"maxHeight": newHeight,
|
||||
"position": [pos.left - $(document).scrollLeft(), pos.top - $(document).scrollTop()]
|
||||
}).on('dialogclose', this._collapse_restore).hide().dialog("widget").find(".ui-dialog-buttonpane:visible").hide().end().find(".ui-dialog-titlebar").css("white-space", "nowrap").end().find(".ui-dialog-content");
|
||||
this._setState("collapsed");
|
||||
this._toggleButtons();
|
||||
return this._trigger("collapse");
|
||||
},
|
||||
_restore_collapsed: function() {
|
||||
var original;
|
||||
|
||||
original = this._loadSnapshot();
|
||||
return $(this.element[0]).show().dialog("widget").find(".ui-dialog-buttonpane:hidden").show().end().find(".ui-dialog-titlebar").css("white-space", original.titlebar.wrap).end().find(".ui-dialog-content").dialog("option", {
|
||||
"resizable": original.config.resizable,
|
||||
"height": original.size.height,
|
||||
"maxHeight": original.size.maxHeight
|
||||
}).off('dialogclose', this._collapse_restore);
|
||||
},
|
||||
_initStyles_collapse: function() {
|
||||
var style;
|
||||
|
||||
if (!$(".dialog-extend-collapse-css").length) {
|
||||
style = '';
|
||||
style += '<style class="dialog-extend-collapse-css" type="text/css">';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-collapse { width: 19px; height: 18px; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-collapse span { display: block; margin: 1px; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-collapse:hover,';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-collapse:focus { padding: 0; }';
|
||||
style += '</style>';
|
||||
return $(style).appendTo("body");
|
||||
}
|
||||
},
|
||||
_collapse_restore: function() {
|
||||
return $(this).dialogExtend("restore");
|
||||
}
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
(function() {
|
||||
var $;
|
||||
|
||||
$ = jQuery;
|
||||
|
||||
$.extend(true, $.ui.dialogExtend.prototype, {
|
||||
modes: {
|
||||
"maximize": {
|
||||
option: "maximizable",
|
||||
state: "maximized"
|
||||
}
|
||||
},
|
||||
options: {
|
||||
"maximizable": false,
|
||||
"icons": {
|
||||
"maximize": "ui-icon-extlink"
|
||||
},
|
||||
"beforeMaximize": null,
|
||||
"maximize": null
|
||||
},
|
||||
maximize: function() {
|
||||
var newHeight, newWidth;
|
||||
|
||||
newHeight = $(window).height() - 11;
|
||||
newWidth = $(window).width() - 11;
|
||||
this._trigger("beforeMaximize");
|
||||
if (this._state !== "normal") {
|
||||
this._restore();
|
||||
}
|
||||
this._saveSnapshot();
|
||||
if ($(this.element[0]).dialog("option", "draggable")) {
|
||||
$(this.element[0]).dialog("widget").draggable("option", "handle", null).find(".ui-dialog-draggable-handle").css("cursor", "text").end();
|
||||
}
|
||||
$(this.element[0]).dialog("widget").css("position", "fixed").find(".ui-dialog-content").show().dialog("widget").find(".ui-dialog-buttonpane").show().end().find(".ui-dialog-content").dialog("option", {
|
||||
"resizable": false,
|
||||
"draggable": false,
|
||||
"height": newHeight,
|
||||
"width": newWidth,
|
||||
"position": {
|
||||
my: "left top",
|
||||
at: "left top",
|
||||
of: window
|
||||
}
|
||||
});
|
||||
this._setState("maximized");
|
||||
this._toggleButtons();
|
||||
return this._trigger("maximize");
|
||||
},
|
||||
_restore_maximized: function() {
|
||||
var original;
|
||||
|
||||
original = this._loadSnapshot();
|
||||
$(this.element[0]).dialog("widget").css("position", original.position.mode).find(".ui-dialog-titlebar").css("white-space", original.titlebar.wrap).end().find(".ui-dialog-content").dialog("option", {
|
||||
"resizable": original.config.resizable,
|
||||
"draggable": original.config.draggable,
|
||||
"height": original.size.height,
|
||||
"width": original.size.width,
|
||||
"maxHeight": original.size.maxHeight,
|
||||
"position": {
|
||||
my: "left top",
|
||||
at: "left+" + original.position.left + " top+" + original.position.top,
|
||||
of: window
|
||||
}
|
||||
});
|
||||
if ($(this.element[0]).dialog("option", "draggable")) {
|
||||
return $(this.element[0]).dialog("widget").draggable("option", "handle", $(this.element[0]).dialog("widget").find(".ui-dialog-draggable-handle").length ? $(this.element[0]).dialog("widget").find(".ui-dialog-draggable-handle") : ".ui-dialog-titlebar").find(".ui-dialog-draggable-handle").css("cursor", "move");
|
||||
}
|
||||
},
|
||||
_initStyles_maximize: function() {
|
||||
var style;
|
||||
|
||||
if (!$(".dialog-extend-maximize-css").length) {
|
||||
style = '';
|
||||
style += '<style class="dialog-extend-maximize-css" type="text/css">';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-maximize { width: 19px; height: 18px; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-maximize span { display: block; margin: 1px; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-maximize:hover,';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-maximize:focus { padding: 0; }';
|
||||
style += '</style>';
|
||||
return $(style).appendTo("body");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
(function() {
|
||||
var $;
|
||||
|
||||
$ = jQuery;
|
||||
|
||||
$.extend(true, $.ui.dialogExtend.prototype, {
|
||||
modes: {
|
||||
"minimize": {
|
||||
option: "minimizable",
|
||||
state: "minimized"
|
||||
}
|
||||
},
|
||||
options: {
|
||||
"minimizable": false,
|
||||
"minimizeLocation": "left",
|
||||
"icons": {
|
||||
"minimize": "ui-icon-minus"
|
||||
},
|
||||
"beforeMinimize": null,
|
||||
"minimize": null
|
||||
},
|
||||
minimize: function() {
|
||||
var dialogcontrols, fixedContainer, newWidth;
|
||||
|
||||
this._trigger("beforeMinimize");
|
||||
if (this._state !== "normal") {
|
||||
this._restore();
|
||||
}
|
||||
newWidth = 200;
|
||||
if ($("#dialog-extend-fixed-container").length) {
|
||||
fixedContainer = $("#dialog-extend-fixed-container");
|
||||
} else {
|
||||
fixedContainer = $('<div id="dialog-extend-fixed-container"></div>').appendTo("body");
|
||||
fixedContainer.css({
|
||||
"position": "fixed",
|
||||
"bottom": 1,
|
||||
"left": 1,
|
||||
"right": 1,
|
||||
"z-index": 9999
|
||||
});
|
||||
}
|
||||
this._toggleButtons("minimized");
|
||||
dialogcontrols = $(this.element[0]).dialog("widget").clone().children().remove().end();
|
||||
$(this.element[0]).dialog("widget").find('.ui-dialog-titlebar').clone(true, true).appendTo(dialogcontrols);
|
||||
dialogcontrols.css({
|
||||
"float": this.options.minimizeLocation,
|
||||
"margin": 1
|
||||
});
|
||||
fixedContainer.append(dialogcontrols);
|
||||
$(this.element[0]).data("dialog-extend-minimize-controls", dialogcontrols);
|
||||
if ($(this.element[0]).dialog("option", "draggable")) {
|
||||
dialogcontrols.removeClass("ui-draggable");
|
||||
}
|
||||
dialogcontrols.css({
|
||||
"height": "auto",
|
||||
"width": newWidth,
|
||||
"position": "static"
|
||||
});
|
||||
$(this.element[0]).on('dialogbeforeclose', this._minimize_restoreOnClose).dialog("widget").hide();
|
||||
this._setState("minimized");
|
||||
return this._trigger("minimize");
|
||||
},
|
||||
_restore_minimized: function() {
|
||||
$(this.element[0]).dialog("widget").show();
|
||||
$(this.element[0]).off('dialogbeforeclose', this._minimize_restoreOnClose);
|
||||
$(this.element[0]).data("dialog-extend-minimize-controls").remove();
|
||||
return $(this.element[0]).removeData("dialog-extend-minimize-controls");
|
||||
},
|
||||
_initStyles_minimize: function() {
|
||||
var style;
|
||||
|
||||
if (!$(".dialog-extend-minimize-css").length) {
|
||||
style = '';
|
||||
style += '<style class="dialog-extend-minimize-css" type="text/css">';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-minimize { width: 19px; height: 18px; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-minimize span { display: block; margin: 1px; }';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-minimize:hover,';
|
||||
style += '.ui-dialog .ui-dialog-titlebar-minimize:focus { padding: 0; }';
|
||||
style += '</style>';
|
||||
return $(style).appendTo("body");
|
||||
}
|
||||
},
|
||||
_verifyOptions_minimize: function() {
|
||||
var _ref;
|
||||
|
||||
if (!this.options.minimizeLocation || ((_ref = this.options.minimizeLocation) !== 'left' && _ref !== 'right')) {
|
||||
$.error("jQuery.dialogExtend Error : Invalid <minimizeLocation> value '" + this.options.minimizeLocation + "'");
|
||||
return this.options.minimizeLocation = "left";
|
||||
}
|
||||
},
|
||||
_minimize_restoreOnClose: function() {
|
||||
return $(this).dialogExtend("restore");
|
||||
}
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,388 @@
|
||||
/*
|
||||
* The MIT License
|
||||
* Copyright (c) 2012 Matias Meno <m@tias.me>
|
||||
*/
|
||||
@-webkit-keyframes passing-through {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(40px);
|
||||
-moz-transform: translateY(40px);
|
||||
-ms-transform: translateY(40px);
|
||||
-o-transform: translateY(40px);
|
||||
transform: translateY(40px); }
|
||||
30%, 70% {
|
||||
opacity: 1;
|
||||
-webkit-transform: translateY(0px);
|
||||
-moz-transform: translateY(0px);
|
||||
-ms-transform: translateY(0px);
|
||||
-o-transform: translateY(0px);
|
||||
transform: translateY(0px); }
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(-40px);
|
||||
-moz-transform: translateY(-40px);
|
||||
-ms-transform: translateY(-40px);
|
||||
-o-transform: translateY(-40px);
|
||||
transform: translateY(-40px); } }
|
||||
@-moz-keyframes passing-through {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(40px);
|
||||
-moz-transform: translateY(40px);
|
||||
-ms-transform: translateY(40px);
|
||||
-o-transform: translateY(40px);
|
||||
transform: translateY(40px); }
|
||||
30%, 70% {
|
||||
opacity: 1;
|
||||
-webkit-transform: translateY(0px);
|
||||
-moz-transform: translateY(0px);
|
||||
-ms-transform: translateY(0px);
|
||||
-o-transform: translateY(0px);
|
||||
transform: translateY(0px); }
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(-40px);
|
||||
-moz-transform: translateY(-40px);
|
||||
-ms-transform: translateY(-40px);
|
||||
-o-transform: translateY(-40px);
|
||||
transform: translateY(-40px); } }
|
||||
@keyframes passing-through {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(40px);
|
||||
-moz-transform: translateY(40px);
|
||||
-ms-transform: translateY(40px);
|
||||
-o-transform: translateY(40px);
|
||||
transform: translateY(40px); }
|
||||
30%, 70% {
|
||||
opacity: 1;
|
||||
-webkit-transform: translateY(0px);
|
||||
-moz-transform: translateY(0px);
|
||||
-ms-transform: translateY(0px);
|
||||
-o-transform: translateY(0px);
|
||||
transform: translateY(0px); }
|
||||
100% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(-40px);
|
||||
-moz-transform: translateY(-40px);
|
||||
-ms-transform: translateY(-40px);
|
||||
-o-transform: translateY(-40px);
|
||||
transform: translateY(-40px); } }
|
||||
@-webkit-keyframes slide-in {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(40px);
|
||||
-moz-transform: translateY(40px);
|
||||
-ms-transform: translateY(40px);
|
||||
-o-transform: translateY(40px);
|
||||
transform: translateY(40px); }
|
||||
30% {
|
||||
opacity: 1;
|
||||
-webkit-transform: translateY(0px);
|
||||
-moz-transform: translateY(0px);
|
||||
-ms-transform: translateY(0px);
|
||||
-o-transform: translateY(0px);
|
||||
transform: translateY(0px); } }
|
||||
@-moz-keyframes slide-in {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(40px);
|
||||
-moz-transform: translateY(40px);
|
||||
-ms-transform: translateY(40px);
|
||||
-o-transform: translateY(40px);
|
||||
transform: translateY(40px); }
|
||||
30% {
|
||||
opacity: 1;
|
||||
-webkit-transform: translateY(0px);
|
||||
-moz-transform: translateY(0px);
|
||||
-ms-transform: translateY(0px);
|
||||
-o-transform: translateY(0px);
|
||||
transform: translateY(0px); } }
|
||||
@keyframes slide-in {
|
||||
0% {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(40px);
|
||||
-moz-transform: translateY(40px);
|
||||
-ms-transform: translateY(40px);
|
||||
-o-transform: translateY(40px);
|
||||
transform: translateY(40px); }
|
||||
30% {
|
||||
opacity: 1;
|
||||
-webkit-transform: translateY(0px);
|
||||
-moz-transform: translateY(0px);
|
||||
-ms-transform: translateY(0px);
|
||||
-o-transform: translateY(0px);
|
||||
transform: translateY(0px); } }
|
||||
@-webkit-keyframes pulse {
|
||||
0% {
|
||||
-webkit-transform: scale(1);
|
||||
-moz-transform: scale(1);
|
||||
-ms-transform: scale(1);
|
||||
-o-transform: scale(1);
|
||||
transform: scale(1); }
|
||||
10% {
|
||||
-webkit-transform: scale(1.1);
|
||||
-moz-transform: scale(1.1);
|
||||
-ms-transform: scale(1.1);
|
||||
-o-transform: scale(1.1);
|
||||
transform: scale(1.1); }
|
||||
20% {
|
||||
-webkit-transform: scale(1);
|
||||
-moz-transform: scale(1);
|
||||
-ms-transform: scale(1);
|
||||
-o-transform: scale(1);
|
||||
transform: scale(1); } }
|
||||
@-moz-keyframes pulse {
|
||||
0% {
|
||||
-webkit-transform: scale(1);
|
||||
-moz-transform: scale(1);
|
||||
-ms-transform: scale(1);
|
||||
-o-transform: scale(1);
|
||||
transform: scale(1); }
|
||||
10% {
|
||||
-webkit-transform: scale(1.1);
|
||||
-moz-transform: scale(1.1);
|
||||
-ms-transform: scale(1.1);
|
||||
-o-transform: scale(1.1);
|
||||
transform: scale(1.1); }
|
||||
20% {
|
||||
-webkit-transform: scale(1);
|
||||
-moz-transform: scale(1);
|
||||
-ms-transform: scale(1);
|
||||
-o-transform: scale(1);
|
||||
transform: scale(1); } }
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
-webkit-transform: scale(1);
|
||||
-moz-transform: scale(1);
|
||||
-ms-transform: scale(1);
|
||||
-o-transform: scale(1);
|
||||
transform: scale(1); }
|
||||
10% {
|
||||
-webkit-transform: scale(1.1);
|
||||
-moz-transform: scale(1.1);
|
||||
-ms-transform: scale(1.1);
|
||||
-o-transform: scale(1.1);
|
||||
transform: scale(1.1); }
|
||||
20% {
|
||||
-webkit-transform: scale(1);
|
||||
-moz-transform: scale(1);
|
||||
-ms-transform: scale(1);
|
||||
-o-transform: scale(1);
|
||||
transform: scale(1); } }
|
||||
.dropzone, .dropzone * {
|
||||
box-sizing: border-box; }
|
||||
|
||||
.dropzone {
|
||||
min-height: 150px;
|
||||
border: 2px solid rgba(0, 0, 0, 0.3);
|
||||
background: white;
|
||||
padding: 20px 20px; }
|
||||
.dropzone.dz-clickable {
|
||||
cursor: pointer; }
|
||||
.dropzone.dz-clickable * {
|
||||
cursor: default; }
|
||||
.dropzone.dz-clickable .dz-message, .dropzone.dz-clickable .dz-message * {
|
||||
cursor: pointer; }
|
||||
.dropzone.dz-started .dz-message {
|
||||
display: none; }
|
||||
.dropzone.dz-drag-hover {
|
||||
border-style: solid; }
|
||||
.dropzone.dz-drag-hover .dz-message {
|
||||
opacity: 0.5; }
|
||||
.dropzone .dz-message {
|
||||
text-align: center;
|
||||
margin: 2em 0; }
|
||||
.dropzone .dz-preview {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin: 16px;
|
||||
min-height: 100px; }
|
||||
.dropzone .dz-preview:hover {
|
||||
z-index: 1000; }
|
||||
.dropzone .dz-preview:hover .dz-details {
|
||||
opacity: 1; }
|
||||
.dropzone .dz-preview.dz-file-preview .dz-image {
|
||||
border-radius: 20px;
|
||||
background: #999;
|
||||
background: linear-gradient(to bottom, #eee, #ddd); }
|
||||
.dropzone .dz-preview.dz-file-preview .dz-details {
|
||||
opacity: 1; }
|
||||
.dropzone .dz-preview.dz-image-preview {
|
||||
background: white; }
|
||||
.dropzone .dz-preview.dz-image-preview .dz-details {
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
-moz-transition: opacity 0.2s linear;
|
||||
-ms-transition: opacity 0.2s linear;
|
||||
-o-transition: opacity 0.2s linear;
|
||||
transition: opacity 0.2s linear; }
|
||||
.dropzone .dz-preview .dz-remove {
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
border: none; }
|
||||
.dropzone .dz-preview .dz-remove:hover {
|
||||
text-decoration: underline; }
|
||||
.dropzone .dz-preview:hover .dz-details {
|
||||
opacity: 1; }
|
||||
.dropzone .dz-preview .dz-details {
|
||||
z-index: 20;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
opacity: 0;
|
||||
font-size: 13px;
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
padding: 2em 1em;
|
||||
text-align: center;
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
line-height: 150%; }
|
||||
.dropzone .dz-preview .dz-details .dz-size {
|
||||
margin-bottom: 1em;
|
||||
font-size: 16px; }
|
||||
.dropzone .dz-preview .dz-details .dz-filename {
|
||||
white-space: nowrap; }
|
||||
.dropzone .dz-preview .dz-details .dz-filename:hover span {
|
||||
border: 1px solid rgba(200, 200, 200, 0.8);
|
||||
background-color: rgba(255, 255, 255, 0.8); }
|
||||
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis; }
|
||||
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span {
|
||||
border: 1px solid transparent; }
|
||||
.dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span {
|
||||
background-color: rgba(255, 255, 255, 0.4);
|
||||
padding: 0 0.4em;
|
||||
border-radius: 3px; }
|
||||
.dropzone .dz-preview:hover .dz-image img {
|
||||
-webkit-transform: scale(1.05, 1.05);
|
||||
-moz-transform: scale(1.05, 1.05);
|
||||
-ms-transform: scale(1.05, 1.05);
|
||||
-o-transform: scale(1.05, 1.05);
|
||||
transform: scale(1.05, 1.05);
|
||||
-webkit-filter: blur(8px);
|
||||
filter: blur(8px); }
|
||||
.dropzone .dz-preview .dz-image {
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
position: relative;
|
||||
display: block;
|
||||
z-index: 10; }
|
||||
.dropzone .dz-preview .dz-image img {
|
||||
display: block; }
|
||||
.dropzone .dz-preview.dz-success .dz-success-mark {
|
||||
-webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
|
||||
-moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
|
||||
-ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
|
||||
-o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
|
||||
animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); }
|
||||
.dropzone .dz-preview.dz-error .dz-error-mark {
|
||||
opacity: 1;
|
||||
-webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
|
||||
-moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
|
||||
-ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
|
||||
-o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
|
||||
animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); }
|
||||
.dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark {
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
z-index: 500;
|
||||
position: absolute;
|
||||
display: block;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-left: -27px;
|
||||
margin-top: -27px; }
|
||||
.dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg {
|
||||
display: block;
|
||||
width: 54px;
|
||||
height: 54px; }
|
||||
.dropzone .dz-preview.dz-processing .dz-progress {
|
||||
opacity: 1;
|
||||
-webkit-transition: all 0.2s linear;
|
||||
-moz-transition: all 0.2s linear;
|
||||
-ms-transition: all 0.2s linear;
|
||||
-o-transition: all 0.2s linear;
|
||||
transition: all 0.2s linear; }
|
||||
.dropzone .dz-preview.dz-complete .dz-progress {
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.4s ease-in;
|
||||
-moz-transition: opacity 0.4s ease-in;
|
||||
-ms-transition: opacity 0.4s ease-in;
|
||||
-o-transition: opacity 0.4s ease-in;
|
||||
transition: opacity 0.4s ease-in; }
|
||||
.dropzone .dz-preview:not(.dz-processing) .dz-progress {
|
||||
-webkit-animation: pulse 6s ease infinite;
|
||||
-moz-animation: pulse 6s ease infinite;
|
||||
-ms-animation: pulse 6s ease infinite;
|
||||
-o-animation: pulse 6s ease infinite;
|
||||
animation: pulse 6s ease infinite; }
|
||||
.dropzone .dz-preview .dz-progress {
|
||||
opacity: 1;
|
||||
z-index: 1000;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
height: 16px;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-top: -8px;
|
||||
width: 80px;
|
||||
margin-left: -40px;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
-webkit-transform: scale(1);
|
||||
border-radius: 8px;
|
||||
overflow: hidden; }
|
||||
.dropzone .dz-preview .dz-progress .dz-upload {
|
||||
background: #333;
|
||||
background: linear-gradient(to bottom, #666, #444);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 0;
|
||||
-webkit-transition: width 300ms ease-in-out;
|
||||
-moz-transition: width 300ms ease-in-out;
|
||||
-ms-transition: width 300ms ease-in-out;
|
||||
-o-transition: width 300ms ease-in-out;
|
||||
transition: width 300ms ease-in-out; }
|
||||
.dropzone .dz-preview.dz-error .dz-error-message {
|
||||
display: block; }
|
||||
.dropzone .dz-preview.dz-error:hover .dz-error-message {
|
||||
opacity: 1;
|
||||
pointer-events: auto; }
|
||||
.dropzone .dz-preview .dz-error-message {
|
||||
pointer-events: none;
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
display: block;
|
||||
display: none;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.3s ease;
|
||||
-moz-transition: opacity 0.3s ease;
|
||||
-ms-transition: opacity 0.3s ease;
|
||||
-o-transition: opacity 0.3s ease;
|
||||
transition: opacity 0.3s ease;
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
top: 130px;
|
||||
left: -10px;
|
||||
width: 140px;
|
||||
background: #be2626;
|
||||
background: linear-gradient(to bottom, #be2626, #a92222);
|
||||
padding: 0.5em 1.2em;
|
||||
color: white; }
|
||||
.dropzone .dz-preview .dz-error-message:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: 64px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #be2626; }
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Farbtastic Color Picker 1.2
|
||||
* © 2008 Steven Wittens
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
.farbtastic_wrapper{
|
||||
position:absolute;
|
||||
left:1200px;
|
||||
top:300px;
|
||||
}
|
||||
|
||||
.farbtastic {
|
||||
position: relative;
|
||||
}
|
||||
.farbtastic * {
|
||||
position: absolute;
|
||||
cursor: crosshair;
|
||||
}
|
||||
.farbtastic, .farbtastic .wheel {
|
||||
width: 195px;
|
||||
height: 195px;
|
||||
}
|
||||
.farbtastic .color, .farbtastic .overlay {
|
||||
top: 47px;
|
||||
left: 47px;
|
||||
width: 101px;
|
||||
height: 101px;
|
||||
}
|
||||
.farbtastic .wheel {
|
||||
background: url(wheel.png) no-repeat;
|
||||
width: 195px;
|
||||
height: 195px;
|
||||
}
|
||||
.farbtastic .overlay {
|
||||
background: url(mask.png) no-repeat;
|
||||
}
|
||||
.farbtastic .marker {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
margin: -8px 0 0 -8px;
|
||||
overflow: hidden;
|
||||
background: url(marker.png) no-repeat;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
/**
|
||||
* Farbtastic Color Picker 1.2
|
||||
* © 2008 Steven Wittens
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
jQuery.fn.unite_farbtastic = function (callback) {
|
||||
$.unite_farbtastic(this, callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.unite_farbtastic = function (container, callback, onChange) {
|
||||
var container = jQuery(container).get(0);
|
||||
return container.farbtastic || (container.farbtastic = new jQuery._unite_farbtastic(container, callback, onChange));
|
||||
};
|
||||
|
||||
jQuery._unite_farbtastic = function (container, callback, onChange) {
|
||||
// Store farbtastic object
|
||||
var fb = this;
|
||||
|
||||
// Insert markup
|
||||
jQuery(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
|
||||
var e = jQuery('.farbtastic', container);
|
||||
fb.wheel = jQuery('.wheel', container).get(0);
|
||||
// Dimensions
|
||||
fb.radius = 84;
|
||||
fb.square = 100;
|
||||
fb.width = 194;
|
||||
fb.onchange = onChange;
|
||||
|
||||
// Fix background PNGs in IE6
|
||||
if (navigator.appVersion.match(/MSIE [0-6]\./)) {
|
||||
jQuery('*', e).each(function () {
|
||||
if (this.currentStyle.backgroundImage != 'none') {
|
||||
var image = this.currentStyle.backgroundImage;
|
||||
image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
|
||||
jQuery(this).css({
|
||||
'backgroundImage': 'none',
|
||||
'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to the given element(s) or callback.
|
||||
*/
|
||||
fb.linkTo = function (callback) {
|
||||
// Unbind previous nodes
|
||||
if (typeof fb.callback == 'object') {
|
||||
jQuery(fb.callback).unbind('keyup', fb.updateValue);
|
||||
}
|
||||
|
||||
// Reset color
|
||||
fb.color = null;
|
||||
|
||||
// Bind callback or elements
|
||||
if (typeof callback == 'function') {
|
||||
fb.callback = callback;
|
||||
}
|
||||
else if (typeof callback == 'object' || typeof callback == 'string') {
|
||||
fb.callback = jQuery(callback);
|
||||
fb.callback.on('keyup', fb.updateValue);
|
||||
if (fb.callback.get(0).value) {
|
||||
fb.setColor(fb.callback.get(0).value);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
fb.updateValue = function (event) {
|
||||
if (this.value && this.value != fb.color) {
|
||||
fb.setColor(this.value);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Change color with HTML syntax #123456
|
||||
*/
|
||||
fb.setColor = function (color) {
|
||||
var unpack = fb.unpack(color);
|
||||
if (fb.color != color && unpack) {
|
||||
fb.color = color;
|
||||
fb.rgb = unpack;
|
||||
fb.hsl = fb.RGBToHSL(fb.rgb);
|
||||
fb.updateDisplay();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Change color with HSL triplet [0..1, 0..1, 0..1]
|
||||
*/
|
||||
fb.setHSL = function (hsl) {
|
||||
fb.hsl = hsl;
|
||||
fb.rgb = fb.HSLToRGB(hsl);
|
||||
fb.color = fb.pack(fb.rgb);
|
||||
fb.updateDisplay();
|
||||
return this;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Retrieve the coordinates of the given event relative to the center
|
||||
* of the widget.
|
||||
*/
|
||||
fb.widgetCoords = function (event) {
|
||||
var x, y;
|
||||
var el = event.target || event.srcElement;
|
||||
var reference = fb.wheel;
|
||||
|
||||
if (typeof event.offsetX != 'undefined') {
|
||||
// Use offset coordinates and find common offsetParent
|
||||
var pos = { x: event.offsetX, y: event.offsetY };
|
||||
|
||||
// Send the coordinates upwards through the offsetParent chain.
|
||||
var e = el;
|
||||
while (e) {
|
||||
e.mouseX = pos.x;
|
||||
e.mouseY = pos.y;
|
||||
pos.x += e.offsetLeft;
|
||||
pos.y += e.offsetTop;
|
||||
e = e.offsetParent;
|
||||
}
|
||||
|
||||
// Look for the coordinates starting from the wheel widget.
|
||||
var e = reference;
|
||||
var offset = { x: 0, y: 0 };
|
||||
while (e) {
|
||||
if (typeof e.mouseX != 'undefined') {
|
||||
x = e.mouseX - offset.x;
|
||||
y = e.mouseY - offset.y;
|
||||
break;
|
||||
}
|
||||
offset.x += e.offsetLeft;
|
||||
offset.y += e.offsetTop;
|
||||
e = e.offsetParent;
|
||||
}
|
||||
|
||||
// Reset stored coordinates
|
||||
e = el;
|
||||
while (e) {
|
||||
e.mouseX = undefined;
|
||||
e.mouseY = undefined;
|
||||
e = e.offsetParent;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Use absolute coordinates
|
||||
var pos = fb.absolutePosition(reference);
|
||||
x = (event.pageX || 0*(event.clientX + jQuery('html').get(0).scrollLeft)) - pos.x;
|
||||
y = (event.pageY || 0*(event.clientY + jQuery('html').get(0).scrollTop)) - pos.y;
|
||||
}
|
||||
// Subtract distance to middle
|
||||
return { x: x - fb.width / 2, y: y - fb.width / 2 };
|
||||
};
|
||||
|
||||
/**
|
||||
* Mousedown handler
|
||||
*/
|
||||
fb.mousedown = function (event) {
|
||||
// Capture mouse
|
||||
if (!document.dragging) {
|
||||
jQuery(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
|
||||
document.dragging = true;
|
||||
}
|
||||
|
||||
// Check which area is being dragged
|
||||
var pos = fb.widgetCoords(event);
|
||||
fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
|
||||
|
||||
// Process
|
||||
fb.mousemove(event);
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mousemove handler
|
||||
*/
|
||||
fb.mousemove = function (event) {
|
||||
// Get coordinates relative to color picker center
|
||||
var pos = fb.widgetCoords(event);
|
||||
|
||||
// Set new HSL parameters
|
||||
if (fb.circleDrag) {
|
||||
var hue = Math.atan2(pos.x, -pos.y) / 6.28;
|
||||
if (hue < 0) hue += 1;
|
||||
fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
|
||||
}
|
||||
else {
|
||||
var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
|
||||
var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
|
||||
fb.setHSL([fb.hsl[0], sat, lum]);
|
||||
}
|
||||
|
||||
if(typeof g_ucAdmin.onColorPickerMoveEvent == "function")
|
||||
g_ucAdmin.onColorPickerMoveEvent();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mouseup handler
|
||||
*/
|
||||
fb.mouseup = function () {
|
||||
// Uncapture mouse
|
||||
jQuery(document).unbind('mousemove', fb.mousemove);
|
||||
jQuery(document).unbind('mouseup', fb.mouseup);
|
||||
document.dragging = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the markers and styles
|
||||
*/
|
||||
fb.updateDisplay = function () {
|
||||
// Markers
|
||||
var angle = fb.hsl[0] * 6.28;
|
||||
jQuery('.h-marker', e).css({
|
||||
left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
|
||||
top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
|
||||
});
|
||||
|
||||
jQuery('.sl-marker', e).css({
|
||||
left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
|
||||
top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
|
||||
});
|
||||
|
||||
// Saturation/Luminance gradient
|
||||
jQuery('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
|
||||
|
||||
// Linked elements or callback
|
||||
if (typeof fb.callback == 'object') {
|
||||
// Set background/foreground color
|
||||
jQuery(fb.callback).css({
|
||||
backgroundColor: fb.color,
|
||||
color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
|
||||
});
|
||||
|
||||
// Change linked value
|
||||
jQuery(fb.callback).each(function() {
|
||||
if (!this.value || (this.value && this.value != fb.color)) {
|
||||
this.value = fb.color;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(fb.onchange)
|
||||
fb.onchange(fb.callback, this.value);
|
||||
|
||||
}
|
||||
else if (typeof fb.callback == 'function') {
|
||||
fb.callback.call(fb, fb.color);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Get absolute position of element
|
||||
*/
|
||||
fb.absolutePosition = function (el) {
|
||||
var r = { x: el.offsetLeft, y: el.offsetTop };
|
||||
// Resolve relative to offsetParent
|
||||
if (el.offsetParent) {
|
||||
var tmp = fb.absolutePosition(el.offsetParent);
|
||||
r.x += tmp.x;
|
||||
r.y += tmp.y;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
/* Various color utility functions */
|
||||
fb.pack = function (rgb) {
|
||||
var r = Math.round(rgb[0] * 255);
|
||||
var g = Math.round(rgb[1] * 255);
|
||||
var b = Math.round(rgb[2] * 255);
|
||||
return '#' + (r < 16 ? '0' : '') + r.toString(16) +
|
||||
(g < 16 ? '0' : '') + g.toString(16) +
|
||||
(b < 16 ? '0' : '') + b.toString(16);
|
||||
}
|
||||
|
||||
fb.unpack = function (color) {
|
||||
if (color.length == 7) {
|
||||
return [parseInt('0x' + color.substring(1, 3)) / 255,
|
||||
parseInt('0x' + color.substring(3, 5)) / 255,
|
||||
parseInt('0x' + color.substring(5, 7)) / 255];
|
||||
}
|
||||
else if (color.length == 4) {
|
||||
return [parseInt('0x' + color.substring(1, 2)) / 15,
|
||||
parseInt('0x' + color.substring(2, 3)) / 15,
|
||||
parseInt('0x' + color.substring(3, 4)) / 15];
|
||||
}
|
||||
}
|
||||
|
||||
fb.HSLToRGB = function (hsl) {
|
||||
var m1, m2, r, g, b;
|
||||
var h = hsl[0], s = hsl[1], l = hsl[2];
|
||||
m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
|
||||
m1 = l * 2 - m2;
|
||||
return [this.hueToRGB(m1, m2, h+0.33333),
|
||||
this.hueToRGB(m1, m2, h),
|
||||
this.hueToRGB(m1, m2, h-0.33333)];
|
||||
}
|
||||
|
||||
fb.hueToRGB = function (m1, m2, h) {
|
||||
h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
|
||||
if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
|
||||
if (h * 2 < 1) return m2;
|
||||
if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
|
||||
return m1;
|
||||
}
|
||||
|
||||
fb.RGBToHSL = function (rgb) {
|
||||
var min, max, delta, h, s, l;
|
||||
var r = rgb[0], g = rgb[1], b = rgb[2];
|
||||
min = Math.min(r, Math.min(g, b));
|
||||
max = Math.max(r, Math.max(g, b));
|
||||
delta = max - min;
|
||||
l = (min + max) / 2;
|
||||
s = 0;
|
||||
if (l > 0 && l < 1) {
|
||||
s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
|
||||
}
|
||||
h = 0;
|
||||
if (delta > 0) {
|
||||
if (max == r && max != g) h += (g - b) / delta;
|
||||
if (max == g && max != b) h += (2 + (b - r) / delta);
|
||||
if (max == b && max != r) h += (4 + (r - g) / delta);
|
||||
h /= 6;
|
||||
}
|
||||
return [h, s, l];
|
||||
};
|
||||
|
||||
// Install mousedown handler (the others are set on the document on-demand)
|
||||
jQuery('*', e).mousedown(fb.mousedown);
|
||||
|
||||
// Init color
|
||||
fb.setColor('#000000');
|
||||
|
||||
// Set linked elements/callback
|
||||
if (callback) {
|
||||
fb.linkTo(callback);
|
||||
};
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 652 B |
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
File diff suppressed because one or more lines are too long
6
wp-content/plugins/unlimited-elements-for-elementor/js/html2canvas/html2canvas.min.js
vendored
Normal file
6
wp-content/plugins/unlimited-elements-for-elementor/js/html2canvas/html2canvas.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,228 @@
|
||||
// tipsy, facebook style tooltips for jquery
|
||||
// version 1.0.0a
|
||||
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
||||
// releated under the MIT license
|
||||
|
||||
"use strict";
|
||||
|
||||
(function($) {
|
||||
|
||||
function fixTitle($ele) {
|
||||
if ($ele.attr('title') || typeof($ele.attr('original-title')) != 'string') {
|
||||
$ele.attr('original-title', $ele.attr('title') || '').removeAttr('title');
|
||||
}
|
||||
}
|
||||
|
||||
function Tipsy(element, options) {
|
||||
this.$element = $(element);
|
||||
this.options = options;
|
||||
this.enabled = true;
|
||||
fixTitle(this.$element);
|
||||
}
|
||||
|
||||
Tipsy.prototype = {
|
||||
show: function() {
|
||||
|
||||
var objDoc = jQuery(document);
|
||||
|
||||
var title = this.getTitle();
|
||||
if (title && this.enabled) {
|
||||
var $tip = this.tip();
|
||||
|
||||
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
|
||||
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
|
||||
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
|
||||
|
||||
var pos = $.extend({}, this.$element.offset(), {
|
||||
width: this.$element[0].offsetWidth,
|
||||
height: this.$element[0].offsetHeight
|
||||
});
|
||||
|
||||
pos.left -= objDoc.scrollLeft();
|
||||
pos.top -= objDoc.scrollTop();
|
||||
|
||||
var actualWidth = $tip[0].offsetWidth, actualHeight = $tip[0].offsetHeight;
|
||||
var gravity = (typeof this.options.gravity == 'function')
|
||||
? this.options.gravity.call(this.$element[0])
|
||||
: this.options.gravity;
|
||||
|
||||
var tp;
|
||||
switch (gravity.charAt(0)) {
|
||||
case 'n':
|
||||
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 's':
|
||||
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 'e':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
|
||||
break;
|
||||
case 'w':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
|
||||
break;
|
||||
}
|
||||
|
||||
if (gravity.length == 2) {
|
||||
if (gravity.charAt(1) == 'w') {
|
||||
tp.left = pos.left + pos.width / 2 - 15;
|
||||
} else {
|
||||
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(tp.left && tp.left<0)
|
||||
tp.left = 0;
|
||||
|
||||
|
||||
$tip.css(tp).addClass('tipsy-' + gravity);
|
||||
|
||||
if (this.options.fade) {
|
||||
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
|
||||
} else {
|
||||
$tip.css({visibility: 'visible', opacity: this.options.opacity});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
if (this.options.fade) {
|
||||
this.tip().stop().fadeOut(function() { $(this).remove(); });
|
||||
} else {
|
||||
this.tip().remove();
|
||||
}
|
||||
},
|
||||
|
||||
getTitle: function() {
|
||||
var title, $e = this.$element, o = this.options;
|
||||
fixTitle($e);
|
||||
var title, o = this.options;
|
||||
if (typeof o.title == 'string') {
|
||||
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
|
||||
} else if (typeof o.title == 'function') {
|
||||
title = o.title.call($e[0]);
|
||||
}
|
||||
title = ('' + title).replace(/(^\s*|\s*$)/, "");
|
||||
return title || o.fallback;
|
||||
},
|
||||
|
||||
tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"/></div>');
|
||||
}
|
||||
return this.$tip;
|
||||
},
|
||||
|
||||
validate: function() {
|
||||
if (!this.$element[0].parentNode) {
|
||||
this.hide();
|
||||
this.$element = null;
|
||||
this.options = null;
|
||||
}
|
||||
},
|
||||
|
||||
enable: function() { this.enabled = true; },
|
||||
disable: function() { this.enabled = false; },
|
||||
toggleEnabled: function() { this.enabled = !this.enabled; },
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
$.fn.tipsy = function(options) {
|
||||
|
||||
if (options === true) {
|
||||
return this.data('tipsy');
|
||||
} else if (typeof options == 'string') {
|
||||
return this.data('tipsy')[options]();
|
||||
}
|
||||
|
||||
options = $.extend({}, $.fn.tipsy.defaults, options);
|
||||
|
||||
function get(ele) {
|
||||
var tipsy = $.data(ele, 'tipsy');
|
||||
if (!tipsy) {
|
||||
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
|
||||
$.data(ele, 'tipsy', tipsy);
|
||||
}
|
||||
return tipsy;
|
||||
}
|
||||
|
||||
function enter() {
|
||||
var tipsy = get(this);
|
||||
tipsy.hoverState = 'in';
|
||||
if (options.delayIn == 0) {
|
||||
tipsy.show();
|
||||
} else {
|
||||
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
|
||||
}
|
||||
};
|
||||
|
||||
function leave() {
|
||||
var tipsy = get(this);
|
||||
tipsy.hoverState = 'out';
|
||||
if (options.delayOut == 0) {
|
||||
tipsy.hide();
|
||||
} else {
|
||||
setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
|
||||
}
|
||||
};
|
||||
|
||||
//with delegation
|
||||
if(options.selector){
|
||||
|
||||
jQuery(this).on( "mouseenter", options.selector, enter);
|
||||
jQuery(this).on( "mouseleave", options.selector, leave);
|
||||
|
||||
|
||||
}else{ //old way
|
||||
|
||||
if (!options.live) this.each(function() { get(this); });
|
||||
|
||||
if (options.trigger != 'manual') {
|
||||
var binder = options.live ? 'live' : 'bind',
|
||||
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
|
||||
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
|
||||
this[binder](eventIn, enter)[binder](eventOut, leave);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
|
||||
$.fn.tipsy.defaults = {
|
||||
delayIn: 0,
|
||||
delayOut: 0,
|
||||
fade: false,
|
||||
fallback: '',
|
||||
gravity: 'n',
|
||||
html: false,
|
||||
live: false,
|
||||
offset: 0,
|
||||
opacity: 0.8,
|
||||
title: 'title',
|
||||
trigger: 'hover',
|
||||
selector:null
|
||||
};
|
||||
|
||||
// Overwrite this method to provide options on a per-element basis.
|
||||
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
||||
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
||||
// (remember - do not modify 'options' in place!)
|
||||
$.fn.tipsy.elementOptions = function(ele, options) {
|
||||
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoNS = function() {
|
||||
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoWE = function() {
|
||||
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,765 @@
|
||||
"use strict";
|
||||
|
||||
function UCManagerAdmin(){
|
||||
|
||||
var g_objWrapper = null;
|
||||
var t = this;
|
||||
var g_objCats,g_arrPlugins = [], g_arrPluginsObj = [];
|
||||
var g_arrActionsFunctions = [];
|
||||
var g_objItems = new UCManagerAdminItems();
|
||||
var g_objActions, g_type, g_name, g_passData, g_customOptions = {}, g_objAjaxDataAdd = null;
|
||||
|
||||
var g_minHeight = 450;
|
||||
|
||||
var g_temp = {
|
||||
hasCats: true,
|
||||
updateHeight: true
|
||||
};
|
||||
|
||||
//internal events
|
||||
this.events = {
|
||||
ITEM_HIDE_EMPTY_TEXT:"hide_empty_text",
|
||||
ITEM_MOUSEOVER: "item_mouseover",
|
||||
ITEM_MOUSEOUT: "item_mouseout",
|
||||
ITEM_SELECTION_CHANGE: "item_selection_change"
|
||||
};
|
||||
|
||||
|
||||
function ___________GENERAL_FUNCTIONS________________(){} //sap for outline
|
||||
|
||||
|
||||
/**
|
||||
* trigger internal event
|
||||
*/
|
||||
this.triggerEvent = function(eventName, params){
|
||||
if(!params)
|
||||
var params = null;
|
||||
|
||||
g_objWrapper.trigger(eventName, params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on internal event
|
||||
*/
|
||||
this.onEvent = function(eventName, func){
|
||||
g_objWrapper.on(eventName, func);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update global height, by of categories and items
|
||||
*/
|
||||
this.updateGlobalHeight = function(catHeight, itemsHeight){
|
||||
|
||||
|
||||
setManagerWidthClass();
|
||||
|
||||
if(g_temp.updateHeight == false)
|
||||
return(true);
|
||||
|
||||
if(!catHeight || catHeight === null){
|
||||
if(g_objCats)
|
||||
var catHeight = g_objCats.getCatsHeight();
|
||||
else
|
||||
var catHeight = 0;
|
||||
}
|
||||
|
||||
|
||||
if(!itemsHeight)
|
||||
var itemsHeight = g_objItems.getItemsMaxHeight();
|
||||
|
||||
var maxHeight = catHeight;
|
||||
|
||||
if(itemsHeight > maxHeight)
|
||||
maxHeight = itemsHeight;
|
||||
|
||||
|
||||
maxHeight += 20;
|
||||
|
||||
if(maxHeight < g_minHeight)
|
||||
maxHeight = g_minHeight;
|
||||
|
||||
//set list height
|
||||
g_objItems.setHeight(maxHeight);
|
||||
|
||||
if(g_objCats)
|
||||
g_objCats.setHeight(maxHeight);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set width class to manager
|
||||
*/
|
||||
function setManagerWidthClass(){
|
||||
|
||||
g_objItems.updateWrapperSizeClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* set global height
|
||||
*/
|
||||
this.setTotalHeight = function(totalHeight){
|
||||
|
||||
g_objItems.setHeight(totalHeight);
|
||||
|
||||
if(g_objCats){
|
||||
var catHeight = totalHeight + 50;
|
||||
g_objCats.setHeight(catHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* validate that the manager is already inited
|
||||
*/
|
||||
function validateInited(){
|
||||
|
||||
var isInited = g_objWrapper.data("inited");
|
||||
|
||||
if(isInited === true)
|
||||
throw new Error("Can't init manager twice");
|
||||
|
||||
g_objWrapper.data("inited", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* make sure the manager is not inited
|
||||
*/
|
||||
function validateNotInited(){
|
||||
|
||||
if(!g_objWrapper)
|
||||
return(false);
|
||||
|
||||
var isInited = g_objWrapper.data("inited");
|
||||
if(isInited === true)
|
||||
throw new Error("The manager has to be not inited for this operation");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* destroy the manager
|
||||
*/
|
||||
this.destroy = function(){
|
||||
|
||||
g_objWrapper.add("#manager_shadow_overlay").off("contextmenu");
|
||||
|
||||
g_objWrapper.find(".unite-context-menu li a").off("mouseup");
|
||||
|
||||
g_objWrapper.find("#button_items_operation").off("click");
|
||||
|
||||
if(g_objCats)
|
||||
g_objCats.destroy();
|
||||
|
||||
g_objItems.destroy();
|
||||
|
||||
g_objActions.destroy();
|
||||
|
||||
g_objWrapper.html("");
|
||||
g_objWrapper = null;
|
||||
}
|
||||
|
||||
|
||||
this. ___________PLUGINS_EXTERNAL________________ = function(){}
|
||||
|
||||
|
||||
/**
|
||||
* add plugin
|
||||
*/
|
||||
this.addPlugin = function(plugin){
|
||||
|
||||
validateNotInited();
|
||||
|
||||
g_arrPlugins.push(plugin);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add cats action function
|
||||
*/
|
||||
this.addActionFunction = function(func){
|
||||
|
||||
if(typeof func != "function")
|
||||
throw new Error("the action function should be a function type");
|
||||
|
||||
g_arrActionsFunctions.push(func);
|
||||
};
|
||||
|
||||
/**
|
||||
* get action functions
|
||||
*/
|
||||
this.getActionFunctions = function(){
|
||||
|
||||
return(g_arrActionsFunctions);
|
||||
};
|
||||
|
||||
this. ___________EXTERNAL_GETTERS________________ = function(){}
|
||||
|
||||
/**
|
||||
* get custom option by name
|
||||
*/
|
||||
this.getCustomOption = function(name){
|
||||
if(g_customOptions.hasOwnProperty(name) == false)
|
||||
return(undefined);
|
||||
|
||||
var value = g_customOptions[name];
|
||||
|
||||
return(value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get all items data - from actions
|
||||
*/
|
||||
this.getItemsData = function(){
|
||||
|
||||
if(typeof g_objActions.getItemsData != "function")
|
||||
throw new Error("get items data function not exists in this type");
|
||||
|
||||
var arrItems = g_objActions.getItemsData();
|
||||
|
||||
return(arrItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* get items data json
|
||||
*/
|
||||
this.getItemsDataJson = function(){
|
||||
var data = t.getItemsData();
|
||||
if(typeof data != "object")
|
||||
return("");
|
||||
|
||||
var dataJson = JSON.stringify(data);
|
||||
|
||||
return(dataJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* get categories object
|
||||
*/
|
||||
this.getObjCats = function(){
|
||||
return(g_objCats);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get items objects
|
||||
*/
|
||||
this.getObjItems = function(){
|
||||
|
||||
return(g_objItems);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get wrapper object
|
||||
*/
|
||||
this.getObjWrapper = function(){
|
||||
|
||||
return(g_objWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* get mouseover item
|
||||
*/
|
||||
this.getMouseOverItem = function(){
|
||||
|
||||
if(g_objCats){
|
||||
var catItem = g_objCats.getMouseOverCat();
|
||||
if(catItem)
|
||||
return(catItem);
|
||||
}
|
||||
|
||||
var item = g_objItems.getMouseOverItem();
|
||||
|
||||
return(item);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return if the items field enabled
|
||||
*/
|
||||
this.isItemsAreaEnabled = function(){
|
||||
|
||||
if(!g_objCats)
|
||||
return(true);
|
||||
|
||||
if(g_objCats && g_objCats.isSomeCatSelected() == false)
|
||||
return(false);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
this. ___________EXTERNAL_SETTERS________________ = function(){}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* set some menu on mouse position
|
||||
*/
|
||||
this.showMenuOnMousePos = function(event, objMenu){
|
||||
|
||||
var objOffset = g_objWrapper.offset();
|
||||
var managerY = objOffset.top;
|
||||
var managerX = objOffset.left;
|
||||
|
||||
var menuX = Math.round(event.pageX - managerX);
|
||||
var menuY = Math.round(event.pageY - managerY);
|
||||
|
||||
var menuHeight = objMenu.height();
|
||||
var menuEndY = menuY+menuHeight;
|
||||
|
||||
var parentHeight = g_objWrapper.height();
|
||||
|
||||
//open from bottom
|
||||
if(menuEndY > parentHeight)
|
||||
menuY = menuY - menuHeight;
|
||||
|
||||
jQuery("#manager_shadow_overlay").show();
|
||||
objMenu.css({"left":menuX+"px","top":menuY+"px"}).show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hide all context menus
|
||||
*/
|
||||
this.hideContextMenus = function(){
|
||||
jQuery("#manager_shadow_overlay").hide();
|
||||
jQuery("ul.unite-context-menu").hide();
|
||||
};
|
||||
|
||||
/**
|
||||
* return if the manager has cats
|
||||
*/
|
||||
this.isHasCats = function(){
|
||||
|
||||
return(g_temp.hasCats);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* on item context menu click
|
||||
*/
|
||||
function onContextMenuClick(){
|
||||
|
||||
var objLink = jQuery(this);
|
||||
var action = objLink.data("operation");
|
||||
var objMenu = objLink.parents("ul.unite-context-menu");
|
||||
|
||||
var menuType = objMenu.data("type");
|
||||
|
||||
|
||||
//get extra data according the menu type
|
||||
|
||||
var data = null;
|
||||
|
||||
switch(menuType){
|
||||
case "category":
|
||||
data = g_objCats.getContextMenuCatID();
|
||||
break;
|
||||
}
|
||||
|
||||
var actionFound = false;
|
||||
|
||||
if(g_objCats)
|
||||
actionFound = g_objCats.runCategoryAction(action, data);
|
||||
|
||||
if(actionFound == false)
|
||||
t.runItemAction(action, data);
|
||||
|
||||
t.hideContextMenus();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init context menu events
|
||||
* other context menu functions are located in the items
|
||||
*/
|
||||
function initContextMenus(){
|
||||
|
||||
g_objWrapper.add("#manager_shadow_overlay").on("contextmenu",function(event){
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
//on item right menu click
|
||||
g_objWrapper.find(".unite-context-menu li a").mouseup(onContextMenuClick);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* init plugins
|
||||
*/
|
||||
function initPlugins(){
|
||||
if(g_arrPlugins.length == 0)
|
||||
return(false);
|
||||
|
||||
jQuery.each(g_arrPlugins, function(index, pluginClass){
|
||||
|
||||
|
||||
if(typeof eval(pluginClass) != "function")
|
||||
throw new Error("Plugin "+pluginClass+" not found");
|
||||
|
||||
var objPlugin = eval("new "+pluginClass+"()");
|
||||
objPlugin.init(t);
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* init gallery view
|
||||
*/
|
||||
function initManager(selectedCatID){
|
||||
|
||||
g_objWrapper = jQuery("#uc_managerw");
|
||||
if(g_objWrapper.length == 0)
|
||||
return(false);
|
||||
|
||||
g_type = g_objWrapper.data("type");
|
||||
g_name = g_objWrapper.data("managername");
|
||||
g_passData = g_objWrapper.data("passdata");
|
||||
|
||||
//init text
|
||||
var objText = g_objWrapper.data("text");
|
||||
if(objText && typeof objText == "object"){
|
||||
jQuery.extend(g_uctext, objText);
|
||||
g_objWrapper.removeAttr("data-text");
|
||||
}
|
||||
|
||||
|
||||
if(g_type == "inline")
|
||||
g_minHeight = 210;
|
||||
|
||||
validateInited();
|
||||
|
||||
//set if no cats
|
||||
var objCatsSection = jQuery("#cats_section");
|
||||
if(objCatsSection.length == 0){
|
||||
g_temp.hasCats = false;
|
||||
g_objCats = null;
|
||||
}else{
|
||||
g_objCats = new UCManagerAdminCats();
|
||||
}
|
||||
|
||||
if(!g_ucAdmin)
|
||||
g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
if(g_temp.hasCats == true)
|
||||
initCategories();
|
||||
|
||||
|
||||
//init actions
|
||||
switch(g_type){
|
||||
case "addons":
|
||||
g_objActions = new UCManagerActionsAddons();
|
||||
break;
|
||||
case "inline":
|
||||
g_objActions = new UCManagerActionsInline();
|
||||
break;
|
||||
case "pages":
|
||||
g_objActions = new UCManagerActionsPages();
|
||||
break;
|
||||
default:
|
||||
throw new Error("Wrong manager type: " + g_type);
|
||||
break;
|
||||
}
|
||||
|
||||
if(g_objActions)
|
||||
g_objActions.init(t);
|
||||
|
||||
//the items must be inited from the manager action file
|
||||
g_objItems.validateInited();
|
||||
|
||||
//check first item select
|
||||
if(g_objCats){
|
||||
|
||||
if(selectedCatID){
|
||||
var isSelected = g_objCats.selectCategory(selectedCatID);
|
||||
if(isSelected === false)
|
||||
g_objCats.selectFirstCategory();
|
||||
}
|
||||
else
|
||||
g_objCats.selectFirstCategory();
|
||||
}
|
||||
|
||||
t.updateGlobalHeight();
|
||||
|
||||
initPlugins();
|
||||
};
|
||||
|
||||
|
||||
function ___________CATEGORIES________________(){} //sap for outline
|
||||
|
||||
|
||||
/**
|
||||
* init the categories actions
|
||||
*/
|
||||
function initCategories(){
|
||||
|
||||
g_objCats.init(t);
|
||||
|
||||
//init events
|
||||
g_objCats.events.onRemoveSelectedCategory = function(){
|
||||
t.clearItemsPanel();
|
||||
};
|
||||
|
||||
g_objCats.events.onHeightChange = function(){
|
||||
t.updateGlobalHeight();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ___________ITEMS_FUNCTIONS________________(){} //sap for outline
|
||||
|
||||
|
||||
/**
|
||||
* update bottom operations
|
||||
*/
|
||||
function updateBottomOperations(){
|
||||
|
||||
var numSelected = g_objItems.getNumItemsSelected();
|
||||
|
||||
var numCats = 0;
|
||||
|
||||
if(g_objCats)
|
||||
var numCats = g_objCats.getNumCats();
|
||||
|
||||
jQuery("#num_items_selected").html(numSelected);
|
||||
|
||||
//in case of less then 2 cats - disable operations
|
||||
if(numCats <= 1){
|
||||
|
||||
jQuery("#item_operations_wrapper").hide();
|
||||
return(false);
|
||||
}
|
||||
|
||||
//in case of more then one cat
|
||||
jQuery("#item_operations_wrapper").show();
|
||||
|
||||
//enable operations
|
||||
if(numSelected > 0){
|
||||
jQuery("#select_item_category").prop("disabled","");
|
||||
jQuery("#item_operations_wrapper").removeClass("unite-disabled");
|
||||
jQuery("#button_items_operation").removeClass("button-disabled");
|
||||
|
||||
}else{ //disable operations
|
||||
jQuery("#select_item_category").prop("disabled","disabled");
|
||||
jQuery("#button_items_operation").addClass("button-disabled");
|
||||
jQuery("#item_operations_wrapper").addClass("unite-disabled");
|
||||
}
|
||||
|
||||
//hide / show operation categories
|
||||
jQuery("#select_item_category option").show();
|
||||
var arrOptions = jQuery("#select_item_category option").get();
|
||||
|
||||
var firstSelected = false;
|
||||
|
||||
var selectedCatID = g_objCats.getSelectedCatID();
|
||||
|
||||
for(var index in arrOptions){
|
||||
var objOption = jQuery(arrOptions[index]);
|
||||
var value = objOption.prop("value");
|
||||
|
||||
if(value == selectedCatID)
|
||||
objOption.hide();
|
||||
else
|
||||
if(firstSelected == false){
|
||||
objOption.prop("selected","selected");
|
||||
firstSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* run items action
|
||||
*/
|
||||
this.runItemAction = function(action, data){
|
||||
|
||||
g_objActions.runItemAction(action, data);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* on select category event
|
||||
*/
|
||||
this.onCatSelect = function(catID){
|
||||
g_objActions.runItemAction("get_cat_items", catID);
|
||||
g_objItems.unselectAllItems("selectCategory");
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* run gallery ajax request
|
||||
*/
|
||||
this.ajaxRequestManager = function(action,data,status,funcSuccess){
|
||||
|
||||
jQuery("#status_loader").show();
|
||||
jQuery("#status_text").show().html(status);
|
||||
|
||||
if(g_objAjaxDataAdd && typeof(data) == "object"){
|
||||
jQuery.extend(data, g_objAjaxDataAdd);
|
||||
}
|
||||
|
||||
g_ucAdmin.ajaxRequest(action,data,function(response){
|
||||
jQuery("#status_loader").hide();
|
||||
jQuery("#status_text").hide();
|
||||
if(typeof funcSuccess == "function")
|
||||
funcSuccess(response);
|
||||
|
||||
g_objItems.checkSelectRelatedItems();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* on bottom GO button click, move items
|
||||
*/
|
||||
function onBottomOperationsClick(){
|
||||
|
||||
var arrIDs = g_objItems.getSelectedItemIDs();
|
||||
|
||||
if(arrIDs.length == 0)
|
||||
return(false);
|
||||
|
||||
var selectedCatID = g_objCats.getSelectedCatID();
|
||||
|
||||
var targetCatID = jQuery("#select_item_category").val();
|
||||
if(targetCatID == selectedCatID){
|
||||
alert("Can't move addons to same category");
|
||||
return(false);
|
||||
}
|
||||
|
||||
var data = {};
|
||||
data.targetCatID = targetCatID;
|
||||
data.selectedCatID = selectedCatID;
|
||||
data.arrAddonIDs = arrIDs;
|
||||
|
||||
g_objActions.runItemAction("move_items", data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set actions options
|
||||
* some data goes directly to options
|
||||
*/
|
||||
this.setCustomOptions = function(options){
|
||||
g_customOptions = options;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* set items from data
|
||||
*/
|
||||
this.setItemsFromData = function(arrItems){
|
||||
if(typeof g_objActions.setItemsFromData != "function")
|
||||
throw new Error("set items from data function not exists in this type");
|
||||
|
||||
g_objActions.setItemsFromData(arrItems);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* clear items panel
|
||||
*/
|
||||
this.clearItemsPanel = function(){
|
||||
g_objItems.clearItemsPanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* set object add data to every ajax request
|
||||
*/
|
||||
this.setObjAjaxAddData = function(objData){
|
||||
|
||||
g_objAjaxDataAdd = objData;
|
||||
|
||||
}
|
||||
|
||||
this. ___________EXTERNAL_INIT________________ = function(){}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* init bottom operations
|
||||
*/
|
||||
this.initBottomOperations = function(){
|
||||
|
||||
// do items operations
|
||||
g_objWrapper.find("#button_items_operation").on("click",onBottomOperationsClick);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init items actions
|
||||
*/
|
||||
this.initItems = function(){
|
||||
|
||||
g_objItems.initItems(t);
|
||||
|
||||
//on selection change
|
||||
g_objItems.events.onItemSelectionChange = function(){
|
||||
updateBottomOperations();
|
||||
|
||||
t.triggerEvent(t.events.ITEM_SELECTION_CHANGE);
|
||||
};
|
||||
|
||||
//on items height change
|
||||
g_objItems.events.onHeightChange = function(itemsHeight){
|
||||
t.updateGlobalHeight(null, itemsHeight);
|
||||
};
|
||||
|
||||
initContextMenus();
|
||||
|
||||
//if items only - clear panel
|
||||
if(g_temp.hasCats == false)
|
||||
g_objItems.updatePanelView();
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* get manager name
|
||||
*/
|
||||
this.getManagerName = function(){
|
||||
|
||||
return(g_name);
|
||||
};
|
||||
|
||||
/**
|
||||
* get manager pass data
|
||||
*/
|
||||
this.getManagerPassData = function(){
|
||||
|
||||
return(g_passData);
|
||||
}
|
||||
|
||||
/**
|
||||
* set not to update height
|
||||
*/
|
||||
this.setNotUpdateHeight = function(){
|
||||
|
||||
g_temp.updateHeight = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init manager
|
||||
*/
|
||||
this.initManager = function(selectedCatID){
|
||||
|
||||
initManager(selectedCatID);
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,534 @@
|
||||
"use strict";
|
||||
|
||||
function UCManagerActionsInline(){
|
||||
|
||||
var t = this;
|
||||
var g_objCats, g_manager, g_objDialogEdit;
|
||||
var g_objWrapper, g_objSettings, g_objSettingsWrapper, g_initByAddonID = null;
|
||||
var g_imageField = null; //field that set to be image for html output
|
||||
var g_dialogFormItem = new UniteCreatorParamsDialog();
|
||||
var g_itemType = "default"; //default / form
|
||||
|
||||
var g_objItems = new UCManagerAdminItems();
|
||||
|
||||
if(!g_ucAdmin){
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
}
|
||||
|
||||
var g_temp = {
|
||||
source:""
|
||||
};
|
||||
|
||||
/**
|
||||
* on item button click
|
||||
*/
|
||||
this.runItemAction = function(action, data){
|
||||
|
||||
switch(action){
|
||||
case "add_images":
|
||||
onAddImagesClick();
|
||||
break;
|
||||
case "add_form_item":
|
||||
openFormItemDialog();
|
||||
break;
|
||||
case "add_item":
|
||||
openAddEditItemDialog();
|
||||
break;
|
||||
case "edit_item":
|
||||
if(g_itemType == "form")
|
||||
onEditFormItemClick();
|
||||
else
|
||||
onEditItemClick();
|
||||
break;
|
||||
case "update_order": //do nothing
|
||||
break;
|
||||
case "remove_items":
|
||||
g_objItems.removeSelectedItems();
|
||||
break;
|
||||
case "duplicate_items":
|
||||
g_objItems.duplicateSelectedItems();
|
||||
break;
|
||||
case "select_all_items":
|
||||
g_objItems.selectUnselectAllItems();
|
||||
break;
|
||||
default:
|
||||
trace("wrong action: "+action);
|
||||
break;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
function ________FORM___________(){}
|
||||
|
||||
|
||||
/**
|
||||
* open form item dialog - attributes dialog
|
||||
*/
|
||||
function openFormItemDialog(params, itemID){
|
||||
|
||||
var isEdit = false;
|
||||
if(params)
|
||||
isEdit = true;
|
||||
|
||||
if(isEdit == false){ //add
|
||||
|
||||
g_dialogFormItem.open(null,null,function(objValues){
|
||||
|
||||
appendItem(objValues);
|
||||
|
||||
});
|
||||
|
||||
}else{ //edit
|
||||
|
||||
g_dialogFormItem.open(params, itemID, function(objValues, itemID){
|
||||
|
||||
updateItemByID(itemID, objValues);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* open edit for item dialog with form data
|
||||
*/
|
||||
function onEditFormItemClick(){
|
||||
|
||||
var objItem = g_objItems.getSelectedItem();
|
||||
if(!objItem)
|
||||
throw new Error("No items found");
|
||||
|
||||
var params = objItem.data("params");
|
||||
var itemID = objItem.data("id");
|
||||
|
||||
openFormItemDialog(params,itemID);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get items data
|
||||
*/
|
||||
this.getItemsData = function(){
|
||||
var objItems = g_objItems.getObjItems();
|
||||
|
||||
var arrItems = [];
|
||||
jQuery.each(objItems, function(index, item){
|
||||
var objItem = jQuery(item);
|
||||
var params = objItem.data("params");
|
||||
arrItems.push(params);
|
||||
});
|
||||
|
||||
return(arrItems);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* set items from data
|
||||
*/
|
||||
this.setItemsFromData = function(arrItems){
|
||||
|
||||
g_objItems.removeAllItems(true);
|
||||
|
||||
if(typeof arrItems != "object")
|
||||
return(false);
|
||||
|
||||
jQuery.each(arrItems, function(index, itemData){
|
||||
appendItem(itemData, true);
|
||||
});
|
||||
|
||||
g_objItems.updateAfterHtmlListChange();
|
||||
};
|
||||
|
||||
|
||||
|
||||
function ________OTHER___________(){}
|
||||
|
||||
|
||||
/**
|
||||
* on add images click
|
||||
*/
|
||||
function onAddImagesClick(){
|
||||
|
||||
g_ucAdmin.openAddImageDialog("Add Images",function(response){
|
||||
|
||||
if(response && jQuery.isArray(response) == false)
|
||||
response = [response];
|
||||
|
||||
jQuery.each(response, function(index, item){
|
||||
|
||||
if(g_temp.source == "addon"){
|
||||
|
||||
var urlAssetsRelative = item.url_assets_relative;
|
||||
var urlImage = item.full_url;
|
||||
|
||||
}else{
|
||||
var urlImage = item.url;
|
||||
}
|
||||
|
||||
urlImage = g_ucAdmin.urlToRelative(urlImage);
|
||||
|
||||
addItemFromImage(urlImage);
|
||||
});
|
||||
|
||||
}, true, g_temp.source);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* open edit item dialog
|
||||
*/
|
||||
function onEditItemClick(){
|
||||
|
||||
var objItem = g_objItems.getSelectedItem();
|
||||
if(!objItem)
|
||||
throw new Error("No items found");
|
||||
|
||||
openAddEditItemDialog(true, objItem);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* open add item dialog
|
||||
*/
|
||||
function openAddEditItemDialog(isEdit, objItem){
|
||||
|
||||
if(!isEdit)
|
||||
var isEdit = false;
|
||||
|
||||
var buttonText = g_uctext.add_item;
|
||||
var titleText = g_uctext.add_item;
|
||||
|
||||
if(isEdit){
|
||||
var params = objItem.data("params");
|
||||
g_objDialogEdit.data("item", objItem);
|
||||
|
||||
buttonText = g_uctext.update_item;
|
||||
titleText = g_uctext.edit_item;
|
||||
}
|
||||
|
||||
var buttonOpts = {};
|
||||
|
||||
buttonOpts[g_uctext.cancel] = function(){
|
||||
g_objDialogEdit.dialog("close");
|
||||
};
|
||||
|
||||
buttonOpts[buttonText] = function(){
|
||||
|
||||
if(isEdit == false)
|
||||
addItemFromDialog();
|
||||
else{
|
||||
var objItem = g_objDialogEdit.data("item");
|
||||
updateItemFromDialog(objItem);
|
||||
}
|
||||
|
||||
g_objDialogEdit.dialog("close");
|
||||
};
|
||||
|
||||
|
||||
g_objDialogEdit.dialog({
|
||||
dialogClass:"unite-ui",
|
||||
buttons:buttonOpts,
|
||||
title: titleText,
|
||||
minWidth:800,
|
||||
modal:true,
|
||||
open:function(){
|
||||
|
||||
if(g_initByAddonID){ //ajax init
|
||||
|
||||
var data = {
|
||||
addonid:g_initByAddonID
|
||||
};
|
||||
|
||||
g_initByAddonID = null;
|
||||
|
||||
g_ucAdmin.ajaxRequest("get_addon_item_settings_html", data, function(response){
|
||||
|
||||
g_objSettingsWrapper.html(response.html);
|
||||
|
||||
initSettingsObject();
|
||||
|
||||
//clear or init settings
|
||||
if(isEdit == false) //add
|
||||
g_objSettings.clearSettings();
|
||||
else //edit
|
||||
g_objSettings.setValues(params);
|
||||
|
||||
});
|
||||
|
||||
}else{
|
||||
|
||||
if(isEdit == false) //add
|
||||
g_objSettings.clearSettings();
|
||||
else //edit
|
||||
g_objSettings.setValues(params);
|
||||
|
||||
}
|
||||
|
||||
g_objSettings.focusFirstInput();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* generate item title
|
||||
*/
|
||||
function generateItemTitle(){
|
||||
var numItems = g_objItems.getNumItems()+1;
|
||||
var title = "Item " + numItems;
|
||||
return(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* get title from params
|
||||
* @param params
|
||||
*/
|
||||
function getTitleFromParams(params){
|
||||
|
||||
if(params.hasOwnProperty("title") == false)
|
||||
return(null);
|
||||
|
||||
var title = params["title"];
|
||||
if(!title)
|
||||
return(null);
|
||||
|
||||
return(title);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generate item html
|
||||
*/
|
||||
function generateItemHtml(params, id){
|
||||
|
||||
//set title
|
||||
var title = generateItemTitle();
|
||||
var altTitle = getTitleFromParams(params);
|
||||
|
||||
if(altTitle)
|
||||
title = altTitle;
|
||||
|
||||
var description = "";
|
||||
|
||||
//set description style
|
||||
var urlImage = null;
|
||||
|
||||
if(params.hasOwnProperty("thumb"))
|
||||
urlImage = jQuery.trim(params.thumb);
|
||||
|
||||
if(!urlImage && g_imageField && params.hasOwnProperty(g_imageField))
|
||||
urlImage = jQuery.trim(params[g_imageField]);
|
||||
|
||||
//trace('generateItemHtml');
|
||||
//trace(urlImage);
|
||||
|
||||
var descStyle = "";
|
||||
if(urlImage){
|
||||
urlImage = g_ucAdmin.urlToFull(urlImage);
|
||||
descStyle = "style=\"background-image:url('"+urlImage+"')\"";
|
||||
}
|
||||
|
||||
//generatet id
|
||||
if(id){
|
||||
var itemID = g_objItems.getItemIDFromID(id);
|
||||
}else{
|
||||
var objID = g_objItems.getObjNewID();
|
||||
var id = objID.id;
|
||||
var itemID = objID.itemID;
|
||||
}
|
||||
|
||||
|
||||
var $htmlItem = "";
|
||||
$htmlItem += "<li id='" + itemID + "' data-id='"+id+"' data-title="+title+" >";
|
||||
$htmlItem += " <div class=\"uc-item-title unselectable\" unselectable=\"on\">"+title+"</div>";
|
||||
$htmlItem += " <div class=\"uc-item-description unselectable\" unselectable=\"on\" "+descStyle+">"+description+"</div>";
|
||||
$htmlItem += " <div class=\"uc-item-icon unselectable\" unselectable=\"on\"></div>";
|
||||
$htmlItem += "</li>";
|
||||
|
||||
return($htmlItem);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update item html from params
|
||||
*/
|
||||
function updateItemHtml(objItem, params){
|
||||
|
||||
var id = objItem.data("id");
|
||||
|
||||
var html = generateItemHtml(params, id);
|
||||
|
||||
var objNewItem = g_objItems.replaceItemHtml(objItem, html);
|
||||
|
||||
objNewItem.data("params", params);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* append item from values
|
||||
* @param objValues
|
||||
*/
|
||||
function appendItem(objValues, noUpdate){
|
||||
var htmlItem = generateItemHtml(objValues);
|
||||
var objItem = g_objItems.appendItem(htmlItem, noUpdate);
|
||||
objItem.data("params", objValues);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add item from dialog
|
||||
*/
|
||||
function addItemFromDialog(){
|
||||
var objValues = g_objSettings.getSettingsValues();
|
||||
appendItem(objValues);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add item from image
|
||||
*/
|
||||
function addItemFromImage(urlImage){
|
||||
|
||||
var objInfo = g_ucAdmin.pathinfo(urlImage);
|
||||
var params = {};
|
||||
params.title = objInfo.filename;
|
||||
params.image = urlImage;
|
||||
|
||||
appendItem(params);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update item from dialog
|
||||
*/
|
||||
function updateItemFromDialog(objItem){
|
||||
|
||||
var params = g_objSettings.getSettingsValues();
|
||||
objItem.data("params", params);
|
||||
updateItemHtml(objItem, params);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* update item setting by id
|
||||
*/
|
||||
function updateItemByID(itemID, params){
|
||||
|
||||
var objItem = jQuery("#uc_item_" + itemID);
|
||||
g_ucAdmin.validateDomElement(objItem, "edit item");
|
||||
|
||||
objItem.data("params", params);
|
||||
updateItemHtml(objItem, params);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set thumb field for viewing the thumb
|
||||
*/
|
||||
function init_setImageField(){
|
||||
|
||||
var arrFieldNames = g_objSettings.getFieldNamesByType("image");
|
||||
|
||||
if(arrFieldNames.length == 0)
|
||||
return(false);
|
||||
|
||||
g_imageField = arrFieldNames[0];
|
||||
|
||||
if(arrFieldNames.length > 1){
|
||||
if(jQuery.inArray("image",arrFieldNames) != -1)
|
||||
g_imageField == "image";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* destroy
|
||||
*/
|
||||
this.destroy = function(){
|
||||
|
||||
if(g_objSettings)
|
||||
g_objSettings.destroy();
|
||||
|
||||
//nothing to destroy yet
|
||||
};
|
||||
|
||||
/**
|
||||
* init settings, after the settigns html is set
|
||||
*/
|
||||
function initSettingsObject(){
|
||||
|
||||
g_objSettings = new UniteSettingsUC();
|
||||
g_objSettings.init(g_objSettingsWrapper);
|
||||
|
||||
init_setImageField();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init the actions
|
||||
*/
|
||||
this.init = function(objManager){
|
||||
|
||||
g_manager = objManager;
|
||||
|
||||
g_manager.initItems();
|
||||
|
||||
g_objCats = g_manager.getObjCats();
|
||||
g_objItems = g_manager.getObjItems();
|
||||
g_objWrapper = g_manager.getObjWrapper();
|
||||
|
||||
//init options
|
||||
var options = g_objWrapper.data("options");
|
||||
var source = g_ucAdmin.getVal(options, "source");
|
||||
|
||||
if(source)
|
||||
g_temp.source = source;
|
||||
|
||||
|
||||
g_objDialogEdit = g_objWrapper.find(".uc-dialog-edit-item");
|
||||
if(g_objDialogEdit.length){
|
||||
|
||||
g_objSettingsWrapper = g_objWrapper.find(".uc-item-config-settings");
|
||||
|
||||
var addonID = g_objSettingsWrapper.data("initbyaddon");
|
||||
if(addonID){
|
||||
g_objSettingsWrapper.data("initbyaddon", null);
|
||||
g_initByAddonID = addonID;
|
||||
}else{ //init settings right away - no ajax
|
||||
|
||||
initSettingsObject();
|
||||
|
||||
}
|
||||
}else
|
||||
g_objDialogEdit = null;
|
||||
|
||||
|
||||
//init form item dialog
|
||||
var objDialogFormItemWrapper = g_objWrapper.find(".uc-dialog-param-form_item");
|
||||
if(objDialogFormItemWrapper.length){
|
||||
g_itemType = "form";
|
||||
g_dialogFormItem.init(objDialogFormItemWrapper);
|
||||
}else
|
||||
g_dialogFormItem = null;
|
||||
|
||||
|
||||
//init from data
|
||||
var arrInitItems = g_objWrapper.data("init-items");
|
||||
|
||||
if(arrInitItems && typeof arrInitItems == "object")
|
||||
t.setItemsFromData(arrInitItems);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,842 @@
|
||||
"use strict";
|
||||
|
||||
function UCManagerAdminCats(){
|
||||
|
||||
var g_catClickReady = false;
|
||||
var g_catFieldRightClickReady = true; //avoid double menu on cat field
|
||||
var g_maxCatHeight = 450;
|
||||
var g_manager, g_objAjaxDataAdd = null;
|
||||
var g_objListCats;
|
||||
|
||||
|
||||
//event functions
|
||||
this.events = {
|
||||
onRemoveSelectedCategory: function(){},
|
||||
onHeightChange: function(){},
|
||||
onOpenCategoryDialog:function(){}
|
||||
};
|
||||
|
||||
|
||||
var g_temp = {
|
||||
isInited: false
|
||||
};
|
||||
|
||||
var t = this;
|
||||
|
||||
|
||||
function _______________INIT______________(){}
|
||||
|
||||
/**
|
||||
* validate that the object is inited
|
||||
*/
|
||||
function validateInited(){
|
||||
if(g_temp.isInited == false)
|
||||
throw new Error("The categories is not inited");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init the categories
|
||||
*/
|
||||
function initCats(objManager){
|
||||
|
||||
if(g_temp.isInited == true)
|
||||
throw new Error("Can't init cat object twice");
|
||||
|
||||
g_manager = objManager;
|
||||
g_objListCats = jQuery("#list_cats");
|
||||
|
||||
g_temp.isInited = true;
|
||||
|
||||
if(!g_ucAdmin)
|
||||
g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
initEvents();
|
||||
|
||||
//update sortable categories
|
||||
try{
|
||||
g_objListCats.sortable({
|
||||
axis:'y',
|
||||
start: function( event, ui ) {
|
||||
g_catClickReady = false;
|
||||
},
|
||||
update: function(){
|
||||
updateCatOrder();
|
||||
//save sorting order
|
||||
}
|
||||
});
|
||||
}catch(error){
|
||||
trace("error occured in jquery sortable!");
|
||||
trace(error);
|
||||
}
|
||||
|
||||
initAddCategoryDialog();
|
||||
|
||||
initEditCategoryDialog();
|
||||
|
||||
initDeleteCategoryDialog();
|
||||
}
|
||||
|
||||
|
||||
function _______________GETTERS______________(){}
|
||||
|
||||
/**
|
||||
*
|
||||
* get category by id
|
||||
*/
|
||||
function getCatByID(catID){
|
||||
var objCat = jQuery("#category_" + catID);
|
||||
return(objCat);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get category data
|
||||
*/
|
||||
function getCatData(catID){
|
||||
|
||||
var objCat = getCatByID(catID);
|
||||
if(objCat.length == 0)
|
||||
return(null);
|
||||
|
||||
var data = {};
|
||||
data.id = catID;
|
||||
data.title = objCat.data("title");
|
||||
data.isweb = objCat.data("isweb");
|
||||
data.isweb = g_ucAdmin.strToBool(data.isweb);
|
||||
|
||||
return(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check if some category selected
|
||||
*
|
||||
*/
|
||||
this.isCatSelected = function(catID){
|
||||
|
||||
var selectedCatID = t.getSelectedCatID();
|
||||
|
||||
if(catID == selectedCatID)
|
||||
return(true);
|
||||
|
||||
return(false);
|
||||
};
|
||||
|
||||
|
||||
function _______________SETTERS______________(){}
|
||||
|
||||
|
||||
/**
|
||||
* remove category from html
|
||||
*/
|
||||
function removeCategoryFromHtml(catID){
|
||||
|
||||
jQuery("#category_"+catID).remove();
|
||||
|
||||
//disableCatButtons();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set first category selected
|
||||
*/
|
||||
this.selectFirstCategory = function(){
|
||||
|
||||
var arrCats = getArrCats();
|
||||
if(arrCats.length == 0)
|
||||
return(false);
|
||||
|
||||
var firstCat = arrCats[0];
|
||||
|
||||
var catID = jQuery(firstCat).data("id");
|
||||
t.selectCategory(catID);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* run category action
|
||||
*/
|
||||
this.runCategoryAction = function(action, catID){
|
||||
|
||||
if(!catID)
|
||||
var catID = t.getSelectedCatID();
|
||||
|
||||
switch(action){
|
||||
case "add_category":
|
||||
openAddCategoryDialog();
|
||||
break;
|
||||
case "edit_category":
|
||||
openEditCategoryDialog(catID);
|
||||
break;
|
||||
case "delete_category":
|
||||
openDeleteCategoryDialog(catID);
|
||||
break;
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* enable category buttons
|
||||
*/
|
||||
function enableCatButtons(){
|
||||
|
||||
//cat butons:
|
||||
//g_ucAdmin.enableButton("#button_remove_category, #button_edit_category");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* enable category buttons
|
||||
*/
|
||||
function disableCatButtons(){
|
||||
|
||||
//g_ucAdmin.disableButton("#button_remove_category, #button_edit_category");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update categories order
|
||||
*/
|
||||
function updateCatOrder(){
|
||||
|
||||
//get sortIDs
|
||||
var arrSortCats = jQuery( "#list_cats" ).sortable("toArray");
|
||||
var arrSortIDs = [];
|
||||
for(var i=0;i < arrSortCats.length; i++){
|
||||
var catHtmlID = arrSortCats[i];
|
||||
var catID = catHtmlID.replace("category_","");
|
||||
arrSortIDs.push(catID);
|
||||
}
|
||||
|
||||
var data = {cat_order:arrSortIDs};
|
||||
g_manager.ajaxRequestManager("update_cat_order",data,g_uctext.updating_categories_order);
|
||||
}
|
||||
|
||||
function _______________ADD_CATEGORY______________(){}
|
||||
|
||||
/**
|
||||
* add category
|
||||
*/
|
||||
function addCategory(){
|
||||
|
||||
var data = {};
|
||||
data.catname = jQuery("#uc_dialog_add_category_catname").val();
|
||||
|
||||
if(g_objAjaxDataAdd && typeof(data) == "object"){
|
||||
jQuery.extend(data, g_objAjaxDataAdd);
|
||||
}
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_add_category", "add_category", data, function(response){
|
||||
|
||||
var html = response.htmlCat;
|
||||
|
||||
jQuery("#list_cats").append(html);
|
||||
|
||||
//update html cats select
|
||||
var htmlSelectCats = response.htmlSelectCats;
|
||||
jQuery("#select_item_category").html(htmlSelectCats);
|
||||
|
||||
t.events.onHeightChange();
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* open add category dialog
|
||||
*/
|
||||
function openAddCategoryDialog(){
|
||||
|
||||
g_ucAdmin.openCommonDialog("#uc_dialog_add_category", function(){
|
||||
|
||||
jQuery("#uc_dialog_add_category_catname").val("").focus();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init add category dialog
|
||||
*/
|
||||
function initAddCategoryDialog(){
|
||||
|
||||
jQuery("#uc_dialog_add_category_action").on("click",addCategory);
|
||||
|
||||
// set update title onenter function
|
||||
jQuery("#uc_dialog_add_category_catname").keyup(function(event){
|
||||
if(event.keyCode == 13)
|
||||
addCategory();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function _______________EDIT_CATEGORY______________(){}
|
||||
|
||||
/**
|
||||
*
|
||||
* open the edit category dialog by category id
|
||||
*/
|
||||
function openEditCategoryDialog(catID){
|
||||
|
||||
if(catID == -1)
|
||||
return(false);
|
||||
|
||||
var cat = getCatByID(catID);
|
||||
|
||||
if(cat.length == 0){
|
||||
trace("category with id: " + catID + " don't exists");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(jQuery.isNumeric(catID) == false)
|
||||
return(false);
|
||||
|
||||
//set data
|
||||
var dialogEdit = jQuery("#uc_dialog_edit_category");
|
||||
var isCustom = dialogEdit.data("custom");
|
||||
|
||||
dialogEdit.data("catid", catID);
|
||||
|
||||
//update catid field
|
||||
if(!isCustom){
|
||||
jQuery("#span_catdialog_id").html(catID);
|
||||
|
||||
var title = cat.data("title");
|
||||
jQuery("#uc_dialog_edit_category_title").val(title).focus();
|
||||
}
|
||||
|
||||
var options = {
|
||||
minWidth: 900
|
||||
};
|
||||
|
||||
g_ucAdmin.openCommonDialog("#uc_dialog_edit_category", function(){
|
||||
|
||||
if(!isCustom)
|
||||
jQuery("#uc_dialog_edit_category_title").select();
|
||||
else{
|
||||
t.events.onOpenCategoryDialog(dialogEdit, catID);
|
||||
}
|
||||
|
||||
},options);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* function invoke from the dialog update button
|
||||
*/
|
||||
function updateCategoryTitle(){
|
||||
|
||||
var dialogEdit = jQuery("#uc_dialog_edit_category");
|
||||
|
||||
var catID = dialogEdit.data("catid");
|
||||
|
||||
var cat = getCatByID(catID);
|
||||
|
||||
var newTitle = jQuery("#uc_dialog_edit_category_title").val();
|
||||
var data = {
|
||||
catID: catID,
|
||||
title: newTitle
|
||||
};
|
||||
|
||||
if(g_objAjaxDataAdd && typeof(data) == "object"){
|
||||
jQuery.extend(data, g_objAjaxDataAdd);
|
||||
}
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_edit_category", "update_category", data, function(response){
|
||||
|
||||
t.updateTitle(catID, newTitle);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* update category title
|
||||
*/
|
||||
this.updateTitle = function(catID, newTitle){
|
||||
|
||||
var objCat = getCatByID(catID);
|
||||
var numItems = objCat.data("numaddons");
|
||||
|
||||
var newTitleShow = newTitle;
|
||||
if(numItems && numItems != undefined && numItems > 0)
|
||||
newTitleShow += " ("+numItems+")";
|
||||
|
||||
objCat.html("<span>" + newTitleShow + "</span>");
|
||||
|
||||
objCat.data("title",newTitle);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init edit category dialog
|
||||
*/
|
||||
function initEditCategoryDialog(){
|
||||
|
||||
var objEditDialog = jQuery("#uc_dialog_edit_category");
|
||||
|
||||
if(objEditDialog.length == 0)
|
||||
return(false);
|
||||
|
||||
var isCustom = objEditDialog.data("custom");
|
||||
|
||||
if(isCustom)
|
||||
return(false);
|
||||
|
||||
// set update title onenter function
|
||||
jQuery("#uc_dialog_edit_category_action").on("click",updateCategoryTitle);
|
||||
|
||||
jQuery("#uc_dialog_edit_category_title").doOnEnter(updateCategoryTitle);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function _______________DELETE_CATEGORY______________(){}
|
||||
|
||||
|
||||
/**
|
||||
* remove some category by id
|
||||
*/
|
||||
function deleteCategory(){
|
||||
|
||||
var dialogDelete = jQuery("#uc_dialog_delete_category");
|
||||
var catID = dialogDelete.data("catid");
|
||||
|
||||
var data = {};
|
||||
data.catID = catID;
|
||||
|
||||
var selectedCatID = t.getSelectedCatID();
|
||||
|
||||
//get if selected category will be removed
|
||||
var isSelectedRemoved = (catID == selectedCatID);
|
||||
|
||||
if(g_objAjaxDataAdd && typeof(data) == "object"){
|
||||
jQuery.extend(data, g_objAjaxDataAdd);
|
||||
}
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_delete_category", "remove_category", data, function(response){
|
||||
|
||||
removeCategoryFromHtml(catID);
|
||||
|
||||
//update html cats select
|
||||
var htmlSelectCats = response.htmlSelectCats;
|
||||
jQuery("#select_item_category").html(htmlSelectCats);
|
||||
|
||||
//clear the items panel
|
||||
if(isSelectedRemoved == true){
|
||||
|
||||
//run event
|
||||
t.events.onRemoveSelectedCategory();
|
||||
|
||||
t.selectFirstCategory();
|
||||
}
|
||||
|
||||
//fire height change event
|
||||
t.events.onHeightChange();
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* open the edit category dialog by category id
|
||||
*/
|
||||
function openDeleteCategoryDialog(catID){
|
||||
|
||||
if(catID == -1)
|
||||
return(false);
|
||||
|
||||
var cat = getCatByID(catID);
|
||||
|
||||
if(cat.length == 0){
|
||||
trace("category with id: " + catID + " don't exists");
|
||||
return(false);
|
||||
}
|
||||
|
||||
//set data
|
||||
var dialogDelete = jQuery("#uc_dialog_delete_category");
|
||||
dialogDelete.data("catid", catID);
|
||||
|
||||
var title = cat.data("title");
|
||||
|
||||
jQuery("#uc_dialog_delete_category_catname").html(title);
|
||||
|
||||
g_ucAdmin.openCommonDialog("#uc_dialog_delete_category");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init edit category dialog
|
||||
*/
|
||||
function initDeleteCategoryDialog(){
|
||||
|
||||
// set update title onenter function
|
||||
jQuery("#uc_dialog_delete_category_action").on("click",deleteCategory);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function _______________EVENTS______________(){}
|
||||
|
||||
|
||||
/**
|
||||
* on category list item click
|
||||
*/
|
||||
function onCatListItemClick(event){
|
||||
|
||||
if(g_ucAdmin.isRightButtonPressed(event))
|
||||
return(true);
|
||||
|
||||
if(g_catClickReady == false)
|
||||
return(false);
|
||||
|
||||
if(jQuery(this).hasClass("selected-item"))
|
||||
return(false);
|
||||
|
||||
var catID = jQuery(this).data("id");
|
||||
t.selectCategory(catID);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* on double click
|
||||
*/
|
||||
function onCatListItemDblClick(event){
|
||||
|
||||
if(g_ucAdmin.isRightButtonPressed(event))
|
||||
return(true);
|
||||
|
||||
if(g_catClickReady == false)
|
||||
return(false);
|
||||
|
||||
var catID = jQuery(this).data("id");
|
||||
|
||||
t.runCategoryAction("edit_category",catID);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* on cat list item mousedown
|
||||
*/
|
||||
function onCatListItemMousedown(event){
|
||||
|
||||
if(g_ucAdmin.isRightButtonPressed(event))
|
||||
return(true);
|
||||
|
||||
g_catClickReady = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on category context menu click
|
||||
*/
|
||||
function onCategoryContextMenu(event){
|
||||
|
||||
g_catFieldRightClickReady = false;
|
||||
|
||||
var objCat = jQuery(this);
|
||||
var catID = objCat.data("id");
|
||||
|
||||
if(catID == 0 || catID == "all")
|
||||
return(false);
|
||||
|
||||
var objMenu = jQuery("#rightmenu_cat");
|
||||
|
||||
objMenu.data("catid",catID);
|
||||
g_manager.showMenuOnMousePos(event, objMenu);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on categories context menu
|
||||
*/
|
||||
function onCatsFieldContextMenu(event){
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if(g_catFieldRightClickReady == false){
|
||||
g_catFieldRightClickReady = true;
|
||||
return(true);
|
||||
}
|
||||
|
||||
var objMenu = jQuery("#rightmenu_catfield");
|
||||
g_manager.showMenuOnMousePos(event, objMenu);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on action button click
|
||||
*/
|
||||
function onActionByttonClick(){
|
||||
|
||||
var objButton = jQuery(this);
|
||||
|
||||
if(!g_ucAdmin.isButtonEnabled(objButton))
|
||||
return(false);
|
||||
|
||||
var action = objButton.data("action");
|
||||
|
||||
t.runCategoryAction(action);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
jQuery(".uc-cat-action-button").on("click",onActionByttonClick);
|
||||
|
||||
//list categories actions
|
||||
jQuery("#list_cats").on("mouseover", "li", function() {
|
||||
jQuery(this).addClass("item-hover");
|
||||
|
||||
});
|
||||
|
||||
jQuery("#list_cats").on("mouseout","li", function() {
|
||||
jQuery(this).removeClass("item-hover");
|
||||
});
|
||||
|
||||
jQuery("#list_cats").on("click", "li", onCatListItemClick);
|
||||
jQuery("#list_cats").on("dblclick", "li", onCatListItemDblClick);
|
||||
|
||||
jQuery("#list_cats").on("mousedown", "li", onCatListItemMousedown );
|
||||
|
||||
//init context menus
|
||||
jQuery("#list_cats").on("contextmenu", "li", onCategoryContextMenu);
|
||||
jQuery("#cats_section").on("contextmenu", onCatsFieldContextMenu);
|
||||
|
||||
}
|
||||
|
||||
this._______________EXTERNAL_GETTERS______________ = function(){}
|
||||
|
||||
|
||||
/**
|
||||
* get selected category ID
|
||||
*/
|
||||
this.getSelectedCatID = function(){
|
||||
var objCat = g_objListCats.find("li.selected-item");
|
||||
if(objCat.length == 0)
|
||||
return(-1);
|
||||
|
||||
var catID = objCat.data("id");
|
||||
|
||||
return(catID);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get selected category data
|
||||
*/
|
||||
this.getSelectedCatData = function(){
|
||||
|
||||
var selectedCatID = t.getSelectedCatID();
|
||||
|
||||
if(selectedCatID == -1)
|
||||
return(null);
|
||||
|
||||
var data = getCatData(selectedCatID);
|
||||
|
||||
return(data);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* return if some category selected
|
||||
*/
|
||||
this.isSomeCatSelected = function(){
|
||||
|
||||
var selectedCatID = t.getSelectedCatID();
|
||||
|
||||
if(selectedCatID == -1)
|
||||
return(false);
|
||||
|
||||
return(true);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get height of the categories list
|
||||
*/
|
||||
this.getCatsHeight = function(){
|
||||
|
||||
var catsWrapper = jQuery("#cats_section .cat_list_wrapper");
|
||||
var catHeight = catsWrapper.height();
|
||||
|
||||
if(catHeight > g_maxCatHeight)
|
||||
catHeight = g_maxCatHeight;
|
||||
|
||||
return(catHeight);
|
||||
};
|
||||
|
||||
/**
|
||||
* get arr categories
|
||||
*/
|
||||
function getArrCats(){
|
||||
var arrCats = jQuery("#list_cats li").get();
|
||||
return(arrCats);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get num categories
|
||||
*/
|
||||
this.getNumCats = function(){
|
||||
var numCats = jQuery("#list_cats li").length;
|
||||
return(numCats);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get mouseover category
|
||||
*/
|
||||
this.getMouseOverCat = function(){
|
||||
|
||||
var arrCats = getArrCats();
|
||||
|
||||
for(var index in arrCats){
|
||||
var objCat = arrCats[index];
|
||||
objCat = jQuery(objCat);
|
||||
|
||||
var isMouseOver = objCat.ismouseover();
|
||||
if(isMouseOver == true)
|
||||
return(objCat);
|
||||
}
|
||||
|
||||
return(null);
|
||||
};
|
||||
|
||||
|
||||
this._______________EXTERNAL_SETTERS______________ = function(){}
|
||||
|
||||
|
||||
/**
|
||||
* set object add data to every ajax request
|
||||
*/
|
||||
this.setObjAjaxAddData = function(objData){
|
||||
|
||||
g_objAjaxDataAdd = objData;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* set cat section height
|
||||
*/
|
||||
this.setHeight = function(height){
|
||||
|
||||
jQuery("#cats_section").css("height", height+"px");
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* set html cats list
|
||||
*/
|
||||
this.setHtmlListCats = function(htmlCats){
|
||||
|
||||
jQuery("#list_cats").html(htmlCats);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* select some category by id
|
||||
*/
|
||||
this.selectCategory = function(catID){
|
||||
|
||||
var fullCatID = "#category_"+catID;
|
||||
|
||||
var cat = jQuery(fullCatID);
|
||||
|
||||
if(cat.length == 0){
|
||||
//g_ucAdmin.showErrorMessage("category with id: "+catID+" not found");
|
||||
return(false);
|
||||
}
|
||||
|
||||
cat.removeClass("item-hover");
|
||||
|
||||
if(cat.hasClass("selected-item"))
|
||||
return(false);
|
||||
|
||||
|
||||
jQuery("#list_cats li").removeClass("selected-item");
|
||||
cat.addClass("selected-item");
|
||||
|
||||
/*
|
||||
if(catID == 0 || catID == "all")
|
||||
disableCatButtons();
|
||||
else
|
||||
enableCatButtons();
|
||||
*/
|
||||
|
||||
g_manager.onCatSelect(catID);
|
||||
|
||||
return(true);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get context menu category ID
|
||||
*/
|
||||
this.getContextMenuCatID = function(){
|
||||
var catID = jQuery("#rightmenu_cat").data("catid");
|
||||
return(catID);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* destroy the categories
|
||||
*/
|
||||
this.destroy = function(){
|
||||
|
||||
//add category
|
||||
jQuery("#button_add_category").off("click");
|
||||
|
||||
//remove category:
|
||||
jQuery("#button_remove_category").off("click");
|
||||
|
||||
//edit category
|
||||
jQuery("#button_edit_category").off("click");
|
||||
|
||||
var objListItems = jQuery("#list_cats").find("li");
|
||||
objListItems.off("mouseover");
|
||||
objListItems.off("mouseout");
|
||||
objListItems.off("click");
|
||||
objListItems.off("dblclick");
|
||||
objListItems.off("mousedown");
|
||||
|
||||
//init context menus
|
||||
jQuery("#list_cats").off("contextmenu");
|
||||
jQuery("#cats_section").off("contextmenu");
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init categories
|
||||
*/
|
||||
this.init = function(objManager){
|
||||
|
||||
initCats(objManager);
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,835 @@
|
||||
"use strict";
|
||||
|
||||
function UniteMediaDialogUC(){
|
||||
|
||||
var t = this;
|
||||
var g_lastVideoData = null; //last fetched data
|
||||
var g_lastVideoCallback = null; //last callback from video dialog return
|
||||
var g_desc_small_size = 200; //small description size
|
||||
var g_searchTimeout = 5000; //timeout that after that show error
|
||||
|
||||
|
||||
/**
|
||||
* start select image dialog to change the image
|
||||
*/
|
||||
function onChangePreviewImageClick(){
|
||||
|
||||
var dialogTitle = jQuery("#dv_link_change_image").data("dialogtitle");
|
||||
|
||||
g_ucAdmin.openAddImageDialog(dialogTitle, function(arrData, imageID){
|
||||
if(arrData.length == 0)
|
||||
return(false);
|
||||
|
||||
var urlImage = "";
|
||||
if(typeof arrData == "string"){
|
||||
urlImage = arrData;
|
||||
}
|
||||
else{
|
||||
urlImage = arrData[0].url;
|
||||
var imageID = arrData[0].id;
|
||||
}
|
||||
|
||||
jQuery("#dv_input_video_preview").val(urlImage).data("imageid", imageID);
|
||||
|
||||
updatePropsImages();
|
||||
|
||||
requestThumbUrl();
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* start select image dialog to change the image
|
||||
*/
|
||||
function onChangeThumbImageClick(){
|
||||
|
||||
var dialogTitle = jQuery("#dv_link_change_thumb").data("dialogtitle");
|
||||
|
||||
g_ucAdmin.openAddImageDialog(dialogTitle, function(arrData){
|
||||
if(arrData.length == 0)
|
||||
return(false);
|
||||
|
||||
var urlImage = "";
|
||||
if(typeof arrData == "string")
|
||||
urlImage = arrData;
|
||||
else
|
||||
urlImage = arrData[0].url;
|
||||
|
||||
jQuery("#dv_input_video_thumb").val(urlImage);
|
||||
|
||||
updatePropsImages();
|
||||
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get object from all the fields
|
||||
*/
|
||||
function getObjFromFields(){
|
||||
var radioType = jQuery(".check-video-type:checked");
|
||||
var videoType = radioType.data("type");
|
||||
|
||||
var data = {};
|
||||
data.type = videoType;
|
||||
|
||||
//collect the props fields
|
||||
data.title = jQuery("#dv_input_video_title").val();
|
||||
data.description = jQuery("#dv_input_video_desc").val();
|
||||
data.urlImage = jQuery("#dv_input_video_preview").val();
|
||||
data.urlThumb = jQuery("#dv_input_video_thumb").val();
|
||||
|
||||
//set video specific data
|
||||
switch(videoType){
|
||||
case "youtube":
|
||||
var videoID = jQuery("#dv_youtube_id").val();
|
||||
data.videoid = getYoutubeIDFromUrl(videoID);
|
||||
break;
|
||||
case "vimeo":
|
||||
var videoID = jQuery("#dv_vimeo_id").val();
|
||||
data.videoid = getVimeoIDFromUrl(videoID);
|
||||
break;
|
||||
case "wistia":
|
||||
var videoID = jQuery("#dv_wistia_id").val();
|
||||
data.videoid = jQuery.trim(videoID);
|
||||
break;
|
||||
case "html5video":
|
||||
data.urlVideo_mp4 = jQuery("#dv_html5_url_mp4").val();
|
||||
data.urlVideo_webm = jQuery("#dv_html5_url_webm").val();
|
||||
data.urlVideo_ogv = jQuery("#dv_html5_url_ogv").val();
|
||||
break;
|
||||
}
|
||||
|
||||
return(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* validate that field not empty by value
|
||||
*/
|
||||
function validateFieldNotEmpty(value, fieldName){
|
||||
|
||||
if(value == "")
|
||||
throw new Error("Please fill <b>" + fieldName + "</b> field");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* validate dialog before add
|
||||
*/
|
||||
function validateBeforeAdd(data){
|
||||
|
||||
try{
|
||||
validateFieldNotEmpty(data.title, "title");
|
||||
|
||||
switch(data.type){
|
||||
case "youtube":
|
||||
validateFieldNotEmpty(data.videoid, "Youtube ID");
|
||||
|
||||
break;
|
||||
case "vimeo":
|
||||
validateFieldNotEmpty(data.videoid, "Vimeo ID");
|
||||
|
||||
break;
|
||||
case "html5video":
|
||||
|
||||
validateFieldNotEmpty(data.urlVideo_mp4, "Video MP4 Url");
|
||||
validateFieldNotEmpty(data.urlVideo_webm, "Video WEBM Url");
|
||||
validateFieldNotEmpty(data.urlVideo_ogv, "Video OGV Url");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}catch(objError){
|
||||
|
||||
jQuery("#dv_button_video_add").blur();
|
||||
jQuery("#dv_error_message_bottom").show().html(objError.message);
|
||||
|
||||
setTimeout('jQuery("#dv_error_message_bottom").hide()', 5000);
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on add video button click
|
||||
*/
|
||||
function onAddVideoClick(){
|
||||
|
||||
var objDialog = jQuery("#dialog_video");
|
||||
var mode = objDialog.data("mode");
|
||||
|
||||
var data = getObjFromFields();
|
||||
|
||||
if(validateBeforeAdd(data) == false)
|
||||
return(false);
|
||||
|
||||
if(mode == "update"){
|
||||
data.itemID = objDialog.data("itemID");
|
||||
}
|
||||
|
||||
if(typeof g_lastVideoCallback == "function")
|
||||
g_lastVideoCallback(data);
|
||||
|
||||
objDialog.dialog("close");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on put example link, put the example text to target id
|
||||
*/
|
||||
function onPutExampleClick(){
|
||||
var text = jQuery(this).data("example");
|
||||
var targetID = jQuery(this).data("targetid");
|
||||
|
||||
jQuery("#" + targetID).val(text);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init dialog events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
jQuery(".check-video-type").on("click",function(){
|
||||
var mediaType = jQuery(this).data("type");
|
||||
changeMediaType(mediaType);
|
||||
});
|
||||
|
||||
jQuery("#dv_youtube_id").keyup(function(event){
|
||||
if(event.keyCode == 13)
|
||||
searchYoutube();
|
||||
});
|
||||
|
||||
jQuery("#dv_vimeo_id").keyup(function(event){
|
||||
if(event.keyCode == 13)
|
||||
searchVimeo();
|
||||
});
|
||||
|
||||
jQuery("#dv_wistia_id").keyup(function(event){
|
||||
if(event.keyCode == 13)
|
||||
searchWistia();
|
||||
});
|
||||
|
||||
//set search actions
|
||||
jQuery("#dv_button_youtube_search").on("click",searchYoutube);
|
||||
jQuery("#dv_button_vimeo_search").on("click",searchVimeo);
|
||||
jQuery("#dv_button_wistia_search").on("click",searchWistia);
|
||||
|
||||
jQuery("#dv_link_change_image").on("click",onChangePreviewImageClick);
|
||||
|
||||
jQuery("#dv_link_change_thumb").on("click",onChangeThumbImageClick);
|
||||
|
||||
jQuery("#dv_input_video_preview, #dv_input_video_thumb").change(updatePropsImages);
|
||||
|
||||
jQuery(".dv_put_example").on("click",onPutExampleClick);
|
||||
|
||||
//add the selected video to the callback function
|
||||
jQuery("#dv_button_video_add").on("click",onAddVideoClick);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* show error message on the dialog
|
||||
*/
|
||||
this.videoDialogOnError = function(){
|
||||
|
||||
//if ok, don't do nothing
|
||||
if(g_lastVideoData)
|
||||
return(false);
|
||||
|
||||
var message = jQuery("#dv_error_message").data("notfound");
|
||||
|
||||
showSearchErrorMessage(message);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* init video dialog buttons
|
||||
*/
|
||||
function initVideoDialog(){
|
||||
|
||||
//set youtube radio checked:
|
||||
jQuery("#video_radio_youtube").prop("checked",true);
|
||||
|
||||
|
||||
initEvents();
|
||||
|
||||
}; //end initVideoDialog
|
||||
|
||||
|
||||
/**
|
||||
* change the media type
|
||||
*/
|
||||
function changeMediaType(mediaType){
|
||||
|
||||
jQuery(".video-select-block").hide();
|
||||
switch(mediaType){
|
||||
case "youtube":
|
||||
jQuery("#video_block_youtube").show();
|
||||
jQuery("#dv_youtube_id").focus();
|
||||
break;
|
||||
case "vimeo":
|
||||
jQuery("#video_block_vimeo").show();
|
||||
jQuery("#dv_vimeo_id").focus();
|
||||
break;
|
||||
case "html5video":
|
||||
showPropsFields();
|
||||
jQuery("#video_block_html5").show();
|
||||
break;
|
||||
case "wistia":
|
||||
jQuery("#video_block_wistia").show();
|
||||
jQuery("#dv_wistia_id").focus();
|
||||
break;
|
||||
}
|
||||
|
||||
//check for hiduing props fields (on add mode if not searched yet)
|
||||
var dialogMode = jQuery("#dialog_video").data("mode");
|
||||
|
||||
if(mediaType != "html5video" && g_lastVideoData == null && dialogMode == "add")
|
||||
hidePropsFields();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clear dialog fields
|
||||
*/
|
||||
function clearInitFields(){
|
||||
|
||||
jQuery("#dv_youtube_id").val("");
|
||||
jQuery("#dv_vimeo_id").val("");
|
||||
jQuery("#dv_wistia_id").val("");
|
||||
|
||||
jQuery("#dialog_video .video_props input[type='text']").val("");
|
||||
jQuery("#dv_input_video_desc").val("");
|
||||
|
||||
jQuery("#dv_html5_url_mp4, #dv_html5_url_webm, #dv_html5_url_ogv").val("");
|
||||
|
||||
updatePropsImages();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hide video content fields
|
||||
*/
|
||||
function hidePropsFields(){
|
||||
jQuery("#dialog_video .video_props").hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* show video properties fields
|
||||
*/
|
||||
function showPropsFields(){
|
||||
jQuery("#dialog_video .video_props").show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* fill video properties from the callback data
|
||||
*/
|
||||
function fillVideoProps_fromCallback(data){
|
||||
|
||||
var urlThumb = data.thumb_medium.url;
|
||||
var urlPreview = data.preview_image.url;
|
||||
|
||||
switch(data.type){
|
||||
case "youtube":
|
||||
jQuery("#dv_youtube_id").val(data.id);
|
||||
break;
|
||||
case "vimeo":
|
||||
jQuery("#dv_vimeo_id").val(data.id);
|
||||
break;
|
||||
}
|
||||
|
||||
jQuery("#dv_input_video_title").val(data.title);
|
||||
jQuery("#dv_input_video_desc").val(data.desc_small);
|
||||
jQuery("#dv_input_video_preview").val(urlPreview);
|
||||
jQuery("#dv_input_video_thumb").val(urlThumb);
|
||||
|
||||
updatePropsImages();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* fill video properties from the item data
|
||||
*/
|
||||
function fillVideoProps_fromItemData(data){
|
||||
|
||||
switch(data.type){
|
||||
case "youtube":
|
||||
jQuery("#dv_youtube_id").val(data.videoid);
|
||||
jQuery("#video_radio_youtube").trigger("click");
|
||||
break;
|
||||
case "vimeo":
|
||||
jQuery("#dv_vimeo_id").val(data.videoid);
|
||||
jQuery("#video_radio_vimeo").trigger("click");
|
||||
break;
|
||||
case "html5video":
|
||||
jQuery("#video_radio_html5").trigger("click");
|
||||
jQuery("#dv_html5_url_mp4").val(data.video_mp4);
|
||||
jQuery("#dv_html5_url_webm").val(data.video_webm);
|
||||
jQuery("#dv_html5_url_ogv").val(data.video_ogv);
|
||||
break;
|
||||
}
|
||||
|
||||
jQuery("#dv_input_video_title").val(data.title);
|
||||
jQuery("#dv_input_video_desc").val(data.description);
|
||||
jQuery("#dv_input_video_preview").val(data.url_image);
|
||||
jQuery("#dv_input_video_thumb").val(data.url_thumb);
|
||||
|
||||
updatePropsImages();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* take the url's from the inputs and update image sources of thumb and big image
|
||||
*/
|
||||
function updatePropsImages(){
|
||||
|
||||
var urlImage = jQuery("#dv_input_video_preview").val();
|
||||
var urlThumb = jQuery("#dv_input_video_thumb").val();
|
||||
|
||||
urlImage = jQuery.trim(urlImage);
|
||||
urlThumb = jQuery.trim(urlThumb);
|
||||
|
||||
jQuery("#dv_preview_image").css("background-image","url('"+urlImage+"')");
|
||||
jQuery("#dv_video_thumb").css("background-image","url('"+urlThumb+"')");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* request thumb url from image url
|
||||
*/
|
||||
function requestThumbUrl(){
|
||||
|
||||
var urlImage = jQuery("#dv_input_video_preview").val();
|
||||
urlImage = jQuery.trim(urlImage);
|
||||
var imageID = jQuery("#dv_input_video_preview").data("imageid");
|
||||
|
||||
jQuery("#dv_loader_thumb").show();
|
||||
|
||||
//ajax request for getting the thumb
|
||||
g_ucAdmin.requestThumbUrl(urlImage, imageID, function(urlThumb){
|
||||
jQuery("#dv_loader_thumb").hide();
|
||||
if(!urlThumb)
|
||||
return(false);
|
||||
|
||||
var urlThumb = jQuery("#dv_input_video_thumb").val(urlThumb);
|
||||
|
||||
updatePropsImages();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* treat dialog update mode, request item data,
|
||||
* then fill the fields.
|
||||
*/
|
||||
function treatUpdateMode(objData){
|
||||
|
||||
var itemID = objData.itemID;
|
||||
|
||||
objData.requestFunction(itemID, function(response){
|
||||
|
||||
fillVideoProps_fromItemData(response);
|
||||
|
||||
jQuery("#video_dialog_loader").hide();
|
||||
jQuery("#video_dialog_inner").show();
|
||||
showPropsFields();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set dialog mode - add / update
|
||||
*/
|
||||
function setMode(mode, objData){
|
||||
|
||||
var buttonVideoAdd = jQuery("#dv_button_video_add");
|
||||
var addText = buttonVideoAdd.data("textadd");
|
||||
var updateText = buttonVideoAdd.data("textupdate");
|
||||
var objDialog = jQuery("#dialog_video");
|
||||
var radioType = jQuery(".check-video-type:checked");
|
||||
var mediaType = radioType.data("type");
|
||||
|
||||
clearInitFields();
|
||||
|
||||
objDialog.data("mode", mode);
|
||||
|
||||
jQuery("#dv_error_message_bottom").hide();
|
||||
|
||||
switch(mode){
|
||||
case "add":
|
||||
jQuery("#video_dialog_loader").hide();
|
||||
jQuery("#video_dialog_inner").show();
|
||||
|
||||
buttonVideoAdd.val(addText);
|
||||
hidePropsFields();
|
||||
changeMediaType(mediaType);
|
||||
break;
|
||||
case "update":
|
||||
jQuery("#video_dialog_loader").show();
|
||||
jQuery("#video_dialog_inner").hide();
|
||||
objDialog.data("itemID", objData.itemID);
|
||||
|
||||
buttonVideoAdd.val(updateText);
|
||||
treatUpdateMode(objData);
|
||||
break;
|
||||
default:
|
||||
throw new Error("wrong mode: " + mode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function __________Search_Related__________(){}
|
||||
|
||||
/**
|
||||
* pass youtube id or youtube url, and get the id
|
||||
*/
|
||||
function getYoutubeIDFromUrl(url){
|
||||
url = jQuery.trim(url);
|
||||
|
||||
var video_id = url.split('v=')[1];
|
||||
if(video_id){
|
||||
var ampersandPosition = video_id.indexOf('&');
|
||||
if(ampersandPosition != -1) {
|
||||
video_id = video_id.substring(0, ampersandPosition);
|
||||
}
|
||||
}else{
|
||||
video_id = url;
|
||||
}
|
||||
|
||||
return(video_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get vimeo id from url
|
||||
*/
|
||||
function getVimeoIDFromUrl(url){
|
||||
url = jQuery.trim(url);
|
||||
|
||||
var video_id = url.replace(/[^0-9]+/g, '');
|
||||
video_id = jQuery.trim(video_id);
|
||||
|
||||
return(video_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* get data from youtube callback object
|
||||
*/
|
||||
function getDataFromVimeo(obj){
|
||||
|
||||
obj = obj[0];
|
||||
|
||||
var data = {};
|
||||
data.video_type = "vimeo";
|
||||
data.id = obj.id;
|
||||
data.id = jQuery.trim(data.id);
|
||||
data.title = obj.title;
|
||||
data.link = obj.url;
|
||||
data.author = obj.user_name;
|
||||
data.description = obj.description;
|
||||
data.desc_small = data.description;
|
||||
|
||||
if(data.description.length > g_desc_small_size)
|
||||
data.desc_small = data.description.slice(0, g_desc_small_size)+"...";
|
||||
|
||||
data.thumb_large = {url:obj.thumbnail_large,width:640,height:360};
|
||||
data.thumb_medium = {url:obj.thumbnail_medium,width:200,height:150};
|
||||
data.thumb_small = {url:obj.thumbnail_small,width:100,height:75};
|
||||
|
||||
data.preview_image = {url:obj.thumbnail_large,width:640,height:360};
|
||||
|
||||
//trace(data);
|
||||
|
||||
return(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* get data from youtube callback object
|
||||
*/
|
||||
function getDataFromYoutube(obj){
|
||||
|
||||
var data = {};
|
||||
|
||||
var entry = obj.entry;
|
||||
data.id = entry.media$group.yt$videoid.$t;
|
||||
|
||||
data.video_type = "youtube";
|
||||
data.title = entry.title.$t;
|
||||
data.author = entry.author[0].name.$t;
|
||||
data.link = entry.link[0].href;
|
||||
data.description = entry.media$group.media$description.$t;
|
||||
data.desc_small = data.description;
|
||||
|
||||
if(data.description.length > g_desc_small_size)
|
||||
data.desc_small = data.description.slice(0,g_desc_small_size)+"...";
|
||||
|
||||
var thumbnails = entry.media$group.media$thumbnail;
|
||||
|
||||
data.thumb_small = {url:thumbnails[0].url,width:thumbnails[0].width,height:thumbnails[0].height};
|
||||
data.thumb_medium = {url:thumbnails[1].url,width:thumbnails[1].width,height:thumbnails[1].height};
|
||||
data.thumb_big = {url:thumbnails[2].url,width:thumbnails[2].width,height:thumbnails[2].height};
|
||||
|
||||
data.preview_image = {url:thumbnails[3].url,width:thumbnails[3].width,height:thumbnails[3].height};
|
||||
|
||||
return(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get data from wistia callback object
|
||||
*/
|
||||
function getDataFromWistia(obj){
|
||||
|
||||
var data = {};
|
||||
|
||||
data.video_type = "wistia";
|
||||
data.title = obj.title;
|
||||
data.description = "";
|
||||
data.desc_small = "";
|
||||
|
||||
var previewUrl = obj.thumbnail_url;
|
||||
var previewWidth = obj.thumbnail_width;
|
||||
var previewHeight = obj.thumbnail_height;
|
||||
|
||||
//make thumb string
|
||||
var ratio = previewHeight / previewWidth;
|
||||
var thumbWidth = 320;
|
||||
var thumbHeight = Math.round(thumbWidth * ratio);
|
||||
|
||||
var strReplace = previewWidth + "x" + previewHeight;
|
||||
var strReplaceTo = thumbWidth + "x" + thumbHeight;
|
||||
|
||||
var thumbUrl = previewUrl.replace(strReplace, strReplaceTo);
|
||||
|
||||
data.preview_image = {url:previewUrl, width:previewWidth, height:previewHeight};
|
||||
|
||||
data.thumb_medium = {url:thumbUrl, width:thumbWidth, height:thumbHeight};
|
||||
|
||||
return(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* search for youtube video
|
||||
*/
|
||||
function searchYoutube(){
|
||||
|
||||
g_lastVideoData = null;
|
||||
|
||||
//prepare fields
|
||||
jQuery("#dv_youtube_loader").show();
|
||||
hidePropsFields();
|
||||
jQuery("#dv_error_message").hide();
|
||||
|
||||
//prepare data
|
||||
var youtubeID = jQuery("#dv_youtube_id").val();
|
||||
youtubeID = getYoutubeIDFromUrl(youtubeID);
|
||||
|
||||
if(!youtubeID){
|
||||
showSearchErrorMessage("Empty Youtube ID");
|
||||
return(false);
|
||||
}
|
||||
|
||||
//call API
|
||||
var urlAPI = "https://gdata.youtube.com/feeds/api/videos/"+youtubeID+"?v=2&alt=json-in-script&callback=g_ugMediaDialog.onYoutubeCallback";
|
||||
|
||||
jQuery.getScript(urlAPI);
|
||||
|
||||
//handle url don't pass:
|
||||
setTimeout("g_ugMediaDialog.videoDialogOnError()", g_searchTimeout);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* search vimeo video
|
||||
*/
|
||||
function searchVimeo(){
|
||||
|
||||
g_lastVideoData = null;
|
||||
|
||||
//prepare fields
|
||||
jQuery("#dv_vimeo_loader").show();
|
||||
hidePropsFields();
|
||||
jQuery("#dv_error_message").hide();
|
||||
|
||||
var vimeoID = jQuery("#dv_vimeo_id").val();
|
||||
vimeoID = jQuery.trim(vimeoID);
|
||||
vimeoID = getVimeoIDFromUrl(vimeoID);
|
||||
|
||||
var urlAPI = 'https://www.vimeo.com/api/v2/video/' + vimeoID + '.json?callback=g_ugMediaDialog.onVimeoCallback';
|
||||
|
||||
jQuery.getScript(urlAPI);
|
||||
|
||||
//handle url don't pass:
|
||||
setTimeout("g_ugMediaDialog.videoDialogOnError()", g_searchTimeout);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* search wistia
|
||||
*/
|
||||
function searchWistia(){
|
||||
|
||||
var videoID = jQuery("#dv_wistia_id").val();
|
||||
videoID = jQuery.trim(videoID);
|
||||
|
||||
var url = "https://fast.wistia.net/oembed?url=http%3A//home.wistia.com/medias/"+videoID;
|
||||
|
||||
//prepare fields
|
||||
jQuery("#dv_wistia_loader").show();
|
||||
hidePropsFields();
|
||||
jQuery("#dv_error_message").hide();
|
||||
|
||||
jQuery.get( url ,"", function(response){
|
||||
jQuery("#dv_wistia_loader").hide();
|
||||
jQuery("#dv_button_wistia_search").blur();
|
||||
|
||||
var data = getDataFromWistia(response);
|
||||
|
||||
fillVideoProps_fromCallback(data);
|
||||
showPropsFields();
|
||||
|
||||
//refresh couple of times to show thumb
|
||||
setTimeout(updatePropsImages, 5000);
|
||||
setTimeout(updatePropsImages, 10000);
|
||||
setTimeout(updatePropsImages, 15000);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* show error message on search area
|
||||
*/
|
||||
function showSearchErrorMessage(message){
|
||||
|
||||
jQuery("#dv_youtube_loader").hide();
|
||||
jQuery("#dv_vimeo_loader").hide();
|
||||
jQuery("#dv_wistia_loader").hide();
|
||||
|
||||
hidePropsFields();
|
||||
|
||||
jQuery("#dv_error_message").show().html(message);
|
||||
|
||||
setTimeout('jQuery("#dv_error_message").hide()', 7000);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* open dialog for youtube or vimeo import , add / update
|
||||
*/
|
||||
this.openVideoDialog = function(callback, itemData){
|
||||
|
||||
g_lastVideoCallback = callback;
|
||||
|
||||
var dialogVideo = jQuery("#dialog_video");
|
||||
|
||||
//set buttons:
|
||||
var buttons = {
|
||||
"Close":function(){
|
||||
dialogVideo.dialog("close");
|
||||
}
|
||||
};
|
||||
|
||||
var mode = itemData ? "update":"add";
|
||||
|
||||
|
||||
setMode(mode, itemData);
|
||||
|
||||
var dialogOptions = {
|
||||
dialogClass:"unite-ui",
|
||||
buttons:buttons,
|
||||
minWidth:900,
|
||||
minHeight:530,
|
||||
modal:true
|
||||
};
|
||||
|
||||
//set dilog title - custom or default
|
||||
if(mode == "update" && typeof itemData.dialogTitle != "undefined")
|
||||
dialogOptions.title = itemData.dialogTitle;
|
||||
else
|
||||
dialogOptions.title = dialogVideo.data("title");
|
||||
|
||||
//open the dialog
|
||||
dialogVideo.dialog(dialogOptions);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* youtube callback script, set and store youtube data, and add it to dialog
|
||||
*/
|
||||
this.onYoutubeCallback = function(obj){
|
||||
jQuery("#dv_youtube_loader").hide();
|
||||
|
||||
try{
|
||||
|
||||
//prepare data
|
||||
var data = getDataFromYoutube(obj);
|
||||
|
||||
//store last video data
|
||||
g_lastVideoData = data;
|
||||
|
||||
//show fields:
|
||||
fillVideoProps_fromCallback(data);
|
||||
showPropsFields();
|
||||
|
||||
}catch(objError){
|
||||
|
||||
g_lastVideoData = "error";
|
||||
showSearchErrorMessage(objError.message);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* vimeo callback script, set and store vimeo data, and add it to dialog
|
||||
*/
|
||||
this.onVimeoCallback = function(obj){
|
||||
jQuery("#dv_vimeo_loader").hide();
|
||||
|
||||
//prepare data
|
||||
var data = getDataFromVimeo(obj);
|
||||
|
||||
//store last video data
|
||||
g_lastVideoData = data;
|
||||
|
||||
//show fields:
|
||||
fillVideoProps_fromCallback(data);
|
||||
showPropsFields();
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init the variables
|
||||
*/
|
||||
this.init = function(){
|
||||
|
||||
initVideoDialog();
|
||||
};
|
||||
|
||||
} //class end
|
||||
|
||||
g_ugMediaDialog = new UniteMediaDialogUC();
|
||||
484
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.css
vendored
Normal file
484
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.css
vendored
Normal file
@@ -0,0 +1,484 @@
|
||||
.select2-container {
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
vertical-align: middle; }
|
||||
.select2-container .select2-selection--single {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
height: 28px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-container .select2-selection--single .select2-selection__rendered {
|
||||
display: block;
|
||||
padding-left: 8px;
|
||||
padding-right: 20px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap; }
|
||||
.select2-container .select2-selection--single .select2-selection__clear {
|
||||
position: relative; }
|
||||
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
|
||||
padding-right: 8px;
|
||||
padding-left: 20px; }
|
||||
.select2-container .select2-selection--multiple {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
min-height: 32px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
padding-left: 8px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap; }
|
||||
.select2-container .select2-search--inline {
|
||||
float: left; }
|
||||
.select2-container .select2-search--inline .select2-search__field {
|
||||
box-sizing: border-box;
|
||||
border: none;
|
||||
font-size: 100%;
|
||||
margin-top: 5px;
|
||||
padding: 0; }
|
||||
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
||||
-webkit-appearance: none; }
|
||||
|
||||
.select2-dropdown {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: -100000px;
|
||||
width: 100%;
|
||||
z-index: 1051; }
|
||||
|
||||
.select2-results {
|
||||
display: block; }
|
||||
|
||||
.select2-results__options {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0; }
|
||||
|
||||
.select2-results__option {
|
||||
padding: 6px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-results__option[aria-selected] {
|
||||
cursor: pointer; }
|
||||
|
||||
.select2-container--open .select2-dropdown {
|
||||
left: 0; }
|
||||
|
||||
.select2-container--open .select2-dropdown--above {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--open .select2-dropdown--below {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-search--dropdown {
|
||||
display: block;
|
||||
padding: 4px; }
|
||||
.select2-search--dropdown .select2-search__field {
|
||||
padding: 4px;
|
||||
width: 100%;
|
||||
box-sizing: border-box; }
|
||||
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
||||
-webkit-appearance: none; }
|
||||
.select2-search--dropdown.select2-search--hide {
|
||||
display: none; }
|
||||
|
||||
.select2-close-mask {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: block;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
min-height: 100%;
|
||||
min-width: 100%;
|
||||
height: auto;
|
||||
width: auto;
|
||||
opacity: 0;
|
||||
z-index: 99;
|
||||
background-color: #fff;
|
||||
filter: alpha(opacity=0); }
|
||||
|
||||
.select2-hidden-accessible {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
-webkit-clip-path: inset(50%) !important;
|
||||
clip-path: inset(50%) !important;
|
||||
height: 1px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
white-space: nowrap !important; }
|
||||
|
||||
.select2-container--default .select2-selection--single {
|
||||
background-color: #fff;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
color: #444;
|
||||
line-height: 28px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
||||
color: #999; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
width: 20px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: #888 transparent transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 4px 0 4px;
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -2px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 0; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
||||
float: left; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
||||
left: 1px;
|
||||
right: auto; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection--single {
|
||||
background-color: #eee;
|
||||
cursor: default; }
|
||||
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
||||
display: none; }
|
||||
|
||||
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent #888 transparent;
|
||||
border-width: 0 4px 5px 4px; }
|
||||
|
||||
.select2-container--default .select2-selection--multiple {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: text; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
||||
box-sizing: border-box;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
width: 100%; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
||||
list-style: none; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
|
||||
color: #999;
|
||||
margin-top: 5px;
|
||||
float: left; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin-top: 5px;
|
||||
margin-right: 10px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #e4e4e4;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: #999;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
margin-right: 2px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #333; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
|
||||
float: right; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
margin-left: 5px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-left: 2px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
||||
border: solid black 1px;
|
||||
outline: 0; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
||||
background-color: #eee;
|
||||
cursor: default; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
||||
display: none; }
|
||||
|
||||
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
border: 1px solid #aaa; }
|
||||
|
||||
.select2-container--default .select2-search--inline .select2-search__field {
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
-webkit-appearance: textfield; }
|
||||
|
||||
.select2-container--default .select2-results > .select2-results__options {
|
||||
max-height: 200px;
|
||||
overflow-y: auto; }
|
||||
|
||||
.select2-container--default .select2-results__option[role=group] {
|
||||
padding: 0; }
|
||||
|
||||
.select2-container--default .select2-results__option[aria-disabled=true] {
|
||||
color: #999; }
|
||||
|
||||
.select2-container--default .select2-results__option[aria-selected=true] {
|
||||
background-color: #ddd; }
|
||||
|
||||
.select2-container--default .select2-results__option .select2-results__option {
|
||||
padding-left: 1em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
||||
padding-left: 0; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -1em;
|
||||
padding-left: 2em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -2em;
|
||||
padding-left: 3em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -3em;
|
||||
padding-left: 4em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -4em;
|
||||
padding-left: 5em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -5em;
|
||||
padding-left: 6em; }
|
||||
|
||||
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #5897fb;
|
||||
color: white; }
|
||||
|
||||
.select2-container--default .select2-results__group {
|
||||
cursor: default;
|
||||
display: block;
|
||||
padding: 6px; }
|
||||
|
||||
.select2-container--classic .select2-selection--single {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
outline: 0;
|
||||
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
|
||||
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
|
||||
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
||||
.select2-container--classic .select2-selection--single:focus {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
||||
color: #444;
|
||||
line-height: 28px; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin-right: 10px; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
||||
color: #999; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
||||
background-color: #ddd;
|
||||
border: none;
|
||||
border-left: 1px solid #aaa;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
width: 20px;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
||||
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
||||
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: #888 transparent transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 4px 0 4px;
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -2px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 0; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
||||
float: left; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
||||
border: none;
|
||||
border-right: 1px solid #aaa;
|
||||
border-radius: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
left: 1px;
|
||||
right: auto; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-selection--single {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
||||
background: transparent;
|
||||
border: none; }
|
||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent #888 transparent;
|
||||
border-width: 0 4px 5px 4px; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
|
||||
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
||||
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
|
||||
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
|
||||
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
|
||||
|
||||
.select2-container--classic .select2-selection--multiple {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: text;
|
||||
outline: 0; }
|
||||
.select2-container--classic .select2-selection--multiple:focus {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 5px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
||||
display: none; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #e4e4e4;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: #888;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
margin-right: 2px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #555; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
float: right;
|
||||
margin-left: 5px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-left: 2px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
||||
border: 1px solid #5897fb; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
||||
border: 1px solid #aaa;
|
||||
outline: 0; }
|
||||
|
||||
.select2-container--classic .select2-search--inline .select2-search__field {
|
||||
outline: 0;
|
||||
box-shadow: none; }
|
||||
|
||||
.select2-container--classic .select2-dropdown {
|
||||
background-color: white;
|
||||
border: 1px solid transparent; }
|
||||
|
||||
.select2-container--classic .select2-dropdown--above {
|
||||
border-bottom: none; }
|
||||
|
||||
.select2-container--classic .select2-dropdown--below {
|
||||
border-top: none; }
|
||||
|
||||
.select2-container--classic .select2-results > .select2-results__options {
|
||||
max-height: 200px;
|
||||
overflow-y: auto; }
|
||||
|
||||
.select2-container--classic .select2-results__option[role=group] {
|
||||
padding: 0; }
|
||||
|
||||
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
||||
color: grey; }
|
||||
|
||||
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #3875d7;
|
||||
color: white; }
|
||||
|
||||
.select2-container--classic .select2-results__group {
|
||||
cursor: default;
|
||||
display: block;
|
||||
padding: 6px; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-dropdown {
|
||||
border-color: #5897fb; }
|
||||
6597
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.full.js
vendored
Normal file
6597
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.full.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.full.min.js
vendored
Normal file
1
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.full.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
54
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.sortable.css
vendored
Normal file
54
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.sortable.css
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
.select2-container-multi .select2-choices .select2-search-choice {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
.select2-container {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.select2-choices {
|
||||
border-radius: 0px;
|
||||
border-color: #d0d0d0;
|
||||
}
|
||||
|
||||
.select2-container-multi .select2-choices {
|
||||
border-color: #d0d0d0;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.select2-drop {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
.select2-container-multi.select2-container-active {
|
||||
border-color: #646464;
|
||||
}
|
||||
|
||||
.select2-container-multi.select2-container-active .select2-choices {
|
||||
border-color: #646464;
|
||||
}
|
||||
|
||||
.select2-drop-active {
|
||||
border-color: #646464;
|
||||
}
|
||||
|
||||
.select2-container-multi .select2-choices .select2-search-choice {
|
||||
background: #646464;
|
||||
color: #fdfdfd;
|
||||
width: 100%;
|
||||
margin: 0 0 2px 0;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
padding: 10px 10px 10px 30px;
|
||||
box-shadow: 0 0 0px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.select2-container-multi .select2-search-choice-close {
|
||||
left: 10px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.select2-results .select2-highlighted {
|
||||
background: #2f73b6;
|
||||
}
|
||||
234
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.sortable.js
vendored
Normal file
234
wp-content/plugins/unlimited-elements-for-elementor/js/select2/select2.sortable.js
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
(function($) {
|
||||
|
||||
function getSortableUl($select) {
|
||||
|
||||
var objParent = $select.parent();
|
||||
var objUl = objParent.find(".select2-container ul");
|
||||
|
||||
return objUl;
|
||||
};
|
||||
|
||||
/**
|
||||
* get list items
|
||||
*/
|
||||
function getListItems(objUL){
|
||||
|
||||
var objItems = objUL.find("li.select2-selection__choice");
|
||||
|
||||
return(objItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* get list items values
|
||||
*/
|
||||
function getObjULValues(objUL){
|
||||
|
||||
var objItems = getListItems(objUL);
|
||||
|
||||
var objValues = {};
|
||||
|
||||
jQuery.each(objItems,function(index, li){
|
||||
|
||||
var objItem = jQuery(li);
|
||||
|
||||
var value = objItem.data("value");
|
||||
|
||||
objValues[value] = null;
|
||||
});
|
||||
|
||||
|
||||
return(objValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* get list items values
|
||||
*/
|
||||
function getArrULValues(objUL){
|
||||
|
||||
var objItems = getListItems(objUL);
|
||||
|
||||
var arrValues = [];
|
||||
|
||||
jQuery.each(objItems,function(index, li){
|
||||
|
||||
var objItem = jQuery(li);
|
||||
|
||||
var value = objItem.data("value");
|
||||
var text = objItem.text();
|
||||
|
||||
text = text.substring(1);
|
||||
|
||||
value = value.toString();
|
||||
|
||||
arrValues.push([value,text]);
|
||||
});
|
||||
|
||||
|
||||
return(arrValues);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get select from ul
|
||||
*/
|
||||
function getSelectFromUL(objUL){
|
||||
|
||||
var objContainer = objUL.parents(".select2-container");
|
||||
var objSelectInput = objContainer.siblings("select");
|
||||
|
||||
return(objSelectInput);
|
||||
}
|
||||
|
||||
/**
|
||||
* update values
|
||||
*/
|
||||
function updateLIValues(objUL, arrValues){
|
||||
|
||||
var objItems = getListItems(objUL);
|
||||
|
||||
if(objItems.length != arrValues.length){
|
||||
trace("num items not match!");
|
||||
return(false);
|
||||
}
|
||||
|
||||
jQuery.each(arrValues, function(index, value){
|
||||
|
||||
var objItem = jQuery(objItems[index]);
|
||||
|
||||
objItem.attr("data-value",value);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init sortable ul
|
||||
*/
|
||||
function initSortableUl($ul, options) {
|
||||
|
||||
if($ul.length == 0){
|
||||
trace("no url found");
|
||||
return(false);
|
||||
}
|
||||
|
||||
$ul.sortable({
|
||||
forcePlaceholderSize: true,
|
||||
items: 'li.select2-selection__choice',
|
||||
placeholder : '<li> </li>',
|
||||
start:function(event){
|
||||
|
||||
var objUL = jQuery(event.target);
|
||||
var objSelect = getSelectFromUL(objUL);
|
||||
var arrValues = objSelect.val();
|
||||
|
||||
updateLIValues(objUL, arrValues);
|
||||
|
||||
},
|
||||
update:function(event){
|
||||
|
||||
var objUL = jQuery(event.target);
|
||||
|
||||
var objSelectInput = getSelectFromUL(objUL);
|
||||
|
||||
var arrInitIDs = [];
|
||||
|
||||
var arrValues = getArrULValues(objUL);
|
||||
|
||||
if(arrValues.length == 0)
|
||||
return(false);
|
||||
|
||||
if(!arrValues[0])
|
||||
return(false);
|
||||
|
||||
objSelectInput.html("");
|
||||
|
||||
for(var index in arrValues){
|
||||
|
||||
var item = arrValues[index];
|
||||
|
||||
var value = item[0];
|
||||
var text = item[1];
|
||||
|
||||
var option = new Option(text, value, true, true);
|
||||
|
||||
objSelectInput.append(option);
|
||||
}
|
||||
|
||||
objSelectInput.trigger("change");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
function trace(str){
|
||||
|
||||
console.log(str);
|
||||
}
|
||||
|
||||
function initSelect2Sortable($select) {
|
||||
|
||||
var observer,
|
||||
$ul;
|
||||
|
||||
//$select.select2();
|
||||
$ul = getSortableUl($select);
|
||||
|
||||
if($ul.length == 0){
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
observer = new MutationObserver(function(mutations) {
|
||||
initSortableUl($ul);
|
||||
observer.disconnect();
|
||||
});
|
||||
|
||||
$select.on('select2-selecting', function() {
|
||||
observer.observe($ul.get(0), { subtree: false, childList: true, attributes: false });
|
||||
});
|
||||
|
||||
initSortableUl($ul, { bindSortEvent: true, $select: $select });
|
||||
|
||||
$select.data('hasSelect2Sortable', true);
|
||||
};
|
||||
|
||||
|
||||
function sortSelect2Sortable($select, val) {
|
||||
|
||||
var $ul = getSortableUl($select),
|
||||
$lis = $ul.find('.select2-search-choice');
|
||||
|
||||
$.each(val, function(i, id) {
|
||||
$lis.each(function() {
|
||||
if (id == $(this).data('select2Data').id) {
|
||||
$(this).insertBefore($ul.find('.select2-search-field'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$ul.trigger('sortupdate');
|
||||
}
|
||||
|
||||
$.fn.extend({
|
||||
|
||||
select2Sortable: function(val) {
|
||||
|
||||
var objSelect = jQuery(this);
|
||||
|
||||
var hasInit = objSelect.data('hasSelect2Sortable');
|
||||
|
||||
if(hasInit)
|
||||
return(this);
|
||||
|
||||
initSelect2Sortable(objSelect);
|
||||
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
}(window.jQuery));
|
||||
4766
wp-content/plugins/unlimited-elements-for-elementor/js/settings.js
Normal file
4766
wp-content/plugins/unlimited-elements-for-elementor/js/settings.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,511 @@
|
||||
/***
|
||||
Spectrum Colorpicker v1.8.0
|
||||
https://github.com/bgrins/spectrum
|
||||
Author: Brian Grinstead
|
||||
License: MIT
|
||||
***/
|
||||
|
||||
.sp-container {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
display:inline-block;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
/* https://github.com/bgrins/spectrum/issues/40 */
|
||||
z-index: 9999994;
|
||||
overflow: hidden;
|
||||
}
|
||||
.sp-container.sp-flat {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Fix for * { box-sizing: border-box; } */
|
||||
.sp-container,
|
||||
.sp-container * {
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
/* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
|
||||
.sp-top {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
display:inline-block;
|
||||
}
|
||||
.sp-top-inner {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
right:0;
|
||||
}
|
||||
.sp-color {
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
right:20%;
|
||||
}
|
||||
.sp-hue {
|
||||
position: absolute;
|
||||
top:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
left:84%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sp-clear-enabled .sp-hue {
|
||||
top:33px;
|
||||
height: 77.5%;
|
||||
}
|
||||
|
||||
.sp-fill {
|
||||
padding-top: 80%;
|
||||
}
|
||||
.sp-sat, .sp-val {
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
.sp-alpha-enabled .sp-top {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.sp-alpha-enabled .sp-alpha {
|
||||
display: block;
|
||||
}
|
||||
.sp-alpha-handle {
|
||||
position:absolute;
|
||||
top:-4px;
|
||||
bottom: -4px;
|
||||
width: 10px;
|
||||
left: 50%;
|
||||
cursor: pointer;
|
||||
border: 1px solid black;
|
||||
background: white;
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
.sp-alpha {
|
||||
display: none;
|
||||
position: absolute;
|
||||
bottom: -14px;
|
||||
xright: 0;
|
||||
left: 0;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.sp-alpha-inner {
|
||||
border: solid 1px #333;
|
||||
}
|
||||
|
||||
.sp-clear {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sp-clear.sp-clear-display {
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
.sp-clear-enabled .sp-clear {
|
||||
display: block;
|
||||
position:absolute;
|
||||
top:0px;
|
||||
right:0;
|
||||
bottom:0;
|
||||
left:84%;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
/* Don't allow text selection */
|
||||
.sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
|
||||
-webkit-user-select:none;
|
||||
-moz-user-select: -moz-none;
|
||||
-o-user-select:none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.sp-container.sp-input-disabled .sp-input-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-container.sp-buttons-disabled .sp-button-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-container.sp-palette-buttons-disabled .sp-palette-button-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-palette-only .sp-picker-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-palette-disabled .sp-palette-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sp-initial-disabled .sp-initial {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
|
||||
.sp-sat {
|
||||
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
|
||||
background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
|
||||
background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
||||
background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
||||
background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
||||
background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
|
||||
filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
|
||||
}
|
||||
.sp-val {
|
||||
background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
|
||||
background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
|
||||
background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
||||
background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
||||
background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
||||
background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
|
||||
filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
|
||||
}
|
||||
|
||||
.sp-hue {
|
||||
background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
|
||||
background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
}
|
||||
|
||||
/* IE filters do not support multiple color stops.
|
||||
Generate 6 divs, line them up, and do two color gradients for each.
|
||||
Yes, really.
|
||||
*/
|
||||
.sp-1 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
|
||||
}
|
||||
.sp-2 {
|
||||
height:16%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
|
||||
}
|
||||
.sp-3 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
|
||||
}
|
||||
.sp-4 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
|
||||
}
|
||||
.sp-5 {
|
||||
height:16%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
|
||||
}
|
||||
.sp-6 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
|
||||
}
|
||||
|
||||
.sp-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Clearfix hack */
|
||||
.sp-cf:before, .sp-cf:after { content: ""; display: table; }
|
||||
.sp-cf:after { clear: both; }
|
||||
.sp-cf { *zoom: 1; }
|
||||
|
||||
/* Mobile devices, make hue slider bigger so it is easier to slide */
|
||||
@media (max-device-width: 480px) {
|
||||
.sp-color { right: 40%; }
|
||||
.sp-hue { left: 63%; }
|
||||
.sp-fill { padding-top: 60%; }
|
||||
}
|
||||
.sp-dragger {
|
||||
border-radius: 5px;
|
||||
height: 5px;
|
||||
width: 5px;
|
||||
border: 1px solid #fff;
|
||||
background: #000;
|
||||
cursor: pointer;
|
||||
position:absolute;
|
||||
top:0;
|
||||
left: 0;
|
||||
}
|
||||
.sp-slider {
|
||||
position: absolute;
|
||||
top:0;
|
||||
cursor:pointer;
|
||||
height: 3px;
|
||||
left: -1px;
|
||||
right: -1px;
|
||||
border: 1px solid #000;
|
||||
background: white;
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
/*
|
||||
Theme authors:
|
||||
Here are the basic themeable display options (colors, fonts, global widths).
|
||||
See http://bgrins.github.io/spectrum/themes/ for instructions.
|
||||
*/
|
||||
|
||||
.sp-container {
|
||||
border-radius: 0;
|
||||
background-color: #ECECEC;
|
||||
border: solid 1px #f0c49B;
|
||||
padding: 0;
|
||||
}
|
||||
.sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear {
|
||||
font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.sp-top {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.sp-color, .sp-hue, .sp-clear {
|
||||
border: solid 1px #666;
|
||||
}
|
||||
|
||||
/* Input */
|
||||
.sp-input-container {
|
||||
float:right;
|
||||
width: 100px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.sp-initial-disabled .sp-input-container {
|
||||
width: 100%;
|
||||
}
|
||||
.sp-input {
|
||||
font-size: 12px !important;
|
||||
border: 1px inset;
|
||||
padding: 4px 5px;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
background:transparent;
|
||||
border-radius: 3px;
|
||||
color: #222;
|
||||
}
|
||||
.sp-input:focus {
|
||||
border: 1px solid orange;
|
||||
}
|
||||
.sp-input.sp-validation-error {
|
||||
border: 1px solid red;
|
||||
background: #fdd;
|
||||
}
|
||||
|
||||
.sp-picker-container , .sp-palette-container {
|
||||
|
||||
}
|
||||
.sp-picker-container {
|
||||
width: 200px;
|
||||
border-left: solid 1px #fff;
|
||||
}
|
||||
|
||||
/* Palettes */
|
||||
.sp-palette-container {
|
||||
border-right: solid 1px #ccc;
|
||||
}
|
||||
|
||||
.sp-palette-only .sp-palette-container {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-el {
|
||||
display: block;
|
||||
position:relative;
|
||||
float:left;
|
||||
width: 24px;
|
||||
height: 15px;
|
||||
margin: 3px;
|
||||
cursor: pointer;
|
||||
border:solid 2px transparent;
|
||||
}
|
||||
.sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
|
||||
border-color: orange;
|
||||
}
|
||||
.sp-thumb-el {
|
||||
position:relative;
|
||||
}
|
||||
|
||||
/* Initial */
|
||||
.sp-initial {
|
||||
float: left;
|
||||
border: solid 1px #333;
|
||||
}
|
||||
|
||||
.sp-pallete-internal{
|
||||
float:left;
|
||||
margin-left:5px;
|
||||
width:132px;
|
||||
xbackground-color:green;
|
||||
}
|
||||
|
||||
.sp-initial span {
|
||||
width: 30px;
|
||||
height: 25px;
|
||||
border:none;
|
||||
display:block;
|
||||
float:left;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.sp-initial .sp-clear-display {
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.sp-palette-button-container,
|
||||
.sp-button-container {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* Replacer (the little preview div that shows up instead of the <input>) */
|
||||
.sp-replacer {
|
||||
margin:0;
|
||||
overflow:hidden;
|
||||
cursor:pointer;
|
||||
padding: 4px;
|
||||
display:inline-block;
|
||||
border: solid 1px #91765d;
|
||||
background: #eee;
|
||||
color: #333;
|
||||
vertical-align: middle;
|
||||
width:50px;
|
||||
height:31px;
|
||||
border-left:none;
|
||||
box-sizing:border-box;
|
||||
}
|
||||
|
||||
.sp-replacer:hover, .sp-replacer.sp-active {
|
||||
border-color: #F0C49B;
|
||||
color: #111;
|
||||
}
|
||||
.sp-replacer.sp-disabled {
|
||||
cursor:default;
|
||||
border-color: silver;
|
||||
color: silver;
|
||||
}
|
||||
|
||||
.sp-preview {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: solid 1px #222;
|
||||
margin-right: 5px;
|
||||
float:left;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.sp-palette {
|
||||
*width: 220px;
|
||||
max-width: 220px;
|
||||
}
|
||||
.sp-palette .sp-thumb-el {
|
||||
width:16px;
|
||||
height: 16px;
|
||||
margin:2px 1px;
|
||||
border: solid 1px #d0d0d0;
|
||||
}
|
||||
|
||||
.sp-container {
|
||||
padding-bottom:0;
|
||||
}
|
||||
|
||||
|
||||
/* Buttons: http://hellohappy.org/css3-buttons/ */
|
||||
.sp-container button {
|
||||
background-color: #eeeeee;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
|
||||
border: 1px solid #ccc;
|
||||
border-bottom: 1px solid #bbb;
|
||||
border-radius: 3px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
padding: 5px 4px;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #eee;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.sp-container button:hover {
|
||||
background-color: #dddddd;
|
||||
background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: linear-gradient(to bottom, #dddddd, #bbbbbb);
|
||||
border: 1px solid #bbb;
|
||||
border-bottom: 1px solid #999;
|
||||
cursor: pointer;
|
||||
text-shadow: 0 1px 0 #ddd;
|
||||
}
|
||||
.sp-container button:active {
|
||||
border: 1px solid #aaa;
|
||||
border-bottom: 1px solid #888;
|
||||
-webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
-moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
-ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
-o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
}
|
||||
.sp-cancel {
|
||||
font-size: 11px;
|
||||
color: #d93f3f !important;
|
||||
margin:0;
|
||||
padding:2px;
|
||||
margin-right: 5px;
|
||||
vertical-align: middle;
|
||||
text-decoration:none;
|
||||
|
||||
}
|
||||
.sp-cancel:hover {
|
||||
color: #d93f3f !important;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
.sp-palette span:hover, .sp-palette span.sp-thumb-active {
|
||||
border-color: #000;
|
||||
}
|
||||
|
||||
.sp-preview, .sp-alpha, .sp-thumb-el {
|
||||
position:relative;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
|
||||
}
|
||||
.sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner {
|
||||
display:block;
|
||||
position:absolute;
|
||||
top:0;left:0;bottom:0;right:0;
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-inner {
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
|
||||
}
|
||||
|
||||
.sp-clear-display {
|
||||
background-repeat:no-repeat;
|
||||
background-position: center;
|
||||
background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
1
wp-content/plugins/unlimited-elements-for-elementor/js/spectrum/spectrum.min.js
vendored
Normal file
1
wp-content/plugins/unlimited-elements-for-elementor/js/spectrum/spectrum.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,701 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorAddonConfig(){
|
||||
|
||||
var g_objWrapper, g_addonName, g_addonType;
|
||||
var g_objSettingsContainer, g_objFontsPanel;
|
||||
var g_objConfigTable;
|
||||
var g_objTitle, g_objSettings = new UniteSettingsUC();
|
||||
|
||||
var g_objPreviewWrapper, g_objIframePreview, g_objManager = new UCManagerAdmin();
|
||||
var g_objInputUpdate = null; //field for put settings values
|
||||
|
||||
|
||||
var t = this;
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
var g_temp = {
|
||||
|
||||
};
|
||||
|
||||
var g_options = {
|
||||
addon_id:"",
|
||||
title: "",
|
||||
url_icon: "",
|
||||
enable_items: false,
|
||||
admin_labels: null
|
||||
};
|
||||
|
||||
this.events = {
|
||||
SHOW_PREVIEW: "show_preview",
|
||||
HIDE_PREVIEW: "hide_preview"
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* validate that addon exists
|
||||
*/
|
||||
function validateInited(){
|
||||
if(!g_addonName)
|
||||
throw new Error("Addon name not given");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* show the addon config
|
||||
*/
|
||||
this.show = function(){
|
||||
g_objWrapper.show();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* hide the addon config
|
||||
*/
|
||||
this.hide = function(){
|
||||
g_objWrapper.hide();
|
||||
|
||||
triggerEvent(t.events.HIDE_PREVIEW);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get extra addon data from browser addon data
|
||||
*/
|
||||
this.getGridAddonDataFromBrowserData = function(objData){
|
||||
|
||||
var extra = {};
|
||||
extra["id"] = g_ucAdmin.getVal(objData, "id");
|
||||
extra["title"] = g_ucAdmin.getVal(objData, "title");
|
||||
|
||||
var addonData = {};
|
||||
addonData["name"] = g_ucAdmin.getVal(objData, "name");
|
||||
addonData["addontype"] = g_ucAdmin.getVal(objData, "addontype");
|
||||
|
||||
addonData["extra"] = extra;
|
||||
|
||||
return(addonData);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get addon data without any config from name and type
|
||||
*/
|
||||
this.getEmptyAddonData = function(name, addontype){
|
||||
|
||||
if(!addontype)
|
||||
var addontype = "";
|
||||
|
||||
var addonData = {};
|
||||
addonData["name"] = name;
|
||||
addonData["addontype"] = addontype;
|
||||
|
||||
return(addonData);
|
||||
};
|
||||
|
||||
/**
|
||||
* update addon data setting
|
||||
*/
|
||||
this.updateAddonDataSetting = function(addonData, settingName, settingValue){
|
||||
|
||||
var itemsPrefix = "uc_items_attribute_";
|
||||
|
||||
if(!addonData)
|
||||
addonData = {};
|
||||
|
||||
//check items
|
||||
if(settingName.indexOf(itemsPrefix) === 0){
|
||||
|
||||
var arrItems = g_ucAdmin.getVal(addonData,"items");
|
||||
|
||||
var trimmed = settingName.replace(itemsPrefix,"");
|
||||
var posSap = settingName.indexOf("_");
|
||||
var numItem = trimmed.substr(0, posSap-1);
|
||||
var dataSetting = settingName.replace(itemsPrefix+numItem+"_","");
|
||||
|
||||
numItem = parseInt(numItem);
|
||||
|
||||
if(addonData.items)
|
||||
addonData.items[numItem][dataSetting] = settingValue;
|
||||
|
||||
}else{ //check config
|
||||
|
||||
var config = g_ucAdmin.getVal(addonData,"config");
|
||||
var isExistsInConfig = g_ucAdmin.isObjPropertyExists(config, settingName);
|
||||
|
||||
if(!addonData.config)
|
||||
addonData.config = {};
|
||||
|
||||
addonData.config[settingName] = settingValue;
|
||||
|
||||
}
|
||||
|
||||
addonData = removeHtmlSettingsFromData(addonData);
|
||||
|
||||
return(addonData);
|
||||
}
|
||||
|
||||
/**
|
||||
* remove settings from data
|
||||
*/
|
||||
function removeHtmlSettingsFromData(addonData){
|
||||
|
||||
var extra = g_ucAdmin.getVal(addonData,"extra");
|
||||
delete extra["html_settings"];
|
||||
addonData["extra"] = extra;
|
||||
|
||||
return(addonData);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear duplicated addon data
|
||||
*/
|
||||
this.clearDuplicatedAddonData = function(addonData){
|
||||
|
||||
//remove settings html
|
||||
addonData = removeHtmlSettingsFromData(addonData);
|
||||
|
||||
return(addonData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get send to panel data from addon data
|
||||
*/
|
||||
this.getSendDataFromAddonData = function(addonData){
|
||||
|
||||
var sendData = {};
|
||||
|
||||
//check for html settings
|
||||
var extra = g_ucAdmin.getVal(addonData, "extra");
|
||||
|
||||
var htmlSettings = g_ucAdmin.getVal(extra, "html_settings");
|
||||
if(htmlSettings){
|
||||
sendData["html_settings"] = htmlSettings;
|
||||
return(sendData);
|
||||
}
|
||||
|
||||
var sendFields = ["config","items","fonts","name","addontype"];
|
||||
|
||||
for(var index in sendFields){
|
||||
var field = sendFields[index];
|
||||
sendData[field] = g_ucAdmin.getVal(addonData, field);
|
||||
}
|
||||
|
||||
//add id
|
||||
sendData["id"] = g_ucAdmin.getVal(extra, "id");
|
||||
|
||||
return(sendData);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get addon data from settings data
|
||||
*/
|
||||
this.getAddonDataFromSettingsValues = function(objValuesParam){
|
||||
|
||||
var objValues = jQuery.extend({}, objValuesParam);
|
||||
|
||||
var objData = {};
|
||||
objData["items"] = "";
|
||||
objData["fonts"] = g_ucAdmin.getVal(objValues, "uc_fonts_panel");
|
||||
|
||||
//------ get items
|
||||
objData["items"] = g_ucAdmin.getVal(objValues, "uc_items_editor");
|
||||
|
||||
delete objValues["uc_items_editor"];
|
||||
delete objValues["uc_fonts_panel"];
|
||||
|
||||
objData["config"] = objValues;
|
||||
|
||||
return(objData);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* return if the addon data is equal
|
||||
*/
|
||||
this.isAddonsDataEqual = function(addonData1, addonData2){
|
||||
|
||||
if(typeof addonData1 == "object")
|
||||
var str1 = JSON.stringify(addonData1);
|
||||
else
|
||||
var str1 = addonData1;
|
||||
|
||||
if(typeof addonData2 == "object")
|
||||
var str2 = JSON.stringify(addonData2);
|
||||
else
|
||||
var str2 = addonData2;
|
||||
|
||||
if(str1 === str2)
|
||||
return(true);
|
||||
|
||||
return(false);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get addon title from data
|
||||
*/
|
||||
this.getAddonTitle = function(addonData){
|
||||
|
||||
var extra = g_ucAdmin.getVal(addonData, "extra");
|
||||
var title = g_ucAdmin.getVal(extra, "title");
|
||||
|
||||
if(!title)
|
||||
title = "Untitled Addon";
|
||||
|
||||
return(title);
|
||||
};
|
||||
|
||||
/**
|
||||
* return command to panel settings on some events
|
||||
*/
|
||||
this.getPanelCommand = function(eventName, addonData){
|
||||
|
||||
var extra = g_ucAdmin.getVal(addonData, "extra");
|
||||
|
||||
switch(eventName){
|
||||
case "add_addon":
|
||||
var hasItems = g_ucAdmin.getVal(extra, "has_items");
|
||||
if(hasItems == false)
|
||||
return(false);
|
||||
|
||||
var numItems = g_ucAdmin.getVal(extra, "num_items");
|
||||
if(numItems === 0)
|
||||
return("open_items_panel");
|
||||
break;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get additional data to pass the panel
|
||||
*/
|
||||
this.getPanelData = function(addonData){
|
||||
|
||||
var panelData = {};
|
||||
|
||||
var extra = g_ucAdmin.getVal(addonData, "extra");
|
||||
var addonID = g_ucAdmin.getVal(extra, "id");
|
||||
if(addonID){
|
||||
panelData["header_edit_link"] = g_ucAdmin.getUrlView("addon", "id="+addonID);
|
||||
}
|
||||
|
||||
return(panelData);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* set new addon data, accured on save data from panel settings
|
||||
* remove addon config if exists
|
||||
*/
|
||||
this.setNewAddonData = function(addonData, addonDataNew){
|
||||
|
||||
addonData.config = g_ucAdmin.getVal(addonDataNew,"config");
|
||||
addonData.fonts = g_ucAdmin.getVal(addonDataNew,"fonts");
|
||||
addonData.items = g_ucAdmin.getVal(addonDataNew,"items");
|
||||
|
||||
//remove settings html
|
||||
var extra = g_ucAdmin.getVal(addonData,"extra");
|
||||
delete extra["html_settings"];
|
||||
addonData["extra"] = extra;
|
||||
|
||||
return(addonData);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* set html settings in addon data
|
||||
*/
|
||||
this.setHtmlSettingsInAddonData = function(addonData, htmlSettings){
|
||||
|
||||
var extra = g_ucAdmin.getVal(addonData,"extra");
|
||||
if(!extra)
|
||||
extra = {};
|
||||
|
||||
extra["html_settings"] = htmlSettings;
|
||||
|
||||
addonData["extra"] = extra;
|
||||
|
||||
return(addonData);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* load new addon data
|
||||
*/
|
||||
this.loadNewAddonData = function(data, funcResponse){
|
||||
|
||||
g_ucAdmin.ajaxRequest("get_addon_editor_data", data, funcResponse);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get data object
|
||||
*/
|
||||
this.getObjData = function(isChangedOnly){
|
||||
|
||||
validateInited();
|
||||
|
||||
if(isChangedOnly === true){
|
||||
|
||||
var objValues = g_objSettings.getSettingsValues(false, true);
|
||||
|
||||
}else{
|
||||
|
||||
var objValues = g_objSettings.getSettingsValues();
|
||||
}
|
||||
|
||||
var objExtra = {};
|
||||
objExtra["title"] = g_options.title;
|
||||
objExtra["url_icon"] = g_options.url_icon;
|
||||
objExtra["admin_labels"] = g_options.admin_labels;
|
||||
|
||||
var objData = t.getAddonDataFromSettingsValues(objValues);
|
||||
|
||||
objData["name"] = g_addonName;
|
||||
objData["addontype"] = g_addonType;
|
||||
objData["extra"] = objExtra;
|
||||
|
||||
return(objData);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get addon ID
|
||||
*/
|
||||
this.getAddonID = function(){
|
||||
|
||||
|
||||
return(g_options.addon_id);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get json data from the settings
|
||||
*/
|
||||
function getJsonData(isChangedOnly){
|
||||
|
||||
var objData = t.getObjData(isChangedOnly);
|
||||
|
||||
var strData = JSON.stringify(objData);
|
||||
|
||||
return(strData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update values field if exists
|
||||
*/
|
||||
function updateValuesInput(){
|
||||
|
||||
if(!g_objInputUpdate)
|
||||
return(false);
|
||||
|
||||
if(!g_addonName)
|
||||
throw new Error("Addon name should be exists");
|
||||
|
||||
var strData = getJsonData();
|
||||
|
||||
g_objInputUpdate.val(strData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* set update input ID, this function should be run before init
|
||||
*/
|
||||
this.setInputUpdate = function(objInput){
|
||||
g_objInputUpdate = objInput;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* parse options from input
|
||||
*/
|
||||
function parseInputOptions(optionsInput){
|
||||
|
||||
jQuery.each(optionsInput, function(key, value){
|
||||
|
||||
if(g_options.hasOwnProperty(key)){
|
||||
if(value === "true")
|
||||
value = true;
|
||||
else
|
||||
if(value === "false")
|
||||
value = false;
|
||||
|
||||
g_options[key] = value;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* clear addon configuration to default
|
||||
*/
|
||||
this.clearData = function(){
|
||||
validateInited();
|
||||
g_objSettings.clearSettings();
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* set addon config
|
||||
*/
|
||||
this.setData = function(settingsData, itemsData, optionsData){
|
||||
|
||||
validateInited();
|
||||
g_objSettings.setValues(settingsData);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get ajax preview url
|
||||
*/
|
||||
function getPreviewUrl(){
|
||||
|
||||
var jsonData = getJsonData(true);
|
||||
|
||||
jsonData = encodeURIComponent(jsonData);
|
||||
|
||||
var params = "data="+jsonData+"";
|
||||
var urlPreview = g_ucAdmin.getUrlAjax("show_preview", params);
|
||||
|
||||
return(urlPreview);
|
||||
}
|
||||
|
||||
/**
|
||||
* validate that preview exists
|
||||
*/
|
||||
function validatePreviewExists(){
|
||||
|
||||
if(!g_objPreviewWrapper)
|
||||
throw new Error("The preview container not exists");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* show preview
|
||||
*/
|
||||
this.showPreview = function(){
|
||||
|
||||
validatePreviewExists();
|
||||
|
||||
g_objConfigTable.hide();
|
||||
g_objPreviewWrapper.show();
|
||||
|
||||
var urlPreview = getPreviewUrl();
|
||||
g_objIframePreview.attr("src", urlPreview);
|
||||
|
||||
triggerEvent(t.events.SHOW_PREVIEW);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hide the preview
|
||||
*/
|
||||
this.hidePreview = function(){
|
||||
g_objIframePreview.attr("src", "");
|
||||
g_objPreviewWrapper.hide();
|
||||
|
||||
g_objConfigTable.show();
|
||||
|
||||
triggerEvent(t.events.HIDE_PREVIEW);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* show preview in new tab
|
||||
*/
|
||||
this.showPreviewNewTab = function(){
|
||||
|
||||
var urlPreview = getPreviewUrl();
|
||||
window.open(urlPreview);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* clean tags
|
||||
*/
|
||||
function cleanNonFormattingTags(htmlContents) {
|
||||
|
||||
htmlContents = jQuery(htmlContents);
|
||||
|
||||
if (htmlContents && htmlContents.length) {
|
||||
var result = '';
|
||||
htmlContents.each(function () {
|
||||
var $child = $(this), type = $child.prop('tagName'), isTextNode = this.nodeName == "#text";
|
||||
if (isTextNode) {
|
||||
result += this.textContent;
|
||||
}
|
||||
else if (type == 'B' || type == 'U' || type == 'I' || type == 'BR') { // Allow only these types of tags
|
||||
var innerContent = cleanNonFormattingTags($child.contents());
|
||||
var $newTag = $(document.createElement(type)).html(innerContent);
|
||||
result += $newTag[0].outerHTML;
|
||||
}
|
||||
else {
|
||||
result += cleanNonFormattingTags($child.contents());
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
return htmlContents.text();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* init preview button
|
||||
*/
|
||||
function initPreview(){
|
||||
|
||||
g_objPreviewWrapper = g_objWrapper.find(".uc-addon-config-preview");
|
||||
|
||||
if(g_objPreviewWrapper.length == 0){
|
||||
g_objPreviewWrapper = null;
|
||||
return(false);
|
||||
}
|
||||
|
||||
g_objIframePreview = g_objPreviewWrapper.find(".uc-preview-iframe");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ______________EVENTS____________(){};
|
||||
|
||||
/**
|
||||
* on settings change event.
|
||||
* Update field if exists
|
||||
*/
|
||||
function onSettingsChange(){
|
||||
|
||||
if(g_objInputUpdate)
|
||||
updateValuesInput();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* grigger event
|
||||
*/
|
||||
function triggerEvent(eventName, options){
|
||||
|
||||
g_objWrapper.trigger(eventName, options);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on some event
|
||||
*/
|
||||
function onEvent(eventName, func){
|
||||
|
||||
g_objWrapper.on(eventName, func);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set on show preview function
|
||||
*/
|
||||
this.onShowPreview = function(func){
|
||||
|
||||
onEvent(t.events.SHOW_PREVIEW, func);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set on hide preview function
|
||||
*/
|
||||
this.onHidePreview = function(func){
|
||||
|
||||
onEvent(t.events.HIDE_PREVIEW, func);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvens(){
|
||||
|
||||
g_objSettings.setEventOnChange(onSettingsChange);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* destroy object
|
||||
*/
|
||||
this.destroy = function(){
|
||||
|
||||
if(!g_objWrapper || g_objWrapper.length == 0)
|
||||
return(false);
|
||||
|
||||
g_objSettings.destroy();
|
||||
|
||||
g_objWrapper.html("");
|
||||
g_objWrapper = null;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param objWrapper
|
||||
*/
|
||||
this.init = function(objWrapper, isPreviewMode){
|
||||
|
||||
if(g_objWrapper)
|
||||
throw new Error("the config is alrady inited, can't init it twice");
|
||||
|
||||
g_objWrapper = objWrapper;
|
||||
|
||||
if(g_objWrapper.length == 0)
|
||||
throw new Error("wrong config object");
|
||||
|
||||
|
||||
g_objSettingsContainer = g_objWrapper.find(".uc-addon-config-settings");
|
||||
g_objTitle = g_objWrapper.find(".uc-addon-config-title");
|
||||
g_objConfigTable = g_objWrapper.find(".uc-addon-config-table");
|
||||
|
||||
g_ucAdmin.validateDomElement(g_objConfigTable, "config table: .uc-addon-config-table");
|
||||
|
||||
//get name
|
||||
g_addonName = g_objWrapper.data("name");
|
||||
g_addonType = g_objWrapper.data("addontype");
|
||||
|
||||
|
||||
g_ucAdmin.validateNotEmpty(g_addonName, "addon admin");
|
||||
|
||||
//get options
|
||||
var objOptions = g_objWrapper.data("options");
|
||||
parseInputOptions(objOptions);
|
||||
|
||||
|
||||
//set settings events
|
||||
g_objSettings.init(g_objSettingsContainer);
|
||||
|
||||
initEvens();
|
||||
|
||||
initPreview();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
"use strict";
|
||||
|
||||
function UniteAddonPreviewAdmin() {
|
||||
var g_objPreview, g_addonID, g_requestPreview;
|
||||
var g_helper = new UniteCreatorHelper();
|
||||
var g_settings = new UniteSettingsUC();
|
||||
var that = this;
|
||||
|
||||
if (!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
/**
|
||||
* init the view
|
||||
*/
|
||||
this.init = function () {
|
||||
boot();
|
||||
|
||||
loadSettings(function () {
|
||||
refreshPreview();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* init the view by slot
|
||||
*/
|
||||
this.initBySlot = function (slot) {
|
||||
boot();
|
||||
|
||||
loadSettings(function () {
|
||||
that.restoreSlot(slot);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* get addon id
|
||||
*/
|
||||
this.getAddonId = function () {
|
||||
return g_addonID;
|
||||
};
|
||||
|
||||
/**
|
||||
* get settings values
|
||||
*/
|
||||
this.getSettingsValues = function () {
|
||||
return g_settings.getSettingsValues();
|
||||
};
|
||||
|
||||
/**
|
||||
* clear settings
|
||||
*/
|
||||
this.clearSettings = function () {
|
||||
g_settings.clearSettings();
|
||||
|
||||
refreshPreview();
|
||||
};
|
||||
|
||||
/**
|
||||
* get selectors css
|
||||
*/
|
||||
this.getSelectorsCss = function () {
|
||||
return g_settings.getSelectorsCss();
|
||||
};
|
||||
|
||||
/**
|
||||
* restore slot
|
||||
*/
|
||||
this.restoreSlot = function (slot) {
|
||||
var data = {
|
||||
id: g_addonID,
|
||||
slotnum: slot,
|
||||
combine: true,
|
||||
};
|
||||
|
||||
g_ucAdmin.ajaxRequest("get_test_addon_data", data, function (response) {
|
||||
var values = g_ucAdmin.getVal(response, "settings_values");
|
||||
|
||||
trace("restoring settings:");
|
||||
trace(values);
|
||||
|
||||
if (!values) {
|
||||
trace("no settings found");
|
||||
return;
|
||||
}
|
||||
|
||||
g_settings.setValues(values);
|
||||
|
||||
refreshPreview();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* boot the view
|
||||
*/
|
||||
function boot() {
|
||||
g_addonID = jQuery("#uc_preview_addon_wrapper").data("addonid");
|
||||
g_objPreview = jQuery("#uc_preview_wrapper");
|
||||
|
||||
g_settings.setSelectorWrapperID("uc_preview_wrapper");
|
||||
}
|
||||
|
||||
/**
|
||||
* load settings
|
||||
*/
|
||||
function loadSettings(onSuccess) {
|
||||
g_ucAdmin.setAjaxLoaderID("uc_settings_loader");
|
||||
|
||||
return g_ucAdmin.ajaxRequest("get_addon_settings_html", { id: g_addonID }, function (response) {
|
||||
trace("initializing settings");
|
||||
|
||||
initSettingsByHtml(response.html);
|
||||
|
||||
if (typeof onSuccess === "function")
|
||||
onSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* init settings by its html
|
||||
*/
|
||||
function initSettingsByHtml(html) {
|
||||
var objSettingsWrapper = jQuery("#uc_settings_wrapper");
|
||||
|
||||
objSettingsWrapper.html(html);
|
||||
|
||||
g_settings.init(objSettingsWrapper);
|
||||
g_settings.setEventOnChange(refreshPreview);
|
||||
g_settings.setEventOnSelectorsChange(handleSelectorsChange);
|
||||
}
|
||||
|
||||
/**
|
||||
* handle selectors change
|
||||
*/
|
||||
function handleSelectorsChange() {
|
||||
updateSelectorsIncludes();
|
||||
updateSelectorsStyles();
|
||||
}
|
||||
|
||||
/**
|
||||
* update selectors includes (like google font)
|
||||
*/
|
||||
function updateSelectorsIncludes() {
|
||||
var includes = g_settings.getSelectorsIncludes();
|
||||
|
||||
if (includes)
|
||||
g_helper.putIncludes(window, includes);
|
||||
}
|
||||
|
||||
/**
|
||||
* update selectors styles
|
||||
*/
|
||||
function updateSelectorsStyles() {
|
||||
var css = g_settings.getSelectorsCss();
|
||||
|
||||
jQuery("[name=uc_selectors_css]").text(css);
|
||||
}
|
||||
|
||||
/**
|
||||
* refresh preview
|
||||
*/
|
||||
function refreshPreview() {
|
||||
var values = g_settings.getSettingsValues();
|
||||
|
||||
var data = {
|
||||
id: g_addonID,
|
||||
settings: values,
|
||||
selectors: true,
|
||||
};
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID("uc_preview_loader");
|
||||
|
||||
if (g_requestPreview)
|
||||
g_requestPreview.abort();
|
||||
|
||||
g_requestPreview = g_ucAdmin.ajaxRequest("get_addon_output_data", data, function (response) {
|
||||
var html = g_ucAdmin.getVal(response, "html");
|
||||
var includes = g_ucAdmin.getVal(response, "includes");
|
||||
|
||||
g_helper.putIncludes(window, includes, function () {
|
||||
g_objPreview.html(html);
|
||||
});
|
||||
}).done(function (response) {
|
||||
var success = g_ucAdmin.getVal(response, "success");
|
||||
var message = g_ucAdmin.getVal(response, "message");
|
||||
|
||||
if (success === false)
|
||||
g_objPreview.html("<span style='color:red'><b>Error:</b> " + message + "</span>");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorAddonDefaultsAdmin(){
|
||||
|
||||
var g_objWrapper, g_objConfig = new UniteCreatorAddonConfig();
|
||||
var g_objLoaderSave, g_options;
|
||||
|
||||
var t = this;
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
|
||||
/**
|
||||
* on save data event
|
||||
*/
|
||||
function onSaveDataClick(){
|
||||
|
||||
var objData = g_objConfig.getObjData();
|
||||
|
||||
if(objData.hasOwnProperty("extra"))
|
||||
delete objData["extra"];
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID("uc_addondefaults_loader_save");
|
||||
g_ucAdmin.setAjaxHideButtonID("uc_addondefaults_button_save");
|
||||
|
||||
g_ucAdmin.ajaxRequest("save_addon_defaults", objData, function(){
|
||||
|
||||
jQuery("#uc_addondefaults_button_save").show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* restore data
|
||||
*/
|
||||
function onRestoreDataClick(){
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID("uc_addondefaults_loader_restore");
|
||||
g_ucAdmin.setAjaxHideButtonID("uc_addondefaults_button_restore");
|
||||
|
||||
var addonID = g_objConfig.getAddonID();
|
||||
var data = {"id":addonID,"slotnum":1};
|
||||
|
||||
g_ucAdmin.ajaxRequest("get_test_addon_data", data, function(response){
|
||||
|
||||
g_objConfig.setData(response.config, response.items);
|
||||
|
||||
jQuery("#uc_addondefaults_button_restore").show();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on clear data click
|
||||
*/
|
||||
function onDeleteDataClick(){
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID("uc_addondefaults_loader_delete");
|
||||
g_ucAdmin.setAjaxHideButtonID("uc_addondefaults_button_delete");
|
||||
|
||||
var addonID = g_objConfig.getAddonID();
|
||||
var data = {"id":addonID,"slotnum":1};
|
||||
|
||||
g_ucAdmin.ajaxRequest("delete_test_addon_data", data, function(response){
|
||||
|
||||
jQuery("#uc_addondefaults_button_delete").show();
|
||||
|
||||
g_objConfig.clearData();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on show preview - change the buttons
|
||||
*/
|
||||
function onShowPreview(){
|
||||
|
||||
jQuery("#uc_button_preview").hide();
|
||||
jQuery("#uc_button_close_preview").show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on hide preview - change the buttons
|
||||
*/
|
||||
function onHidePreview(){
|
||||
jQuery("#uc_button_preview").show();
|
||||
jQuery("#uc_button_close_preview").hide();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
jQuery("#uc_button_preview").on("click",g_objConfig.showPreview);
|
||||
jQuery("#uc_button_preview_tab").on("click",g_objConfig.showPreviewNewTab);
|
||||
jQuery("#uc_button_close_preview").on("click",g_objConfig.hidePreview);
|
||||
|
||||
g_objConfig.onShowPreview(onShowPreview);
|
||||
g_objConfig.onHidePreview(onHidePreview);
|
||||
|
||||
jQuery("#uc_addondefaults_button_save").on("click",onSaveDataClick);
|
||||
|
||||
jQuery("#uc_addondefaults_button_delete").on("click",onDeleteDataClick);
|
||||
|
||||
jQuery("#uc_addondefaults_button_restore").on("click",onRestoreDataClick);
|
||||
|
||||
jQuery("#uc_addondefaults_button_clear").on("click",g_objConfig.clearData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get assets path
|
||||
*/
|
||||
function getPathAssets(){
|
||||
|
||||
var pathAssets = g_options["path_assets"];
|
||||
return(pathAssets);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get assets url
|
||||
*/
|
||||
function getUrlAssets(){
|
||||
var pathAssets = getPathAssets();
|
||||
if(!pathAssets)
|
||||
return(pathAssets);
|
||||
|
||||
var urlAssets = g_urlAssetsUC + pathAssets + "/";
|
||||
|
||||
return(urlAssets);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update path for image select based on the assets path
|
||||
*/
|
||||
function updateImageSelectPath(){
|
||||
|
||||
var pathAddonAssets = getPathAssets();
|
||||
if(!pathAddonAssets)
|
||||
return(false);
|
||||
|
||||
|
||||
if(pathAddonAssets){
|
||||
pathAddonAssets = g_pathAssetsUC+pathAddonAssets;
|
||||
}
|
||||
|
||||
var urlAssets = getUrlAssets();
|
||||
|
||||
g_ucAdmin.triggerEvent("update_assets_path", urlAssets);
|
||||
|
||||
g_ucAdmin.setAddImagePath(pathAddonAssets, urlAssets);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* init test view
|
||||
*/
|
||||
this.init = function(){
|
||||
|
||||
g_objWrapper = jQuery("#uc_addondefaults_wrapper");
|
||||
g_options = g_objWrapper.data("options");
|
||||
|
||||
//init config
|
||||
var objConfigWrapper = jQuery("#uc_addon_config");
|
||||
|
||||
updateImageSelectPath();
|
||||
|
||||
g_objConfig = new UniteCreatorAddonConfig();
|
||||
g_objConfig.init(objConfigWrapper);
|
||||
|
||||
initEvents();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorAddonDefaultsAdmin() {
|
||||
var g_slot = 2;
|
||||
var g_addonPreview = new UniteAddonPreviewAdmin();
|
||||
|
||||
if (!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
/**
|
||||
* init the view
|
||||
*/
|
||||
this.init = function () {
|
||||
g_addonPreview.initBySlot(g_slot);
|
||||
|
||||
initEvents();
|
||||
};
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvents() {
|
||||
jQuery("#uc_addondefaults_button_save").on("click", onSaveDataClick);
|
||||
}
|
||||
|
||||
/**
|
||||
* on save data event
|
||||
*/
|
||||
function onSaveDataClick() {
|
||||
var values = g_addonPreview.getSettingsValues();
|
||||
|
||||
var data = {
|
||||
id: g_addonPreview.getAddonId(),
|
||||
settings_values: values,
|
||||
};
|
||||
|
||||
trace("saving settings:");
|
||||
trace(values);
|
||||
|
||||
g_ucAdmin.setAjaxLoadingButtonID("uc_addondefaults_button_save");
|
||||
|
||||
g_ucAdmin.ajaxRequest("save_addon_defaults", data);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,166 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorAdmin_GeneralSettings(){
|
||||
|
||||
var t = this;
|
||||
var g_providerAdmin = new UniteProviderAdminUC();
|
||||
var g_settings = new UniteSettingsUC();
|
||||
var g_saveAction = null;
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
|
||||
/**
|
||||
* on save button click function
|
||||
*/
|
||||
function onSaveButtonClick(){
|
||||
|
||||
g_ucAdmin.validateNotEmpty(g_saveAction, "save action");
|
||||
var objButton = jQuery(this);
|
||||
var prefix = objButton.data("prefix");
|
||||
var settingsKey = objButton.data("settingskey");
|
||||
|
||||
var setting_values = g_settings.getSettingsValues();
|
||||
|
||||
var data = {settings_values:setting_values};
|
||||
|
||||
if(settingsKey)
|
||||
data.settings_key = settingsKey;
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID(prefix+"_loader_save");
|
||||
g_ucAdmin.setSuccessMessageID(prefix+"_message_saved");
|
||||
g_ucAdmin.setAjaxHideButtonID(prefix+"_button_save_settings");
|
||||
g_ucAdmin.setErrorMessageID(prefix+"_save_settings_error");
|
||||
|
||||
g_ucAdmin.ajaxRequest(g_saveAction, data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* select tab in addon view
|
||||
* tab is the link object to tab
|
||||
*/
|
||||
function onTabSelect(objTab){
|
||||
|
||||
if(objTab.hasClass("uc-tab-selected"))
|
||||
return(false);
|
||||
|
||||
var contentID = objTab.data("contentid");
|
||||
var tabID = objTab.prop("id");
|
||||
var tabName = objTab.data("name");
|
||||
|
||||
var hash = "tab="+tabName;
|
||||
if(!tabName)
|
||||
hash = "";
|
||||
|
||||
location.hash = hash;
|
||||
|
||||
jQuery("#uc_tab_contents .uc-tab-content").hide();
|
||||
|
||||
jQuery("#" + contentID).show();
|
||||
|
||||
jQuery("#uc_tabs a").not(objTab).removeClass("uc-tab-selected");
|
||||
objTab.addClass("uc-tab-selected");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* go to tab by name
|
||||
*/
|
||||
function gotoTabByName(tabName){
|
||||
var tabID = "#uc_tab_"+tabName+"_tablink";
|
||||
var objTab = jQuery(tabID);
|
||||
|
||||
if(objTab.length)
|
||||
onTabSelect(objTab);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init tabs
|
||||
*/
|
||||
function initTabs(){
|
||||
|
||||
jQuery("#uc_tabs a").on("click",function(){
|
||||
var objTab = jQuery(this);
|
||||
onTabSelect(objTab);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* see if there is some tab in the hash, and go to this tab
|
||||
*/
|
||||
function gotoTabByHash(){
|
||||
var hash = location.hash;
|
||||
if(!hash)
|
||||
return(false);
|
||||
if(hash == "#")
|
||||
return(false);
|
||||
|
||||
if(hash.indexOf("#tab=") !== 0)
|
||||
return(false);
|
||||
|
||||
var tabName = hash.replace("#tab=", "");
|
||||
if(!tabName)
|
||||
return(false);
|
||||
|
||||
gotoTabByName(tabName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* on instagram delete button click
|
||||
*/
|
||||
function onInstagramDeleteDataClick(){
|
||||
|
||||
var objMessage = jQuery("#uc_instagram_reconnect_message");
|
||||
var objButtonWrapper = jQuery("#uc_instagram_connect_button_wrapper");
|
||||
|
||||
var objInputToken = jQuery("input[name=\"instagram_access_token\"]");
|
||||
var objInputUserID = jQuery("input[name=\"instagram_user_id\"]");
|
||||
var objInputUserName = jQuery("input[name=\"instagram_username\"]");
|
||||
|
||||
//clear buttons
|
||||
objInputToken.val("");
|
||||
objInputUserID.val("");
|
||||
objInputUserName.val("");
|
||||
|
||||
//show hide messages
|
||||
objMessage.hide();
|
||||
objButtonWrapper.show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init general settings view
|
||||
*/
|
||||
this.initView = function(saveAction){
|
||||
|
||||
g_ucAdmin.validateNotEmpty(saveAction, "save action");
|
||||
g_saveAction = saveAction;
|
||||
|
||||
var objSettingsWrapper = jQuery("#uc_general_settings");
|
||||
|
||||
if(objSettingsWrapper.length == 0)
|
||||
throw new Error("general settings not found");
|
||||
|
||||
initTabs();
|
||||
|
||||
g_settings.init(objSettingsWrapper);
|
||||
|
||||
//save settings click
|
||||
jQuery(".uc-button-save-settings").on("click",onSaveButtonClick);
|
||||
|
||||
jQuery("#uc_button_delete_insta_data").on("click", onInstagramDeleteDataClick);
|
||||
|
||||
//goto tab by hash
|
||||
gotoTabByHash();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,706 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorAdmin_LayoutsList(){
|
||||
|
||||
var t = this;
|
||||
var g_providerAdmin = new UniteProviderAdminUC();
|
||||
var g_settingsGlobal, g_tableLayouts;
|
||||
var g_objBrowser = new UniteCreatorBrowser(),g_objButtonCatalogImport;
|
||||
|
||||
|
||||
//layouts related
|
||||
var g_selectedCatID = -1, g_openedLayout = -1, g_selectedSort = "";
|
||||
var g_searchText,g_oldCatTitle = "", g_canRename = true;
|
||||
var g_isDeleteInProcess = false;
|
||||
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
|
||||
/**
|
||||
* init global settings dialog
|
||||
*/
|
||||
function initGlobalSettingsDialog(){
|
||||
|
||||
//init settings
|
||||
var settingsWrapper = jQuery("#uc_layout_general_settings");
|
||||
|
||||
|
||||
g_settingsGlobal = new UniteSettingsUC();
|
||||
g_settingsGlobal.init(settingsWrapper);
|
||||
|
||||
//on open dialog click
|
||||
jQuery("#uc_layouts_global_settings").on("click",function(){
|
||||
|
||||
var dialogOptions = {
|
||||
minWidth: 750
|
||||
};
|
||||
|
||||
g_ucAdmin.openCommonDialog("#uc_dialog_layout_global_settings", null, dialogOptions);
|
||||
|
||||
});
|
||||
|
||||
jQuery("#uc_dialog_layout_global_settings_action").on("click",function(){
|
||||
|
||||
var settingsData = g_settingsGlobal.getSettingsValues();
|
||||
var data = {
|
||||
settings_values: settingsData
|
||||
};
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_layout_global_settings", "update_global_layout_settings", data);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on delete layout click
|
||||
*/
|
||||
function onDeleteClick(){
|
||||
var objButton = jQuery(this);
|
||||
var objLoader = objButton.siblings(".uc-loader-delete");
|
||||
|
||||
var textDelete = g_tableLayouts.data("text-delete");
|
||||
|
||||
if(confirm(textDelete) == false)
|
||||
return(false);
|
||||
|
||||
objButton.hide();
|
||||
objLoader.show();
|
||||
|
||||
var layoutID = objButton.data("layoutid");
|
||||
|
||||
var data = {
|
||||
layout_id: layoutID
|
||||
};
|
||||
|
||||
g_ucAdmin.ajaxRequest("delete_layout", data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* duplicating addon
|
||||
*/
|
||||
this.onDuplicateClick = function(event, layoutID, objButton, addParams){
|
||||
|
||||
if(!objButton)
|
||||
var objButton = jQuery(this);
|
||||
|
||||
var objLoader = objButton.siblings(".uc-loader-duplicate");
|
||||
|
||||
objButton.hide();
|
||||
objLoader.show();
|
||||
|
||||
if(!layoutID)
|
||||
var layoutID = objButton.data("layoutid");
|
||||
|
||||
var data = {
|
||||
layout_id: layoutID
|
||||
};
|
||||
|
||||
if(addParams)
|
||||
data = jQuery.extend(data, addParams);
|
||||
|
||||
g_ucAdmin.ajaxRequest("duplicate_layout", data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on export click
|
||||
*/
|
||||
this.onExportClick = function(event, layoutID){
|
||||
|
||||
if(!layoutID){
|
||||
var objButton = jQuery(this);
|
||||
var layoutID = objButton.data("layoutid");
|
||||
}
|
||||
|
||||
var params = "id="+layoutID;
|
||||
var urlExport = g_ucAdmin.getUrlAjax("export_layout", params);
|
||||
|
||||
location.href=urlExport;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ___________IMPORT_DIALOG_____________(){}
|
||||
|
||||
|
||||
/**
|
||||
* open import layout dialog
|
||||
*/
|
||||
function openImportLayoutDialog(){
|
||||
|
||||
jQuery("#dialog_import_layouts_file").val("");
|
||||
|
||||
var options = {minWidth:700, minHeight:300};
|
||||
|
||||
g_ucAdmin.openCommonDialog("#uc_dialog_import_layouts", null, options);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* open import page catalog
|
||||
*/
|
||||
function openImportPageCatalog(){
|
||||
|
||||
g_objBrowser.openAddonsBrowser(null, function(pageData){
|
||||
|
||||
//g_objBrowser.closeCatalog();
|
||||
if(pageData && pageData.url_redirect)
|
||||
window.location.href = pageData.url_redirect;
|
||||
else
|
||||
window.location.reload();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init import layout dialog
|
||||
*/
|
||||
this.initImportLayoutDialog = function(addParams, layoutID){
|
||||
|
||||
jQuery("#uc_button_import_layout").on("click",openImportLayoutDialog);
|
||||
g_objButtonCatalogImport = jQuery("#uc_button_import_layout_from_catalog");
|
||||
|
||||
if(g_objButtonCatalogImport.length)
|
||||
g_objButtonCatalogImport.on("click",openImportPageCatalog);
|
||||
|
||||
jQuery("#uc_dialog_import_layouts_action").on("click",function(){
|
||||
|
||||
var isOverwrite = jQuery("#dialog_import_layouts_file_overwrite").is(":checked");
|
||||
var data = {overwrite_addons:isOverwrite};
|
||||
if(addParams)
|
||||
data.params = addParams;
|
||||
|
||||
if(layoutID){
|
||||
data.layoutID = layoutID;
|
||||
data.no_redirect = true;
|
||||
}
|
||||
|
||||
var objData = new FormData();
|
||||
var jsonData = JSON.stringify(data);
|
||||
objData.append("data", jsonData);
|
||||
|
||||
g_ucAdmin.addFormFilesToData("dialog_import_layouts_form", objData);
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_import_layouts", "import_layouts", objData);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* init view events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
if(g_tableLayouts){
|
||||
|
||||
g_tableLayouts.on("click", ".button_delete", onDeleteClick);
|
||||
g_tableLayouts.on("click", ".button_duplicate", t.onDuplicateClick);
|
||||
g_tableLayouts.on("click", ".button_export", t.onExportClick);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* init import page dialog
|
||||
*/
|
||||
this.initImportPageCatalog = function(addParams){
|
||||
|
||||
var objBrowserWrapper = jQuery("#uc_addon_browser_layout");
|
||||
|
||||
//validate browser if there is button
|
||||
if(g_objButtonCatalogImport.length){
|
||||
g_ucAdmin.validateDomElement(objBrowserWrapper, "pages browser");
|
||||
}
|
||||
|
||||
if(objBrowserWrapper.length == 0)
|
||||
return(false);
|
||||
|
||||
g_objBrowser.init(objBrowserWrapper, addParams);
|
||||
|
||||
};
|
||||
|
||||
function ___________CATEGORIES_____________(){}
|
||||
|
||||
|
||||
/**
|
||||
* init categories related events
|
||||
*/
|
||||
function initEventsCats(){
|
||||
|
||||
|
||||
/**
|
||||
* event handler for clear filter
|
||||
*/
|
||||
jQuery(document).on('click', '.uc-catdialog-button-filter-clear', function(){
|
||||
filterClear();
|
||||
});
|
||||
|
||||
/**
|
||||
* event handler for filter by word
|
||||
*/
|
||||
jQuery(document).on('click', '.uc-catdialog-button-filter', function(){
|
||||
var val = jQuery('.uc-catdialog-button-clearfilter').val();
|
||||
if(val == ''){
|
||||
filterClear();
|
||||
return;
|
||||
}
|
||||
|
||||
loadCats(g_selectedCatID, g_selectedSort, val);
|
||||
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* handler to submit delete button
|
||||
*/
|
||||
jQuery(document).on('click', '.uc-button-delete-category', function(){
|
||||
|
||||
var catid = parseInt(jQuery(this).data('catid'));
|
||||
if(isNaN(catid))
|
||||
catid = jQuery(this).attr('data-catid');
|
||||
|
||||
deleteCat(catid);
|
||||
});
|
||||
|
||||
|
||||
//event handler for change sort
|
||||
jQuery(document).on('click', 'a.uc-link-change-cat-sort', function(){
|
||||
|
||||
var type = jQuery(this).data('type');
|
||||
|
||||
if(type == g_selectedSort)
|
||||
return false;
|
||||
|
||||
g_selectedSort = type;
|
||||
|
||||
loadCats();
|
||||
|
||||
});
|
||||
|
||||
|
||||
// event handler for button set category
|
||||
jQuery("#uc_dialog_add_category_action").on("click",setCategoryForLayout);
|
||||
|
||||
jQuery(".uc-layouts-list-category").on("click",onChangeCategoryClick);
|
||||
|
||||
//function for event "click" button cancel while editing category
|
||||
jQuery(document).on('click', '.egn-cancel-inp', function(){
|
||||
var parent = jQuery(this).parent('td').parent('tr');
|
||||
var catid = jQuery(parent).data('catid');
|
||||
|
||||
//cancel editing
|
||||
closeEdit(catid, g_oldCatTitle);
|
||||
});
|
||||
|
||||
|
||||
//click save event handler
|
||||
jQuery(document).on('click', '.egn-save-inp', function(){
|
||||
saveCatName(this);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* on change category on layouts table click
|
||||
*/
|
||||
function onChangeCategoryClick(){
|
||||
|
||||
var objButton = jQuery(this);
|
||||
|
||||
var action = objButton.data("action");
|
||||
var layoutID = objButton.data("layoutid");
|
||||
|
||||
var catID = objButton.data("catid");
|
||||
catID = parseInt(catID);
|
||||
|
||||
openManageCategoryDialog(layoutID, catID);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* open add category dialog
|
||||
*/
|
||||
function openManageCategoryDialog(layoutID, catID){
|
||||
|
||||
var objDialog = jQuery("#uc_dialog_add_category");
|
||||
objDialog.data("catid", catID);
|
||||
objDialog.data("layoutid", layoutID);
|
||||
|
||||
g_selectedCatID = catID;
|
||||
|
||||
g_openedLayout = layoutID;
|
||||
|
||||
g_ucAdmin.openCommonDialog("#uc_dialog_add_category", function(){
|
||||
|
||||
loadCats(catID);
|
||||
|
||||
jQuery("#uc_dialog_add_category_catname").val("").focus();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* showing list of categories
|
||||
**/
|
||||
function loadCats(sort, filter_word){
|
||||
|
||||
var data = {};
|
||||
data.type = "layout";
|
||||
|
||||
if(sort == 'a-z' || sort == 'z-a'){
|
||||
data.sort = sort;
|
||||
} else if(g_selectedSort != ''){
|
||||
data.sort = g_selectedSort;
|
||||
}
|
||||
|
||||
if(filter_word != ''){
|
||||
g_searchText = filter_word;
|
||||
data.filter_word = filter_word;
|
||||
} else if(g_searchText != ""){
|
||||
data.filter_word = g_searchText;
|
||||
}
|
||||
|
||||
jQuery("#list_layouts_cats").html('Loading...');
|
||||
|
||||
|
||||
g_ucAdmin.ajaxRequest("get_layouts_categories", data, function(response){
|
||||
|
||||
var html = "<table>"; //prepare html
|
||||
|
||||
jQuery.each(response.cats_list, function(key, value){
|
||||
|
||||
var addHTML = ""; //for selected attr
|
||||
|
||||
if(value.id == g_selectedCatID)
|
||||
addHTML = "selected";
|
||||
|
||||
html += "<tr class='category " + addHTML + "' data-catid='"+value.id+"' data-countl='"+value.num_layouts+"'><td class='cat-name'>"+value.title+"</td><td class='controls'></td></tr>";
|
||||
});
|
||||
|
||||
html += "</table>";
|
||||
|
||||
jQuery("#list_layouts_cats").html(html);
|
||||
|
||||
jQuery("#list_layouts_cats td.controls:gt(0)").append(" <span class='uc_layout_category_rename'>rename</span> | <span class='uc-link-delete-category'>delete</span>")
|
||||
|
||||
scrollToCat(g_selectedCatID);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* show dialog with custom text (for messages)
|
||||
*/
|
||||
function showMsgCats(msg, isError){
|
||||
|
||||
if(isError == true)
|
||||
msg = "<div class='unite-color-red'>"+msg+"</div>";
|
||||
|
||||
jQuery("#uc_layout_categories_message").html(msg);
|
||||
jQuery("#uc_layout_categories_message").dialog({
|
||||
minWidth:400,
|
||||
buttons:{
|
||||
"Close":function(){
|
||||
jQuery("#uc_layout_categories_message").dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hide my dialog
|
||||
*/
|
||||
function hideMsgCats(){
|
||||
jQuery('#uc_layout_categories_message').dialog('close').html("");
|
||||
}
|
||||
|
||||
/**
|
||||
* function for add new category
|
||||
*/
|
||||
function addCategory(){
|
||||
|
||||
var data = {};
|
||||
data.catname = jQuery("#uc_dialog_add_category_catname").val();
|
||||
data.type = "layout";
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_add_category", "add_category", data, function(response){
|
||||
loadCats();
|
||||
}, {noclose: true});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* function initialige manage category dialog and some events
|
||||
*/
|
||||
function initManageCategoryDialog(){
|
||||
|
||||
jQuery("#uc_dialog_add_category_button_add").on("click",addCategory);
|
||||
|
||||
// set update title onenter function
|
||||
jQuery("#uc_dialog_add_category_catname").keyup(function(event){
|
||||
if(event.keyCode == 13)
|
||||
addCategory();
|
||||
});
|
||||
|
||||
// set events
|
||||
jQuery(document).on('click', '.uc_layout_category_rename', function(){
|
||||
renameCategory(this);
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '#list_layouts_cats tr.category', function(){
|
||||
if(g_selectedCatID != -1)
|
||||
jQuery('tr.category[data-catid='+g_selectedCatID+']').removeClass('selected');
|
||||
|
||||
g_selectedCatID = jQuery(this).data('catid');
|
||||
jQuery(this).addClass('selected')
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function that show input and needed buttons to edit name category
|
||||
*/
|
||||
function renameCategory(elem){
|
||||
|
||||
if(!g_canRename)
|
||||
return false;
|
||||
|
||||
g_canRename = false;
|
||||
var parent = jQuery(elem).parent('td').parent('tr');
|
||||
|
||||
var catid = jQuery(parent).data('catid');
|
||||
|
||||
var val_form = jQuery(parent).find('td.cat-name').html();
|
||||
g_oldCatTitle = val_form;
|
||||
|
||||
var html = "<input name='egn-change-name' data-catid='"+catid+"' value='"+val_form+"' type='text'><button class='egn-save-inp unite-button-primary'>Save</button><button class='egn-cancel-inp unite-button-secondary'>cancel</button>";
|
||||
jQuery(parent).find('td.cat-name').html(html);
|
||||
}
|
||||
|
||||
/**
|
||||
* hide input and buttons and instead show name of category
|
||||
*/
|
||||
function closeEdit(catId, txt){
|
||||
jQuery('.category[data-catid='+catId+'] td.cat-name').html(txt);
|
||||
g_canRename = true;
|
||||
g_oldCatTitle = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* prepare for save category name
|
||||
*/
|
||||
function saveCatName(elem){
|
||||
|
||||
var parent = jQuery(elem).parent('td');
|
||||
jQuery(elem).attr('disabled', 'true').html('Saving...');
|
||||
var objInput = jQuery(parent).find('input[name=egn-change-name]');
|
||||
|
||||
var catid = objInput.data('catid');
|
||||
var newTitle = objInput.val();
|
||||
|
||||
updateCategoryTitle(catid, newTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* scroll to needed category by id
|
||||
*/
|
||||
function scrollToCat(catID){
|
||||
|
||||
if(catID == 0 || catID == '' || catID == -1)
|
||||
return false;
|
||||
|
||||
jQuery('#list_layouts_cats').scrollTop(parseInt(jQuery('.category[data-catid='+catID+']').offset().top - 134));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* function invoke from the dialog update button
|
||||
*/
|
||||
function updateCategoryTitle(catID, newTitle){
|
||||
|
||||
var data = {
|
||||
cat_id: catID,
|
||||
title: newTitle
|
||||
};
|
||||
|
||||
//show update error
|
||||
g_ucAdmin.setErrorMessageID(function(message, operation){
|
||||
|
||||
jQuery('.egn-save-inp:disabled').removeAttr('disabled').html('Save');
|
||||
showMsgCats(message, true);
|
||||
|
||||
});
|
||||
|
||||
g_ucAdmin.ajaxRequest("update_category", data, function(response){
|
||||
|
||||
jQuery('a.uc-layouts-list-category[data-catid='+catID+']').html(newTitle);
|
||||
closeEdit(catID, newTitle);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* get id from current selected category
|
||||
*/
|
||||
function getSelectedCatIDFromHtmlTable(){
|
||||
|
||||
var id = parseInt(jQuery('#list_layouts_cats table tr.category.selected').data('catid'));
|
||||
|
||||
if(!isNaN(id))
|
||||
return id;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get name category by id (using list of categories)
|
||||
*/
|
||||
function getCategoryNameFromHtmlTableById(id){
|
||||
|
||||
var name = jQuery('#list_layouts_cats table tr.category[data-catid='+id+'] td.cat-name').html();
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete category
|
||||
*/
|
||||
function deleteCat(catId){
|
||||
|
||||
jQuery('.egn-btn-del').attr('disabled', 'true').html('deleting...');
|
||||
var catId = parseInt(catId);
|
||||
if(isNaN(catId))
|
||||
return false;
|
||||
|
||||
var data = {};
|
||||
data.catID = catId;
|
||||
data.type = 'layout';
|
||||
|
||||
g_ucAdmin.ajaxRequest("remove_category", data, function(response){
|
||||
g_isDeleteInProcess = false;
|
||||
jQuery('a.uc-layouts-list-category[data-catid='+catId+']').html('Uncategorized').attr("data-catid", 0).data('catid', 0);
|
||||
|
||||
hideMsgCats();
|
||||
|
||||
if(g_selectedCatID == catId)
|
||||
g_selectedCatID = -1;
|
||||
|
||||
loadCats();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* event handler for delete label, prepare data and check count of categories
|
||||
*/
|
||||
jQuery(document).on('click', '.uc-link-delete-category', function(){
|
||||
|
||||
if(g_isDeleteInProcess)
|
||||
return false;
|
||||
|
||||
g_isDeleteInProcess = true;
|
||||
|
||||
var parent = jQuery(this).parent('td').parent('tr');
|
||||
|
||||
var catid = jQuery(parent).data('catid');
|
||||
|
||||
if(!catid || catid == '')
|
||||
return false;
|
||||
|
||||
var count = jQuery(parent).data('countl');
|
||||
|
||||
if(count > 0){
|
||||
showMsgCats('This category contains layouts. Are you sure? <br/><br/><a class="unite-button-primary egn-btn-del uc-button-delete-category" href="javascript:void(0)" data-catid="'+catid+'">Yes, delete category</a>');
|
||||
} else {
|
||||
showMsgCats('deleting...');
|
||||
deleteCat(catid);
|
||||
g_isDeleteInProcess = false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* set category to layout (receives button object)
|
||||
*/
|
||||
function setCategoryForLayout(){
|
||||
|
||||
var catID = getSelectedCatIDFromHtmlTable();
|
||||
var layoutID = g_openedLayout;
|
||||
|
||||
data = {
|
||||
layoutid: layoutID,
|
||||
catid: catID
|
||||
};
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_add_category", "update_layout_category", data, function(){
|
||||
|
||||
var objTableItem = jQuery('a.uc-layouts-list-category[data-layoutid='+layoutID+']');
|
||||
|
||||
objTableItem.html(getCategoryNameFromHtmlTableById(catID));
|
||||
objTableItem.attr("data-catid", catID).data('catid', catID);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clear filter (clear variables and input and reload list of categories)
|
||||
*/
|
||||
function filterClear(){
|
||||
g_searchText = "";
|
||||
jQuery('.uc-catdialog-button-clearfilter').val('');
|
||||
loadCats();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init the categories
|
||||
*/
|
||||
function initCategories(){
|
||||
|
||||
g_selectedCatID = -1;
|
||||
|
||||
initEventsCats();
|
||||
initManageCategoryDialog();
|
||||
}
|
||||
|
||||
|
||||
function ___________INIT_____________(){}
|
||||
|
||||
/**
|
||||
* objects list view
|
||||
*/
|
||||
this.initObjectsListView = function(){
|
||||
|
||||
g_tableLayouts = jQuery("#uc_table_layouts");
|
||||
if(g_tableLayouts.length == 0)
|
||||
g_tableLayouts = null;
|
||||
|
||||
//g_ucAdmin.validateDomElement(g_tableLayouts, "table layouts");
|
||||
|
||||
initGlobalSettingsDialog();
|
||||
t.initImportLayoutDialog();
|
||||
|
||||
t.initImportPageCatalog();
|
||||
|
||||
initEvents();
|
||||
|
||||
initCategories();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,680 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorAdmin_ObjectsList(){
|
||||
|
||||
var t = this;
|
||||
var g_providerAdmin = new UniteProviderAdminUC();
|
||||
var g_tableObjects;
|
||||
|
||||
//layouts related
|
||||
var g_selectedCatID = -1, g_openedLayout = -1, g_selectedSort = "";
|
||||
var g_searchText,g_oldCatTitle = "", g_canRename = true;
|
||||
var g_isDeleteInProcess = false;
|
||||
var g_options = {
|
||||
enable_categories: false
|
||||
};
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
|
||||
/**
|
||||
* init global settings dialog
|
||||
*/
|
||||
function initGlobalSettingsDialog(){
|
||||
|
||||
//init settings
|
||||
var settingsWrapper = jQuery("#uc_layout_general_settings");
|
||||
|
||||
|
||||
g_settingsGlobal = new UniteSettingsUC();
|
||||
g_settingsGlobal.init(settingsWrapper);
|
||||
|
||||
//on open dialog click
|
||||
jQuery("#uc_layouts_global_settings").on("click",function(){
|
||||
|
||||
var dialogOptions = {
|
||||
minWidth: 750
|
||||
};
|
||||
|
||||
g_ucAdmin.openCommonDialog("#uc_dialog_layout_global_settings", null, dialogOptions);
|
||||
|
||||
});
|
||||
|
||||
jQuery("#uc_dialog_layout_global_settings_action").on("click",function(){
|
||||
|
||||
var settingsData = g_settingsGlobal.getSettingsValues();
|
||||
var data = {
|
||||
settings_values: settingsData
|
||||
};
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_layout_global_settings", "update_global_layout_settings", data);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* run delete action
|
||||
*/
|
||||
function runActionDelete(objectID){
|
||||
|
||||
var actionDelete = g_options["action_delete"];
|
||||
|
||||
var data = {
|
||||
id: objectID
|
||||
};
|
||||
|
||||
|
||||
g_ucAdmin.ajaxRequest(actionDelete, data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on delete layout click
|
||||
*/
|
||||
function onActionButtonClick(){
|
||||
|
||||
var objButton = jQuery(this);
|
||||
var action = objButton.data("action");
|
||||
|
||||
var objLoader = objButton.siblings(".uc-loader-"+action);
|
||||
|
||||
var textConfirm = g_tableObjects.data("text-confirm-"+action);
|
||||
if(textConfirm){
|
||||
if(confirm(textConfirm) == false)
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(objLoader){
|
||||
objButton.hide();
|
||||
objLoader.show();
|
||||
}
|
||||
|
||||
var objectID = objButton.data("id");
|
||||
|
||||
switch(action){
|
||||
case "delete":
|
||||
runActionDelete(objectID);
|
||||
break;
|
||||
default:
|
||||
throw new Error("No action: "+action);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* duplicating addon
|
||||
*/
|
||||
function onDuplicateClick(){
|
||||
var objButton = jQuery(this);
|
||||
var objLoader = objButton.siblings(".uc-loader-duplicate");
|
||||
|
||||
objButton.hide();
|
||||
objLoader.show();
|
||||
|
||||
var layoutID = objButton.data("layoutid");
|
||||
|
||||
var data = {
|
||||
layout_id: layoutID
|
||||
};
|
||||
|
||||
g_ucAdmin.ajaxRequest("duplicate_layout", data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on export click
|
||||
*/
|
||||
this.onExportClick = function(){
|
||||
var objButton = jQuery(this);
|
||||
var layoutID = objButton.data("layoutid");
|
||||
|
||||
var params = "id="+layoutID;
|
||||
var urlExport = g_ucAdmin.getUrlAjax("export_layout", params);
|
||||
|
||||
location.href=urlExport;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ___________IMPORT_DIALOG_____________(){}
|
||||
|
||||
|
||||
/**
|
||||
* open import layout dialog
|
||||
*/
|
||||
function openImportLayoutDialog(){
|
||||
|
||||
jQuery("#dialog_import_layouts_file").val("");
|
||||
|
||||
var options = {minWidth:700,minHeight:190};
|
||||
|
||||
g_ucAdmin.openCommonDialog("#uc_dialog_import_layouts", null, options);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init import layout dialog
|
||||
*/
|
||||
this.initImportLayoutDialog = function(){
|
||||
jQuery("#uc_button_import_layout").on("click",openImportLayoutDialog);
|
||||
|
||||
jQuery("#uc_dialog_import_layouts_action").on("click",function(){
|
||||
|
||||
var isOverwrite = jQuery("#dialog_import_layouts_file_overwrite").is(":checked");
|
||||
var data = {overwrite_addons:isOverwrite};
|
||||
|
||||
var objData = new FormData();
|
||||
var jsonData = JSON.stringify(data);
|
||||
objData.append("data", jsonData);
|
||||
|
||||
g_ucAdmin.addFormFilesToData("dialog_import_layouts_form", objData);
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_import_layouts", "import_layouts", objData);
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* init view events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
if(g_tableObjects){
|
||||
|
||||
g_tableObjects.on("click", ".uc-button-action", onActionButtonClick);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ___________CATEGORIES_____________(){}
|
||||
|
||||
|
||||
/**
|
||||
* init categories related events
|
||||
*/
|
||||
function initEventsCats(){
|
||||
|
||||
|
||||
/**
|
||||
* event handler for clear filter
|
||||
*/
|
||||
jQuery(document).on('click', '.uc-catdialog-button-filter-clear', function(){
|
||||
filterClear();
|
||||
});
|
||||
|
||||
/**
|
||||
* event handler for filter by word
|
||||
*/
|
||||
jQuery(document).on('click', '.uc-catdialog-button-filter', function(){
|
||||
var val = jQuery('.uc-catdialog-button-clearfilter').val();
|
||||
if(val == '')
|
||||
{
|
||||
filterClear();
|
||||
return;
|
||||
}
|
||||
loadCats(g_selectedCatID, g_selectedSort, val);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* handler to submit delete button
|
||||
*/
|
||||
jQuery(document).on('click', '.uc-button-delete-category', function(){
|
||||
|
||||
var catid = parseInt(jQuery(this).data('catid'));
|
||||
if(isNaN(catid))
|
||||
catid = jQuery(this).attr('data-catid');
|
||||
|
||||
deleteCat(catid);
|
||||
});
|
||||
|
||||
|
||||
//event handler for change sort
|
||||
jQuery(document).on('click', 'a.uc-link-change-cat-sort', function(){
|
||||
|
||||
var type = jQuery(this).data('type');
|
||||
|
||||
if(type == g_selectedSort)
|
||||
return false;
|
||||
|
||||
g_selectedSort = type;
|
||||
|
||||
loadCats(g_selectedCatID, type);
|
||||
|
||||
});
|
||||
|
||||
|
||||
// event handler for button set category
|
||||
jQuery("#uc_dialog_add_category_action").on("click",setCategoryForLayout);
|
||||
|
||||
jQuery(".uc-layouts-list-category").on("click",onChangeCategoryClick);
|
||||
|
||||
//function for event "click" button cancel while editing category
|
||||
jQuery(document).on('click', '.egn-cancel-inp', function(){
|
||||
var parent = jQuery(this).parent('td').parent('tr');
|
||||
var catid = jQuery(parent).data('catid');
|
||||
|
||||
//cancel editing
|
||||
closeEdit(catid, g_oldCatTitle);
|
||||
});
|
||||
|
||||
|
||||
//click save event handler
|
||||
jQuery(document).on('click', '.egn-save-inp', function(){
|
||||
saveCatName(this);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* on change category on layouts table click
|
||||
*/
|
||||
function onChangeCategoryClick(){
|
||||
|
||||
var objButton = jQuery(this);
|
||||
|
||||
var action = objButton.data("action");
|
||||
var layoutID = objButton.data("layoutid");
|
||||
|
||||
var catID = objButton.data("catid");
|
||||
catID = parseInt(catID);
|
||||
|
||||
openManageCategoryDialog(layoutID, catID);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* open add category dialog
|
||||
*/
|
||||
function openManageCategoryDialog(layoutID, catID){
|
||||
|
||||
var objDialog = jQuery("#uc_dialog_add_category");
|
||||
objDialog.data("catid", catID);
|
||||
objDialog.data("layoutid", layoutID);
|
||||
|
||||
g_selectedCatID = catID;
|
||||
|
||||
g_openedLayout = layoutID;
|
||||
|
||||
g_ucAdmin.openCommonDialog("#uc_dialog_add_category", function(){
|
||||
|
||||
loadCats(catID);
|
||||
|
||||
jQuery("#uc_dialog_add_category_catname").val("").focus();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* showing list of categories
|
||||
**/
|
||||
function loadCats(sort, filter_word){
|
||||
|
||||
var data = {};
|
||||
data.type = "layout";
|
||||
|
||||
if(sort == 'a-z' || sort == 'z-a'){
|
||||
data.sort = sort;
|
||||
} else if(g_selectedSort != ''){
|
||||
data.sort = g_selectedSort;
|
||||
}
|
||||
|
||||
if(filter_word != ''){
|
||||
g_searchText = filter_word;
|
||||
data.filter_word = filter_word;
|
||||
} else if(g_searchText != ""){
|
||||
data.filter_word = g_searchText;
|
||||
}
|
||||
|
||||
jQuery("#list_layouts_cats").html('Loading...');
|
||||
|
||||
g_ucAdmin.ajaxRequest("get_layouts_categories", data, function(response){
|
||||
|
||||
var html = "<table>"; //prepare html
|
||||
|
||||
jQuery.each(response.cats_list, function(key, value){
|
||||
|
||||
var addHTML = ""; //for selected attr
|
||||
|
||||
if(value.id == g_selectedCatID)
|
||||
addHTML = "selected";
|
||||
|
||||
html += "<tr class='category " + addHTML + "' data-catid='"+value.id+"' data-countl='"+value.num_layouts+"'><td class='cat-name'>"+value.title+"</td><td class='controls'></td></tr>";
|
||||
});
|
||||
|
||||
html += "</table>";
|
||||
|
||||
jQuery("#list_layouts_cats").html(html);
|
||||
|
||||
jQuery("#list_layouts_cats td.controls:gt(0)").append(" <span class='uc_layout_category_rename'>rename</span> | <span class='uc-link-delete-category'>delete</span>")
|
||||
|
||||
scrollToCat(g_selectedCatID);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* show dialog with custom text (for messages)
|
||||
*/
|
||||
function showMsgCats(msg, isError){
|
||||
|
||||
if(isError == true)
|
||||
msg = "<div class='unite-color-red'>"+msg+"</div>";
|
||||
|
||||
jQuery("#uc_layout_categories_message").html(msg);
|
||||
jQuery("#uc_layout_categories_message").dialog({
|
||||
minWidth:400,
|
||||
buttons:{
|
||||
"Close":function(){
|
||||
jQuery("#uc_layout_categories_message").dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hide my dialog
|
||||
*/
|
||||
function hideMsgCats(){
|
||||
jQuery('#uc_layout_categories_message').dialog('close').html("");
|
||||
}
|
||||
|
||||
/**
|
||||
* function for add new category
|
||||
*/
|
||||
function addCategory(){
|
||||
|
||||
var data = {};
|
||||
data.catname = jQuery("#uc_dialog_add_category_catname").val();
|
||||
data.type = "layout";
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_add_category", "add_category", data, function(response){
|
||||
loadCats();
|
||||
}, {noclose: true});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* function initialige manage category dialog and some events
|
||||
*/
|
||||
function initManageCategoryDialog(){
|
||||
|
||||
jQuery("#uc_dialog_add_category_button_add").on("click",addCategory);
|
||||
|
||||
// set update title onenter function
|
||||
jQuery("#uc_dialog_add_category_catname").keyup(function(event){
|
||||
if(event.keyCode == 13)
|
||||
addCategory();
|
||||
});
|
||||
|
||||
// set events
|
||||
jQuery(document).on('click', '.uc_layout_category_rename', function(){
|
||||
renameCategory(this);
|
||||
});
|
||||
|
||||
jQuery(document).on('click', '#list_layouts_cats tr.category', function(){
|
||||
if(g_selectedCatID != -1)
|
||||
jQuery('tr.category[data-catid='+g_selectedCatID+']').removeClass('selected');
|
||||
|
||||
g_selectedCatID = jQuery(this).data('catid');
|
||||
jQuery(this).addClass('selected')
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function that show input and needed buttons to edit name category
|
||||
*/
|
||||
function renameCategory(elem){
|
||||
|
||||
if(!g_canRename)
|
||||
return false;
|
||||
|
||||
g_canRename = false;
|
||||
var parent = jQuery(elem).parent('td').parent('tr');
|
||||
|
||||
var catid = jQuery(parent).data('catid');
|
||||
|
||||
var val_form = jQuery(parent).find('td.cat-name').html();
|
||||
g_oldCatTitle = val_form;
|
||||
|
||||
var html = "<input name='egn-change-name' data-catid='"+catid+"' value='"+val_form+"' type='text'><button class='egn-save-inp unite-button-primary'>Save</button><button class='egn-cancel-inp unite-button-secondary'>cancel</button>";
|
||||
jQuery(parent).find('td.cat-name').html(html);
|
||||
}
|
||||
|
||||
/**
|
||||
* hide input and buttons and instead show name of category
|
||||
*/
|
||||
function closeEdit(catId, txt){
|
||||
jQuery('.category[data-catid='+catId+'] td.cat-name').html(txt);
|
||||
g_canRename = true;
|
||||
g_oldCatTitle = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* prepare for save category name
|
||||
*/
|
||||
function saveCatName(elem){
|
||||
|
||||
var parent = jQuery(elem).parent('td');
|
||||
jQuery(elem).attr('disabled', 'true').html('Saving...');
|
||||
var objInput = jQuery(parent).find('input[name=egn-change-name]');
|
||||
|
||||
var catid = objInput.data('catid');
|
||||
var newTitle = objInput.val();
|
||||
|
||||
updateCategoryTitle(catid, newTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* scroll to needed category by id
|
||||
*/
|
||||
function scrollToCat(catID){
|
||||
|
||||
if(catID == 0 || catID == '' || catID == -1)
|
||||
return false;
|
||||
|
||||
jQuery('#list_layouts_cats').scrollTop(parseInt(jQuery('.category[data-catid='+catID+']').offset().top - 134));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* function invoke from the dialog update button
|
||||
*/
|
||||
function updateCategoryTitle(catID, newTitle){
|
||||
|
||||
var data = {
|
||||
cat_id: catID,
|
||||
title: newTitle
|
||||
};
|
||||
|
||||
//show update error
|
||||
g_ucAdmin.setErrorMessageID(function(message, operation){
|
||||
|
||||
jQuery('.egn-save-inp:disabled').removeAttr('disabled').html('Save');
|
||||
showMsgCats(message, true);
|
||||
|
||||
});
|
||||
|
||||
g_ucAdmin.ajaxRequest("update_category", data, function(response){
|
||||
|
||||
jQuery('a.uc-layouts-list-category[data-catid='+catID+']').html(newTitle);
|
||||
closeEdit(catID, newTitle);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* get id from current selected category
|
||||
*/
|
||||
function getSelectedCatIDFromHtmlTable(){
|
||||
|
||||
var id = parseInt(jQuery('#list_layouts_cats table tr.category.selected').data('catid'));
|
||||
|
||||
if(!isNaN(id))
|
||||
return id;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get name category by id (using list of categories)
|
||||
*/
|
||||
function getCategoryNameFromHtmlTableById(id){
|
||||
|
||||
var name = jQuery('#list_layouts_cats table tr.category[data-catid='+id+'] td.cat-name').html();
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete category
|
||||
*/
|
||||
function deleteCat(catId){
|
||||
|
||||
jQuery('.egn-btn-del').attr('disabled', 'true').html('deleting...');
|
||||
var catId = parseInt(catId);
|
||||
if(isNaN(catId))
|
||||
return false;
|
||||
|
||||
var data = {};
|
||||
data.catID = catId;
|
||||
data.type = 'layout';
|
||||
|
||||
g_ucAdmin.ajaxRequest("remove_category", data, function(response){
|
||||
g_isDeleteInProcess = false;
|
||||
jQuery('a.uc-layouts-list-category[data-catid='+catId+']').html('Uncategorized').attr("data-catid", 0).data('catid', 0);
|
||||
|
||||
hideMsgCats();
|
||||
|
||||
if(g_selectedCatID == catId)
|
||||
g_selectedCatID = -1;
|
||||
|
||||
loadCats();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* event handler for delete label, prepare data and check count of categories
|
||||
*/
|
||||
jQuery(document).on('click', '.uc-link-delete-category', function(){
|
||||
|
||||
if(g_isDeleteInProcess)
|
||||
return false;
|
||||
|
||||
g_isDeleteInProcess = true;
|
||||
|
||||
var parent = jQuery(this).parent('td').parent('tr');
|
||||
|
||||
var catid = jQuery(parent).data('catid');
|
||||
|
||||
if(!catid || catid == '')
|
||||
return false;
|
||||
|
||||
var count = jQuery(parent).data('countl');
|
||||
|
||||
if(count > 0){
|
||||
showMsgCats('This category contains layouts. Are you sure? <br/><br/><a class="unite-button-primary egn-btn-del uc-button-delete-category" href="javascript:void(0)" data-catid="'+catid+'">Yes, delete category</a>');
|
||||
} else {
|
||||
showMsgCats('deleting...');
|
||||
deleteCat(catid);
|
||||
g_isDeleteInProcess = false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* set category to layout (receives button object)
|
||||
*/
|
||||
function setCategoryForLayout(){
|
||||
|
||||
var catID = getSelectedCatIDFromHtmlTable();
|
||||
var layoutID = g_openedLayout;
|
||||
|
||||
data = {
|
||||
layoutid: layoutID,
|
||||
catid: catID
|
||||
};
|
||||
|
||||
g_ucAdmin.dialogAjaxRequest("uc_dialog_add_category", "update_layout_category", data, function(){
|
||||
|
||||
var objTableItem = jQuery('a.uc-layouts-list-category[data-layoutid='+layoutID+']');
|
||||
|
||||
objTableItem.html(getCategoryNameFromHtmlTableById(catID));
|
||||
objTableItem.attr("data-catid", catID).data('catid', catID);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clear filter (clear variables and input and reload list of categories)
|
||||
*/
|
||||
function filterClear(){
|
||||
g_searchText = "";
|
||||
jQuery('.uc-catdialog-button-clearfilter').val('');
|
||||
loadCats();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init the categories
|
||||
*/
|
||||
function initCategories(){
|
||||
|
||||
g_selectedCatID = -1;
|
||||
|
||||
initEventsCats();
|
||||
initManageCategoryDialog();
|
||||
}
|
||||
|
||||
|
||||
function ___________INIT_____________(){}
|
||||
|
||||
/**
|
||||
* init options
|
||||
*/
|
||||
function initOptions(paramsOptions){
|
||||
trace(paramsOptions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* objects list view
|
||||
*/
|
||||
this.initObjectsListView = function(options){
|
||||
|
||||
g_tableObjects = jQuery("#uc_table_objects");
|
||||
if(g_tableObjects.length == 0)
|
||||
g_tableObjects = null;
|
||||
|
||||
var objWrapper = jQuery("#uc_table_objects_wrapper");
|
||||
g_ucAdmin.validateDomElement(objWrapper, "Table Wrapper");
|
||||
|
||||
//init options
|
||||
var options = objWrapper.data("options");
|
||||
jQuery.extend(g_options, options);
|
||||
|
||||
initEvents();
|
||||
|
||||
if(g_options.enable_categories == true)
|
||||
initCategories();
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorAdmin_Template(){
|
||||
|
||||
var t = this;
|
||||
var g_templateID, g_objWrapper;
|
||||
var g_objSettings = new UniteSettingsUC();
|
||||
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
|
||||
function _______GENERAL_________(){}
|
||||
|
||||
|
||||
/**
|
||||
* on update layout button click
|
||||
*/
|
||||
function onUpdateClick(){
|
||||
|
||||
var settingsValues = g_objSettings.getSettingsValues();
|
||||
|
||||
var data = {
|
||||
params: settingsValues
|
||||
};
|
||||
|
||||
if(g_templateID)
|
||||
data.id = g_templateID;
|
||||
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID("uc_loader_update");
|
||||
g_ucAdmin.setAjaxHideButtonID("uc_button_update_template");
|
||||
g_ucAdmin.setSuccessMessageID("uc_message_addon_updated");
|
||||
|
||||
|
||||
g_ucAdmin.ajaxRequest("create_update_template", data);
|
||||
}
|
||||
|
||||
|
||||
function _______INIT_________(){}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
jQuery("#uc_button_update_template").on("click",onUpdateClick);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* objects list view
|
||||
*/
|
||||
this.initTemplateView = function(){
|
||||
|
||||
g_objWrapper = jQuery("#uc_templates_wrapper");
|
||||
|
||||
var objSettingsWrapper = jQuery("#uc_template_settings");
|
||||
g_objSettings.init(objSettingsWrapper);
|
||||
|
||||
initEvents();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,861 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* browser object
|
||||
*/
|
||||
function UniteCreatorBrowser(){
|
||||
|
||||
var g_objWrapper, g_objTabsWrapper, g_objBackButton;
|
||||
var g_objLoader;
|
||||
var g_objCatalog, g_objHeaderMenu;
|
||||
var g_objSearchInput, g_addParams = null;
|
||||
|
||||
var g_objCache = {};
|
||||
|
||||
//return events to the caller with g_temp.funcResponse
|
||||
this.events = {
|
||||
LOADING_ADDON: "loading_addon",
|
||||
ADDON_DATA: "addon_data"
|
||||
};
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
|
||||
//temp vars
|
||||
var g_temp = {
|
||||
funcResponse: null,
|
||||
addonType: "",
|
||||
isPages:false,
|
||||
isDialogInited:false,
|
||||
prefix:"",
|
||||
isSelectMode:false,
|
||||
lastOpenedTime:null,
|
||||
objTriggerElement:null,
|
||||
isInsideManager:false
|
||||
};
|
||||
|
||||
var t = this;
|
||||
|
||||
function _______________TABS__________(){}
|
||||
|
||||
|
||||
/**
|
||||
* return if tab selected or not
|
||||
*/
|
||||
function isTabSelected(objTab){
|
||||
if(objTab.hasClass("uc-tab-selected"))
|
||||
return(true);
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* select some tab
|
||||
*/
|
||||
function selectTab(objTab){
|
||||
|
||||
if(objTab.hasClass("uc-browser-tab") == false)
|
||||
throw new Error("Wrong tab object");
|
||||
|
||||
var objOtherTabs = getObjTabs(objTab);
|
||||
|
||||
objOtherTabs.removeClass("uc-tab-selected");
|
||||
objTab.addClass("uc-tab-selected");
|
||||
|
||||
//show content, hide others
|
||||
var catID = objTab.data("catid");
|
||||
|
||||
showContentCategory(catID);
|
||||
}
|
||||
|
||||
/**
|
||||
* select first visible tab
|
||||
*/
|
||||
function selectFirstVisibleTab(){
|
||||
|
||||
var objTabItems = g_objWrapper.find(".uc-browser-tabs-wrapper .uc-tab-item:visible");
|
||||
if(objTabItems.length == 0)
|
||||
return(false);
|
||||
|
||||
var objTab = jQuery(objTabItems[0]).children("a");
|
||||
|
||||
selectTab(objTab);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on tab click function
|
||||
*/
|
||||
function onTabClick(){
|
||||
var objTab = jQuery(this);
|
||||
if(isTabSelected(objTab))
|
||||
return(true);
|
||||
|
||||
selectTab(objTab);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get obj all tabs without some tab
|
||||
*/
|
||||
function getObjTabs(objWithout){
|
||||
var objTabs = g_objWrapper.find(".uc-browser-tabs-wrapper .uc-browser-tab");
|
||||
|
||||
if(objWithout)
|
||||
objTabs = objTabs.not(objWithout);
|
||||
|
||||
return(objTabs);
|
||||
}
|
||||
|
||||
/**
|
||||
* init tabs
|
||||
*/
|
||||
function initTabs(){
|
||||
|
||||
var objTabs = getObjTabs();
|
||||
|
||||
objTabs.on("click",onTabClick);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ________CATALOG_HEADER_MENU__________(){}
|
||||
|
||||
/**
|
||||
* on header menu item click
|
||||
*/
|
||||
function onHeaderMenuClick(){
|
||||
|
||||
var objItem = jQuery(this);
|
||||
g_objHeaderMenu.find("a").not(objItem).removeClass("uc-menu-active");
|
||||
objItem.addClass("uc-menu-active");
|
||||
|
||||
var state = objItem.data("state");
|
||||
|
||||
trace(state);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init header menu
|
||||
*/
|
||||
function initHeaderMenu(){
|
||||
|
||||
g_objHeaderMenu = g_objCatalog.find(".uc-catalog-header-menu");
|
||||
|
||||
if(g_objHeaderMenu.length == 0){
|
||||
g_objHeaderMenu = null;
|
||||
return(false);
|
||||
}
|
||||
|
||||
g_ucAdmin.validateDomElement(g_objHeaderMenu, "header menu");
|
||||
|
||||
g_objHeaderMenu.find("a").on("click",onHeaderMenuClick);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function __________CATALOG_RELATED__________(){}
|
||||
|
||||
/**
|
||||
* get addon data by name
|
||||
*/
|
||||
this.getAddonData = function(addonName){
|
||||
|
||||
if(g_objCache.hasOwnProperty(addonName) == true)
|
||||
return(g_objCache[addonName]);
|
||||
|
||||
var objAddon = g_objCatalog.find(".uc-browser-addon[data-name='"+addonName+"']");
|
||||
|
||||
if(objAddon.length != 1)
|
||||
return(null);
|
||||
|
||||
var objData = getAddonDataFromAddon(objAddon);
|
||||
|
||||
return(objData);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* install addon
|
||||
*/
|
||||
this.installAddon = function(objAddon, catTitle, onInstalledFunc){
|
||||
|
||||
var addonName = objAddon.data("name");
|
||||
|
||||
var isOneClickInstall = false;
|
||||
if(g_temp.isInsideManager == false && (!g_temp.addonType || g_temp.addonType == "layout" || g_temp.addonType == "pages"))
|
||||
isOneClickInstall = true;
|
||||
|
||||
if(!catTitle)
|
||||
var catTitle = objAddon.data("cattitle");
|
||||
|
||||
if(!catTitle){
|
||||
var objContent = objAddon.parents(".uc-browser-content");
|
||||
var catTitle = objContent.data("cattitle");
|
||||
}
|
||||
|
||||
var objInstalled = objAddon.find(".uc-installed-success");
|
||||
if(objInstalled.length == 0)
|
||||
objInstalled = null;
|
||||
|
||||
//set loader
|
||||
objAddon.find(".uc-hover-free").hide();
|
||||
objAddon.find(".uc-installing").show();
|
||||
|
||||
var data = {};
|
||||
data["name"] = addonName;
|
||||
data["cat"] = catTitle;
|
||||
data["type"] = g_temp.addonType;
|
||||
|
||||
if(g_temp.isInsideManager)
|
||||
data["from_manager"] = true;
|
||||
|
||||
g_ucAdmin.setErrorMessageID(function(message){
|
||||
|
||||
objAddon.find(".uc-installing div").hide();
|
||||
objAddon.find(".uc-installing i").hide();
|
||||
objAddon.find(".uc-installing span").hide();
|
||||
objAddon.find("h3").show().html(message);
|
||||
});
|
||||
|
||||
var action = "install_catalog_addon";
|
||||
if(g_temp.isPages == true)
|
||||
action = "install_catalog_page";
|
||||
|
||||
if(g_addParams)
|
||||
data["params"] = g_addParams;
|
||||
|
||||
g_ucAdmin.ajaxRequest(action, data, function(response){
|
||||
|
||||
//set id
|
||||
var id = g_ucAdmin.getVal(response, "addonid");
|
||||
if(!id)
|
||||
id = g_ucAdmin.getVal(response, "layoutid");
|
||||
|
||||
//set alias, replace name
|
||||
var alias = g_ucAdmin.getVal(response, "alias");
|
||||
if(alias){
|
||||
addonName = alias;
|
||||
objAddon.data("name", alias);
|
||||
}
|
||||
|
||||
if(id){
|
||||
objAddon.data("id", id);
|
||||
}
|
||||
|
||||
objAddon.find(".uc-installing").hide();
|
||||
|
||||
//trigger global event
|
||||
var installData = response;
|
||||
installData["addontype"] = g_temp.addonType;
|
||||
installData["name"] = addonName;
|
||||
|
||||
g_ucAdmin.triggerEvent("install_addon", installData);
|
||||
|
||||
|
||||
if(isOneClickInstall == false){
|
||||
objAddon.find(".uc-state-label").hide();
|
||||
objAddon.data("state","installed");
|
||||
|
||||
}else{ //on once click install call response func
|
||||
|
||||
objAddon.find(".uc-hover-free").show();
|
||||
|
||||
if(typeof g_temp.funcResponse == "function")
|
||||
g_temp.funcResponse(response);
|
||||
|
||||
if(objInstalled)
|
||||
objInstalled.show();
|
||||
}
|
||||
|
||||
if(onInstalledFunc)
|
||||
onInstalledFunc(response);
|
||||
|
||||
});
|
||||
|
||||
|
||||
return(false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* on addon click
|
||||
*/
|
||||
function onAddonClick(event){
|
||||
|
||||
//view page click
|
||||
var target = event.target;
|
||||
var objTarget = jQuery(target);
|
||||
if(objTarget.hasClass("uc-hover-label-preview"))
|
||||
return(true);
|
||||
|
||||
|
||||
var objAddon = jQuery(this);
|
||||
var state = objAddon.data("state");
|
||||
|
||||
switch(state){
|
||||
case "free":
|
||||
t.installAddon(objAddon);
|
||||
return(false);
|
||||
break;
|
||||
case "pro":
|
||||
|
||||
return(true);
|
||||
break;
|
||||
}
|
||||
|
||||
var objData = getAddonDataFromAddon(objAddon);
|
||||
|
||||
g_temp.funcResponse(objData);
|
||||
|
||||
closeCatalog();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on addon hover
|
||||
*/
|
||||
this.onAddonHover = function(event, objAddon) {
|
||||
|
||||
if(!objAddon)
|
||||
var objAddon = jQuery(this);
|
||||
|
||||
var objLabel = objAddon.find(".uc-hover-label")
|
||||
if(objLabel.length == 0)
|
||||
return(true);
|
||||
|
||||
if(objLabel.attr('installing') === 'true' || objLabel.attr('installed') === 'true') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(event.type === "mouseenter" || event.type == "item_mouseover") {
|
||||
objAddon.addClass("hover-label-visible");
|
||||
objLabel.removeClass('hidden');
|
||||
} else {
|
||||
objAddon.removeClass("hover-label-visible");
|
||||
|
||||
objLabel.addClass('hidden');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* check if catalog opened
|
||||
*/
|
||||
function isCatalogOpened(){
|
||||
|
||||
var isOpened = g_objCatalog.is(":visible");
|
||||
|
||||
return(isOpened);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* close the catalog
|
||||
*/
|
||||
function closeCatalog(){
|
||||
|
||||
var isOpened = isCatalogOpened();
|
||||
if(isOpened == false)
|
||||
return(true);
|
||||
|
||||
if(g_temp.isSelectMode == true){
|
||||
|
||||
var timeNow = jQuery.now();
|
||||
var diff = timeNow - g_temp.lastOpenedTime;
|
||||
if(diff < 300)
|
||||
return(true);
|
||||
}
|
||||
|
||||
if(g_temp.isSelectMode == false)
|
||||
jQuery("body").removeClass("uc-catalog-open");
|
||||
|
||||
g_objWrapper.hide();
|
||||
g_objCatalog.hide();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* position the catalog
|
||||
*/
|
||||
function positionCatalog(){
|
||||
|
||||
if(g_temp.isSelectMode == false)
|
||||
return(false);
|
||||
|
||||
if(!g_temp.objTriggerElement)
|
||||
return(false);
|
||||
|
||||
var offset = g_ucAdmin.getCustomDialogOffset(g_objCatalog, g_temp.objTriggerElement);
|
||||
|
||||
g_objCatalog.offset(offset);
|
||||
|
||||
//set width
|
||||
var width = g_temp.objTriggerElement.width();
|
||||
g_objCatalog.width(width+10);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* open catalog
|
||||
*/
|
||||
function openCatalog(){
|
||||
|
||||
g_temp.lastOpenedTime = jQuery.now();
|
||||
|
||||
g_objWrapper.show();
|
||||
|
||||
g_objCatalog.show();
|
||||
|
||||
if(g_temp.isSelectMode == false){
|
||||
jQuery("body").addClass("uc-catalog-open");
|
||||
}else{
|
||||
|
||||
//select mode
|
||||
positionCatalog();
|
||||
|
||||
}
|
||||
|
||||
if(g_objSearchInput)
|
||||
g_objSearchInput.focus();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init catalog events
|
||||
*/
|
||||
function initCatalogEvents(){
|
||||
|
||||
//close button
|
||||
g_objCatalog.find(".uc-catalog-button-close").on("click",closeCatalog);
|
||||
|
||||
g_objCatalog.find(".uc-link-update-catalog").on("click",openDialogCatalogUpdate);
|
||||
|
||||
if(g_temp.isSelectMode == true){
|
||||
|
||||
g_objCatalog.on("click",function(event){
|
||||
event.stopPropagation();
|
||||
event.stopImmediatePropagation();
|
||||
});
|
||||
|
||||
|
||||
jQuery("body").on("click",function(){
|
||||
closeCatalog();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get category addons
|
||||
*/
|
||||
function getCatAddons(catID){
|
||||
|
||||
var selector = "#uc_browser_content_"+g_temp.prefix+"_"+catID+" .uc-browser-addon";
|
||||
|
||||
var objAddons = jQuery(selector);
|
||||
|
||||
return(objAddons);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* init the catalog
|
||||
*/
|
||||
function initCatalog(){
|
||||
|
||||
g_objCatalog = g_objWrapper.find(".uc-catalog");
|
||||
|
||||
g_ucAdmin.validateDomElement(g_objCatalog, "addon browser catalog");
|
||||
|
||||
g_objTabsWrapper = g_objWrapper.find(".uc-browser-tabs-wrapper");
|
||||
|
||||
//select mode
|
||||
if(g_objCatalog.hasClass("uc-select-mode"))
|
||||
g_temp.isSelectMode = true;
|
||||
|
||||
initTabs();
|
||||
|
||||
initHeaderMenu();
|
||||
|
||||
initCatalogSearch();
|
||||
|
||||
initCatalogEvents();
|
||||
}
|
||||
|
||||
function _______________SEARCH__________(){}
|
||||
|
||||
|
||||
/**
|
||||
* set categories titles according number of items
|
||||
* only on visible items
|
||||
*/
|
||||
function setCategoriesTitles(){
|
||||
|
||||
var objTabItems = g_objWrapper.find(".uc-browser-tabs-wrapper .uc-tab-item:visible");
|
||||
|
||||
objTabItems.each(function(index, tabItem){
|
||||
var objItem = jQuery(tabItem);
|
||||
var title = objItem.data("title");
|
||||
var catID = objItem.data("catid");
|
||||
var objAddons = getCatAddons(catID);
|
||||
var numAddons = objAddons.not(".uc-item-hidden").length;
|
||||
var showTitle = title+" ("+numAddons+")";
|
||||
objItem.children("a").html(showTitle);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* show all addons and cats that been hidden by search
|
||||
*/
|
||||
function search_showAll(){
|
||||
|
||||
g_objWrapper.find(".uc-item-hidden").removeClass("uc-item-hidden").show();
|
||||
|
||||
setCategoriesTitles();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* do search
|
||||
*/
|
||||
function doCatalogSearch(searchValue){
|
||||
|
||||
searchValue = jQuery.trim(searchValue);
|
||||
|
||||
if(!searchValue){
|
||||
search_showAll();
|
||||
return(true);
|
||||
}
|
||||
|
||||
searchValue = searchValue.toLowerCase();
|
||||
|
||||
var objTabItems = g_objWrapper.find(".uc-browser-tabs-wrapper .uc-tab-item");
|
||||
|
||||
objTabItems.each(function(index, item){
|
||||
var objItem = jQuery(this);
|
||||
var title = objItem.data("title");
|
||||
title = title.toLowerCase();
|
||||
|
||||
var pos = title.indexOf(searchValue);
|
||||
var isCatFound = (pos !== -1);
|
||||
|
||||
var catID = objItem.data('catid');
|
||||
var objAddons = getCatAddons(catID);
|
||||
|
||||
var isSomeAddonFound = false;
|
||||
|
||||
//if category found, all addons will be visible
|
||||
if(isCatFound == true){
|
||||
|
||||
objAddons.removeClass("uc-item-hidden").show();
|
||||
|
||||
}else{ //if cat not found, check addons
|
||||
|
||||
jQuery.each(objAddons, function(index, addon){
|
||||
|
||||
var objAddon = jQuery(addon);
|
||||
|
||||
var addonTitle = objAddon.data("title");
|
||||
addonTitle = addonTitle.toLowerCase();
|
||||
|
||||
var posAddon = addonTitle.indexOf(searchValue);
|
||||
var isAddonFound = (posAddon !== -1);
|
||||
if(isAddonFound == true){
|
||||
isSomeAddonFound = true;
|
||||
objAddon.removeClass("uc-item-hidden").show();
|
||||
|
||||
}else{
|
||||
objAddon.addClass("uc-item-hidden").hide();
|
||||
}
|
||||
|
||||
}); //end foreach addons
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(isCatFound == true || isSomeAddonFound == true){
|
||||
objItem.removeClass("uc-item-hidden").show();
|
||||
}else
|
||||
objItem.addClass("uc-item-hidden").hide();
|
||||
|
||||
});
|
||||
|
||||
//select first cat
|
||||
setCategoriesTitles();
|
||||
selectFirstVisibleTab();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init search in catalog
|
||||
*/
|
||||
function initCatalogSearch(){
|
||||
|
||||
g_objSearchInput = g_objCatalog.find(".uc-catalog-search-input");
|
||||
|
||||
if(g_objSearchInput.length == 0){
|
||||
g_objSearchInput = null;
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
var objButtonClear = g_objCatalog.find(".uc-catalog-search-clear");
|
||||
|
||||
//-- search input
|
||||
|
||||
g_ucAdmin.onChangeInputValue(g_objSearchInput, function(){
|
||||
|
||||
var value = g_objSearchInput.val();
|
||||
value = jQuery.trim(value);
|
||||
|
||||
if(value)
|
||||
objButtonClear.fadeTo(500, 1).removeClass("button-disabled");
|
||||
else
|
||||
objButtonClear.fadeTo(500,0).addClass("button-disabled");
|
||||
|
||||
doCatalogSearch(value);
|
||||
});
|
||||
|
||||
//--clear button
|
||||
|
||||
objButtonClear.on("click",function(){
|
||||
|
||||
var objButton = jQuery(this);
|
||||
if(objButton.hasClass("button-disabled"))
|
||||
return(false);
|
||||
|
||||
//hide button
|
||||
objButton.fadeTo(500,0).addClass("button-disabled");
|
||||
|
||||
g_objSearchInput.val("");
|
||||
search_showAll();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function _______________GENERAL__________(){}
|
||||
|
||||
|
||||
/**
|
||||
* get addon data from addon thumbnail
|
||||
*/
|
||||
function getAddonDataFromAddon(objAddon){
|
||||
|
||||
var addonName = objAddon.data("name");
|
||||
|
||||
if(g_objCache.hasOwnProperty(addonName) == true)
|
||||
return(g_objCache[addonName]);
|
||||
|
||||
var addonTitle = objAddon.data("title");
|
||||
var addonID = objAddon.data("id");
|
||||
|
||||
var bgImage = null;
|
||||
var objBGImage = objAddon.find(".uc-browser-addon-image");
|
||||
if(objBGImage.length)
|
||||
bgImage = objBGImage.css("background-image");
|
||||
|
||||
//load put new addon data, close the catalog first
|
||||
|
||||
if(!addonName)
|
||||
addonName = null;
|
||||
|
||||
if(!addonTitle)
|
||||
addonTitle = null;
|
||||
|
||||
if(!addonID)
|
||||
addonID = null;
|
||||
|
||||
var objData = {
|
||||
"name":addonName,
|
||||
"title":addonTitle,
|
||||
"id":addonID,
|
||||
"addontype":g_temp.addonType,
|
||||
"bgimage":bgImage
|
||||
};
|
||||
|
||||
g_objCache[addonName] = objData;
|
||||
|
||||
return(objData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* show content category
|
||||
*/
|
||||
function showContentCategory(catID){
|
||||
|
||||
var objContent = jQuery("#uc_browser_content_"+g_temp.prefix+"_"+catID);
|
||||
g_objWrapper.find(".uc-browser-content").not(objContent).hide();
|
||||
objContent.show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* open addons browser, for column - add new, for addon - update
|
||||
* objTriggerElement - the button element that trigger the catalog open
|
||||
*/
|
||||
this.openAddonsBrowser = function(currentAddonData, funcResponse, objTriggerElement){
|
||||
|
||||
validateInited();
|
||||
|
||||
if(!funcResponse)
|
||||
throw new Error("There should be response func");
|
||||
|
||||
g_temp.funcResponse = funcResponse;
|
||||
|
||||
g_temp.objTriggerElement = objTriggerElement;
|
||||
if(!objTriggerElement)
|
||||
g_temp.objTriggerElement = null;
|
||||
|
||||
openCatalog();
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init update catalog
|
||||
*/
|
||||
function openDialogCatalogUpdate(){
|
||||
|
||||
var options = {
|
||||
dialogClass:"uc-dialog-catalog-update unite-ui-black",
|
||||
height:300
|
||||
};
|
||||
|
||||
g_ucAdmin.openCommonDialog("uc_dialog_catalog_update", function(){
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID("uc_dialog_catalog_update_loader");
|
||||
jQuery("#uc_dialog_catalog_update_message").html("").hide();
|
||||
|
||||
g_ucAdmin.setErrorMessageID("uc_dialog_catalog_update_error");
|
||||
|
||||
g_ucAdmin.ajaxRequest("check_catalog", {force:true}, function(response){
|
||||
|
||||
var errorMessage = g_ucAdmin.getVal(response,"error_message");
|
||||
if(errorMessage)
|
||||
jQuery("#uc_dialog_catalog_update_error").show().html(errorMessage);
|
||||
|
||||
jQuery("#uc_dialog_catalog_update_message").html(response.message).show();
|
||||
|
||||
});
|
||||
|
||||
|
||||
}, options);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function _______________INIT__________(){}
|
||||
|
||||
/**
|
||||
* validate that the browser inited
|
||||
*/
|
||||
function validateInited(){
|
||||
|
||||
g_ucAdmin.validateDomElement(g_objWrapper, "addon browser");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
g_objWrapper.find(".uc-browser-addon").on("click",onAddonClick);
|
||||
|
||||
//g_objWrapper.find(".buttons-addon").on("click",onAddonButtonClick);
|
||||
g_objWrapper.find(".uc-browser-addon").on("mouseenter", t.onAddonHover);
|
||||
g_objWrapper.find(".uc-browser-addon").on("mouseleave", t.onAddonHover);
|
||||
|
||||
if(g_objBackButton)
|
||||
g_objBackButton.on("click",onBackButtonClick);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* close catalog
|
||||
*/
|
||||
this.closeCatalog = function(){
|
||||
closeCatalog();
|
||||
};
|
||||
|
||||
/**
|
||||
* set addon type
|
||||
*/
|
||||
this.setAddonType = function(addontype, isPages, isFromManager){
|
||||
|
||||
g_temp.addonType = addontype;
|
||||
g_temp.isPages = isPages;
|
||||
g_temp.isInsideManager = isFromManager;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init browser object
|
||||
*/
|
||||
this.init = function(objWrapper, addParams){
|
||||
|
||||
if(!addParams)
|
||||
var addParams = {};
|
||||
|
||||
g_objWrapper = objWrapper;
|
||||
|
||||
//validate wrapper
|
||||
if(g_objWrapper.length == 0){
|
||||
console.trace();
|
||||
return(false);
|
||||
}
|
||||
|
||||
g_temp.addonType = g_objWrapper.data("addontype");
|
||||
|
||||
var isInited = objWrapper.data("is_inited");
|
||||
if(isInited === true){
|
||||
trace(g_temp.addonType);
|
||||
console.trace();
|
||||
throw new Error("The browser is already inited");
|
||||
}
|
||||
|
||||
//add params on install submit
|
||||
g_addParams = addParams;
|
||||
|
||||
g_temp.prefix = g_objWrapper.data("prefix");
|
||||
|
||||
var isPages = g_objWrapper.data("ispages");
|
||||
if(isPages)
|
||||
g_temp.isPages = true;
|
||||
|
||||
initCatalog();
|
||||
|
||||
initEvents();
|
||||
|
||||
g_ucAdmin.initActivationDialog();
|
||||
|
||||
objWrapper.data("is_inited", true);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorHelper() {
|
||||
if (!g_ucAdmin)
|
||||
g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
/**
|
||||
* get random string
|
||||
*/
|
||||
this.getRandomString = g_ucAdmin.getRandomString
|
||||
|
||||
/**
|
||||
* put includes
|
||||
*/
|
||||
this.putIncludes = function (windowElement, includes, onLoaded) {
|
||||
var objWindow = jQuery(windowElement.document);
|
||||
|
||||
// make a list of handles
|
||||
var arrHandles = {};
|
||||
|
||||
jQuery.each(includes, function (index, include) {
|
||||
var handle = prepareIncludeHandle(include);
|
||||
|
||||
// skip jquery for now
|
||||
if (include.handle === "jquery")
|
||||
return;
|
||||
|
||||
arrHandles[handle] = include;
|
||||
});
|
||||
|
||||
// load css files and first js file
|
||||
var isFirstJS = true;
|
||||
|
||||
jQuery.each(includes, function (event, include) {
|
||||
if (include.type === "css") {
|
||||
loadIncludeFile(include);
|
||||
} else { // js (load first only)
|
||||
if (isFirstJS === true) {
|
||||
isFirstJS = false;
|
||||
|
||||
loadIncludeFile(include);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
checkAllFilesLoaded();
|
||||
|
||||
// prepare include handle
|
||||
function prepareIncludeHandle(include) {
|
||||
return "uc_include_" + include.type + "_" + include.handle;
|
||||
}
|
||||
|
||||
// check that all files loaded by handle
|
||||
function checkAllFilesLoaded() {
|
||||
if (jQuery.isEmptyObject(arrHandles) === false)
|
||||
return;
|
||||
|
||||
if (typeof onLoaded === "function")
|
||||
onLoaded();
|
||||
}
|
||||
|
||||
// load include file
|
||||
function loadIncludeFile(objInclude) {
|
||||
var handle = prepareIncludeHandle(objInclude);
|
||||
var type = objInclude.type;
|
||||
var url = objInclude.url;
|
||||
var isModule = objInclude.is_module === true;
|
||||
|
||||
// skip jquery for now
|
||||
if (objInclude.handle === "jquery") {
|
||||
checkAllFilesLoaded();
|
||||
onJsFileLoaded();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {
|
||||
objWindow: objWindow,
|
||||
name: "uc_include_file",
|
||||
replaceID: handle,
|
||||
ismodule: isModule,
|
||||
};
|
||||
|
||||
// onload trigger event when all scripts loaded
|
||||
data.onload = function (obj, handle) {
|
||||
var objDomInclude = jQuery(obj);
|
||||
|
||||
objDomInclude.data("isloaded", true);
|
||||
|
||||
// delete the handle from the list, and check for all files loaded
|
||||
if (arrHandles.hasOwnProperty(handle) === true) {
|
||||
delete arrHandles[handle];
|
||||
|
||||
checkAllFilesLoaded();
|
||||
}
|
||||
|
||||
var tagName = objDomInclude.prop("tagName").toLowerCase();
|
||||
|
||||
if (tagName === "script")
|
||||
onJsFileLoaded();
|
||||
};
|
||||
|
||||
//if file not included - include it
|
||||
var objDomInclude = objWindow.find("#" + handle);
|
||||
|
||||
if (objDomInclude.length === 0) {
|
||||
loadDOMIncludeFile(type, url, data);
|
||||
} else {
|
||||
|
||||
//if the files is in the loading list but still not loaded,
|
||||
//wait until they will be loaded and then check for firing the finish event (addons with same files)
|
||||
|
||||
//check if the file is loaded
|
||||
var isLoaded = objDomInclude.data("isloaded");
|
||||
|
||||
if (isLoaded === true) {
|
||||
//if it's already included - remove from handle
|
||||
if (arrHandles.hasOwnProperty(handle) === true)
|
||||
delete arrHandles[handle];
|
||||
|
||||
var tagName = objDomInclude.prop("tagName").toLowerCase();
|
||||
|
||||
if (tagName === "script")
|
||||
onJsFileLoaded();
|
||||
} else {
|
||||
var timeoutHandle = setInterval(function () {
|
||||
var isLoaded = objDomInclude.data("isloaded");
|
||||
|
||||
if (isLoaded === true) {
|
||||
clearInterval(timeoutHandle);
|
||||
|
||||
if (arrHandles.hasOwnProperty(handle) === true)
|
||||
delete arrHandles[handle];
|
||||
|
||||
checkAllFilesLoaded();
|
||||
|
||||
var tagName = objDomInclude.prop("tagName").toLowerCase();
|
||||
|
||||
if (tagName === "script")
|
||||
onJsFileLoaded();
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// on js file loaded - load next file
|
||||
function onJsFileLoaded() {
|
||||
for (var index in arrHandles) {
|
||||
var include = arrHandles[index];
|
||||
|
||||
if (include.type === "js") {
|
||||
loadIncludeFile(include);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* load include file, js or css
|
||||
*/
|
||||
function loadDOMIncludeFile(type, url, data) {
|
||||
if (!url)
|
||||
return;
|
||||
|
||||
var objWindow = g_ucAdmin.getVal(data, "objWindow");
|
||||
var name = g_ucAdmin.getVal(data, "name");
|
||||
var replaceID = g_ucAdmin.getVal(data, "replaceID");
|
||||
var isModule = g_ucAdmin.getVal(data, "ismodule");
|
||||
var noRand = g_ucAdmin.getVal(data, "norand");
|
||||
var onload = g_ucAdmin.getVal(data, "onload");
|
||||
|
||||
// add random number at the end
|
||||
if (!noRand) {
|
||||
var rand = Math.floor((Math.random() * 100000) + 1);
|
||||
var char = (url.indexOf("?") === -1) ? "?" : "&";
|
||||
|
||||
url += char + "rand=" + rand;
|
||||
}
|
||||
|
||||
if (replaceID)
|
||||
objWindow.find("#" + replaceID).remove();
|
||||
|
||||
switch (type) {
|
||||
case "js":
|
||||
var objTag = jQuery("<script />")
|
||||
.attr("src", url)
|
||||
.attr("type", (isModule === true) ? "module" : null);
|
||||
|
||||
objWindow.find("script:first").before(objTag);
|
||||
break;
|
||||
case "css":
|
||||
var objTag = jQuery("<link />")
|
||||
.attr("rel", "stylesheet")
|
||||
.attr("type", "text/css")
|
||||
.attr("href", url);
|
||||
|
||||
objWindow.find("head").append(objTag);
|
||||
break;
|
||||
default:
|
||||
throw Error("Include type \"" + type + "\" is not implemented.");
|
||||
}
|
||||
|
||||
if (replaceID)
|
||||
objTag.attr("id", replaceID);
|
||||
|
||||
if (name)
|
||||
objTag.attr("name", name);
|
||||
|
||||
if (onload) {
|
||||
objTag.attr("onload", function () {
|
||||
onload(jQuery(this), replaceID);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,860 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorIncludes(){
|
||||
|
||||
var t = this;
|
||||
|
||||
var g_objListJs, g_objListCss, g_objIncludesWrapper;
|
||||
var g_parent;
|
||||
|
||||
//for type autocomplete
|
||||
if(0==1){ //never occure
|
||||
g_parent = new UniteCreatorAdmin();
|
||||
}
|
||||
|
||||
|
||||
var g_temp = {
|
||||
funcOnDelete: null,
|
||||
funcOnInputBlur: null
|
||||
};
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
|
||||
/**
|
||||
* get includes tab data
|
||||
*/
|
||||
this.getIncludesTabData = function(){
|
||||
|
||||
var arrJS = [];
|
||||
var arrJSLib = [];
|
||||
var arrCSS = [];
|
||||
|
||||
var inputJsLib = jQuery("#uc-js-libraries input[type='checkbox']");
|
||||
|
||||
var rowsJs = jQuery("#uc-js-includes li");
|
||||
var rowsCSS = jQuery("#uc-css-includes li");
|
||||
|
||||
//get js libraries
|
||||
jQuery.each(inputJsLib, function(index, input){
|
||||
var objInput = jQuery(input);
|
||||
|
||||
var isChecked = objInput.is(":checked");
|
||||
if(isChecked == false)
|
||||
return(true);
|
||||
|
||||
var libName = objInput.data("include");
|
||||
arrJSLib.push(libName);
|
||||
});
|
||||
|
||||
//get js
|
||||
jQuery.each(rowsJs, function(index, row){
|
||||
var objRow = jQuery(row);
|
||||
var data = getIncludeData(objRow, true);
|
||||
|
||||
arrJS.push(data);
|
||||
});
|
||||
|
||||
//get css
|
||||
jQuery.each(rowsCSS, function(index, row){
|
||||
var objRow = jQuery(row);
|
||||
var data = getIncludeData(objRow, true);
|
||||
arrCSS.push(data);
|
||||
});
|
||||
|
||||
var output = {
|
||||
arrJS:arrJS,
|
||||
arrJSLib:arrJSLib,
|
||||
arrCSS:arrCSS
|
||||
};
|
||||
|
||||
|
||||
return(output);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get all includes array
|
||||
*/
|
||||
this.getArrAllIncludesUrls = function(){
|
||||
|
||||
var data = t.getIncludesTabData();
|
||||
|
||||
var arrIncludes = [];
|
||||
|
||||
jQuery.each(data.arrJS,function(index, include){
|
||||
arrIncludes.push(include.url);
|
||||
});
|
||||
|
||||
jQuery.each(data.arrCSS,function(index, include){
|
||||
arrIncludes.push(include.url);
|
||||
});
|
||||
|
||||
return(arrIncludes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get condition html
|
||||
*/
|
||||
function getHtmlCondition(objCondition){
|
||||
|
||||
if(!objCondition)
|
||||
return("");
|
||||
|
||||
var html = "";
|
||||
|
||||
if(objCondition.name == "never_include")
|
||||
html = "<span class='uc-condition-never'>"+g_uctext.never_include+"</span>";
|
||||
else
|
||||
html = "when "+objCondition.name + " = " + objCondition.value;
|
||||
|
||||
return(html);
|
||||
}
|
||||
|
||||
/**
|
||||
* get state text
|
||||
*/
|
||||
function getHtmlStateText(item){
|
||||
|
||||
if(!item)
|
||||
return(null);
|
||||
|
||||
var text = "";
|
||||
var params = g_ucAdmin.getVal(item, "params");
|
||||
|
||||
//include_after_elementor_frontend
|
||||
var includeAfterFrontend = g_ucAdmin.getVal(params, "include_after_elementor_frontend");
|
||||
includeAfterFrontend = g_ucAdmin.strToBool(includeAfterFrontend);
|
||||
|
||||
if(includeAfterFrontend == true)
|
||||
text += "include after <b>elementor-frontend.js</b>";
|
||||
|
||||
//handle:
|
||||
|
||||
var includeHandle = g_ucAdmin.getVal(params, "include_handle");
|
||||
|
||||
if(includeHandle){
|
||||
|
||||
if(text)
|
||||
text += ", ";
|
||||
|
||||
text += "handle: <b>" + includeHandle+"</b>";
|
||||
}
|
||||
|
||||
//module:
|
||||
var module = g_ucAdmin.getVal(params, "include_as_module");
|
||||
|
||||
if(module){
|
||||
|
||||
if(text)
|
||||
text += ", ";
|
||||
|
||||
text += " type: <b>module</b>";
|
||||
}
|
||||
|
||||
|
||||
return(text);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update the row extra html
|
||||
*/
|
||||
function updateInputExtraHTML(objRow, rowParams){
|
||||
|
||||
var objText = objRow.find(".uc-includes-state-text");
|
||||
|
||||
var item = {params: rowParams};
|
||||
var html = getHtmlStateText(item);
|
||||
|
||||
objText.show();
|
||||
objText.html(html);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get include item html
|
||||
*/
|
||||
function getIncludeListHTML(item){
|
||||
|
||||
var url = "";
|
||||
var objCondition = null;
|
||||
|
||||
//init the input
|
||||
if(item){
|
||||
if(typeof item == "string")
|
||||
url = item;
|
||||
else{
|
||||
url = url = item.url;
|
||||
if(item.hasOwnProperty("condition")){
|
||||
objCondition = item.condition;
|
||||
if(typeof objCondition != "object")
|
||||
objCondition = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var title = "";
|
||||
|
||||
//encode uri
|
||||
var objInfo = g_ucAdmin.pathinfo(url);
|
||||
var filename = objInfo.basename;
|
||||
|
||||
var conditionStyle = " style='display:none'";
|
||||
var htmlCondition = "";
|
||||
|
||||
if(objCondition){
|
||||
htmlCondition = getHtmlCondition(objCondition);
|
||||
conditionStyle = "";
|
||||
}
|
||||
|
||||
var htmlStateText = getHtmlStateText(item);
|
||||
var attributesStyle = " style='display:none'";
|
||||
|
||||
if(htmlStateText)
|
||||
attributesStyle = "";
|
||||
|
||||
var html = '<li>';
|
||||
html += '<div class="uc-includes-handle"></div>';
|
||||
html += '<input type="text" class="uc-includes-url" value="'+url+'">';
|
||||
html += '<input type="text" class="uc-includes-filename" value="'+filename+'" readonly>';
|
||||
html += '<div class="uc-includes-icon uc-includes-delete" title="'+g_uctext.delete_include+'"></div>';
|
||||
html += '<div class="uc-includes-icon uc-includes-add" title="'+g_uctext.add_include+'"></div>';
|
||||
html += '<div class="uc-includes-icon uc-includes-settings" title="'+g_uctext.include_settings+'"></div>';
|
||||
|
||||
html += '<div class="unite-clear"></div>';
|
||||
html += '<div class="uc-condition-container" '+conditionStyle+'>'+htmlCondition+'</div>';
|
||||
html += '<div class="uc-includes-state-text" '+attributesStyle+'>'+htmlStateText+'</div>';
|
||||
html += '</li>';
|
||||
|
||||
var objHtml = jQuery(html);
|
||||
if(objCondition)
|
||||
objHtml.data("condition", objCondition);
|
||||
|
||||
//update params
|
||||
var objParams = g_ucAdmin.getVal(item, "params");
|
||||
if(objParams)
|
||||
objHtml.data("params",objParams);
|
||||
|
||||
return(objHtml)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add a include to the includes list
|
||||
*/
|
||||
function addIncludesListItem(objList, item){
|
||||
|
||||
var objItem = getIncludeListHTML(item);
|
||||
|
||||
objList.append(objItem);
|
||||
|
||||
return(objItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* update inlcude list item
|
||||
*/
|
||||
function updateIncludesListItem(objInput, url){
|
||||
objInput.val(url);
|
||||
objInput.trigger("change");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get first empty include input
|
||||
*/
|
||||
function getEmptyIncludeInput(objList){
|
||||
|
||||
var objInputs = objList.find("input");
|
||||
|
||||
var returnInput = null;
|
||||
|
||||
jQuery.each(objInputs, function(index, input){
|
||||
var objInput = jQuery(input);
|
||||
var val = objInput.val();
|
||||
val = jQuery.trim(val);
|
||||
|
||||
if(val == ""){
|
||||
returnInput = objInput;
|
||||
return(false); //break;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return(returnInput);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* adds includes item to appropriete place from assets
|
||||
* @param objItem
|
||||
*/
|
||||
this.addIncludesFromAssets = function(objItem){
|
||||
|
||||
switch(objItem.type){
|
||||
case "js":
|
||||
var objList = jQuery("#uc-js-includes");
|
||||
break;
|
||||
case "css":
|
||||
var objList = jQuery("#uc-css-includes");
|
||||
break;
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
}
|
||||
|
||||
var url = objItem.full_url;
|
||||
var filename = objItem.file;
|
||||
|
||||
var objInput = getEmptyIncludeInput(objList);
|
||||
|
||||
if(objInput == null)
|
||||
addIncludesListItem(objList, url, filename);
|
||||
else{
|
||||
updateIncludesListItem(objInput, url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* remove include by item data
|
||||
*/
|
||||
this.removeIncludeByAsset = function(itemData){
|
||||
var url = itemData.full_url;
|
||||
|
||||
switch(itemData.type){
|
||||
case "js":
|
||||
var inputs = jQuery("#uc-js-includes input");
|
||||
break;
|
||||
case "css":
|
||||
var inputs = jQuery("#uc-css-includes input");
|
||||
break;
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//get js libraries
|
||||
jQuery.each(inputs, function(index, input){
|
||||
var objInput = jQuery(input);
|
||||
var inputUrl = objInput.val();
|
||||
inputUrl = jQuery.trim(inputUrl);
|
||||
if(inputUrl == url){
|
||||
var listItem = objInput.parents("li");
|
||||
deleteIncludesListItem(listItem);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get num items from includes list
|
||||
*/
|
||||
function getIncludesListNumItems(objList){
|
||||
|
||||
var items = objList.children("li");
|
||||
var numItems = items.length;
|
||||
|
||||
return(numItems);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get item data by row
|
||||
*/
|
||||
function getIncludeData(objRow, noFilename){
|
||||
|
||||
var data = {};
|
||||
|
||||
data.url = objRow.find(".uc-includes-url").val();
|
||||
data.url = jQuery.trim(data.url);
|
||||
|
||||
if(noFilename !== true){
|
||||
data.filename = objRow.find(".uc-includes-filename").val();
|
||||
data.filename = jQuery.trim(data.filename);
|
||||
}
|
||||
|
||||
data.condition = objRow.data("condition");
|
||||
if(!data.condition && typeof data.condition != "object")
|
||||
data.condition = null;
|
||||
|
||||
//get params
|
||||
var objParams = objRow.data("params");
|
||||
if(!objParams)
|
||||
objParams = null;
|
||||
|
||||
data.params = objParams;
|
||||
|
||||
return(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clear all inputs in the includes tab
|
||||
*/
|
||||
function clearIncludesTabInputs(){
|
||||
|
||||
g_objIncludesWrapper.find("input").each(function(inedx, input){
|
||||
var objInput = jQuery(input);
|
||||
var initval = objInput.data("initval");
|
||||
if(initval == undefined)
|
||||
initval = "";
|
||||
objInput.val(initval);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on add click
|
||||
*/
|
||||
function onAddClick(){
|
||||
|
||||
var objButton = jQuery(this);
|
||||
var objList = objButton.parents("ul");
|
||||
|
||||
var objItem = addIncludesListItem(objList);
|
||||
var objInput = objItem.find("input");
|
||||
|
||||
objInput.focus();
|
||||
}
|
||||
|
||||
/**
|
||||
* on delete click
|
||||
*/
|
||||
function onDeleteClick(){
|
||||
var objButton = jQuery(this);
|
||||
var objItem = objButton.parents("li");
|
||||
|
||||
deleteIncludesListItem(objItem);
|
||||
|
||||
if(typeof g_temp.funcOnDelete == "function")
|
||||
g_temp.funcOnDelete();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* delete includes list item
|
||||
*/
|
||||
function deleteIncludesListItem(objItem){
|
||||
|
||||
var objList = objItem.parents("ul");
|
||||
objItem.remove();
|
||||
var numItems = getIncludesListNumItems(objList);
|
||||
if(numItems == 0)
|
||||
addIncludesListItem(objList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init include list
|
||||
*/
|
||||
function initIncludeList(objList){
|
||||
|
||||
var data = objList.data("init");
|
||||
|
||||
if(!data || typeof data != "object" || data.length == 0){
|
||||
addIncludesListItem(objList);
|
||||
return(false);
|
||||
}
|
||||
|
||||
jQuery.each(data,function(index, item){
|
||||
addIncludesListItem(objList, item);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on input url change
|
||||
*/
|
||||
function onInputUrlChange(){
|
||||
var objInput = jQuery(this);
|
||||
|
||||
if(typeof g_temp.funcOnInputBlur == "function")
|
||||
g_temp.funcOnInputBlur(objInput);
|
||||
|
||||
var objInputFilename = objInput.siblings(".uc-includes-filename");
|
||||
var url = objInput.val();
|
||||
var info = g_ucAdmin.pathinfo(url);
|
||||
var filename = info.basename;
|
||||
objInputFilename.val(filename);
|
||||
|
||||
}
|
||||
|
||||
function ______________SETTINGS_DIALOG_____________(){}
|
||||
|
||||
/**
|
||||
* fill settings dialog
|
||||
*/
|
||||
function dialogSettings_fillParams(arrParams, objData){
|
||||
|
||||
//save params data
|
||||
var objDialog = jQuery("#uc_dialog_unclude_settings");
|
||||
var objValueContainer = jQuery("#uc_dialog_include_value_container");
|
||||
|
||||
objValueContainer.hide();
|
||||
|
||||
//fill select
|
||||
var selectParams = jQuery("#uc_dialog_include_attr");
|
||||
|
||||
selectParams.html("");
|
||||
|
||||
//add constant param
|
||||
g_ucAdmin.addOptionToSelect(selectParams, "", "["+g_uctext.always+"]");
|
||||
g_ucAdmin.addOptionToSelect(selectParams, "never_include", "["+g_uctext.never_include+"]");
|
||||
|
||||
jQuery.each(arrParams,function(index, param){
|
||||
g_ucAdmin.addOptionToSelect(selectParams, param.name, param.name);
|
||||
});
|
||||
|
||||
//fill values if needed
|
||||
if(objData.condition){
|
||||
var paramName = objData.condition.name;
|
||||
var selectedValue = "";
|
||||
|
||||
if(paramName && paramName != "never_include"){
|
||||
if(arrParams.hasOwnProperty(paramName) == false)
|
||||
paramName = "never_include";
|
||||
else{
|
||||
var param = arrParams[paramName];
|
||||
var selectedValue = objData.condition.value;
|
||||
}
|
||||
}
|
||||
|
||||
selectParams.val(paramName);
|
||||
updateSettingsDialogValues(arrParams, selectedValue);
|
||||
|
||||
}
|
||||
|
||||
//checkboxes
|
||||
var objInputs = objDialog.find("input[type='checkbox'],input[type='text']");
|
||||
|
||||
var objParams = g_ucAdmin.getVal(objData, "params");
|
||||
if(!objParams)
|
||||
objParams = null;
|
||||
|
||||
jQuery.each(objInputs,function(index, input){
|
||||
|
||||
var type = input.type.toLowerCase();
|
||||
|
||||
var objInput = jQuery(input);
|
||||
var name = objInput.prop("name");
|
||||
var value = g_ucAdmin.getVal(objParams, name);
|
||||
|
||||
switch(type){
|
||||
default:
|
||||
case "text":
|
||||
|
||||
objInput.val(value);
|
||||
|
||||
break;
|
||||
case "checkbox":
|
||||
|
||||
value = g_ucAdmin.strToBool(value);
|
||||
|
||||
objInput.prop("checked", value);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* fill values select
|
||||
*/
|
||||
function dialogSettings_fillValuesSelect(objParam, selectedValue){
|
||||
|
||||
var objSelectValues = jQuery("#uc_dialog_include_values");
|
||||
|
||||
objSelectValues.html("");
|
||||
|
||||
var arrValues = [];
|
||||
|
||||
switch(objParam.type){
|
||||
|
||||
case "uc_radioboolean":
|
||||
g_ucAdmin.addOptionToSelect(objSelectValues, objParam.true_value, objParam.true_value);
|
||||
g_ucAdmin.addOptionToSelect(objSelectValues, objParam.false_value, objParam.false_value);
|
||||
|
||||
arrValues.push(objParam.true_value);
|
||||
arrValues.push(objParam.false_value);
|
||||
|
||||
break;
|
||||
case "uc_dropdown":
|
||||
|
||||
jQuery.each(objParam.options, function(optionName, optionValue){
|
||||
g_ucAdmin.addOptionToSelect(objSelectValues, optionValue, optionName);
|
||||
arrValues.push(optionValue);
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(selectedValue){
|
||||
|
||||
if(jQuery.isArray(selectedValue))
|
||||
var isFound = true;
|
||||
else
|
||||
var isFound = (jQuery.inArray(selectedValue, arrValues) != -1)
|
||||
|
||||
if(isFound == true)
|
||||
objSelectValues.val(selectedValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* update the condition of the input
|
||||
*/
|
||||
function updateInputCondition(objRow, paramName, paramValue){
|
||||
|
||||
var objCondition = objRow.find(".uc-condition-container");
|
||||
|
||||
if(jQuery.trim(paramName) == ""){
|
||||
objCondition.html("").hide(); //hide condition
|
||||
objRow.removeData("condition");
|
||||
}
|
||||
else{
|
||||
|
||||
var data = {name: paramName, value: paramValue};
|
||||
objRow.data("condition", data);
|
||||
|
||||
objCondition.show();
|
||||
var htmlCondition = getHtmlCondition(data);
|
||||
|
||||
objCondition.html(htmlCondition);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on include settings click
|
||||
*/
|
||||
function openIncludeSettingsDialog(){
|
||||
|
||||
var objRow = jQuery(this).parents("li");
|
||||
var objList = objRow.parents("ul");
|
||||
|
||||
var listType = objList.data("type");
|
||||
|
||||
|
||||
var data = getIncludeData(objRow);
|
||||
|
||||
var objDialog = jQuery("#uc_dialog_unclude_settings");
|
||||
objDialog.data("objRow", objRow);
|
||||
|
||||
if(listType == "js"){
|
||||
objDialog.addClass("uc-include-type-js");
|
||||
}else{
|
||||
objDialog.removeClass("uc-include-type-js");
|
||||
}
|
||||
|
||||
var buttonOpts = {};
|
||||
|
||||
buttonOpts[g_uctext.update] = function(){
|
||||
|
||||
var paramName = jQuery("#uc_dialog_include_attr").val();
|
||||
var paramValue = jQuery("#uc_dialog_include_values").val();
|
||||
|
||||
|
||||
updateInputCondition(objRow, paramName, paramValue);
|
||||
|
||||
var rowParams = {};
|
||||
var objInputs = objDialog.find("input[type='checkbox'],input[type='text']");
|
||||
|
||||
jQuery.each(objInputs, function(index, input){
|
||||
|
||||
var type = input.type.toLowerCase();
|
||||
var name = input.name;
|
||||
|
||||
switch(type){
|
||||
case "checkbox":
|
||||
|
||||
var objCheckbox = jQuery(input);
|
||||
var isChecked = objCheckbox.is(":checked");
|
||||
|
||||
if(isChecked == true)
|
||||
rowParams[name] = true;
|
||||
|
||||
break;
|
||||
default:
|
||||
case "text":
|
||||
rowParams[name] = input.value;
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
updateInputExtraHTML(objRow, rowParams);
|
||||
|
||||
objRow.data("params", rowParams);
|
||||
|
||||
objDialog.dialog("close");
|
||||
}
|
||||
|
||||
|
||||
buttonOpts[g_uctext.cancel] = function(){
|
||||
objDialog.dialog("close");
|
||||
};
|
||||
|
||||
var title = g_uctext.include_settings + ": " + data.filename;
|
||||
|
||||
objDialog.dialog({
|
||||
dialogClass:"unite-ui",
|
||||
buttons:buttonOpts,
|
||||
title: title,
|
||||
minWidth:700,
|
||||
modal:true,
|
||||
open:function(){
|
||||
|
||||
var arrParams = g_parent.getControlParams();
|
||||
|
||||
dialogSettings_fillParams(arrParams, data);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* update values according the params
|
||||
*/
|
||||
function updateSettingsDialogValues(objParams, selectedValue){
|
||||
|
||||
var paramName = jQuery("#uc_dialog_include_attr").val();
|
||||
if(paramName == "" || paramName == "never_include"){
|
||||
jQuery("#uc_dialog_include_value_container").hide();
|
||||
return(true);
|
||||
}
|
||||
|
||||
//show container
|
||||
jQuery("#uc_dialog_include_value_container").show();
|
||||
|
||||
//set select values
|
||||
if(!objParams)
|
||||
var objParams = g_parent.getControlParams();
|
||||
|
||||
if(objParams.hasOwnProperty(paramName) == false)
|
||||
throw new Error("param: "+paramName+" not found");
|
||||
|
||||
var objParam = objParams[paramName];
|
||||
|
||||
dialogSettings_fillValuesSelect(objParam, selectedValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init settings dialog
|
||||
*/
|
||||
function initSettingsDialog(){
|
||||
|
||||
jQuery("#uc_dialog_include_attr").change(function(){
|
||||
updateSettingsDialogValues();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ______________INIT_____________(){}
|
||||
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
//add include
|
||||
g_objIncludesWrapper.on("click", ".uc-includes-add", onAddClick);
|
||||
|
||||
//delete inlcude
|
||||
g_objIncludesWrapper.on("click", ".uc-includes-delete", onDeleteClick);
|
||||
|
||||
//include settings
|
||||
g_objIncludesWrapper.on("click", ".uc-includes-settings", openIncludeSettingsDialog);
|
||||
|
||||
g_objIncludesWrapper.on("blur", ".uc-includes-url", onInputUrlChange);
|
||||
g_objIncludesWrapper.on("change", ".uc-includes-url", onInputUrlChange);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init the includes tab
|
||||
*/
|
||||
function init(){
|
||||
|
||||
g_objIncludesWrapper = jQuery("#uc_includes_wrapper");
|
||||
g_objListJs = jQuery("#uc-js-includes");
|
||||
g_objListCss = jQuery("#uc-css-includes");
|
||||
|
||||
//clear inlcudes tab
|
||||
clearIncludesTabInputs();
|
||||
|
||||
initIncludeList(g_objListJs);
|
||||
initIncludeList(g_objListCss);
|
||||
|
||||
//sortable:
|
||||
g_objIncludesWrapper.find("ul").sortable({
|
||||
handle: ".uc-includes-handle"
|
||||
});
|
||||
|
||||
//init events:
|
||||
|
||||
initSettingsDialog();
|
||||
|
||||
initEvents();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* init includes tab
|
||||
*/
|
||||
this.initIncludesTab = function(objParent){
|
||||
|
||||
g_parent = objParent;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set evetn on delete include
|
||||
*/
|
||||
this.eventOnDelete = function(func){
|
||||
g_temp.funcOnDelete = func;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set event on input blur
|
||||
*/
|
||||
this.eventOnInputBlur = function(func){
|
||||
g_temp.funcOnInputBlur = func;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,957 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorParamsPanel(){
|
||||
|
||||
var g_objWrapper, g_prefix = "", g_type, g_arrConstants = {};
|
||||
var g_objFiltersWrapper, g_activeFilter = null, g_objThumbSizes = null, g_objImageAddParams;
|
||||
var g_objChildKeys = null, g_objSkipParams = null, g_objAddKeys = null, g_objTemplateCode = null;
|
||||
|
||||
var t = this;
|
||||
|
||||
var g_constants = {
|
||||
PARAM_CHILD_KEYS: "param_panel_child_keys"
|
||||
};
|
||||
|
||||
var g_temp = {
|
||||
funcOnClick: function(){}
|
||||
};
|
||||
|
||||
var events = {
|
||||
DELETE_VARIABLE: "delete_variable",
|
||||
EDIT_VARIABLE: "edit_variable"
|
||||
};
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
|
||||
/**
|
||||
* validate that the panel is inited
|
||||
*/
|
||||
function validateInited(){
|
||||
if(!g_objWrapper)
|
||||
throw new Error("The panel is not inited");
|
||||
}
|
||||
|
||||
/**
|
||||
* get prefix by fitler
|
||||
*/
|
||||
function getPrefix(filter){
|
||||
|
||||
if(typeof g_prefix == "string")
|
||||
return(g_prefix);
|
||||
|
||||
if(!filter || typeof g_prefix != "object")
|
||||
return("");
|
||||
|
||||
if(g_prefix.hasOwnProperty(filter) == false)
|
||||
return("");
|
||||
|
||||
var prefix = g_prefix[filter];
|
||||
|
||||
return(prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get template code by name
|
||||
*/
|
||||
function getTemplateCode(key, paramName, parentName){
|
||||
|
||||
var strCode = g_ucAdmin.getVal(g_objTemplateCode, key);
|
||||
|
||||
if(!strCode)
|
||||
throw new Error("Template code with key: "+key+" not found");
|
||||
|
||||
if(paramName)
|
||||
strCode = g_ucAdmin.replaceAll(strCode, "[param_name]", paramName);
|
||||
|
||||
if(parentName)
|
||||
strCode = g_ucAdmin.replaceAll(strCode, "[param_prefix]", parentName);
|
||||
|
||||
return(strCode);
|
||||
}
|
||||
|
||||
|
||||
function ___________ADD_PARAMS___________(){}
|
||||
|
||||
|
||||
/**
|
||||
* add image base params
|
||||
*/
|
||||
function addImageBaseParams(objParam, filter){
|
||||
|
||||
//var arrParams = ["image","thumb","description","enable_link","link"];
|
||||
var arrParams = ["image","thumb","description"];
|
||||
|
||||
jQuery.each(arrParams, function(index, name){
|
||||
addParam(name, null, filter);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add textare param fields
|
||||
*/
|
||||
function addTextareaParam(objParam, filter){
|
||||
|
||||
var name = objParam.name;
|
||||
|
||||
//addParam(name, null, filter);
|
||||
addParam(name+"|raw", null, filter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* add child params
|
||||
*/
|
||||
function addChildParams(objParentParam, arrChildKeys, filter){
|
||||
|
||||
var baseName = objParentParam.name;
|
||||
var parentName = baseName;
|
||||
|
||||
//add parent param
|
||||
var paramParent = {
|
||||
name: parentName,
|
||||
is_parent: true,
|
||||
parent_open_onclick: true
|
||||
};
|
||||
|
||||
var visual = g_ucAdmin.getVal(objParentParam, "visual");
|
||||
if(visual)
|
||||
paramParent.visual = visual;
|
||||
|
||||
addParam(paramParent, null, filter);
|
||||
|
||||
|
||||
//add child params:
|
||||
jQuery.each(arrChildKeys, function(index, objChildParam){
|
||||
|
||||
var objParamInsert = jQuery.extend({}, objChildParam);
|
||||
|
||||
//if string, add no slashes
|
||||
if(typeof objChildParam == "string"){
|
||||
|
||||
objParamInsert.name = objChildParam;
|
||||
objParamInsert.original_name = objChildParam;
|
||||
objParamInsert.noslashes = true;
|
||||
}else{
|
||||
|
||||
objParamInsert.name = baseName + "." + objChildParam.name;
|
||||
objParamInsert.original_name = objChildParam.name;
|
||||
}
|
||||
|
||||
objParamInsert.parent_name = parentName;
|
||||
objParamInsert.is_child = true;
|
||||
|
||||
//put parent param
|
||||
addParam(objParamInsert, null, filter);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add child params
|
||||
*/
|
||||
function addAddParams(objParentParam, arrAddKeys, filter){
|
||||
|
||||
var parentName = objParentParam["name"];
|
||||
|
||||
jQuery.each(arrAddKeys,function(index, objAddParam){
|
||||
|
||||
var condition = g_ucAdmin.getVal(objAddParam, "condition");
|
||||
|
||||
//filter by condition
|
||||
if(condition == "responsive"){
|
||||
var isResponsive = g_ucAdmin.getVal(objParentParam, "is_responsive");
|
||||
isResponsive = g_ucAdmin.strToBool(isResponsive);
|
||||
|
||||
if(isResponsive == false)
|
||||
return(true);
|
||||
}
|
||||
|
||||
var objParamInsert = jQuery.extend({}, objAddParam);
|
||||
var rawVisual = g_ucAdmin.getVal(objParamInsert, "rawvisual");
|
||||
rawVisual = g_ucAdmin.strToBool(rawVisual);
|
||||
|
||||
var paramInsertName = objParamInsert["name"];
|
||||
|
||||
if(paramInsertName === null){
|
||||
paramInsertName = parentName;
|
||||
}
|
||||
else
|
||||
if(g_type != "item" && rawVisual !== true){
|
||||
|
||||
paramInsertName = parentName + "_"+objParamInsert["name"];
|
||||
}
|
||||
|
||||
paramInsertName = paramInsertName.replace("[parent_name]", parentName);
|
||||
|
||||
//replace the raw insert text
|
||||
var rawInsertText = g_ucAdmin.getVal(objParamInsert, "raw_insert_text");
|
||||
if(rawInsertText){
|
||||
|
||||
rawInsertText = g_ucAdmin.replaceAll(rawInsertText, "[parent_name]", parentName);
|
||||
|
||||
objParamInsert["raw_insert_text"] = rawInsertText;
|
||||
}
|
||||
|
||||
objParamInsert["name"] = paramInsertName;
|
||||
|
||||
addParam(objParamInsert, null, filter);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add param to panel
|
||||
* can accept name:string, type:string or object
|
||||
*/
|
||||
function addParam(objParam, type, filter){
|
||||
|
||||
if(typeof objParam == "string"){
|
||||
objParam = {
|
||||
name: objParam,
|
||||
type: "uc_textfield"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//get param type
|
||||
if(type)
|
||||
objParam.type = type;
|
||||
|
||||
//add name
|
||||
var paramType = g_ucAdmin.getVal(objParam, "type");
|
||||
var name = objParam.name;
|
||||
|
||||
//check skip param type - don't add
|
||||
var isSkip = g_ucAdmin.getVal(g_objSkipParams, paramType);
|
||||
isSkip = g_ucAdmin.strToBool(isSkip);
|
||||
if(isSkip == true)
|
||||
return(false);
|
||||
|
||||
//check for param groups
|
||||
var rawInsertText = null;
|
||||
var paramVisual = null;
|
||||
|
||||
//modify by param type
|
||||
|
||||
var isTakeChildred = false;
|
||||
|
||||
switch(paramType){
|
||||
case "uc_textfield":
|
||||
if(typeof objParam["font_editable"] !== "undefined")
|
||||
name += "|raw";
|
||||
break;
|
||||
case "uc_hr":
|
||||
return(false); //don't add hr
|
||||
break;
|
||||
case "uc_imagebase":
|
||||
addImageBaseParams(objParam, filter);
|
||||
return(false);
|
||||
break;
|
||||
case "uc_textarea":
|
||||
addTextareaParam(objParam, filter);
|
||||
return(false);
|
||||
break;
|
||||
case "uc_posts_list":
|
||||
|
||||
rawInsertText = getTemplateCode("no_items_code", name);
|
||||
paramVisual = name + " wrapping code";
|
||||
|
||||
break;
|
||||
|
||||
case "uc_font_override":
|
||||
|
||||
if(g_type != "css")
|
||||
return(false);
|
||||
|
||||
rawInsertText = "{{put_font_override('"+name+"','.selector',true)}}";
|
||||
paramVisual = "{{"+name + "_font_override"+"}}";
|
||||
|
||||
break;
|
||||
case "uc_dataset":
|
||||
|
||||
if(g_type == "item")
|
||||
isTakeChildred = true;
|
||||
else{
|
||||
rawInsertText = getTemplateCode("no_items_code", name);
|
||||
paramVisual = name + " wrapping code";
|
||||
}
|
||||
|
||||
break;
|
||||
case "uc_image":
|
||||
|
||||
isTakeChildred = true;
|
||||
|
||||
var mediaType = g_ucAdmin.getVal(objParam, "media_type");
|
||||
if(mediaType == "json")
|
||||
isTakeChildred = false;
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
isTakeChildred = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//take child params
|
||||
if(isTakeChildred == true){
|
||||
|
||||
//check child keys
|
||||
var arrChildKeys = g_ucAdmin.getVal(g_objChildKeys, objParam.type);
|
||||
|
||||
if(arrChildKeys){
|
||||
addChildParams(objParam, arrChildKeys, filter);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
//add "add" keys, additional keys for this param
|
||||
var arrAddKeys = g_ucAdmin.getVal(g_objAddKeys, objParam.type);
|
||||
|
||||
if(arrAddKeys){
|
||||
addAddParams(objParam, arrAddKeys, filter);
|
||||
return(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var originalName = g_ucAdmin.getVal(objParam, "original_name");
|
||||
|
||||
//modify by param name
|
||||
switch(originalName){
|
||||
case "no_items_code":
|
||||
var childParamName = objParam.parent_name+"."+ objParam.child_param_name;
|
||||
|
||||
rawInsertText = getTemplateCode("no_items_code", childParamName, objParam.parent_name);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!rawInsertText){
|
||||
rawInsertText = g_ucAdmin.getVal(objParam, "raw_insert_text");
|
||||
}
|
||||
|
||||
|
||||
//get param class type
|
||||
var paramClassType = "uc-type-param";
|
||||
switch(objParam.type){
|
||||
case "uc_function":
|
||||
paramClassType = "uc-type-function";
|
||||
break;
|
||||
case "uc_constant":
|
||||
paramClassType = "uc-type-constant";
|
||||
break;
|
||||
}
|
||||
|
||||
//set filter class
|
||||
var classFilter = getFilterClass(filter);
|
||||
|
||||
var specialParamType = "regular";
|
||||
|
||||
var isParent = g_ucAdmin.getVal(objParam, "is_parent", false, g_ucAdmin.getvalopt.FORCE_BOOLEAN);
|
||||
if(isParent === true)
|
||||
specialParamType = "parent";
|
||||
else{
|
||||
var parentName = g_ucAdmin.getVal(objParam, "parent_name");
|
||||
if(parentName)
|
||||
specialParamType = "child";
|
||||
}
|
||||
|
||||
//set ending
|
||||
var ending = "";
|
||||
switch(objParam.type){
|
||||
case "uc_joomla_module":
|
||||
case "uc_editor":
|
||||
ending = "|raw";
|
||||
break;
|
||||
}
|
||||
|
||||
var prefix = getPrefix(filter);
|
||||
|
||||
var textNoSlashes = prefix+name+ending;
|
||||
var textNoSlashesParent = prefix+name;
|
||||
|
||||
if(specialParamType == "child")
|
||||
textNoSlashesParent = prefix+parentName;
|
||||
|
||||
var isNoSlashes = g_ucAdmin.getVal(objParam, "noslashes", false, g_ucAdmin.getvalopt.FORCE_BOOLEAN);
|
||||
|
||||
if(isNoSlashes === true)
|
||||
var text = textNoSlashes;
|
||||
else
|
||||
var text = "{{"+textNoSlashes+"}}";
|
||||
|
||||
if(rawInsertText){
|
||||
|
||||
rawInsertText = g_ucAdmin.replaceAll(rawInsertText, "[param_name]", textNoSlashes);
|
||||
rawInsertText = g_ucAdmin.replaceAll(rawInsertText, "[param_prefix]", textNoSlashesParent);
|
||||
|
||||
rawInsertText = g_ucAdmin.htmlspecialchars(rawInsertText);
|
||||
}
|
||||
|
||||
//check if hidden by filter
|
||||
var style = "";
|
||||
if(g_activeFilter && filter && g_activeFilter !== filter)
|
||||
style = "style='display:none'";
|
||||
|
||||
var htmlClass = "uc-link-paramkey " + paramClassType +" " + classFilter;
|
||||
var htmlTip = "";
|
||||
|
||||
var tooltip = g_ucAdmin.getVal(objParam, "tooltip");
|
||||
|
||||
var addHtml = "";
|
||||
|
||||
if(rawInsertText){
|
||||
addHtml += " data-rawtext=\""+rawInsertText+"\"";
|
||||
}
|
||||
|
||||
var isRawVisual = g_ucAdmin.getVal(objParam, "rawvisual", false, g_ucAdmin.getvalopt.FORCE_BOOLEAN);
|
||||
if(isRawVisual === true){
|
||||
paramVisual = objParam.original_name;
|
||||
}
|
||||
|
||||
var visual = g_ucAdmin.getVal(objParam, "visual");
|
||||
if(visual)
|
||||
paramVisual = visual;
|
||||
|
||||
if(paramVisual){
|
||||
paramVisual = g_ucAdmin.replaceAll(paramVisual, "[param_name]", textNoSlashes);
|
||||
paramVisual = g_ucAdmin.replaceAll(paramVisual, "[param_prefix]", textNoSlashesParent);
|
||||
}
|
||||
|
||||
//special output
|
||||
switch(specialParamType){
|
||||
case "parent":
|
||||
|
||||
if(!tooltip)
|
||||
tooltip = "Show All Fields";
|
||||
|
||||
var isOpenOnClick = g_ucAdmin.getVal(objParam, "parent_open_onclick");
|
||||
if(isOpenOnClick === true){
|
||||
addHtml = " data-openonclick='true'";
|
||||
text = textNoSlashes;
|
||||
}
|
||||
|
||||
if(paramVisual)
|
||||
text = paramVisual;
|
||||
|
||||
|
||||
var html = "<div class='uc-param-wrapper uc-param-parent uc-hover "+classFilter+"' "+style+" data-name='"+name+"' "+addHtml+">";
|
||||
html += " <a data-name='"+name+"' data-text='"+text+"' href='javascript:void(0)' class='uc-link-paramkey "+classFilter+"' >"+text+"</a>";
|
||||
html += " <div class='uc-icons-wrapper uc-icons-parent'>";
|
||||
html += " <a class='uc-icon-show-children uc-tip' title='"+tooltip+"'></a>";
|
||||
html += " </div>";
|
||||
html += "</div>";
|
||||
break;
|
||||
case "child":
|
||||
|
||||
if(tooltip)
|
||||
htmlTip = " title='"+tooltip+"'";
|
||||
|
||||
htmlClass += " ucparent-"+parentName+" uc-child-key uc-child-hidden";
|
||||
default:
|
||||
|
||||
if(paramVisual == null)
|
||||
paramVisual = text;
|
||||
|
||||
var html = "<a data-name='"+name+"' data-text='"+text+"' href='javascript:void(0)' class='"+htmlClass+"' "+style+htmlTip+addHtml+">"+paramVisual+"</a>";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
g_objWrapper.append(html);
|
||||
}
|
||||
|
||||
function ___________VARIABLES_CONSTANTS___________(){}
|
||||
|
||||
|
||||
/**
|
||||
* add param to panel
|
||||
*/
|
||||
function addVariable(index, objVar, filter){
|
||||
|
||||
if(typeof objVar != "object")
|
||||
throw new Error("The variable should be object");
|
||||
|
||||
var name = objVar.name;
|
||||
var prefix = getPrefix(filter);
|
||||
var text = "{{"+prefix+name+"}}";
|
||||
|
||||
//set class
|
||||
var classFilter = getFilterClass(filter);
|
||||
var htmlClass = "uc-link-paramkey uc-type-variable "+classFilter;
|
||||
|
||||
var style = "";
|
||||
if(g_activeFilter && filter && g_activeFilter !== filter)
|
||||
style = "style='display:none'";
|
||||
|
||||
var html = "<div class='uc-param-wrapper uc-variable-wrapper' data-name='"+name+"' data-index='"+index+"'>";
|
||||
html += "<a data-name='"+name+"' data-text='"+text+"' href='javascript:void(0)' class='"+htmlClass+"' "+style+">"+text+"</a>";
|
||||
html += "<div class='uc-icons-wrapper'>";
|
||||
html += "<div class='uc-icon-edit'></div>";
|
||||
html += "<div class='uc-icon-delete'></div>";
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
|
||||
g_objWrapper.append(html);
|
||||
}
|
||||
|
||||
/**
|
||||
* add constant params as prefix
|
||||
*/
|
||||
function addConstants(argFilter){
|
||||
|
||||
if(!g_arrConstants)
|
||||
return(false);
|
||||
|
||||
if(typeof g_arrConstants != "object")
|
||||
return(false);
|
||||
|
||||
if(g_arrConstants.length == 0)
|
||||
return(false);
|
||||
|
||||
jQuery.each(g_arrConstants, function(filter, name){
|
||||
|
||||
if(argFilter && filter != argFilter)
|
||||
return(true);
|
||||
|
||||
var arrConstants = g_arrConstants[filter];
|
||||
|
||||
jQuery.map(arrConstants,function(name){
|
||||
|
||||
//add child params
|
||||
if(typeof name == "object"){
|
||||
var isParent = g_ucAdmin.getVal(name, "is_parent",false, g_ucAdmin.getvalopt.FORCE_BOOLEAN);
|
||||
var arrChildParams = g_ucAdmin.getVal(name, "child_params");
|
||||
|
||||
if(isParent == true && arrChildParams)
|
||||
addChildParams(name, arrChildParams, filter);
|
||||
}else
|
||||
addParam(name, "uc_constant", filter);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ___________EVENTS___________(){}
|
||||
|
||||
/**
|
||||
* on param click
|
||||
*/
|
||||
function onParamClick(){
|
||||
var objParam = jQuery(this);
|
||||
|
||||
var text = objParam.data("text");
|
||||
var rawText = objParam.data("rawtext");
|
||||
if(rawText)
|
||||
text = rawText;
|
||||
|
||||
//check if open children on click
|
||||
var objParent = objParam.parents(".uc-param-parent");
|
||||
if(objParent.length != 0){
|
||||
var openOnClick = objParent.data("openonclick");
|
||||
if(openOnClick === true){
|
||||
var objIcon = objParent.find(".uc-icon-show-children");
|
||||
objIcon.trigger("click");
|
||||
return(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
g_temp.funcOnClick(text, rawText);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* trigger event
|
||||
*/
|
||||
function triggerEvent(eventName, params){
|
||||
if(!params)
|
||||
var params = null;
|
||||
|
||||
g_objWrapper.trigger(eventName, params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on event name
|
||||
*/
|
||||
function onEvent(eventName, func){
|
||||
g_objWrapper.on(eventName,func);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
g_objWrapper.on("click", "a.uc-link-paramkey", onParamClick);
|
||||
|
||||
g_objWrapper.on("focus", "a.uc-link-paramkey", function(){
|
||||
this.blur();
|
||||
});
|
||||
|
||||
//show, hide icons panel
|
||||
|
||||
g_objWrapper.on("mouseenter", ".uc-variable-wrapper", function(){
|
||||
jQuery(this).addClass("uc-hover");
|
||||
});
|
||||
|
||||
g_objWrapper.on("mouseleave", ".uc-variable-wrapper", function(){
|
||||
jQuery(this).removeClass("uc-hover");
|
||||
});
|
||||
|
||||
|
||||
g_objWrapper.on("click", ".uc-variable-wrapper .uc-icon-edit", function(){
|
||||
|
||||
var objLink = jQuery(this);
|
||||
var objVarWrapper = objLink.parents(".uc-variable-wrapper");
|
||||
|
||||
var varIndex = objVarWrapper.data("index");
|
||||
|
||||
triggerEvent(events.EDIT_VARIABLE, varIndex);
|
||||
|
||||
});
|
||||
|
||||
g_objWrapper.on("click", ".uc-param-parent .uc-icon-show-children", function(){
|
||||
|
||||
var objLink = jQuery(this);
|
||||
|
||||
var objMenu = objLink.parents(".uc-icons-wrapper");
|
||||
var objParamWrapper = objLink.parents(".uc-param-wrapper");
|
||||
var paramName = objParamWrapper.data("name");
|
||||
var classChildren = ".ucparent-"+paramName;
|
||||
|
||||
var objChildren = g_objWrapper.find(classChildren);
|
||||
|
||||
objMenu.hide();
|
||||
objChildren.removeClass("uc-child-hidden");
|
||||
|
||||
});
|
||||
|
||||
|
||||
g_objWrapper.on("click", ".uc-variable-wrapper .uc-icon-delete", function(){
|
||||
|
||||
var objLink = jQuery(this);
|
||||
var objVarWrapper = objLink.parents(".uc-variable-wrapper");
|
||||
var varIndex = objVarWrapper.data("index");
|
||||
|
||||
triggerEvent(events.DELETE_VARIABLE, varIndex);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* remove all params
|
||||
*/
|
||||
this.removeAllParams = function(){
|
||||
g_objWrapper.html("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ___________FILTERS___________(){}
|
||||
|
||||
|
||||
/**
|
||||
* get fitler class
|
||||
*/
|
||||
function getFilterClass(filter, addDot){
|
||||
|
||||
if(!filter)
|
||||
return("");
|
||||
|
||||
var prefix = "";
|
||||
if(addDot === true)
|
||||
prefix = ".";
|
||||
|
||||
filter = filter.replace(".","_");
|
||||
filter = filter.replace("|e","");
|
||||
|
||||
var classFilter = prefix+"uc-filter-"+filter;
|
||||
|
||||
return(classFilter);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* activate all filter tabs
|
||||
*/
|
||||
function onFilterTabClick(){
|
||||
var activeClass = "uc-filter-active";
|
||||
|
||||
var objFilter = jQuery(this);
|
||||
if(objFilter.hasClass(activeClass))
|
||||
return(false);
|
||||
|
||||
var otherFitlers = g_objFiltersWrapper.find("a").not(objFilter);
|
||||
otherFitlers.removeClass(activeClass);
|
||||
|
||||
objFilter.addClass(activeClass);
|
||||
|
||||
g_activeFilter = objFilter.data("filter");
|
||||
|
||||
//hide, show filters
|
||||
var classFilter = getFilterClass(g_activeFilter, true);
|
||||
|
||||
var objFilterKeys = g_objWrapper.find(classFilter);
|
||||
var objOtherKeys = g_objWrapper.find("a.uc-link-paramkey").add(g_objWrapper.find(".uc-param-wrapper")).not(objFilterKeys);
|
||||
|
||||
objOtherKeys.hide();
|
||||
objFilterKeys.show().css({"display":"block"});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init filter tabs
|
||||
*/
|
||||
function initFilterTabs(){
|
||||
|
||||
var objFilterWrapper = g_objWrapper.siblings(".uc-params-panel-filters");
|
||||
|
||||
if(objFilterWrapper.length == 0)
|
||||
return(false);
|
||||
|
||||
g_objFiltersWrapper = objFilterWrapper;
|
||||
|
||||
|
||||
//set active filter
|
||||
|
||||
var objActiveFilter = g_objFiltersWrapper.find("a.uc-filter-active");
|
||||
if(objActiveFilter.length == 0)
|
||||
throw new Error("Must have at least one active filter!!!");
|
||||
|
||||
g_activeFilter = objActiveFilter.data("filter");
|
||||
|
||||
//set events
|
||||
g_objFiltersWrapper.delegate("a", "click", onFilterTabClick);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* replace all params
|
||||
*/
|
||||
this.setParams = function(arrParams, arrVariables, filter){
|
||||
|
||||
if(!filter)
|
||||
t.removeAllParams();
|
||||
|
||||
//add constants
|
||||
addConstants(filter);
|
||||
|
||||
//add params
|
||||
jQuery.each(arrParams, function(index, param){
|
||||
addParam(param, null, filter);
|
||||
});
|
||||
|
||||
//add variables
|
||||
if(arrVariables && typeof arrVariables == "object"){
|
||||
|
||||
jQuery.each(arrVariables, function(index, objVar){
|
||||
addVariable(index, objVar, filter);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on param click
|
||||
*/
|
||||
this.onParamClick = function(func){
|
||||
g_temp.funcOnClick = func;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* on edit variable
|
||||
*/
|
||||
this.onEditVariable = function(func){
|
||||
onEvent(events.EDIT_VARIABLE, func);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on delete variable function
|
||||
*/
|
||||
this.onDeleteVariable = function(func){
|
||||
onEvent(events.DELETE_VARIABLE, func);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init global setting
|
||||
*/
|
||||
function initGlobalSetting(name, data){
|
||||
|
||||
if(!data || data.length == 0)
|
||||
return(false);
|
||||
|
||||
g_ucAdmin.storeGlobalData(name, data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* set thumb sizes
|
||||
*/
|
||||
this.initGlobalSetting_ThumbSizes = function(objThumbSizes){
|
||||
|
||||
initGlobalSetting("param_panel_thumb_sizes", objThumbSizes);
|
||||
};
|
||||
|
||||
/**
|
||||
* set thumb sizes
|
||||
*/
|
||||
this.initGlobalSetting_ImageAddParams = function(objParams){
|
||||
|
||||
initGlobalSetting("param_panel_image_add_params", objParams);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* set skip params
|
||||
*/
|
||||
this.initGlobalSetting_SkipParams = function(objSkipParams){
|
||||
|
||||
|
||||
initGlobalSetting("panel_skip_params", objSkipParams);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* set thumb sizes
|
||||
*/
|
||||
this.initGlobalSetting_ChildKeys = function(objChildKeys, objAddKeys){
|
||||
|
||||
initGlobalSetting(g_constants.PARAM_CHILD_KEYS, objChildKeys);
|
||||
initGlobalSetting("param_panel_add_keys", objAddKeys);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* get global settings child keys
|
||||
*/
|
||||
this.getGlobalSetting_SkipParams = function(){
|
||||
|
||||
var objGlobalSetting = g_ucAdmin.getGlobalData("panel_skip_params");
|
||||
|
||||
return(objGlobalSetting);
|
||||
}
|
||||
|
||||
/**
|
||||
* get global settings child keys
|
||||
*/
|
||||
this.getGlobalSetting_ChildKeys = function(){
|
||||
|
||||
var objGlobalSetting = g_ucAdmin.getGlobalData(g_constants.PARAM_CHILD_KEYS);
|
||||
|
||||
return(objGlobalSetting);
|
||||
}
|
||||
|
||||
/**
|
||||
* store child keys content
|
||||
*/
|
||||
this.updateGlobalSetting_ChildKeys = function(objKeys){
|
||||
|
||||
g_ucAdmin.storeGlobalData(g_constants.PARAM_CHILD_KEYS, objKeys);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init template code
|
||||
*/
|
||||
this.initGlobalSetting_TemplateCode = function(objTemplateCode){
|
||||
|
||||
initGlobalSetting("param_panel_template_code", objTemplateCode);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init the panel
|
||||
*/
|
||||
this.init = function(objWrapper, type, prefix, arrConstants){
|
||||
g_objWrapper = objWrapper;
|
||||
|
||||
g_type = type;
|
||||
|
||||
|
||||
if(prefix)
|
||||
g_prefix = prefix;
|
||||
|
||||
initFilterTabs();
|
||||
|
||||
if(arrConstants && typeof arrConstants == "object")
|
||||
t.initConstants(arrConstants, "all");
|
||||
|
||||
//get the sizes
|
||||
g_objThumbSizes = g_ucAdmin.getGlobalData("param_panel_thumb_sizes");
|
||||
if(!g_objThumbSizes)
|
||||
g_objThumbSizes = null;
|
||||
|
||||
//get image add params
|
||||
g_objImageAddParams = g_ucAdmin.getGlobalData("param_panel_image_add_params");
|
||||
if(!g_objImageAddParams)
|
||||
g_objImageAddParams = null;
|
||||
|
||||
//get the child keys
|
||||
g_objChildKeys = g_ucAdmin.getGlobalData("param_panel_child_keys");
|
||||
if(!g_objChildKeys)
|
||||
g_objChildKeys = null;
|
||||
|
||||
g_objSkipParams = this.getGlobalSetting_SkipParams();
|
||||
if(!g_objSkipParams)
|
||||
g_objSkipParams = null;
|
||||
|
||||
g_objAddKeys = g_ucAdmin.getGlobalData("param_panel_add_keys");
|
||||
if(!g_objAddKeys)
|
||||
g_objAddKeys = null;
|
||||
|
||||
g_objTemplateCode = g_ucAdmin.getGlobalData("param_panel_template_code");
|
||||
if(!g_objTemplateCode)
|
||||
g_objTemplateCode = null;
|
||||
|
||||
|
||||
initEvents();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init consants
|
||||
*/
|
||||
this.initConstants = function(arrConstants, filter){
|
||||
|
||||
if(!arrConstants || typeof arrConstants != "object")
|
||||
return(false);
|
||||
|
||||
if(!g_arrConstants)
|
||||
g_arrConstants = {};
|
||||
|
||||
if(!filter)
|
||||
filter = "all";
|
||||
|
||||
g_arrConstants[filter] = arrConstants;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
"use strict";
|
||||
|
||||
function UCScreenshot(){
|
||||
|
||||
var t = this;
|
||||
var g_pageBuilder = null;
|
||||
var g_ucAdminTop = null;
|
||||
|
||||
var g_temp = {
|
||||
isInsideIframe: false,
|
||||
allowLogging: false
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* trigger end event
|
||||
*/
|
||||
function triggerEndEvent(response){
|
||||
|
||||
if(g_pageBuilder){
|
||||
g_pageBuilder.triggerEvent("screenshot_saved", response);
|
||||
return(true);
|
||||
}
|
||||
|
||||
if(g_ucAdminTop)
|
||||
g_ucAdminTop.triggerEvent("screenshot_saved", response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* save data - send ajax request to save
|
||||
*/
|
||||
function saveScreenshotData(data, ext){
|
||||
|
||||
writeLog("done screenshot, saving " + ext);
|
||||
|
||||
jQuery("body").append("<div id='div_debug'></div>");
|
||||
|
||||
var data = {
|
||||
screenshot_data:data,
|
||||
source:"layout",
|
||||
layoutid:g_layoutID,
|
||||
ext:ext
|
||||
};
|
||||
|
||||
g_ucAdmin.ajaxRequest("save_screenshot", data, function(response){
|
||||
|
||||
writeLog("file saved");
|
||||
|
||||
triggerEndEvent(response);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* write log
|
||||
*/
|
||||
function writeLog(str){
|
||||
|
||||
if(g_temp.allowLogging == false)
|
||||
return(false);
|
||||
|
||||
trace(str);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* take screenshot
|
||||
*/
|
||||
this.takeScreenshot = function(){
|
||||
|
||||
writeLog("start screenshot");
|
||||
|
||||
var scale = window.devicePixelRatio * 0.5;
|
||||
|
||||
var objBody = jQuery("body");
|
||||
var bodyHeight = objBody.height();
|
||||
var bodyWidth = objBody.width();
|
||||
|
||||
var maxHeight = bodyWidth*3;
|
||||
|
||||
var options = {
|
||||
logging:false,
|
||||
scale:scale
|
||||
};
|
||||
|
||||
if(bodyHeight > maxHeight)
|
||||
options["height"] = maxHeight;
|
||||
|
||||
html2canvas(document.body, options).then(canvas => {
|
||||
|
||||
var dataJpg = canvas.toDataURL("image/jpeg",0.7);
|
||||
var dataPng = canvas.toDataURL("image/png");
|
||||
|
||||
//document.body.innerHTML = "";
|
||||
//document.body.appendChild(canvas)
|
||||
|
||||
if(dataJpg.length < dataPng.length)
|
||||
saveScreenshotData(dataJpg, "jpg");
|
||||
else
|
||||
saveScreenshotData(dataPng, "png");
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* init page builder
|
||||
*/
|
||||
function initTopObjects(){
|
||||
|
||||
if(!window.top)
|
||||
return(false);
|
||||
|
||||
if(window.top.g_objPageBuilder){
|
||||
g_pageBuilder = window.top.g_objPageBuilder;
|
||||
}
|
||||
|
||||
g_ucAdminTop = window.top.g_ucAdmin;
|
||||
if(!g_ucAdminTop)
|
||||
g_ucAdminTop = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init
|
||||
*/
|
||||
this.init = function(){
|
||||
|
||||
initTopObjects();
|
||||
|
||||
if(window.top){
|
||||
g_temp.isInsideIframe = true;
|
||||
}else{
|
||||
|
||||
g_temp.allowLogging = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
|
||||
var objScreenshot = new UCScreenshot();
|
||||
objScreenshot.init();
|
||||
objScreenshot.takeScreenshot();
|
||||
|
||||
});
|
||||
@@ -0,0 +1,135 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorTestAddon(){
|
||||
|
||||
var g_objWrapper, g_objConfig = new UniteCreatorAddonConfig();
|
||||
var g_objLoaderSave;
|
||||
|
||||
var t = this;
|
||||
|
||||
|
||||
/**
|
||||
* on save data event
|
||||
*/
|
||||
function onSaveDataClick(){
|
||||
|
||||
var objData = g_objConfig.getObjData();
|
||||
|
||||
if(objData.hasOwnProperty("extra"))
|
||||
delete objData["extra"];
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID("uc_testaddon_loader_save");
|
||||
g_ucAdmin.setAjaxHideButtonID("uc_testaddon_button_save");
|
||||
|
||||
g_ucAdmin.ajaxRequest("save_test_addon", objData, function(){
|
||||
|
||||
jQuery("#uc_testaddon_slot1").show();
|
||||
|
||||
jQuery("#uc_testaddon_button_save").show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* restore data
|
||||
*/
|
||||
function onRestoreDataClick(){
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID("uc_testaddon_loader_restore");
|
||||
g_ucAdmin.setAjaxHideButtonID("uc_testaddon_button_restore");
|
||||
|
||||
var addonID = g_objConfig.getAddonID();
|
||||
var data = {"id":addonID,"slotnum":1};
|
||||
|
||||
g_ucAdmin.ajaxRequest("get_test_addon_data", data, function(response){
|
||||
|
||||
g_objConfig.setData(response.config, response.items);
|
||||
|
||||
jQuery("#uc_testaddon_button_restore").show();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on clear data click
|
||||
*/
|
||||
function onDeleteDataClick(){
|
||||
|
||||
g_ucAdmin.setAjaxLoaderID("uc_testaddon_loader_delete");
|
||||
g_ucAdmin.setAjaxHideButtonID("uc_testaddon_button_delete");
|
||||
|
||||
var addonID = g_objConfig.getAddonID();
|
||||
var data = {"id":addonID,"slotnum":1};
|
||||
|
||||
g_ucAdmin.ajaxRequest("delete_test_addon_data", data, function(response){
|
||||
|
||||
jQuery("#uc_testaddon_button_delete").show();
|
||||
|
||||
g_objConfig.clearData();
|
||||
jQuery("#uc_testaddon_slot1").hide();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on show preview - change the buttons
|
||||
*/
|
||||
function onShowPreview(){
|
||||
|
||||
jQuery("#uc_button_preview").hide();
|
||||
jQuery("#uc_button_close_preview").show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* on hide preview - change the buttons
|
||||
*/
|
||||
function onHidePreview(){
|
||||
jQuery("#uc_button_preview").show();
|
||||
jQuery("#uc_button_close_preview").hide();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvents(){
|
||||
|
||||
jQuery("#uc_button_preview").on("click",g_objConfig.showPreview);
|
||||
jQuery("#uc_button_preview_tab").on("click",g_objConfig.showPreviewNewTab);
|
||||
jQuery("#uc_button_close_preview").on("click",g_objConfig.hidePreview);
|
||||
|
||||
g_objConfig.onShowPreview(onShowPreview);
|
||||
g_objConfig.onHidePreview(onHidePreview);
|
||||
|
||||
jQuery("#uc_testaddon_button_save").on("click",onSaveDataClick);
|
||||
|
||||
jQuery("#uc_testaddon_button_delete").on("click",onDeleteDataClick);
|
||||
|
||||
jQuery("#uc_testaddon_button_restore").on("click",onRestoreDataClick);
|
||||
|
||||
jQuery("#uc_testaddon_button_clear").on("click",g_objConfig.clearData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* init test view
|
||||
*/
|
||||
this.init = function(){
|
||||
|
||||
g_objWrapper = jQuery("#uc_testaddon_wrapper");
|
||||
|
||||
//init config
|
||||
var objConfigWrapper = jQuery("#uc_addon_config");
|
||||
|
||||
g_objConfig = new UniteCreatorAddonConfig();
|
||||
g_objConfig.init(objConfigWrapper);
|
||||
|
||||
initEvents();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorTestAddonNew() {
|
||||
var g_slot = 1;
|
||||
var g_addonPreview = new UniteAddonPreviewAdmin();
|
||||
|
||||
if (!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
/**
|
||||
* init the view
|
||||
*/
|
||||
this.init = function () {
|
||||
g_addonPreview.init();
|
||||
|
||||
initEvents();
|
||||
};
|
||||
|
||||
/**
|
||||
* init events
|
||||
*/
|
||||
function initEvents() {
|
||||
jQuery("#uc_testaddon_button_save").on("click", onSaveDataClick);
|
||||
jQuery("#uc_testaddon_button_restore").on("click", onRestoreDataClick);
|
||||
jQuery("#uc_testaddon_button_delete").on("click", onDeleteDataClick);
|
||||
jQuery("#uc_testaddon_button_clear").on("click", onClearClick);
|
||||
jQuery("#uc_testaddon_button_check").on("click", onCheckClick);
|
||||
}
|
||||
|
||||
/**
|
||||
* on save data event
|
||||
*/
|
||||
function onSaveDataClick() {
|
||||
var values = g_addonPreview.getSettingsValues();
|
||||
|
||||
var data = {
|
||||
id: g_addonPreview.getAddonId(),
|
||||
settings_values: values,
|
||||
};
|
||||
|
||||
trace("saving settings:");
|
||||
trace(values);
|
||||
|
||||
g_ucAdmin.setAjaxLoadingButtonID("uc_testaddon_button_save");
|
||||
|
||||
g_ucAdmin.ajaxRequest("save_test_addon", data, function () {
|
||||
jQuery("#uc_testaddon_button_restore").show();
|
||||
jQuery("#uc_testaddon_button_delete").show();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* on restore data event
|
||||
*/
|
||||
function onRestoreDataClick() {
|
||||
g_ucAdmin.setAjaxLoadingButtonID("uc_testaddon_button_restore");
|
||||
|
||||
g_addonPreview.restoreSlot(g_slot);
|
||||
}
|
||||
|
||||
/**
|
||||
* on delete data event
|
||||
*/
|
||||
function onDeleteDataClick() {
|
||||
var data = {
|
||||
id: g_addonPreview.getAddonId(),
|
||||
slotnum: g_slot,
|
||||
};
|
||||
|
||||
g_ucAdmin.setAjaxLoadingButtonID("uc_testaddon_button_delete");
|
||||
|
||||
g_ucAdmin.ajaxRequest("delete_test_addon_data", data, function () {
|
||||
jQuery("#uc_testaddon_button_restore").hide();
|
||||
jQuery("#uc_testaddon_button_delete").hide();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* on clear event
|
||||
*/
|
||||
function onClearClick() {
|
||||
trace("clear settings");
|
||||
|
||||
g_addonPreview.clearSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
* on check event
|
||||
*/
|
||||
function onCheckClick() {
|
||||
var values = g_addonPreview.getSettingsValues();
|
||||
var selectorsCss = g_addonPreview.getSelectorsCss();
|
||||
|
||||
trace("settings values:");
|
||||
trace(values);
|
||||
|
||||
if (selectorsCss) {
|
||||
trace("selectors css:");
|
||||
trace(selectorsCss);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
|
||||
function UniteCreatorVariables(){
|
||||
|
||||
var t = this;
|
||||
|
||||
var g_arrVarsMain = [], g_arrVarsItem = [], g_arrVarsItem2 = [];
|
||||
|
||||
this.types = {
|
||||
MAIN:"main",
|
||||
ITEM:"item"
|
||||
};
|
||||
|
||||
if(!g_ucAdmin)
|
||||
var g_ucAdmin = new UniteAdminUC();
|
||||
|
||||
/**
|
||||
* validate type
|
||||
*/
|
||||
function validateType(type){
|
||||
switch(type){
|
||||
case t.types.MAIN:
|
||||
case t.types.ITEM:
|
||||
break;
|
||||
default:
|
||||
throw new Error("Wrong variables type: " + type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* validate that the index exists in array
|
||||
*/
|
||||
function validateIndex(arrItems, index){
|
||||
|
||||
if(index >= arrItems.length)
|
||||
throw new Error("The var: "+index+" don't exists in the collection");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get array by type
|
||||
*/
|
||||
function getArrByType(type){
|
||||
validateType(type);
|
||||
|
||||
switch(type){
|
||||
case t.types.MAIN:
|
||||
return(g_arrVarsMain);
|
||||
break;
|
||||
case t.types.ITEM:
|
||||
return(g_arrVarsItem);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add variable into collection
|
||||
*/
|
||||
this.add = function(type, objVar){
|
||||
|
||||
var arrVars = getArrByType(type);
|
||||
|
||||
arrVars.push(objVar);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update variable
|
||||
*/
|
||||
this.update = function(type, index, objVar){
|
||||
|
||||
var arrVars = getArrByType(type);
|
||||
|
||||
validateIndex(arrVars, index);
|
||||
|
||||
arrVars[index] = objVar;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* delete variable by name from some collection
|
||||
*/
|
||||
this.deleteVar = function(type, index){
|
||||
|
||||
var arrItems = getArrByType(type);
|
||||
|
||||
validateIndex(arrItems, index);
|
||||
|
||||
arrItems.splice(index, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get variable
|
||||
*/
|
||||
this.getVariable = function(type, index){
|
||||
|
||||
validateType(type);
|
||||
|
||||
var arrItems = getArrByType(type);
|
||||
validateIndex(arrItems, index);
|
||||
|
||||
var objVar = arrItems[index];
|
||||
return(objVar);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add variables from array
|
||||
*/
|
||||
this.addFromArray = function(type, arrVars){
|
||||
validateType(type);
|
||||
if(typeof arrVars != "object")
|
||||
return(false);
|
||||
|
||||
jQuery.each(arrVars, function(index, objVar){
|
||||
t.add(type, objVar);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get variables array by type
|
||||
*/
|
||||
this.getArrVars = function(type){
|
||||
|
||||
var objVars = getArrByType(type);
|
||||
|
||||
var arrVars = g_ucAdmin.objToArray(objVars);
|
||||
|
||||
return(arrVars);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user