Import legacy nurinda.co.id website

This commit is contained in:
dirga committed 2026-10-01 14:27:19 +07:00
1 parent 3f59bb9038
commit 6e21646ac4
13389 files changed
+3246690

No files matched your search

@@ -0,0 +1 @@
var UniteAdminRev=new function(){var e=this,i=null,o=null,t=null,r=null,u=[],d=null,n=null,a=null,l=!1;e.showInfo=function(e){var i='<i class="eg-icon-info"></i>';"warning"==e.type&&(i='<i class="eg-icon-cancel"></i>'),"success"==e.type&&(i='<i class="eg-icon-ok"></i>'),e.showdelay=null!=e.showdelay?e.showdelay:0,e.hidedelay=null!=e.hidedelay?e.hidedelay:0,0==jQuery("#eg-toolbox-wrapper").length&&jQuery("#viewWrapper").append('<div id="eg-toolbox-wrapper"></div>'),jQuery("#eg-toolbox-wrapper").append('<div class="eg-toolbox newadded">'+i+e.content+"</div>");var o=jQuery("#eg-toolbox-wrapper").find(".eg-toolbox.newadded");o.removeClass("newadded"),punchgs.TweenLite.fromTo(o,.5,{y:-50,autoAlpha:0,transformOrigin:"50% 50%",transformPerspective:900,rotationX:-90},{autoAlpha:1,y:0,rotationX:0,ease:punchgs.Back.easeOut,delay:e.showdelay}),"event"!=e.hideon?(o.click(function(){punchgs.TweenLite.to(o,.3,{x:200,ease:punchgs.Power3.easeInOut,autoAlpha:0,onComplete:function(){o.remove()}})}),0!=e.hidedelay&&"click"!=e.hideon&&punchgs.TweenLite.to(o,.3,{x:200,ease:punchgs.Power3.easeInOut,autoAlpha:0,delay:e.hidedelay+e.showdelay,onComplete:function(){o.remove()}})):jQuery("#eg-toolbox-wrapper").on(e.event,function(){punchgs.TweenLite.to(o,.3,{x:200,ease:punchgs.Power3.easeInOut,autoAlpha:0,onComplete:function(){o.remove()}})})},e.htmlspecialchars=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},e.getAbsolutePos=function(e){var i=curtop=0;if(e.offsetParent)for(i=e.offsetLeft,curtop=e.offsetTop;e=e.offsetParent;)i+=e.offsetLeft,curtop+=e.offsetTop;return[i,curtop]},e.stripslashes=function(e){return(e+"").replace(/\\(.?)/g,function(e,i){switch(i){case"\\":return"\\";case"0":return"\0";case"":return"";default:return i}})},e.strToBool=function(e){return null!=e&&("string"==typeof e&&"true"==(e=e.toLowerCase()))},e.setColorPickerCallback=function(e){a=e},e.onColorPickerMoveEvent=function(e){"function"==typeof a&&a(e)},e.stripTags=function(e,i){i=(((i||"")+"").toLowerCase().match(/<[a-z][a-z0-9]*>/g)||[]).join("");return e.replace(/<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi,"").replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,function(e,o){return i.indexOf("<"+o.toLowerCase()+">")>-1?e:""})},e.rgb2hex=function(e){if(-1==e.search("rgb")||""==jQuery.trim(e))return e;function i(e){return("0"+parseInt(e).toString(16)).slice(-2)}e.indexOf("-moz")>-1&&(delete(u=e.split(" "))[0],e=jQuery.trim(u.join(" ")));if(e.split(")").length>2){for(var o="",t=e.split(")"),r=0;r<t.length-1;r++){var u;t[r]+=")",4==(u=t[r].split(",")).length?(e=u[0]+","+u[1]+","+u[2],e+=")"):e=t[r],o+="#"+i((e=(e=jQuery.trim(e)).match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/))[1])+i(e[2])+i(e[3])+" "}return o}return 4==(u=e.split(",")).length&&(e=u[0]+","+u[1]+","+u[2],e+=")"),"#"+i((e=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/))[1])+i(e[2])+i(e[3])},e.getTransparencyFromRgba=function(e,i){var o=e.split(",");return 4==o.length&&((i=void 0===i||i)?o[3].replace(/[^\d.]/g,""):100*o[3].replace(/[^\d.]/g,""))},e.debug=function(e){jQuery("#div_debug").show().html(e)},e.trace=function(e,i){i&&1==i&&console.clear(),console.log(e)},e.showErrorMessage=function(i){e.showInfo({content:i,type:"warning",showdelay:0,hidedelay:3,hideon:"",event:""}),_()};e.setErrorMessageID=function(e){i=e},e.setSuccessMessageID=function(e){o=e};this.hideSuccessMessage=function(){o?(jQuery("#"+o).hide(),o=null):jQuery("#success_message").slideUp("slow").fadeOut("slow"),_()},this.setAjaxLoaderID=function(e){t=e};var s=function(){t&&(jQuery("#"+t).hide(),t=null)};this.setAjaxHideButtonID=function(e){r=e};var _=function(){if(r){var e=r.split(",");if(e.length>1)for(var i=0;i<e.length;i++)jQuery("#"+e[i]).show();else jQuery("#"+r).show();r=null}};e.ajaxRequest=function(o,u,d,n,a){var l={action:g_uniteDirPlugin+"_ajax_action",client_action:o,nonce:g_revNonce,data:u};null!==i?(jQuery("#"+i).hide(),i=null):jQuery("#error_message").hide(),t&&jQuery("#"+t).show(),function(){if(r){var e=r.split(",");if(e.length>1)for(var i=0;i<e.length;i++)jQuery("#"+e[i]).hide();else jQuery("#"+r).hide()}}(),void 0===n&&showWaitAMinute({fadeIn:300,text:rev_lang.please_wait_a_moment}),jQuery.ajax({type:"post",url:ajaxurl,dataType:"json",data:l,success:function(i){if(void 0!==n||i.is_redirect||showWaitAMinute({fadeOut:300}),s(),!i)return e.showErrorMessage("Empty ajax response!"),!1;if(-1==i)return e.showErrorMessage("ajax error!!!"),!1;if(0==i)return e.showErrorMessage("ajax error, action: <b>"+o+"</b> not found"),!1;if(null==i.success)return e.showErrorMessage("The 'success' param is a must!"),!1;if(0==i.success){if(void 0===a)return e.showErrorMessage(i.message),!1;"function"==typeof d&&d(i)}else"function"==typeof d&&d(i),i.message&&(t=i.message,e.showInfo({content:t,type:"success",showdelay:0,hidedelay:1,hideon:"",event:""}),_()),i.is_redirect&&(location.href=i.redirect_url);var t},error:function(i,o,t){void 0===n&&showWaLine truncated
@@ -0,0 +1,174 @@
.CodeMirror {
line-height: 1em;
font-family: monospace;
/* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */
position: relative;
/* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */
overflow: hidden;
}
.CodeMirror-scroll {
overflow: auto;
height: 300px;
/* This is needed to prevent an IE[67] bug where the scrolled content
is visible outside of the scrolling box. */
position: relative;
outline: none;
}
/* Vertical scrollbar */
.CodeMirror-scrollbar {
position: absolute;
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
z-index: 5;
}
.CodeMirror-scrollbar-inner {
/* This needs to have a nonzero width in order for the scrollbar to appear
in Firefox and IE9. */
width: 1px;
}
.CodeMirror-scrollbar.cm-sb-overlap {
/* Ensure that the scrollbar appears in Lion, and that it overlaps the content
rather than sitting to the right of it. */
position: absolute;
z-index: 1;
float: none;
right: 0;
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-nonoverlap {
min-width: 12px;
}
.CodeMirror-scrollbar.cm-sb-ie7 {
min-width: 18px;
}
.CodeMirror-gutter {
position: absolute; left: 0; top: 0;
z-index: 10;
background-color: #f7f7f7;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
}
.CodeMirror-gutter-text {
color: #aaa;
text-align: right;
padding: .4em .2em .4em .4em;
white-space: pre !important;
cursor: default;
}
.CodeMirror-lines {
padding: .4em;
white-space: pre;
cursor: text;
}
.CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: inherit;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
overflow: visible;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror textarea {
outline: none !important;
}
.CodeMirror pre.CodeMirror-cursor {
z-index: 10;
position: absolute;
visibility: hidden;
border-left: 1px solid black;
border-right: none;
width: 0;
}
.cm-keymap-fat-cursor pre.CodeMirror-cursor {
width: auto;
border: 0;
background: transparent;
background: rgba(0, 200, 0, .4);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
}
/* Kludge to turn off filter in ie9+, which also accepts rgba */
.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
.CodeMirror-focused pre.CodeMirror-cursor {
visibility: visible;
}
div.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* Default theme */
.cm-s-default span.cm-keyword {color: #708;}
.cm-s-default span.cm-atom {color: #219;}
.cm-s-default span.cm-number {color: #164;}
.cm-s-default span.cm-def {color: #00f;}
.cm-s-default span.cm-variable {color: black;}
.cm-s-default span.cm-variable-2 {color: #05a;}
.cm-s-default span.cm-variable-3 {color: #085;}
.cm-s-default span.cm-property {color: black;}
.cm-s-default span.cm-operator {color: black;}
.cm-s-default span.cm-comment {color: #a50;}
.cm-s-default span.cm-string {color: #a11;}
.cm-s-default span.cm-string-2 {color: #f50;}
.cm-s-default span.cm-meta {color: #555;}
.cm-s-default span.cm-error {color: #f00;}
.cm-s-default span.cm-qualifier {color: #555;}
.cm-s-default span.cm-builtin {color: #30a;}
.cm-s-default span.cm-bracket {color: #997;}
.cm-s-default span.cm-tag {color: #170;}
.cm-s-default span.cm-attribute {color: #00c;}
.cm-s-default span.cm-header {color: blue;}
.cm-s-default span.cm-quote {color: #090;}
.cm-s-default span.cm-hr {color: #999;}
.cm-s-default span.cm-link {color: #00c;}
span.cm-header, span.cm-strong {font-weight: bold;}
span.cm-em {font-style: italic;}
span.cm-emstrong {font-style: italic; font-weight: bold;}
span.cm-link {text-decoration: underline;}
span.cm-invalidchar {color: #f00;}
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
@media print {
/* Hide the cursor when printing */
.CodeMirror pre.CodeMirror-cursor {
visibility: hidden;
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,448 @@
CodeMirror.defineMode("css", function(config) {
var indentUnit = config.indentUnit, type;
var atMediaTypes = keySet([
"all", "aural", "braille", "handheld", "print", "projection", "screen",
"tty", "tv", "embossed"
]);
var atMediaFeatures = keySet([
"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"
]);
var propertyKeywords = keySet([
"align-content", "align-items", "align-self", "alignment-adjust",
"alignment-baseline", "anchor-point", "animation", "animation-delay",
"animation-direction", "animation-duration", "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", "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-cell", "grid-column", "grid-column-align",
"grid-column-sizing", "grid-column-span", "grid-columns", "grid-flow",
"grid-row", "grid-row-align", "grid-row-sizing", "grid-row-span",
"grid-rows", "grid-template", "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", "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", "rendering-intent",
"resize", "rest", "rest-after", "rest-before", "richness", "right",
"rotation", "rotation-point", "ruby-align", "ruby-overhang",
"ruby-position", "ruby-span", "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-shadow",
"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"
]);
var colorKeywords = keySet([
"black", "silver", "gray", "white", "maroon", "red", "purple", "fuchsia",
"green", "lime", "olive", "yellow", "navy", "blue", "teal", "aqua"
]);
var valueKeywords = keySet([
"above", "absolute", "activeborder", "activecaption", "afar",
"after-white-space", "ahead", "alias", "all", "all-scroll", "alternate",
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
"arabic-indic", "armenian", "asterisks", "auto", "avoid", "background",
"backwards", "baseline", "below", "bidi-override", "binary", "bengali",
"blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
"both", "bottom", "break-all", "break-word", "button", "button-bevel",
"buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian",
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
"cell", "center", "checkbox", "circle", "cjk-earthly-branch",
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
"col-resize", "collapse", "compact", "condensed", "contain", "content",
"content-box", "context-menu", "continuous", "copy", "cover", "crop",
"cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal",
"decimal-leading-zero", "default", "default-button", "destination-atop",
"destination-in", "destination-out", "destination-over", "devanagari",
"disc", "discard", "document", "dot-dash", "dot-dot-dash", "dotted",
"double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
"element", "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", "ew-resize", "expanded", "extra-condensed",
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "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-table", "inset", "inside", "intrinsic", "invert",
"italic", "justify", "kannada", "katakana", "katakana-iroha", "khmer",
"landscape", "lao", "large", "larger", "left", "level", "lighter",
"line-through", "linear", "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",
"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", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
"ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
"optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
"outside", "overlay", "overline", "padding", "padding-box", "painted",
"paused", "persian", "plus-darker", "plus-lighter", "pointer", "portrait",
"pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button",
"radio", "read-only", "read-write", "read-write-plaintext-only", "relative",
"repeat", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba",
"ridge", "right", "round", "row-resize", "rtl", "run-in", "running",
"s-resize", "sans-serif", "scroll", "scrollbar", "se-resize", "searchfield",
"searchfield-cancel-button", "searchfield-decoration",
"searchfield-results-button", "searchfield-results-decoration",
"semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
"single", "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", "square",
"square-button", "start", "static", "status-bar", "stretch", "stroke",
"sub", "subpixel-antialiased", "super", "sw-resize", "table",
"table-caption", "table-cell", "table-column", "table-column-group",
"table-footer-group", "table-header-group", "table-row", "table-row-group",
"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",
"transparent", "ultra-condensed", "ultra-expanded", "underline", "up",
"upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
"vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
"visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider",
"window", "windowframe", "windowtext", "x-large", "x-small", "xor",
"xx-large", "xx-small", "yellow"
]);
function keySet(array) { var keys = {}; for (var i = 0; i < array.length; ++i) keys[array[i]] = true; return keys; }
function ret(style, tp) {type = tp; return style;}
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("def", stream.current());}
else if (ch == "/" && stream.eat("*")) {
state.tokenize = tokenCComment;
return tokenCComment(stream, state);
}
else if (ch == "<" && stream.eat("!")) {
state.tokenize = tokenSGMLComment;
return tokenSGMLComment(stream, state);
}
else if (ch == "=") ret(null, "compare");
else if ((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)) {
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(/^[^-]+-/)) {
return ret("meta", type);
}
}
else if (/[,+>*\/]/.test(ch)) {
return ret(null, "select-op");
}
else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
return ret("qualifier", type);
}
else if (ch == ":") {
return ret("operator", ch);
}
else if (/[;{}\[\]\(\)]/.test(ch)) {
return ret(null, ch);
}
else {
stream.eatWhile(/[\w\\\-]/);
return ret("property", "variable");
}
}
function tokenCComment(stream, state) {
var maybeEnd = false, ch;
while ((ch = stream.next()) != null) {
if (maybeEnd && ch == "/") {
state.tokenize = tokenBase;
break;
}
maybeEnd = (ch == "*");
}
return ret("comment", "comment");
}
function tokenSGMLComment(stream, state) {
var dashes = 0, ch;
while ((ch = stream.next()) != null) {
if (dashes >= 2 && ch == ">") {
state.tokenize = tokenBase;
break;
}
dashes = (ch == "-") ? dashes + 1 : 0;
}
return ret("comment", "comment");
}
function tokenString(quote) {
return function(stream, state) {
var escaped = false, ch;
while ((ch = stream.next()) != null) {
if (ch == quote && !escaped)
break;
escaped = !escaped && ch == "\\";
}
if (!escaped) state.tokenize = tokenBase;
return ret("string", "string");
};
}
return {
startState: function(base) {
return {tokenize: tokenBase,
baseIndent: base || 0,
stack: []};
},
token: function(stream, state) {
// Use these terms when applicable (see http://www.xanthir.com/blog/b4E50)
//
// rule** or **ruleset:
// A selector + braces combo, or an at-rule.
//
// declaration block:
// A sequence of declarations.
//
// declaration:
// A property + colon + value combo.
//
// property value:
// The entire value of a property.
//
// component value:
// A single piece of a property value. Like the 5px in
// text-shadow: 0 0 5px blue;. Can also refer to things that are
// multiple terms, like the 1-4 terms that make up the background-size
// portion of the background shorthand.
//
// term:
// The basic unit of author-facing CSS, like a single number (5),
// dimension (5px), string ("foo"), or function. Officially defined
// by the CSS 2.1 grammar (look for the 'term' production)
//
//
// simple selector:
// A single atomic selector, like a type selector, an attr selector, a
// class selector, etc.
//
// compound selector:
// One or more simple selectors without a combinator. div.example is
// compound, div > .example is not.
//
// complex selector:
// One or more compound selectors chained with combinators.
//
// combinator:
// The parts of selectors that express relationships. There are four
// currently - the space (descendant combinator), the greater-than
// bracket (child combinator), the plus sign (next sibling combinator),
// and the tilda (following sibling combinator).
//
// sequence of selectors:
// One or more of the named type of selector chained with commas.
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
// Changing style returned based on context
var context = state.stack[state.stack.length-1];
if (style == "property") {
if (context == "propertyValue"){
if (valueKeywords[stream.current()]) {
style = "string-2";
} else if (colorKeywords[stream.current()]) {
style = "keyword";
} else {
style = "variable-2";
}
} else if (context == "rule") {
if (!propertyKeywords[stream.current()]) {
style += " error";
}
} else if (!context || context == "@media{") {
style = "tag";
} else if (context == "@media") {
if (atMediaTypes[stream.current()]) {
style = "attribute"; // Known attribute
} else if (/^(only|not)$/i.test(stream.current())) {
style = "keyword";
} else if (stream.current().toLowerCase() == "and") {
style = "error"; // "and" is only allowed in @mediaType
} else if (atMediaFeatures[stream.current()]) {
style = "error"; // Known property, should be in @mediaType(
} else {
// Unknown, expecting keyword or attribute, assuming attribute
style = "attribute error";
}
} else if (context == "@mediaType") {
if (atMediaTypes[stream.current()]) {
style = "attribute";
} else if (stream.current().toLowerCase() == "and") {
style = "operator";
} else if (/^(only|not)$/i.test(stream.current())) {
style = "error"; // Only allowed in @media
} else if (atMediaFeatures[stream.current()]) {
style = "error"; // Known property, should be in parentheses
} else {
// Unknown attribute or property, but expecting property (preceded
// by "and"). Should be in parentheses
style = "error";
}
} else if (context == "@mediaType(") {
if (propertyKeywords[stream.current()]) {
// do nothing, remains "property"
} else if (atMediaTypes[stream.current()]) {
style = "error"; // Known property, should be in parentheses
} else if (stream.current().toLowerCase() == "and") {
style = "operator";
} else if (/^(only|not)$/i.test(stream.current())) {
style = "error"; // Only allowed in @media
} else {
style += " error";
}
} else {
style = "error";
}
} else if (style == "atom") {
if(!context || context == "@media{") {
style = "builtin";
} else if (context == "propertyValue") {
if (!/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
style += " error";
}
} else {
style = "error";
}
} else if (context == "@media" && type == "{") {
style = "error";
}
// Push/pop context stack
if (type == "{") {
if (context == "@media" || context == "@mediaType") {
state.stack.pop();
state.stack[state.stack.length-1] = "@media{";
}
else state.stack.push("rule");
}
else if (type == "}") {
state.stack.pop();
if (context == "propertyValue") state.stack.pop();
}
else if (type == "@media") state.stack.push("@media");
else if (context == "@media" && /\b(keyword|attribute)\b/.test(style))
state.stack.push("@mediaType");
else if (context == "@mediaType" && stream.current() == ",") state.stack.pop();
else if (context == "@mediaType" && type == "(") state.stack.push("@mediaType(");
else if (context == "@mediaType(" && type == ")") state.stack.pop();
else if (context == "rule" && type == ":") state.stack.push("propertyValue");
else if (context == "propertyValue" && type == ";") state.stack.pop();
return style;
},
indent: function(state, textAfter) {
var n = state.stack.length;
if (/^\}/.test(textAfter))
n -= state.stack[state.stack.length-1] == "propertyValue" ? 2 : 1;
return state.baseIndent + n * indentUnit;
},
electricChars: "}"
};
});
CodeMirror.defineMIME("text/css", "css");
Whitespace-only changes.
@@ -0,0 +1,164 @@
/**
* Tag-closer extension for CodeMirror.
*
* This extension adds a "closeTag" utility function that can be used with key bindings to
* insert a matching end tag after the ">" character of a start tag has been typed. It can
* also complete "</" if a matching start tag is found. It will correctly ignore signal
* characters for empty tags, comments, CDATA, etc.
*
* The function depends on internal parser state to identify tags. It is compatible with the
* following CodeMirror modes and will ignore all others:
* - htmlmixed
* - xml
*
* See demos/closetag.html for a usage example.
*
* @author Nathan Williams <nathan@nlwillia.net>
* Contributed under the same license terms as CodeMirror.
*/
(function() {
/** Option that allows tag closing behavior to be toggled. Default is true. */
CodeMirror.defaults['closeTagEnabled'] = true;
/** Array of tag names to add indentation after the start tag for. Default is the list of block-level html tags. */
CodeMirror.defaults['closeTagIndent'] = ['applet', 'blockquote', 'body', 'button', 'div', 'dl', 'fieldset', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'iframe', 'layer', 'legend', 'object', 'ol', 'p', 'select', 'table', 'ul'];
/** Array of tag names where an end tag is forbidden. */
CodeMirror.defaults['closeTagVoid'] = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
function innerState(cm, state) {
return CodeMirror.innerMode(cm.getMode(), state).state;
}
/**
* Call during key processing to close tags. Handles the key event if the tag is closed, otherwise throws CodeMirror.Pass.
* - cm: The editor instance.
* - ch: The character being processed.
* - indent: Optional. An array of tag names to indent when closing. Omit or pass true to use the default indentation tag list defined in the 'closeTagIndent' option.
* Pass false to disable indentation. Pass an array to override the default list of tag names.
* - vd: Optional. An array of tag names that should not be closed. Omit to use the default void (end tag forbidden) tag list defined in the 'closeTagVoid' option. Ignored in xml mode.
*/
CodeMirror.defineExtension("closeTag", function(cm, ch, indent, vd) {
if (!cm.getOption('closeTagEnabled')) {
throw CodeMirror.Pass;
}
/*
* Relevant structure of token:
*
* htmlmixed
* className
* state
* htmlState
* type
* tagName
* context
* tagName
* mode
*
* xml
* className
* state
* tagName
* type
*/
var pos = cm.getCursor();
var tok = cm.getTokenAt(pos);
var state = innerState(cm, tok.state);
if (state) {
if (ch == '>') {
var type = state.type;
if (tok.className == 'tag' && type == 'closeTag') {
throw CodeMirror.Pass; // Don't process the '>' at the end of an end-tag.
}
cm.replaceSelection('>'); // Mode state won't update until we finish the tag.
pos = {line: pos.line, ch: pos.ch + 1};
cm.setCursor(pos);
tok = cm.getTokenAt(cm.getCursor());
state = innerState(cm, tok.state);
if (!state) throw CodeMirror.Pass;
var type = state.type;
if (tok.className == 'tag' && type != 'selfcloseTag') {
var tagName = state.tagName;
if (tagName.length > 0 && shouldClose(cm, vd, tagName)) {
insertEndTag(cm, indent, pos, tagName);
}
return;
}
// Undo the '>' insert and allow cm to handle the key instead.
cm.setSelection({line: pos.line, ch: pos.ch - 1}, pos);
cm.replaceSelection("");
} else if (ch == '/') {
if (tok.className == 'tag' && tok.string == '<') {
var ctx = state.context, tagName = ctx ? ctx.tagName : '';
if (tagName.length > 0) {
completeEndTag(cm, pos, tagName);
return;
}
}
}
}
throw CodeMirror.Pass; // Bubble if not handled
});
function insertEndTag(cm, indent, pos, tagName) {
if (shouldIndent(cm, indent, tagName)) {
cm.replaceSelection('\n\n</' + tagName + '>', 'end');
cm.indentLine(pos.line + 1);
cm.indentLine(pos.line + 2);
cm.setCursor({line: pos.line + 1, ch: cm.getLine(pos.line + 1).length});
} else {
cm.replaceSelection('</' + tagName + '>');
cm.setCursor(pos);
}
}
function shouldIndent(cm, indent, tagName) {
if (typeof indent == 'undefined' || indent == null || indent == true) {
indent = cm.getOption('closeTagIndent');
}
if (!indent) {
indent = [];
}
return indexOf(indent, tagName.toLowerCase()) != -1;
}
function shouldClose(cm, vd, tagName) {
if (cm.getOption('mode') == 'xml') {
return true; // always close xml tags
}
if (typeof vd == 'undefined' || vd == null) {
vd = cm.getOption('closeTagVoid');
}
if (!vd) {
vd = [];
}
return indexOf(vd, tagName.toLowerCase()) == -1;
}
// C&P from codemirror.js...would be nice if this were visible to utilities.
function indexOf(collection, elt) {
if (collection.indexOf) return collection.indexOf(elt);
for (var i = 0, e = collection.length; i < e; ++i)
if (collection[i] == elt) return i;
return -1;
}
function completeEndTag(cm, pos, tagName) {
cm.replaceSelection('/' + tagName + '>');
cm.setCursor({line: pos.line, ch: pos.ch + tagName.length + 2 });
}
})();
@@ -0,0 +1,27 @@
.CodeMirror-dialog {
position: relative;
}
.CodeMirror-dialog > div {
position: absolute;
top: 0; left: 0; right: 0;
background: white;
border-bottom: 1px solid #eee;
z-index: 15;
padding: .1em .8em;
overflow: hidden;
color: #333;
}
.CodeMirror-dialog input {
border: none;
outline: none;
background: transparent;
width: 20em;
color: inherit;
font-family: monospace;
}
.CodeMirror-dialog button {
font-size: 70%;
}
@@ -0,0 +1,70 @@
// Open simple dialogs on top of an editor. Relies on dialog.css.
(function() {
function dialogDiv(cm, template) {
var wrap = cm.getWrapperElement();
var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild);
dialog.className = "CodeMirror-dialog";
dialog.innerHTML = '<div>' + template + '</div>';
return dialog;
}
CodeMirror.defineExtension("openDialog", function(template, callback) {
var dialog = dialogDiv(this, template);
var closed = false, me = this;
function close() {
if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);
}
var inp = dialog.getElementsByTagName("input")[0], button;
if (inp) {
CodeMirror.connect(inp, "keydown", function(e) {
if (e.keyCode == 13 || e.keyCode == 27) {
CodeMirror.e_stop(e);
close();
me.focus();
if (e.keyCode == 13) callback(inp.value);
}
});
inp.focus();
CodeMirror.connect(inp, "blur", close);
} else if (button = dialog.getElementsByTagName("button")[0]) {
CodeMirror.connect(button, "click", function() {
close();
me.focus();
});
button.focus();
CodeMirror.connect(button, "blur", close);
}
return close;
});
CodeMirror.defineExtension("openConfirm", function(template, callbacks) {
var dialog = dialogDiv(this, template);
var buttons = dialog.getElementsByTagName("button");
var closed = false, me = this, blurring = 1;
function close() {
if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);
me.focus();
}
buttons[0].focus();
for (var i = 0; i < buttons.length; ++i) {
var b = buttons[i];
(function(callback) {
CodeMirror.connect(b, "click", function(e) {
CodeMirror.e_preventDefault(e);
close();
if (callback) callback(me);
});
})(callbacks[i]);
CodeMirror.connect(b, "blur", function() {
--blurring;
setTimeout(function() { if (blurring <= 0) close(); }, 200);
});
CodeMirror.connect(b, "focus", function() { ++blurring; });
}
});
})();
@@ -0,0 +1,196 @@
// the tagRangeFinder function is
// Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org>
// released under the MIT license (../../LICENSE) like the rest of CodeMirror
CodeMirror.tagRangeFinder = function(cm, line, hideEnd) {
var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*");
var lineText = cm.getLine(line);
var found = false;
var tag = null;
var pos = 0;
while (!found) {
pos = lineText.indexOf("<", pos);
if (-1 == pos) // no tag on line
return;
if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag
pos++;
continue;
}
// ok we weem to have a start tag
if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name...
pos++;
continue;
}
var gtPos = lineText.indexOf(">", pos + 1);
if (-1 == gtPos) { // end of start tag not in line
var l = line + 1;
var foundGt = false;
var lastLine = cm.lineCount();
while (l < lastLine && !foundGt) {
var lt = cm.getLine(l);
var gt = lt.indexOf(">");
if (-1 != gt) { // found a >
foundGt = true;
var slash = lt.lastIndexOf("/", gt);
if (-1 != slash && slash < gt) {
var str = lineText.substr(slash, gt - slash + 1);
if (!str.match( /\/\s*\>/ )) { // yep, that's the end of empty tag
if (hideEnd === true) l++;
return l;
}
}
}
l++;
}
found = true;
}
else {
var slashPos = lineText.lastIndexOf("/", gtPos);
if (-1 == slashPos) { // cannot be empty tag
found = true;
// don't continue
}
else { // empty tag?
// check if really empty tag
var str = lineText.substr(slashPos, gtPos - slashPos + 1);
if (!str.match( /\/\s*\>/ )) { // finally not empty
found = true;
// don't continue
}
}
}
if (found) {
var subLine = lineText.substr(pos + 1);
tag = subLine.match(xmlNAMERegExp);
if (tag) {
// we have an element name, wooohooo !
tag = tag[0];
// do we have the close tag on same line ???
if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep
{
found = false;
}
// we don't, so we have a candidate...
}
else
found = false;
}
if (!found)
pos++;
}
if (found) {
var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";
var startTagRegExp = new RegExp(startTag, "g");
var endTag = "</" + tag + ">";
var depth = 1;
var l = line + 1;
var lastLine = cm.lineCount();
while (l < lastLine) {
lineText = cm.getLine(l);
var match = lineText.match(startTagRegExp);
if (match) {
for (var i = 0; i < match.length; i++) {
if (match[i] == endTag)
depth--;
else
depth++;
if (!depth) {
if (hideEnd === true) l++;
return l;
}
}
}
l++;
}
return;
}
};
CodeMirror.braceRangeFinder = function(cm, line, hideEnd) {
var lineText = cm.getLine(line), at = lineText.length, startChar, tokenType;
for (;;) {
var found = lineText.lastIndexOf("{", at);
if (found < 0) break;
tokenType = cm.getTokenAt({line: line, ch: found}).className;
if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }
at = found - 1;
}
if (startChar == null || lineText.lastIndexOf("}") > startChar) return;
var count = 1, lastLine = cm.lineCount(), end;
outer: for (var i = line + 1; i < lastLine; ++i) {
var text = cm.getLine(i), pos = 0;
for (;;) {
var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
if (nextOpen < 0) nextOpen = text.length;
if (nextClose < 0) nextClose = text.length;
pos = Math.min(nextOpen, nextClose);
if (pos == text.length) break;
if (cm.getTokenAt({line: i, ch: pos + 1}).className == tokenType) {
if (pos == nextOpen) ++count;
else if (!--count) { end = i; break outer; }
}
++pos;
}
}
if (end == null || end == line + 1) return;
if (hideEnd === true) end++;
return end;
};
CodeMirror.indentRangeFinder = function(cm, line) {
var tabSize = cm.getOption("tabSize");
var myIndent = cm.getLineHandle(line).indentation(tabSize), last;
for (var i = line + 1, end = cm.lineCount(); i < end; ++i) {
var handle = cm.getLineHandle(i);
if (!/^\s*$/.test(handle.text)) {
if (handle.indentation(tabSize) <= myIndent) break;
last = i;
}
}
if (!last) return null;
return last + 1;
};
CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) {
var folded = [];
if (markText == null) markText = '<div style="position: absolute; left: 2px; color:#600">&#x25bc;</div>%N%';
function isFolded(cm, n) {
for (var i = 0; i < folded.length; ++i) {
var start = cm.lineInfo(folded[i].start);
if (!start) folded.splice(i--, 1);
else if (start.line == n) return {pos: i, region: folded[i]};
}
}
function expand(cm, region) {
cm.clearMarker(region.start);
for (var i = 0; i < region.hidden.length; ++i)
cm.showLine(region.hidden[i]);
}
return function(cm, line) {
cm.operation(function() {
var known = isFolded(cm, line);
if (known) {
folded.splice(known.pos, 1);
expand(cm, known.region);
} else {
var end = rangeFinder(cm, line, hideEnd);
if (end == null) return;
var hidden = [];
for (var i = line + 1; i < end; ++i) {
var handle = cm.hideLine(i);
if (handle) hidden.push(handle);
}
var first = cm.setMarker(line, markText);
var region = {start: first, hidden: hidden};
cm.onDeleteLine(first, function() { expand(cm, region); });
folded.push(region);
}
});
};
};
@@ -0,0 +1,193 @@
// ============== Formatting extensions ============================
(function() {
// Define extensions for a few modes
CodeMirror.extendMode("css", {
commentStart: "/*",
commentEnd: "*/",
wordWrapChars: [";", "\\{", "\\}"],
autoFormatLineBreaks: function (text) {
return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2");
}
});
function jsNonBreakableBlocks(text) {
var nonBreakableRegexes = [/for\s*?\((.*?)\)/,
/\"(.*?)(\"|$)/,
/\'(.*?)(\'|$)/,
/\/\*(.*?)(\*\/|$)/,
/\/\/.*/];
var nonBreakableBlocks = [];
for (var i = 0; i < nonBreakableRegexes.length; i++) {
var curPos = 0;
while (curPos < text.length) {
var m = text.substr(curPos).match(nonBreakableRegexes[i]);
if (m != null) {
nonBreakableBlocks.push({
start: curPos + m.index,
end: curPos + m.index + m[0].length
});
curPos += m.index + Math.max(1, m[0].length);
}
else { // No more matches
break;
}
}
}
nonBreakableBlocks.sort(function (a, b) {
return a.start - b.start;
});
return nonBreakableBlocks;
}
CodeMirror.extendMode("javascript", {
commentStart: "/*",
commentEnd: "*/",
wordWrapChars: [";", "\\{", "\\}"],
autoFormatLineBreaks: function (text) {
var curPos = 0;
var reLinesSplitter = /(;|\{|\})([^\r\n;])/g;
var nonBreakableBlocks = jsNonBreakableBlocks(text);
if (nonBreakableBlocks != null) {
var res = "";
for (var i = 0; i < nonBreakableBlocks.length; i++) {
if (nonBreakableBlocks[i].start > curPos) { // Break lines till the block
res += text.substring(curPos, nonBreakableBlocks[i].start).replace(reLinesSplitter, "$1\n$2");
curPos = nonBreakableBlocks[i].start;
}
if (nonBreakableBlocks[i].start <= curPos
&& nonBreakableBlocks[i].end >= curPos) { // Skip non-breakable block
res += text.substring(curPos, nonBreakableBlocks[i].end);
curPos = nonBreakableBlocks[i].end;
}
}
if (curPos < text.length)
res += text.substr(curPos).replace(reLinesSplitter, "$1\n$2");
return res;
} else {
return text.replace(reLinesSplitter, "$1\n$2");
}
}
});
CodeMirror.extendMode("xml", {
commentStart: "<!--",
commentEnd: "-->",
wordWrapChars: [">"],
autoFormatLineBreaks: function (text) {
var lines = text.split("\n");
var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)");
var reOpenBrackets = new RegExp("<", "g");
var reCloseBrackets = new RegExp("(>)([^\r\n])", "g");
for (var i = 0; i < lines.length; i++) {
var mToProcess = lines[i].match(reProcessedPortion);
if (mToProcess != null && mToProcess.length > 3) { // The line starts with whitespaces and ends with whitespaces
lines[i] = mToProcess[1]
+ mToProcess[2].replace(reOpenBrackets, "\n$&").replace(reCloseBrackets, "$1\n$2")
+ mToProcess[3];
continue;
}
}
return lines.join("\n");
}
});
function localModeAt(cm, pos) {
return CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(pos).state).mode;
}
function enumerateModesBetween(cm, line, start, end) {
var outer = cm.getMode(), text = cm.getLine(line);
if (end == null) end = text.length;
if (!outer.innerMode) return [{from: start, to: end, mode: outer}];
var state = cm.getTokenAt({line: line, ch: start}).state;
var mode = CodeMirror.innerMode(outer, state).mode;
var found = [], stream = new CodeMirror.StringStream(text);
stream.pos = stream.start = start;
for (;;) {
outer.token(stream, state);
var curMode = CodeMirror.innerMode(outer, state).mode;
if (curMode != mode) {
var cut = stream.start;
// Crappy heuristic to deal with the fact that a change in
// mode can occur both at the end and the start of a token,
// and we don't know which it was.
if (mode.name == "xml" && text.charAt(stream.pos - 1) == ">") cut = stream.pos;
found.push({from: start, to: cut, mode: mode});
start = cut;
mode = curMode;
}
if (stream.pos >= end) break;
stream.start = stream.pos;
}
if (start < end) found.push({from: start, to: end, mode: mode});
return found;
}
// Comment/uncomment the specified range
CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
var curMode = localModeAt(this, from), cm = this;
this.operation(function() {
if (isComment) { // Comment range
cm.replaceRange(curMode.commentEnd, to);
cm.replaceRange(curMode.commentStart, from);
if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside
cm.setCursor(from.line, from.ch + curMode.commentStart.length);
} else { // Uncomment range
var selText = cm.getRange(from, to);
var startIndex = selText.indexOf(curMode.commentStart);
var endIndex = selText.lastIndexOf(curMode.commentEnd);
if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {
// Take string till comment start
selText = selText.substr(0, startIndex)
// From comment start till comment end
+ selText.substring(startIndex + curMode.commentStart.length, endIndex)
// From comment end till string end
+ selText.substr(endIndex + curMode.commentEnd.length);
}
cm.replaceRange(selText, from, to);
}
});
});
// Applies automatic mode-aware indentation to the specified range
CodeMirror.defineExtension("autoIndentRange", function (from, to) {
var cmInstance = this;
this.operation(function () {
for (var i = from.line; i <= to.line; i++) {
cmInstance.indentLine(i, "smart");
}
});
});
// Applies automatic formatting to the specified range
CodeMirror.defineExtension("autoFormatRange", function (from, to) {
var cm = this;
cm.operation(function () {
for (var cur = from.line, end = to.line; cur <= end; ++cur) {
var f = {line: cur, ch: cur == from.line ? from.ch : 0};
var t = {line: cur, ch: cur == end ? to.ch : null};
var modes = enumerateModesBetween(cm, cur, f.ch, t.ch), mangled = "";
var text = cm.getRange(f, t);
for (var i = 0; i < modes.length; ++i) {
var part = modes.length > 1 ? text.slice(modes[i].from, modes[i].to) : text;
if (mangled) mangled += "\n";
if (modes[i].mode.autoFormatLineBreaks) {
mangled += modes[i].mode.autoFormatLineBreaks(part);
} else mangled += text;
}
if (mangled != text) {
for (var count = 0, pos = mangled.indexOf("\n"); pos != -1; pos = mangled.indexOf("\n", pos + 1), ++count) {}
cm.replaceRange(mangled, f, t);
cur += count;
end += count;
}
}
for (var cur = from.line + 1; cur <= end; ++cur)
cm.indentLine(cur, "smart");
cm.setSelection(from, cm.getCursor(false));
});
});
})();
Whitespace-only changes.
@@ -0,0 +1,134 @@
(function () {
function forEach(arr, f) {
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
}
function arrayContains(arr, item) {
if (!Array.prototype.indexOf) {
var i = arr.length;
while (i--) {
if (arr[i] === item) {
return true;
}
}
return false;
}
return arr.indexOf(item) != -1;
}
function scriptHint(editor, keywords, getToken) {
// Find the token at the cursor
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
// If it's not a 'word-style' token, ignore the token.
if (!/^[\w$_]*$/.test(token.string)) {
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
className: token.string == "." ? "property" : null};
}
// If it is a property, find out what it is a property of.
while (tprop.className == "property") {
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
if (tprop.string != ".") return;
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
if (tprop.string == ')') {
var level = 1;
do {
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
switch (tprop.string) {
case ')': level++; break;
case '(': level--; break;
default: break;
}
} while (level > 0);
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
if (tprop.className == 'variable')
tprop.className = 'function';
else return; // no clue
}
if (!context) var context = [];
context.push(tprop);
}
return {list: getCompletions(token, context, keywords),
from: {line: cur.line, ch: token.start},
to: {line: cur.line, ch: token.end}};
}
CodeMirror.javascriptHint = function(editor) {
return scriptHint(editor, javascriptKeywords,
function (e, cur) {return e.getTokenAt(cur);});
};
function getCoffeeScriptToken(editor, cur) {
// This getToken, it is for coffeescript, imitates the behavior of
// getTokenAt method in javascript.js, that is, returning "property"
// type and treat "." as indepenent token.
var token = editor.getTokenAt(cur);
if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
token.end = token.start;
token.string = '.';
token.className = "property";
}
else if (/^\.[\w$_]*$/.test(token.string)) {
token.className = "property";
token.start++;
token.string = token.string.replace(/\./, '');
}
return token;
}
CodeMirror.coffeescriptHint = function(editor) {
return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken);
};
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
"toUpperCase toLowerCase split concat match replace search").split(" ");
var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
var funcProps = "prototype apply call bind".split(" ");
var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
"if in instanceof new null return switch throw true try typeof var void while with").split(" ");
var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
function getCompletions(token, context, keywords) {
var found = [], start = token.string;
function maybeAdd(str) {
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
}
function gatherCompletions(obj) {
if (typeof obj == "string") forEach(stringProps, maybeAdd);
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
for (var name in obj) maybeAdd(name);
}
if (context) {
// If this is a property, see if it belongs to some object we can
// find in the current environment.
var obj = context.pop(), base;
if (obj.className == "variable")
base = window[obj.string];
else if (obj.className == "string")
base = "";
else if (obj.className == "atom")
base = 1;
else if (obj.className == "function") {
if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
(typeof window.jQuery == 'function'))
base = window.jQuery();
else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
base = window._();
}
while (base != null && context.length)
base = base[context.pop().string];
if (base != null) gatherCompletions(base);
}
else {
// If not, just look in the window object and any local scope
// (reading into JS mode internals to get at the local variables)
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
gatherCompletions(window);
forEach(keywords, maybeAdd);
}
return found;
}
})();
@@ -0,0 +1,51 @@
(function() {
if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
var loading = {};
function splitCallback(cont, n) {
var countDown = n;
return function() { if (--countDown == 0) cont(); };
}
function ensureDeps(mode, cont) {
var deps = CodeMirror.modes[mode].dependencies;
if (!deps) return cont();
var missing = [];
for (var i = 0; i < deps.length; ++i) {
if (!CodeMirror.modes.hasOwnProperty(deps[i]))
missing.push(deps[i]);
}
if (!missing.length) return cont();
var split = splitCallback(cont, missing.length);
for (var i = 0; i < missing.length; ++i)
CodeMirror.requireMode(missing[i], split);
}
CodeMirror.requireMode = function(mode, cont) {
if (typeof mode != "string") mode = mode.name;
if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
var script = document.createElement("script");
script.src = CodeMirror.modeURL.replace(/%N/g, mode);
var others = document.getElementsByTagName("script")[0];
others.parentNode.insertBefore(script, others);
var list = loading[mode] = [cont];
var count = 0, poll = setInterval(function() {
if (++count > 100) return clearInterval(poll);
if (CodeMirror.modes.hasOwnProperty(mode)) {
clearInterval(poll);
loading[mode] = null;
ensureDeps(mode, function() {
for (var i = 0; i < list.length; ++i) list[i]();
});
}
}, 200);
};
CodeMirror.autoLoadMode = function(instance, mode) {
if (!CodeMirror.modes.hasOwnProperty(mode))
CodeMirror.requireMode(mode, function() {
instance.setOption("mode", instance.getOption("mode"));
});
};
}());
@@ -0,0 +1,44 @@
// Define match-highlighter commands. Depends on searchcursor.js
// Use by attaching the following function call to the onCursorActivity event:
//myCodeMirror.matchHighlight(minChars);
// And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html)
(function() {
var DEFAULT_MIN_CHARS = 2;
function MatchHighlightState() {
this.marked = [];
}
function getMatchHighlightState(cm) {
return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState());
}
function clearMarks(cm) {
var state = getMatchHighlightState(cm);
for (var i = 0; i < state.marked.length; ++i)
state.marked[i].clear();
state.marked = [];
}
function markDocument(cm, className, minChars) {
clearMarks(cm);
minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);
if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) {
var state = getMatchHighlightState(cm);
var query = cm.getSelection();
cm.operation(function() {
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {
//Only apply matchhighlight to the matches other than the one actually selected
if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch))
state.marked.push(cm.markText(cursor.from(), cursor.to(), className));
}
}
});
}
}
CodeMirror.defineExtension("matchHighlight", function(className, minChars) {
markDocument(this, className, minChars);
});
})();
@@ -0,0 +1,77 @@
CodeMirror.multiplexingMode = function(outer /*, others */) {
// Others should be {open, close, mode [, delimStyle]} objects
var others = Array.prototype.slice.call(arguments, 1);
var n_others = others.length;
function indexOf(string, pattern, from) {
if (typeof pattern == "string") return string.indexOf(pattern, from);
var m = pattern.exec(from ? string.slice(from) : string);
return m ? m.index + from : -1;
}
return {
startState: function() {
return {
outer: CodeMirror.startState(outer),
innerActive: null,
inner: null
};
},
copyState: function(state) {
return {
outer: CodeMirror.copyState(outer, state.outer),
innerActive: state.innerActive,
inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)
};
},
token: function(stream, state) {
if (!state.innerActive) {
var cutOff = Infinity, oldContent = stream.string;
for (var i = 0; i < n_others; ++i) {
var other = others[i];
var found = indexOf(oldContent, other.open, stream.pos);
if (found == stream.pos) {
stream.match(other.open);
state.innerActive = other;
state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0);
return other.delimStyle;
} 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;
var found = indexOf(oldContent, curInner.close, stream.pos);
if (found == stream.pos) {
stream.match(curInner.close);
state.innerActive = state.inner = null;
return curInner.delimStyle;
}
if (found > -1) stream.string = oldContent.slice(0, found);
var innerToken = curInner.mode.token(stream, state.inner);
if (found > -1) stream.string = oldContent;
var cur = stream.current(), found = cur.indexOf(curInner.close);
if (found > -1) stream.backUp(cur.length - found);
return innerToken;
}
},
indent: function(state, textAfter) {
var mode = state.innerActive ? state.innerActive.mode : outer;
if (!mode.indent) return CodeMirror.Pass;
return mode.indent(state.innerActive ? state.inner : state.outer, textAfter);
},
electricChars: outer.electricChars,
innerMode: function(state) {
return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer};
}
};
};
@@ -0,0 +1,59 @@
// Utility function that allows modes to be combined. The mode given
// as the base argument takes care of most of the normal mode
// functionality, but a second (typically simple) mode is used, which
// can override the style of text. Both modes get to parse all of the
// text, but when both assign a non-null style to a piece of code, the
// overlay wins, unless the combine argument was true, in which case
// the styles are combined.
// overlayParser is the old, deprecated name
CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) {
return {
startState: function() {
return {
base: CodeMirror.startState(base),
overlay: CodeMirror.startState(overlay),
basePos: 0, baseCur: null,
overlayPos: 0, overlayCur: null
};
},
copyState: function(state) {
return {
base: CodeMirror.copyState(base, state.base),
overlay: CodeMirror.copyState(overlay, state.overlay),
basePos: state.basePos, baseCur: null,
overlayPos: state.overlayPos, overlayCur: null
};
},
token: function(stream, state) {
if (stream.start == state.basePos) {
state.baseCur = base.token(stream, state.base);
state.basePos = stream.pos;
}
if (stream.start == state.overlayPos) {
stream.pos = stream.start;
state.overlayCur = overlay.token(stream, state.overlay);
state.overlayPos = stream.pos;
}
stream.pos = Math.min(state.basePos, state.overlayPos);
if (stream.eol()) state.basePos = state.overlayPos = 0;
if (state.overlayCur == null) return state.baseCur;
if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
else return state.overlayCur;
},
indent: base.indent && function(state, textAfter) {
return base.indent(state.base, textAfter);
},
electricChars: base.electricChars,
innerMode: function(state) { return {state: state.base, mode: base}; },
blankLine: function(state) {
if (base.blankLine) base.blankLine(state.base);
if (overlay.blankLine) overlay.blankLine(state.overlay);
}
};
};
@@ -0,0 +1,123 @@
(function () {
function forEach(arr, f) {
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
}
function arrayContains(arr, item) {
if (!Array.prototype.indexOf) {
var i = arr.length;
while (i--) {
if (arr[i] === item) {
return true;
}
}
return false;
}
return arr.indexOf(item) != -1;
}
function scriptHint(editor, keywords, getToken) {
// Find the token at the cursor
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
// If it's not a 'word-style' token, ignore the token.
if (!/^[\w$_]*$/.test(token.string)) {
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
className: token.string == ":" ? "pig-type" : null};
}
if (!context) var context = [];
context.push(tprop);
var completionList = getCompletions(token, context);
completionList = completionList.sort();
//prevent autocomplete for last word, instead show dropdown with one word
if(completionList.length == 1) {
completionList.push(" ");
}
return {list: completionList,
from: {line: cur.line, ch: token.start},
to: {line: cur.line, ch: token.end}};
}
CodeMirror.pigHint = function(editor) {
return scriptHint(editor, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
};
function toTitleCase(str) {
return str.replace(/(?:^|\s)\w/g, function(match) {
return match.toUpperCase();
});
}
var pigKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "
+ "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "
+ "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "
+ "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE "
+ "NEQ MATCHES TRUE FALSE";
var pigKeywordsU = pigKeywords.split(" ");
var pigKeywordsL = pigKeywords.toLowerCase().split(" ");
var pigTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP";
var pigTypesU = pigTypes.split(" ");
var pigTypesL = pigTypes.toLowerCase().split(" ");
var pigBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL "
+ "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS "
+ "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG "
+ "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN "
+ "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER "
+ "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS "
+ "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA "
+ "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE "
+ "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG "
+ "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER";
var pigBuiltinsU = pigBuiltins.split(" ").join("() ").split(" ");
var pigBuiltinsL = pigBuiltins.toLowerCase().split(" ").join("() ").split(" ");
var pigBuiltinsC = ("BagSize BinStorage Bloom BuildBloom ConstantSize CubeDimensions DoubleAbs "
+ "DoubleAvg DoubleBase DoubleMax DoubleMin DoubleRound DoubleSum FloatAbs FloatAvg FloatMax "
+ "FloatMin FloatRound FloatSum GenericInvoker IntAbs IntAvg IntMax IntMin IntSum "
+ "InvokeForDouble InvokeForFloat InvokeForInt InvokeForLong InvokeForString Invoker "
+ "IsEmpty JsonLoader JsonMetadata JsonStorage LongAbs LongAvg LongMax LongMin LongSum MapSize "
+ "MonitoredUDF Nondeterministic OutputSchema PigStorage PigStreaming StringConcat StringMax "
+ "StringMin StringSize TextLoader TupleSize Utf8StorageConverter").split(" ").join("() ").split(" ");
function getCompletions(token, context) {
var found = [], start = token.string;
function maybeAdd(str) {
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
}
function gatherCompletions(obj) {
if(obj == ":") {
forEach(pigTypesL, maybeAdd);
}
else {
forEach(pigBuiltinsU, maybeAdd);
forEach(pigBuiltinsL, maybeAdd);
forEach(pigBuiltinsC, maybeAdd);
forEach(pigTypesU, maybeAdd);
forEach(pigTypesL, maybeAdd);
forEach(pigKeywordsU, maybeAdd);
forEach(pigKeywordsL, maybeAdd);
}
}
if (context) {
// If this is a property, see if it belongs to some object we can
// find in the current environment.
var obj = context.pop(), base;
if (obj.className == "pig-word")
base = obj.string;
else if(obj.className == "pig-type")
base = ":" + obj.string;
while (base != null && context.length)
base = base[context.pop().string];
if (base != null) gatherCompletions(base);
}
return found;
}
})();
@@ -0,0 +1,90 @@
/* Just enough of CodeMirror to run runMode under node.js */
function splitLines(string){ return string.split(/\r?\n|\r/); };
function StringStream(string) {
this.pos = this.start = 0;
this.string = string;
}
StringStream.prototype = {
eol: function() {return this.pos >= this.string.length;},
sol: function() {return this.pos == 0;},
peek: function() {return this.string.charAt(this.pos) || null;},
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)){}
return this.pos > start;
},
eatSpace: function() {
var start = this.pos;
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
return this.pos > start;
},
skipToEnd: function() {this.pos = this.string.length;},
skipTo: function(ch) {
var found = this.string.indexOf(ch, this.pos);
if (found > -1) {this.pos = found; return true;}
},
backUp: function(n) {this.pos -= n;},
column: function() {return this.start;},
indentation: function() {return 0;},
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 += pattern.length;
return true;
}
}
else {
var match = this.string.slice(this.pos).match(pattern);
if (match && consume !== false) this.pos += match[0].length;
return match;
}
},
current: function(){return this.string.slice(this.start, this.pos);}
};
exports.StringStream = StringStream;
exports.startState = function(mode, a1, a2) {
return mode.startState ? mode.startState(a1, a2) : true;
};
var modes = exports.modes = {}, mimeModes = exports.mimeModes = {};
exports.defineMode = function(name, mode) { modes[name] = mode; };
exports.defineMIME = function(mime, spec) { mimeModes[mime] = spec; };
exports.getMode = function(options, spec) {
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
spec = mimeModes[spec];
if (typeof spec == "string")
var mname = spec, config = {};
else if (spec != null)
var mname = spec.name, config = spec;
var mfactory = modes[mname];
if (!mfactory) throw new Error("Unknown mode: " + spec);
return mfactory(options, config || {});
};
exports.runMode = function(string, modespec, callback) {
var mode = exports.getMode({indentUnit: 2}, modespec);
var lines = splitLines(string), state = exports.startState(mode);
for (var i = 0, e = lines.length; i < e; ++i) {
if (i) callback("\n");
var stream = new exports.StringStream(lines[i]);
while (!stream.eol()) {
var style = mode.token(stream, state);
callback(stream.current(), style, i, stream.start);
stream.start = stream.pos;
}
}
};
@@ -0,0 +1,53 @@
CodeMirror.runMode = function(string, modespec, callback, options) {
function esc(str) {
return str.replace(/[<&]/g, function(ch) { return ch == "<" ? "&lt;" : "&amp;"; });
}
var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
var isNode = callback.nodeType == 1;
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
if (isNode) {
var node = callback, accum = [], col = 0;
callback = function(text, style) {
if (text == "\n") {
accum.push("<br>");
col = 0;
return;
}
var escaped = "";
// HTML-escape and replace tabs
for (var pos = 0;;) {
var idx = text.indexOf("\t", pos);
if (idx == -1) {
escaped += esc(text.slice(pos));
col += text.length - pos;
break;
} else {
col += idx - pos;
escaped += esc(text.slice(pos, idx));
var size = tabSize - col % tabSize;
col += size;
for (var i = 0; i < size; ++i) escaped += " ";
pos = idx + 1;
}
}
if (style)
accum.push("<span class=\"cm-" + esc(style) + "\">" + escaped + "</span>");
else
accum.push(escaped);
};
}
var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
for (var i = 0, e = lines.length; i < e; ++i) {
if (i) callback("\n");
var stream = new CodeMirror.StringStream(lines[i]);
while (!stream.eol()) {
var style = mode.token(stream, state);
callback(stream.current(), style, i, stream.start);
stream.start = stream.pos;
}
}
if (isNode)
node.innerHTML = accum.join("");
};
@@ -0,0 +1,118 @@
// 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() {
function SearchState() {
this.posFrom = this.posTo = this.query = null;
this.marked = [];
}
function getSearchState(cm) {
return cm._searchState || (cm._searchState = new SearchState());
}
function getSearchCursor(cm, query, pos) {
// Heuristic: if the query string is all lowercase, do a case insensitive search.
return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase());
}
function dialog(cm, text, shortText, f) {
if (cm.openDialog) cm.openDialog(text, f);
else f(prompt(shortText, ""));
}
function confirmDialog(cm, text, shortText, fs) {
if (cm.openConfirm) cm.openConfirm(text, fs);
else if (confirm(shortText)) fs[0]();
}
function parseQuery(query) {
var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query;
}
var queryDialog =
'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
function doSearch(cm, rev) {
var state = getSearchState(cm);
if (state.query) return findNext(cm, rev);
dialog(cm, queryDialog, "Search for:", function(query) {
cm.operation(function() {
if (!query || state.query) return;
state.query = parseQuery(query);
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
for (var cursor = getSearchCursor(cm, state.query); cursor.findNext();)
state.marked.push(cm.markText(cursor.from(), cursor.to(), "CodeMirror-searching"));
}
state.posFrom = state.posTo = cm.getCursor();
findNext(cm, rev);
});
});
}
function findNext(cm, rev) {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 ? {line: cm.lineCount() - 1} : {line: 0, ch: 0});
if (!cursor.find(rev)) return;
}
cm.setSelection(cursor.from(), cursor.to());
state.posFrom = cursor.from(); state.posTo = cursor.to();
});}
function clearSearch(cm) {cm.operation(function() {
var state = getSearchState(cm);
if (!state.query) return;
state.query = null;
for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear();
state.marked.length = 0;
});}
var replaceQueryDialog =
'Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
var replacementQueryDialog = 'With: <input type="text" style="width: 10em"/>';
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";
function replace(cm, all) {
dialog(cm, replaceQueryDialog, "Replace:", function(query) {
if (!query) return;
query = parseQuery(query);
dialog(cm, replacementQueryDialog, "Replace with:", function(text) {
if (all) {
cm.compoundChange(function() { 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)/, function(w, i) {return match[i];}));
} else cursor.replace(text);
}
});});
} else {
clearSearch(cm);
var cursor = getSearchCursor(cm, query, cm.getCursor());
function advance() {
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());
confirmDialog(cm, doReplaceConfirm, "Replace?",
[function() {doReplace(match);}, advance]);
}
function doReplace(match) {
cursor.replace(typeof query == "string" ? text :
text.replace(/\$(\d)/, function(w, i) {return match[i];}));
advance();
}
advance();
}
});
});
}
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
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);};
})();
@@ -0,0 +1,119 @@
(function(){
function SearchCursor(cm, query, pos, caseFold) {
this.atOccurrence = false; this.cm = cm;
if (caseFold == null && typeof query == "string") caseFold = false;
pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0};
this.pos = {from: pos, to: pos};
// The matches method is filled in based on the type of query.
// It takes a position and a direction, and returns an object
// describing the next occurrence of the query, or null if no
// more matches were found.
if (typeof query != "string") { // Regexp match
if (!query.global) query = new RegExp(query.source, query.ignoreCase ? "ig" : "g");
this.matches = function(reverse, pos) {
if (reverse) {
query.lastIndex = 0;
var line = cm.getLine(pos.line).slice(0, pos.ch), match = query.exec(line), start = 0;
while (match) {
start += match.index + 1;
line = line.slice(start);
query.lastIndex = 0;
var newmatch = query.exec(line);
if (newmatch) match = newmatch;
else break;
}
start--;
} else {
query.lastIndex = pos.ch;
var line = cm.getLine(pos.line), match = query.exec(line),
start = match && match.index;
}
if (match)
return {from: {line: pos.line, ch: start},
to: {line: pos.line, ch: start + match[0].length},
match: match};
};
} else { // String query
if (caseFold) query = query.toLowerCase();
var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
var target = query.split("\n");
// Different methods for single-line and multi-line queries
if (target.length == 1)
this.matches = function(reverse, pos) {
var line = fold(cm.getLine(pos.line)), len = query.length, match;
if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
: (match = line.indexOf(query, pos.ch)) != -1)
return {from: {line: pos.line, ch: match},
to: {line: pos.line, ch: match + len}};
};
else
this.matches = function(reverse, pos) {
var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln));
var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
if (reverse ? offsetA >= pos.ch || offsetA != match.length
: offsetA <= pos.ch || offsetA != line.length - match.length)
return;
for (;;) {
if (reverse ? !ln : ln == cm.lineCount() - 1) return;
line = fold(cm.getLine(ln += reverse ? -1 : 1));
match = target[reverse ? --idx : ++idx];
if (idx > 0 && idx < target.length - 1) {
if (line != match) return;
else continue;
}
var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
return;
var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
return {from: reverse ? end : start, to: reverse ? start : end};
}
};
}
}
SearchCursor.prototype = {
findNext: function() {return this.find(false);},
findPrevious: function() {return this.find(true);},
find: function(reverse) {
var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to);
function savePosAndFail(line) {
var pos = {line: line, ch: 0};
self.pos = {from: pos, to: pos};
self.atOccurrence = false;
return false;
}
for (;;) {
if (this.pos = this.matches(reverse, pos)) {
this.atOccurrence = true;
return this.pos.match || true;
}
if (reverse) {
if (!pos.line) return savePosAndFail(0);
pos = {line: pos.line-1, ch: this.cm.getLine(pos.line-1).length};
}
else {
var maxLine = this.cm.lineCount();
if (pos.line == maxLine - 1) return savePosAndFail(maxLine);
pos = {line: pos.line+1, ch: 0};
}
}
},
from: function() {if (this.atOccurrence) return this.pos.from;},
to: function() {if (this.atOccurrence) return this.pos.to;},
replace: function(newText) {
var self = this;
if (this.atOccurrence)
self.pos.to = this.cm.replaceRange(newText, self.pos.from, self.pos.to);
}
};
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
return new SearchCursor(this, query, pos, caseFold);
});
})();
@@ -0,0 +1,16 @@
.CodeMirror-completions {
position: absolute;
z-index: 10;
overflow: hidden;
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
}
.CodeMirror-completions select {
background: #fafafa;
outline: none;
border: none;
padding: 0;
margin: 0;
font-family: monospace;
}
@@ -0,0 +1,102 @@
(function() {
CodeMirror.simpleHint = function(editor, getHints, givenOptions) {
// Determine effective options based on given values and defaults.
var options = {}, defaults = CodeMirror.simpleHint.defaults;
for (var opt in defaults)
if (defaults.hasOwnProperty(opt))
options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
function collectHints(previousToken) {
// We want a single cursor position.
if (editor.somethingSelected()) return;
var tempToken = editor.getTokenAt(editor.getCursor());
// Don't show completions if token has changed and the option is set.
if (options.closeOnTokenChange && previousToken != null &&
(tempToken.start != previousToken.start || tempToken.className != previousToken.className)) {
return;
}
var result = getHints(editor);
if (!result || !result.list.length) return;
var completions = result.list;
function insert(str) {
editor.replaceRange(str, result.from, result.to);
}
// When there is only one completion, use it directly.
if (options.completeSingle && completions.length == 1) {
insert(completions[0]);
return true;
}
// Build the select widget
var complete = document.createElement("div");
complete.className = "CodeMirror-completions";
var sel = complete.appendChild(document.createElement("select"));
// Opera doesn't move the selection when pressing up/down in a
// multi-select, but it does properly support the size property on
// single-selects, so no multi-select is necessary.
if (!window.opera) sel.multiple = true;
for (var i = 0; i < completions.length; ++i) {
var opt = sel.appendChild(document.createElement("option"));
opt.appendChild(document.createTextNode(completions[i]));
}
sel.firstChild.selected = true;
sel.size = Math.min(10, completions.length);
var pos = options.alignWithWord ? editor.charCoords(result.from) : editor.cursorCoords();
complete.style.left = pos.x + "px";
complete.style.top = pos.yBot + "px";
document.body.appendChild(complete);
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
if(winW - pos.x < sel.clientWidth)
complete.style.left = (pos.x - sel.clientWidth) + "px";
// Hack to hide the scrollbar.
if (completions.length <= 10)
complete.style.width = (sel.clientWidth - 1) + "px";
var done = false;
function close() {
if (done) return;
done = true;
complete.parentNode.removeChild(complete);
}
function pick() {
insert(completions[sel.selectedIndex]);
close();
setTimeout(function(){editor.focus();}, 50);
}
CodeMirror.connect(sel, "blur", close);
CodeMirror.connect(sel, "keydown", function(event) {
var code = event.keyCode;
// Enter
if (code == 13) {CodeMirror.e_stop(event); pick();}
// Escape
else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
else if (code != 38 && code != 40 && code != 33 && code != 34 && !CodeMirror.isModifierKey(event)) {
close(); editor.focus();
// Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
editor.triggerOnKeyDown(event);
// Don't show completions if the code is backspace and the option is set.
if (!options.closeOnBackspace || code != 8) {
setTimeout(function(){collectHints(tempToken);}, 50);
}
}
});
CodeMirror.connect(sel, "dblclick", pick);
sel.focus();
// Opera sometimes ignores focusing a freshly created node
if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
return true;
}
return collectHints();
};
CodeMirror.simpleHint.defaults = {
closeOnBackspace: true,
closeOnTokenChange: false,
completeSingle: true,
alignWithWord: true
};
})();
@@ -0,0 +1,137 @@
(function() {
CodeMirror.xmlHints = [];
CodeMirror.xmlHint = function(cm, simbol) {
if(simbol.length > 0) {
var cursor = cm.getCursor();
cm.replaceSelection(simbol);
cursor = {line: cursor.line, ch: cursor.ch + 1};
cm.setCursor(cursor);
}
// dirty hack for simple-hint to receive getHint event on space
var getTokenAt = editor.getTokenAt;
editor.getTokenAt = function() { return 'disabled'; };
CodeMirror.simpleHint(cm, getHint);
editor.getTokenAt = getTokenAt;
};
var getHint = function(cm) {
var cursor = cm.getCursor();
if (cursor.ch > 0) {
var text = cm.getRange({line: 0, ch: 0}, cursor);
var typed = '';
var simbol = '';
for(var i = text.length - 1; i >= 0; i--) {
if(text[i] == ' ' || text[i] == '<') {
simbol = text[i];
break;
}
else {
typed = text[i] + typed;
}
}
text = text.slice(0, text.length - typed.length);
var path = getActiveElement(cm, text) + simbol;
var hints = CodeMirror.xmlHints[path];
if(typeof hints === 'undefined')
hints = [''];
else {
hints = hints.slice(0);
for (var i = hints.length - 1; i >= 0; i--) {
if(hints[i].indexOf(typed) != 0)
hints.splice(i, 1);
}
}
return {
list: hints,
from: { line: cursor.line, ch: cursor.ch - typed.length },
to: cursor
};
};
};
var getActiveElement = function(codeMirror, text) {
var element = '';
if(text.length >= 0) {
var regex = new RegExp('<([^!?][^\\s/>]*).*?>', 'g');
var matches = [];
var match;
while ((match = regex.exec(text)) != null) {
matches.push({
tag: match[1],
selfclose: (match[0].slice(match[0].length - 2) === '/>')
});
}
for (var i = matches.length - 1, skip = 0; i >= 0; i--) {
var item = matches[i];
if (item.tag[0] == '/')
{
skip++;
}
else if (item.selfclose == false)
{
if (skip > 0)
{
skip--;
}
else
{
element = '<' + item.tag + '>' + element;
}
}
}
element += getOpenTag(text);
}
return element;
};
var getOpenTag = function(text) {
var open = text.lastIndexOf('<');
var close = text.lastIndexOf('>');
if (close < open)
{
text = text.slice(open);
if(text != '<') {
var space = text.indexOf(' ');
if(space < 0)
space = text.indexOf('\t');
if(space < 0)
space = text.indexOf('\n');
if (space < 0)
space = text.length;
return text.slice(0, space);
}
}
return '';
};
})();
@@ -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 @@
var tpLayerContextMenu=new function(){function w(a){var b=0,c=0;if(!a)var a=window.event;return a.pageX||a.pageY?(b=a.pageX,c=a.pageY):(a.clientX||a.clientY)&&(b=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,c=a.clientY+document.body.scrollTop+document.documentElement.scrollTop),{x:b,y:c}}function x(){y(),z(),A(),B()}function y(){document.addEventListener("contextmenu",function(c){h=b.clickInsideElement(c,"slide_layer"),jQuery(h).hasClass("demo_layer")||(h?(b.setLayerSelected(jQuery(h).data("serial")),c.preventDefault(),a.toggleMenuOn("layer"),H(c)):(h=b.clickInsideElement(c,"bg_context_listener"),h?(c.preventDefault(),a.toggleMenuOn("background"),H(c)):(h=b.clickInsideElement(c,"ignorecontextmenu"),h?(c.preventDefault(),a.toggleMenuOn(),H(c)):(h=null,a.toggleMenuOff()))))})}function z(){jQuery("body").on("click",function(c){var d=b.clickInsideElement(c,f);if(d)c.preventDefault(),J(d);else{var e=c.which||c.button;1===e&&a.toggleMenuOff()}})}function A(){window.onkeyup=function(b){27===b.keyCode&&a.toggleMenuOff()}}function B(){window.onresize=function(b){a.toggleMenuOff()}}function C(a){var b="rs-icon-layerimage_n";switch(a){case"image":b="rs-icon-layerimage_n";break;case"text":b="rs-icon-layerfont_n";break;case"button":b="rs-icon-layerbutton_n";break;case"audio":b="rs-icon-layeraudio_n";break;case"video":b="rs-icon-layervideo_n";break;case"svg":b="rs-icon-layersvg_n";break;case"row":b="rs-icon-layergroup_n";break;case"column":b="rs-icon-layercolumn_n";break;case"group":b="rs-icon-layergroup_n"}return b}function D(a,b){a?jQuery(b).removeClass("ctx-td-s-off"):jQuery(b).addClass("ctx-td-s-off")}function E(){jQuery(".not_in_ctx_bg").hide(),jQuery(".not_in_ctx_layer").show();var a=jQuery("#ctx_list_of_layers");a.html("");for(i in b.arrLayers){var c=b.arrLayers[i],d=C(c.type);a.append('<li class="ctx-dyn-avl-list-item context-menu__item" data-serial="'+c.serial+'"><div class="ctx_item_inner"><div class="context-menu__link" data-serial="'+c.serial+'" data-action="selectonelayer"><i class="'+d+'"></i><span class="cx-layer-name">'+c.alias+"</span></div></div></li>")}}function F(){var a=b.getLayer(b.selectedLayerSerial),d=a.references.htmlLayer;jQuery(".not_in_ctx_bg").show(),jQuery(".not_in_ctx_layer").hide(),jQuery("#cx-selected-layer-name").html(a.alias);var e=jQuery("#cx-selected-layer-icon");e.attr("class",C(a.type));var f=jQuery("#cx-selected-layer-visible"),g=jQuery("#cx-selected-layer-locked");c.isLayerVisible(d)?(f.find("i").attr("class","eg-icon-eye-off"),f.find(".cx-layer-name").html("Hide Layer")):(f.find("i").attr("class","eg-icon-eye"),f.find(".cx-layer-name").html("Show Layer")),c.isLayerLocked(d)?(g.find("i").attr("class","eg-icon-lock-open"),g.find(".cx-layer-name").html("Unlock Layer")):(g.find("i").attr("class","eg-icon-lock"),g.find(".cx-layer-name").html("Lock Layer"));var h=jQuery("#ctx_list_of_invisibles"),i=jQuery("#ctx_list_of_layers"),j=!0;h.find(".ctx-dyn-inv-list-item").remove(),i.html("");for(q in b.arrLayers){var d=b.arrLayers[q],k=C(d.type),l=void 0!==d.references&&void 0!==d.references.htmlLayer?d.references.htmlLayer:void 0;if(void 0!==l&&l.hasClass("currently_not_visible")){var n=j?"ctx-m-top-divider":"";j=!1,h.append('<li class="ctx-dyn-inv-list-item '+n+' context-menu__item"><div class="ctx_item_inner"><div class="context-menu__link" data-serial="'+d.serial+'" data-action="showonelayer"><i class="eg-icon-eye"></i><span class="cx-layer-name">'+d.alias+"</span></div></div></li>")}i.append('<li class="ctx-dyn-avl-list-item context-menu__item" data-serial="'+d.serial+'"><div class="ctx_item_inner"><div class="context-menu__link" data-serial="'+d.serial+'" data-action="selectonelayer"><i class="'+k+'"></i><span class="cx-layer-name">'+d.alias+"</span></div></div></li>")}"grid"===a.basealign?(jQuery("#ctx_gridbased").addClass("selected"),jQuery("#ctx_slidebased").removeClass("selected")):(jQuery("#ctx_gridbased").removeClass("selected"),jQuery("#ctx_slidebased").addClass("selected")),D(a["resize-full"],"#ctx_autoresponsive"),D(a.resizeme,"#ctx_childrenresponsive"),D(a.responsive_offset,"#ctx_responsiveoffset"),D(a["visible-desktop"],"#ctx_showhideondesktop"),D(a["visible-notebook"],"#ctx_showhideonnotebook"),D(a["visible-tablet"],"#ctx_showhideontablet"),D(a["visible-mobile"],"#ctx_showhideonmobile"),D(a.autolinebreak,"#ctx_linebreak"),D(a.scaleProportional,"#ctx_keepaspect"),a.displaymode||"block"===a.display?(jQuery("#ctx_displayblock").addClass("selected"),jQuery("#ctx_displayinline").removeClass("selected")):(jQuery("#ctx_displayblock").removeClass("selected"),jQuery("#ctx_displayinline").addClass("selected")),jQuery("#ctx-list-of-layer-links").data("uniqueid",a.unique_id);for(var o=void 0!==a.groupLink?a.groupLink:0,p=jQuery("#ctx-layer-link-type-element-cs"),q=0;q<6;q++)p.removeClass("ctx-layer-link-type-"+q);p.addClass("ctx-layer-link-type-"+o),jQuery(m).data("current_layer",l);var r="column"===b.getObjLayerType(a.p_uid);switch(m.className="context-menu Line truncated
@@ -0,0 +1 @@
var UniteCssEditorRev=new function(){var e=this,t=[],r=new Object,a=new Object,n=null,s=null,i=null,o={"background-color":"backgroundColor","border-color":"borderColor","border-radius":"borderRadius","border-style":"borderStyle","border-width":"borderWidth",color:"color","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","line-height":"lineHeight",opacity:"opacity",padding:"padding","text-decoration":"textDecoration"},l="idle",c="idle";e.setInitCssStyles=function(e){t=jQuery.parseJSON(e)},e.setInitCssStylesObj=function(e){t=e},e.init=function(){u(),e.initAdvancedEditor()};var d=function(){a.params=r},u=function(){jQuery(".rev-advanced-css-idle, .rev-advanced-css-hover").click(function(){return-1!==UniteLayersRev.get_current_selected_layer()&&(!0!==UniteLayersRev.getCurrentLayer().hover?jQuery("#change_acea_wrappers").hide():jQuery("#change_acea_wrappers").show(),e.checkIfHandleExists(jQuery("#layer_caption").val())?(l=jQuery(this).hasClass("rev-advanced-css-idle")?"idle":"hover",c=jQuery(this).hasClass("rev-advanced-css-idle")?"idle":"hover",void jQuery("#dialog_advanced_css").dialog({modal:!0,resizable:!1,title:"Currently editing: "+jQuery("#layer_caption").val(),minWidth:1024,minHeight:500,closeOnEscape:!0,open:function(){jQuery(".current-advance-edited-class").text(jQuery("#layer_caption").val()),jQuery(this).closest(".ui-dialog").addClass("tp-css-editor-dialog"),null!=s&&s.refresh(),null!=n&&n.refresh(),e.setTemplateCssUneditable(),e.setTemplateCssEditable()},close:function(e){l=c},buttons:{Save:function(){e.saveTemplateStylesInDb(),d(),l=c},Cancel:function(){jQuery(this).dialog("close"),l=c}}})):(alert(rev_lang.please_select_first_an_existing_style),!1))}),jQuery(".rev-advanced-css-idle-layer, .rev-advanced-css-hover-layer").click(function(){if(-1===UniteLayersRev.get_current_selected_layer())return!1;!0!==UniteLayersRev.getCurrentLayer().hover?jQuery("#change_ace_wrappers").hide():jQuery("#change_ace_wrappers").show(),l=jQuery(this).hasClass("rev-advanced-css-idle-layer")?"idle":"hover",c=jQuery(this).hasClass("rev-advanced-css-idle-layer")?"idle":"hover",jQuery("#dialog_advanced_layer_css").dialog({modal:!0,resizable:!1,minWidth:1024,minHeight:500,closeOnEscape:!0,open:function(t){jQuery(this).closest(".ui-dialog").addClass("tp-css-editor-dialog"),null!=i&&i.refresh(),e.setTemplateCssLayer()},close:function(e){l=c},buttons:{Save:function(){y(),l=c,jQuery(this).dialog("close")},Cancel:function(){l=c,jQuery(this).dialog("close")}}})})};jQuery(document).ready(function(){jQuery("body").on("click","#change_ace_toidle",function(){confirm(rev_lang.save_changes)&&y(),l="idle",e.setTemplateCssLayer()}),jQuery("body").on("click","#change_ace_tohover",function(){confirm(rev_lang.save_changes)&&y(),l="hover",e.setTemplateCssLayer()}),jQuery("body").on("click","#change_acea_toidle",function(){confirm(rev_lang.save_changes)&&(e.saveTemplateStylesInDb(),d()),l="idle",e.setTemplateCssUneditable(),e.setTemplateCssEditable()}),jQuery("body").on("click","#change_acea_tohover",function(){confirm(rev_lang.save_changes)&&(e.saveTemplateStylesInDb(),d()),l="hover",e.setTemplateCssUneditable(),e.setTemplateCssEditable()})}),e.initAdvancedEditor=function(){s=CodeMirror.fromTextArea(document.getElementById("textarea_advanced_css_editor"),{onChange:function(){},lineNumbers:!0}),n=CodeMirror.fromTextArea(document.getElementById("textarea_template_css_editor_uneditable"),{onChange:function(){},lineNumbers:!0,readOnly:!0}),i=CodeMirror.fromTextArea(document.getElementById("textarea_template_css_editor_layer"),{onChange:function(){},lineNumbers:!0,readOnly:!1})},e.setPreviewTextClass=function(){if(void 0!==a.handle){var e=a.handle.split(".");for(var t in e)jQuery("#rev-example-style-layer").addClass(e[t])}jQuery("#rev-example-style-layer").parent().show()},e.clearPreviewText=function(){jQuery("#rev-example-style-layer").attr("style",""),jQuery("#rev-example-style-layer").attr("class","")},e.setTemplateCssUneditable=function(){jQuery("#textarea_template_css_editor_uneditable").val("");var t="{\n";if(_(),"idle"===l?jQuery(".acsa_idle_or_hover").html("- IDLE"):jQuery(".acsa_idle_or_hover").html("- HOVER"),r="idle"==l&&void 0!==a.params?a.params:"hover"==l&&void 0!==a.hover?a.hover:[],!jQuery.isEmptyObject(r))for(var s in o){var i="";"undefined"!==(i="object"==typeof r[s]?r[s].join(" "):r[s])&&void 0!==i&&""!==i&&"none"!==i&&(t+="\t"+s+": "+i+";\n")}t+="}",null!=n?n.setValue(t):(jQuery("#textarea_template_css_editor_uneditable").val(t),e.initAdvancedEditor()),n.refresh()},e.setTemplateCssEditable=function(){jQuery("#textarea_advanced_css_editor").val("");var t="{\n";if(_(),"idle"==l&&void 0!==a.advanced&&void 0!==a.advanced.idle)r=jQuery.extend({},a.advanced.idle);else if("hover"==l&&void 0!==a.advanced&&void 0!==a.advanced.hover)r=jQuery.extend({},a.advanced.hover);else var r=[];for(var n in r){var i="";"undefined"!==(i="object"==typeof r[n]?r[n].join(" "):r[n])&&void 0!==i&&""!==i&Line truncated
@@ -0,0 +1,7 @@
/************************************************
* REVOLUTION 5.4.6.4 EDIT LAYER JS
* @version: 2.0 (17.05.2017)
* @author ThemePunch
************************************************/
!function(e){"use strict";var t=e.GreenSockGlobals||e,r=function(e){var r,a=e.split("."),i=t;for(r=0;a.length>r;r++)i[a[r]]=i=i[a[r]]||{};return i}("com.greensock.utils"),a=function(e){var t=e.nodeType,r="";if(1===t||9===t||11===t){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)r+=a(e)}else if(3===t||4===t)return e.nodeValue;return r},i=document,o=i.defaultView?i.defaultView.getComputedStyle:function(){},s=/([A-Z])/g,n=function(e,t,r,a){var i;return(r=r||o(e,null))?(e=r.getPropertyValue(t.replace(s,"-$1").toLowerCase()),i=e||r.length?e:r[t]):e.currentStyle&&(r=e.currentStyle,i=r[t]),a?i:parseInt(i,10)||0},l=function(e){return!!(e.length&&e[0]&&(e[0].nodeType&&e[0].style&&!e.nodeType||e[0].length&&e[0][0]))},d=function(e){var t,r,a,i=[],o=e.length;for(t=0;o>t;t++)if(r=e[t],l(r))for(a=r.length,a=0;r.length>a;a++)i.push(r[a]);else i.push(r);return i},_=")eefec303079ad17405c",c=/(?:<br>|<br\/>|<br \/>)/gi,y="<div style='position:relative;display:inline-block;"+(i.all&&!i.addEventListener?"*display:inline;*zoom:1;'":"'"),u=function(e){var t=-1!==(e=e||"").indexOf("++"),r=1;return t&&(e=e.split("++").join("")),function(){return y+(e?" class='"+e+(t?r++:"")+"'>":">")}},m=r.SplitText=t.SplitText=function(e,t){if("string"==typeof e&&(e=m.selector(e)),!e)throw"cannot split a null element.";this.elements=l(e)?d(e):[e],this.chars=[],this.words=[],this.lines=[],this._originals=[],this.vars=t||{},this.split(t)},p=function(e,t,r,s,l){c.test(e.innerHTML)&&(e.innerHTML=e.innerHTML.replace(c,_));var d,y,m,p,v,h,g,f,j,b,Q,k,w,x=a(e),L=t.type||t.split||"chars,words,lines",C=-1!==L.indexOf("lines")?[]:null,S=-1!==L.indexOf("words"),I=-1!==L.indexOf("chars"),z="absolute"===t.position||!0===t.absolute,T=z?"&#173; ":" ",E=-999,A=o(e),B=n(e,"paddingLeft",A),V=n(e,"borderBottomWidth",A)+n(e,"borderTopWidth",A),R=n(e,"borderLeftWidth",A)+n(e,"borderRightWidth",A),F=n(e,"paddingTop",A)+n(e,"paddingBottom",A),D=n(e,"paddingLeft",A)+n(e,"paddingRight",A),H=n(e,"textAlign",A,!0),q=e.clientHeight,O=e.clientWidth,N=x.length,P="</div>",M=u(t.wordsClass),U=u(t.charsClass),W=-1!==(t.linesClass||"").indexOf("++"),G=t.linesClass;for(W&&(G=G.split("++").join("")),m=M(),p=0;N>p;p++)h=x.charAt(p),")"===h&&x.substr(p,20)===_?(m+=P+"<BR/>",p!==N-1&&(m+=" "+M()),p+=19):" "===h&&" "!==x.charAt(p-1)&&p!==N-1?(m+=P,p!==N-1&&(m+=T+M())):m+=I&&" "!==h?U()+h+"</div>":h;for(e.innerHTML=m+P,N=(v=e.getElementsByTagName("*")).length,g=[],p=0;N>p;p++)g[p]=v[p];if(C||z)for(p=0;N>p;p++)f=g[p],((y=f.parentNode===e)||z||I&&!S)&&(j=f.offsetTop,C&&y&&j!==E&&"BR"!==f.nodeName&&(d=[],C.push(d),E=j),z&&(f._x=f.offsetLeft,f._y=j,f._w=f.offsetWidth,f._h=f.offsetHeight),C&&(S!==y&&I||(d.push(f),f._x-=B),y&&p&&(g[p-1]._wordEnd=!0)));for(p=0;N>p;p++)f=g[p],y=f.parentNode===e,"BR"!==f.nodeName?(z&&(Q=f.style,S||y||(f._x+=f.parentNode._x,f._y+=f.parentNode._y),Q.left=f._x+"px",Q.top=f._y+"px",Q.position="absolute",Q.display="block",Q.width=f._w+1+"px",Q.height=f._h+"px"),S?y?s.push(f):I&&r.push(f):y?(e.removeChild(f),g.splice(p--,1),N--):!y&&I&&(j=!C&&!z&&f.nextSibling,e.appendChild(f),j||e.appendChild(i.createTextNode(" ")),r.push(f))):C||z?(e.removeChild(f),g.splice(p--,1),N--):S||e.appendChild(f);if(C){for(z&&(b=i.createElement("div"),e.appendChild(b),k=b.offsetWidth+"px",j=b.offsetParent===e?0:e.offsetLeft,e.removeChild(b)),Q=e.style.cssText,e.style.cssText="display:none;";e.firstChild;)e.removeChild(e.firstChild);for(w=!z||!S&&!I,p=0;C.length>p;p++){for(d=C[p],(b=i.createElement("div")).style.cssText="display:block;text-align:"+H+";position:"+(z?"absolute;":"relative;"),G&&(b.className=G+(W?p+1:"")),l.push(b),N=d.length,v=0;N>v;v++)"BR"!==d[v].nodeName&&(f=d[v],b.appendChild(f),w&&(f._wordEnd||S)&&b.appendChild(i.createTextNode(" ")),z&&(0===v&&(b.style.top=f._y+"px",b.style.left=B+j+"px"),f.style.top="0px",j&&(f.style.left=f._x-j+"px")));S||I||(b.innerHTML=a(b).split(String.fromCharCode(160)).join(" ")),z&&(b.style.width=k,b.style.height=f._h+"px"),e.appendChild(b)}e.style.cssText=Q}z&&(q>e.clientHeight&&(e.style.height=q-F+"px",q>e.clientHeight&&(e.style.height=q+V+"px")),O>e.clientWidth&&(e.style.width=O-D+"px",O>e.clientWidth&&(e.style.width=O+R+"px")))},v=m.prototype;v.split=function(e){this.isSplit&&this.revert(),this.vars=e||this.vars,this._originals.length=this.chars.length=this.words.length=this.lines.length=0;for(var t=0;this.elements.length>t;t++)this._originals[t]=this.elements[t].innerHTML,p(this.elements[t],this.vars,this.chars,this.words,this.lines);return this.isSplit=!0,this},v.revert=function(){if(!this._originals)throw"revert() call wasn't scoped properly.";for(var e=this._originals.length;--e>-1;)this.elements[e].innerHTML=this._originals[e];return this.chars=[],this.words=[],this.lines=[],this.isSplit=!1,this},m.selector=e.$||e.jQuery||function(t){return e.$?(m.selector=e.$,e.$(t)):i?i.getElementById("#"===t.charAt(0)?t.substr(1):t):t}}(window||{}),function(e,t){e.widget("ui.rotatable",e.ui.mouse,{options:Line truncated
File diff suppressed because it is too large. Load diff
Whitespace-only changes.
@@ -0,0 +1,198 @@
// tipsy, facebook style tooltips for jquery
// version 1.0.0a
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
// releated under the MIT license
(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 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
});
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;
}
}
$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);
}
};
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'
};
// 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,194 @@
/*! perfect-scrollbar - v0.5.7
* http://noraesae.github.com/perfect-scrollbar/
* Copyright (c) 2014 Hyunje Alex Jun; Licensed MIT */
(function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)})(function(e){"use strict";function t(e){return"string"==typeof e?parseInt(e,10):~~e}var o={wheelSpeed:1,wheelPropagation:!1,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1},n=0,r=function(){var e=n++;return function(t){var o=".perfect-scrollbar-"+e;return t===void 0?o:t+o}};e.fn.perfectScrollbar=function(n,l){return this.each(function(){function i(e,o){var n=e+o,r=E-W;I=0>n?0:n>r?r:n;var l=t(I*(D-E)/(E-W));S.scrollTop(l)}function a(e,o){var n=e+o,r=x-Y;X=0>n?0:n>r?r:n;var l=t(X*(M-x)/(x-Y));S.scrollLeft(l)}function c(e){return L.minScrollbarLength&&(e=Math.max(e,L.minScrollbarLength)),L.maxScrollbarLength&&(e=Math.min(e,L.maxScrollbarLength)),e}function s(){var e={width:x};e.left=O?S.scrollLeft()+x-M:S.scrollLeft(),B?e.bottom=q-S.scrollTop():e.top=H+S.scrollTop(),A.css(e);var t={top:S.scrollTop(),height:E};z?t.right=O?M-S.scrollLeft()-Q-N.outerWidth():Q-S.scrollLeft():t.left=O?S.scrollLeft()+2*x-M-F-N.outerWidth():F+S.scrollLeft(),_.css(t),K.css({left:X,width:Y-U}),N.css({top:I,height:W-G})}function d(){S.removeClass("ps-active-x"),S.removeClass("ps-active-y"),x=L.includePadding?S.innerWidth():S.width(),E=L.includePadding?S.innerHeight():S.height(),M=S.prop("scrollWidth"),D=S.prop("scrollHeight"),!L.suppressScrollX&&M>x+L.scrollXMarginOffset?(C=!0,Y=c(t(x*x/M)),X=t(S.scrollLeft()*(x-Y)/(M-x))):(C=!1,Y=0,X=0,S.scrollLeft(0)),!L.suppressScrollY&&D>E+L.scrollYMarginOffset?(k=!0,W=c(t(E*E/D)),I=t(S.scrollTop()*(E-W)/(D-E))):(k=!1,W=0,I=0,S.scrollTop(0)),X>=x-Y&&(X=x-Y),I>=E-W&&(I=E-W),s(),C&&S.addClass("ps-active-x"),k&&S.addClass("ps-active-y")}function u(){var t,o,n=!1;K.bind(j("mousedown"),function(e){o=e.pageX,t=K.position().left,A.addClass("in-scrolling"),n=!0,e.stopPropagation(),e.preventDefault()}),e(R).bind(j("mousemove"),function(e){n&&(a(t,e.pageX-o),d(),e.stopPropagation(),e.preventDefault())}),e(R).bind(j("mouseup"),function(){n&&(n=!1,A.removeClass("in-scrolling"))}),t=o=null}function p(){var t,o,n=!1;N.bind(j("mousedown"),function(e){o=e.pageY,t=N.position().top,n=!0,_.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(R).bind(j("mousemove"),function(e){n&&(i(t,e.pageY-o),d(),e.stopPropagation(),e.preventDefault())}),e(R).bind(j("mouseup"),function(){n&&(n=!1,_.removeClass("in-scrolling"))}),t=o=null}function f(e,t){var o=S.scrollTop();if(0===e){if(!k)return!1;if(0===o&&t>0||o>=D-E&&0>t)return!L.wheelPropagation}var n=S.scrollLeft();if(0===t){if(!C)return!1;if(0===n&&0>e||n>=M-x&&e>0)return!L.wheelPropagation}return!0}function v(){function e(e){var t=e.originalEvent.deltaX,o=-1*e.originalEvent.deltaY;return(t===void 0||o===void 0)&&(t=-1*e.originalEvent.wheelDeltaX/6,o=e.originalEvent.wheelDeltaY/6),e.originalEvent.deltaMode&&1===e.originalEvent.deltaMode&&(t*=10,o*=10),t!==t&&o!==o&&(t=0,o=e.originalEvent.wheelDelta),[t,o]}function t(t){var n=e(t),r=n[0],l=n[1];o=!1,L.useBothWheelAxes?k&&!C?(l?S.scrollTop(S.scrollTop()-l*L.wheelSpeed):S.scrollTop(S.scrollTop()+r*L.wheelSpeed),o=!0):C&&!k&&(r?S.scrollLeft(S.scrollLeft()+r*L.wheelSpeed):S.scrollLeft(S.scrollLeft()-l*L.wheelSpeed),o=!0):(S.scrollTop(S.scrollTop()-l*L.wheelSpeed),S.scrollLeft(S.scrollLeft()+r*L.wheelSpeed)),d(),o=o||f(r,l),o&&(t.stopPropagation(),t.preventDefault())}var o=!1;window.onwheel!==void 0?S.bind(j("wheel"),t):window.onmousewheel!==void 0&&S.bind(j("mousewheel"),t)}function g(){var t=!1;S.bind(j("mouseenter"),function(){t=!0}),S.bind(j("mouseleave"),function(){t=!1});var o=!1;e(R).bind(j("keydown"),function(n){if((!n.isDefaultPrevented||!n.isDefaultPrevented())&&t){for(var r=document.activeElement?document.activeElement:R.activeElement;r.shadowRoot;)r=r.shadowRoot.activeElement;if(!e(r).is(":input,[contenteditable]")){var l=0,i=0;switch(n.which){case 37:l=-30;break;case 38:i=30;break;case 39:l=30;break;case 40:i=-30;break;case 33:i=90;break;case 32:case 34:i=-90;break;case 35:i=n.ctrlKey?-D:-E;break;case 36:i=n.ctrlKey?S.scrollTop():E;break;default:return}S.scrollTop(S.scrollTop()-i),S.scrollLeft(S.scrollLeft()+l),o=f(l,i),o&&n.preventDefault()}}})}function b(){function e(e){e.stopPropagation()}N.bind(j("click"),e),_.bind(j("click"),function(e){var o=t(W/2),n=e.pageY-_.offset().top-o,r=E-W,l=n/r;0>l?l=0:l>1&&(l=1),S.scrollTop((D-E)*l)}),K.bind(j("click"),e),A.bind(j("click"),function(e){var o=t(Y/2),n=e.pageX-A.offset().left-o,r=x-Y,l=n/r;0>l?l=0:l>1&&(l=1),S.scrollLeft((M-x)*l)})}function h(){function t(){var e=window.getSelection?window.getSelection():document.getSlection?document.getSlection():{rangeCount:0};return 0===e.rangeCount?null:e.getRangeAt(0).commonAncestorContainer}function o(){r||(r=setInterval(function(){return P()?(S.scrollTop(S.scrollTop()+l.top),S.scrollLeft(S.scrollLeft()+l.left),d(),void 0):(clearInterval(r),void 0Line truncated
(function( $ ) {
$(document).ready(function(){
//hover toggles buttons
/*$(".rs-addon-activated").hover(function () {
$this = $(this);
$this.data("original",$this.html());
$this.removeClass('rs-status-green').addClass('rs-status-orange').html($this.data('alternative'));
}, function () {
$this = $(this);
$this.removeClass('rs-status-orange').addClass('rs-status-green').html($this.data("original"));
});
$(".rs-addon-not-activated").hover(function () {
$this = $(this);
$this.data("original",$this.html());
$this.removeClass('rs-status-orange').addClass('rs-status-green').html($this.data('alternative'));
}, function () {
$this = $(this);
$this.removeClass('rs-status-green').addClass('rs-status-orange').html($this.data("original"));
});
$(".rs-addon-not-installed").hover(function () {
$this = $(this);
$this.data("original",$this.html());
$this.removeClass('rs-status-red').addClass('rs-status-green').html($this.data('alternative'));
}, function () {
$this = $(this);
$this.removeClass('rs-status-green').addClass('rs-status-red').html($this.data("original"));
});*/
$('.rs-reload-shop,#rev_check_version').click(function(){
showWaitAMinute({fadeIn:300,text:rev_slider_addon.please_wait_a_moment});
});
//click event to install plugin
$(".rs-addon-not-installed").click(function(){
showWaitAMinute({fadeIn:300,text:rev_slider_addon.please_wait_a_moment});
$this = $(this);
//console.log("install process");
$.ajax({
url : rev_slider_addon.ajax_url,
type : 'post',
data : {
action : 'install_plugin',
nonce: $('#ajax_rev_slider_addon_nonce').text(),// The security nonce
plugin: $this.data("plugin")
},
success : function( response ) {
switch(response){
case "0":
showWaitAMinute({fadeOut:300,text:rev_slider_addon.please_wait_a_moment});
UniteAdminRev.showErrorMessage("Something went wrong!");
//console.log("Something Went Wrong");
break;
case "1":
//console.log("Plugin installed");
location.reload();
break;
case "-1":
showWaitAMinute({fadeOut:300,text:rev_slider_addon.please_wait_a_moment});
UniteAdminRev.showErrorMessage("Nonce missing!");
//console.log("Nonce missing");
break;
}
},
error : function ( response ){
//console.log('Ajax Error');
showWaitAMinute({fadeOut:300,text:rev_slider_addon.please_wait_a_moment});
UniteAdminRev.showErrorMessage("Something went wrong!");
}
}); // End Ajax
}); // End Click
//click event to activate plugin
$(".rs-addon-not-activated").click(function(){
showWaitAMinute({fadeIn:300,text:rev_slider_addon.please_wait_a_moment});
$this = $(this);
$.ajax({
url : rev_slider_addon.ajax_url,
type : 'post',
data : {
action : 'activate_plugin',
nonce: $('#ajax_rev_slider_addon_nonce').text(),// The security nonce
plugin: $this.data("plugin")
},
success : function( response ) {
switch(response){
case "0":
console.log("Something Went Wrong");
break;
case "1":
console.log("Plugin activated");
location.reload();
break;
case "-1":
console.log("Nonce missing");
break;
}
},
error : function ( response ){
console.log('Ajax Error');
}
}); // End Ajax
}); // End Click
//click event to deactivate plugin
$(".rs-dash-deactivate-addon").click(function(){
showWaitAMinute({fadeIn:300,text:rev_slider_addon.please_wait_a_moment});
$this = $(this);
//console.log("deactivate process");
$.ajax({
url : rev_slider_addon.ajax_url,
type : 'post',
data : {
action : 'deactivate_plugin',
nonce: $('#ajax_rev_slider_addon_nonce').text(),// The security nonce
plugin: $this.data("plugin")
},
success : function( response ) {
switch(response){
case "0":
console.log("Something Went Wrong");
break;
case "1":
console.log("Plugin deactivated");
location.reload();
break;
case "-1":
console.log("Nonce missing");
break;
}
},
error : function ( response ){
//console.log('Ajax Error');
}
}); // End Ajax
}); // End Click
});// End Document ready
})( jQuery );
if (showWaitAMinute===undefined)
function showWaitAMinute(obj) {
var wm = jQuery('#waitaminute');
// SHOW AND HIDE WITH DELAY
if (obj.delay!=undefined) {
punchgs.TweenLite.to(wm,0.3,{autoAlpha:1,ease:punchgs.Power3.easeInOut});
punchgs.TweenLite.set(wm,{display:"block"});
setTimeout(function() {
punchgs.TweenLite.to(wm,0.3,{autoAlpha:0,ease:punchgs.Power3.easeInOut,onComplete:function() {
punchgs.TweenLite.set(wm,{display:"block"});
}});
},obj.delay)
}
// SHOW IT
if (obj.fadeIn != undefined) {
punchgs.TweenLite.to(wm,obj.fadeIn/1000,{autoAlpha:1,ease:punchgs.Power3.easeInOut});
punchgs.TweenLite.set(wm,{display:"block"});
}
// HIDE IT
if (obj.fadeOut != undefined) {
punchgs.TweenLite.to(wm,obj.fadeOut/1000,{autoAlpha:0,ease:punchgs.Power3.easeInOut,onComplete:function() {
punchgs.TweenLite.set(wm,{display:"block"});
}});
}
// CHANGE TEXT
if (obj.text != undefined) {
switch (obj.text) {
case "progress1":
break;
default:
wm.html('<div class="waitaminute-message"><i class="eg-icon-emo-coffee"></i><br>'+obj.text+'</div>');
break;
}
}
}
@@ -0,0 +1 @@
var rs_install_slider={},rs_install_ids=[],rs_install_url=!1,RevSliderAdmin=new function(){var e=this,i=null,t=function(e){jQuery("#button_save_slider,#button_save_slider_t").click(function(){var i={params:RevSliderSettings.getSettingsObject("form_slider_params"),main:RevSliderSettings.getSettingsObject("form_slider_main"),template:jQuery("#revslider_template").val()};"update_slider"==e&&(i.sliderid=jQuery("#sliderid").val(),i.params.custom_css=rev_cm_custom_css.getValue(),i.params.custom_javascript=rev_cm_custom_js.getValue(),UniteAdminRev.setAjaxLoaderID("loader_update, #loader_update_t"),UniteAdminRev.setAjaxHideButtonID("button_save_slider,button_save_slider_t"),UniteAdminRev.setSuccessMessageID("update_slider_success,#update_slider_success_t")),UniteAdminRev.ajaxRequest(e,i)})};e.initLayerPreview=function(){jQuery("#button_preview_slider-tb").click(function(){var e=jQuery("#sliderid").val();c(e)})};var r=function(){var e=jQuery("#alias").val(),i='[rev_slider alias="'+e+'"]';""==e&&(i=rev_lang.wrong_alias),jQuery("#shortcode").val(i)},a=!1;e.load_slider_template_html=function(){return a?(jQuery("#template_area").addClass("show"),jQuery("#template_area").trigger("showitnow")):UniteAdminRev.ajaxRequest("load_template_store_sliders",{},function(e){e.success&&(jQuery(".revolution-template-groups").html(e.html),jQuery("#template_area").addClass("show"),jQuery("#template_area").trigger("showitnow"),initTemplateSliders(),a=!0)}),!0};var s=!1;e.load_slide_template_html=function(){return s?(jQuery("#template_area").addClass("show"),jQuery(".revolution-template-groups").perfectScrollbar(),scrollTA()):UniteAdminRev.ajaxRequest("load_template_store_slides",{},function(e){e.success&&(jQuery(".revolution-basic-templates").html(e.html),s=!0,templateSelectorHandling(),jQuery("#template_area").addClass("show"),jQuery(".revolution-template-groups").perfectScrollbar(),scrollTA())}),!0};var l=function(e,i,t,r){jQuery('input[name="width"]').attr("disabled",!1),jQuery('input[name="height"]').attr("disabled",!1),"normal"!=r&&"full"!=r||jQuery("#layout-preshow").removeClass("lp-fullscreenalign"),e?(jQuery("#responsitive_row").removeClass("disabled"),jQuery("#responsitive_row input").prop("disabled","")):(jQuery("#responsitive_row").addClass("disabled"),jQuery("#responsitive_row input").prop("disabled","disabled")),i?(jQuery("#auto_height_row").removeClass("disabled"),jQuery("#layout-preshow").removeClass("lp-fullscreenalign")):jQuery("#auto_height_row").addClass("disabled"),"normal"==r&&0==e&&0==i&&0==t?jQuery(".rs-hide-on-fixed").hide():jQuery(".rs-hide-on-fixed").show(),t?(jQuery(".rs-show-on-fullscreen").show(),jQuery(".rs-hide-on-fullscreen").hide(),"on"==jQuery('input[name="full_screen_align_force"]:checked').val()&&jQuery("#layout-preshow").addClass("lp-fullscreenalign"),jQuery("#full_screen_align_force_row").removeClass("disabled"),jQuery("#fullscreen_offset_container_row").removeClass("disabled")):(jQuery(".rs-show-on-fullscreen").hide(),jQuery(".rs-hide-on-fullscreen").show(),jQuery("#full_screen_align_force_row").addClass("disabled"),jQuery("#fullscreen_offset_container_row").addClass("disabled")),t||i?jQuery("#force_full_width_row").removeClass("disabled"):jQuery("#force_full_width_row").addClass("disabled"),jQuery("#layout-preshow").removeClass("lp-fixed"),jQuery("#layout-preshow").removeClass("lp-custom"),jQuery("#layout-preshow").removeClass("lp-autoresponsive"),jQuery("#layout-preshow").removeClass("lp-fullscreen"),e?jQuery("#layout-preshow").addClass("lp-custom"):i?jQuery("#layout-preshow").addClass("lp-autoresponsive"):t?jQuery("#layout-preshow").addClass("lp-fullscreen"):jQuery("#layout-preshow").addClass("lp-fixed")},n=function(e,t){jQuery("#"+e).change(function(){var e=jQuery(this).val(),r=[];jQuery("#"+t+" option").each(function(){1==jQuery(this).prop("selected")&&r.push(jQuery(this).val())}),jQuery("#"+t).empty(),jQuery(e).each(function(e,a){var s=i[a];for(var l in s){var n=s[l],o=new Option(n,l);0==l.indexOf("option_disabled")?jQuery(o).prop("disabled","disabled"):-1!==jQuery.inArray(jQuery(o).val(),r)&&jQuery(o).prop("selected","selected"),jQuery("#"+t).append(o)}})}),jQuery("#"+e).change()},o=function(){_(),jQuery("#slider_type_1").click(function(){l(!1,!1,!1,"normal")}),jQuery("#slider_type_2").click(function(){l(!0,!1,!1,"normal")}),jQuery("#slider_type_3").click(function(){l(!1,!0,!1,"full")}),jQuery("#slider_type_4").click(function(){l(!1,!1,!0,"screen")}),jQuery('input[name="full_screen_align_force"]').click(function(){"on"==jQuery(this).val()?jQuery("#layout-preshow").addClass("lp-fullscreenalign"):jQuery("#layout-preshow").removeClass("lp-fullscreenalign")}),jQuery('input[name="auto_height"]').click(function(){"on"==jQuery(this).val()?jQuery("#layout-preshow").addClass("lp-autoheight"):jQuery("#layout-preshow").removeClass("lp-autoheight")}),jQuery('input[name="force_full_width"]').click(function(){"on"==jQuery(this).val()?jQuery("#layout-preshow").addClass("lp-fullwidth"):jQuery("#layout-preshLine truncated
@@ -0,0 +1 @@
var RevSliderSettings=new function(){var a={},c=this;this.getSettingsObject=function(a){for(var d,e,f,g,b=new Object,c=document.getElementById(a),h=c.elements.length,i=0;i<h;i++){var j=c.elements[i];if("##NAME##[]"!=j.name&&!jQuery(j).hasClass("rs-ingore-save")){switch(d=j.name,e=j.value,f=j.type,jQuery(j).hasClass("wp-editor-area")&&(f="editor"),g=!0,f){case"checkbox":if("undefined"!=typeof c.elements[i].getAttribute("data-useval")&&null!==c.elements[i].getAttribute("data-useval")){if(!c.elements[i].checked)continue;e=c.elements[i].value}else e="undefined"!=typeof c.elements[i].getAttribute("data-unchecked")&&null!==c.elements[i].getAttribute("data-unchecked")?c.elements[i].checked?e:c.elements[i].getAttribute("data-unchecked"):c.elements[i].checked;break;case"radio":0==c.elements[i].checked&&(g=!1);break;case"editor":"undefined"!=typeof tiynMCE&&null!=tinyMCE.get(d)&&(e=tinyMCE.get(d).getContent());break;case"select-multiple":e=jQuery(j).val(),e&&(e=e.toString())}1==g&&void 0!=d&&(d.indexOf("[]")>-1?(d=d.replace("[]",""),"object"!=typeof b[d]&&(b[d]=[]),b[d][Object.keys(b[d]).length]=e):b[d]=e)}}return b};var d=function(){if("undefined"!=typeof g_settingsObj)for(key in g_settingsObj){var b=g_settingsObj[key];for(controlKey in b.controls)a[controlKey]=b.controls[controlKey]}},e=function(a){jQuery("#"+a+" .unite-postbox .inside").slideUp("fast"),jQuery("#"+a+" .unite-postbox h3").addClass("box_closed")};c.initAccordion=function(a){var b="box_closed";jQuery("#"+a+" .unite-postbox h3").click(function(){var c=jQuery(this);c.hasClass(b)?(e(a),c.removeClass(b).siblings(".inside").slideDown("fast")):c.addClass(b).siblings(".inside").slideUp("fast")})};var f=function(){jQuery(".button-image-select").click(function(){var a=this.id.replace("_button","");UniteAdminRev.openAddImageDialog("Choose Image",function(b,c){jQuery("#"+a).val(b);var d=UniteAdminRev.getUrlShowImage(c,100,70,!0);if(jQuery("#"+a+"_button_preview").html("<div style=\"width:100px;height:70px;background:url('"+d+"'); background-position:center center; background-size:cover;\"></div>"),jQuery(".show_on_thumbnail_exist").show(),"checked"==jQuery("#thumb_for_admin").attr("checked")){var e=jQuery("#slide_thumb_button_preview div").css("background-image");jQuery("#slide_selector .list_slide_links li.selected .slide-media-container").css({"background-image":e,backgroundSize:"cover",backgroundPosition:"center center"})}})}),jQuery(".button-image-remove").click(function(){var a=this.id.replace("_button_remove","");jQuery("#"+a).val(""),jQuery("#"+a+"_button_preview").html(""),jQuery(".show_on_thumbnail_exist").hide()}),jQuery(".button-image-select-video").click(function(){UniteAdminRev.openAddImageDialog("Choose Image",function(a,b){jQuery("#input_video_preview").val(a);var c=UniteAdminRev.getUrlShowImage(b,200,150,!0);jQuery("#video-thumbnail-preview").css({backgroundImage:"url("+c+")"})})}),jQuery(".button-image-remove-video").click(function(){jQuery("#input_video_preview").val(""),"none"!=jQuery("#video_block_vimeo").css("display")&&jQuery("#button_vimeo_search").trigger("click"),"none"!=jQuery("#video_block_youtube").css("display")&&jQuery("#button_youtube_search").trigger("click")}),jQuery(".button-image-select-html5-video").click(function(){UniteAdminRev.openAddImageDialog("Choose Image",function(a,b){jQuery("#html5_url_poster").val(a)})})},g=function(){jQuery(".list_settings li .setting_text").tipsy({gravity:"e",delayIn:70}),jQuery(".tipsy_enabled_top").tipsy({gravity:"s",delayIn:70}),jQuery(".tipsy_enabled_top_left").tipsy({gravity:"se",delayIn:70}),jQuery(".button-primary").tipsy({gravity:"s",delayIn:70}),jQuery('input[type="checkbox"]').change(function(){RevSliderSettings.onoffStatus(jQuery(this))}),d(),f(),jQuery("body").on("click",".rs-close-preview",function(){var a=jQuery("#rs-preview-form");a.action=g_urlAjaxActions,jQuery("#preview-slide-data").val("empty_output"),jQuery("#preview_sliderid").val("empty_output"),jQuery("#rs-preview-wrapper").hide(),a.submit()}),jQuery(document).keyup(function(a){27==a.keyCode&&jQuery(".rs-close-preview").click()}),jQuery(window).resize(function(){jQuery(".rs-preview-width").text(jQuery(".rs-frame-preview-wrapper").width()),jQuery(".rs-preview-height").text(jQuery(".rs-frame-preview-wrapper").height())})};c.createModernOnOff=function(){jQuery(".tp-moderncheckbox").each(function(){var a=jQuery(this);a.wrap('<div class="tp-onoffbutton"><span class="tp-onoff-onstate">On</span><span class="tp-onoff-offstate">Off</span></div>'),a.change(function(){var a=jQuery(this);a.hasClass("changedbyclick")||c.onoffStatus(a)})}),jQuery(".tp-modernonoffboxes").each(function(){var a=jQuery(this);a.wrap('<div class="tp-onoffbutton tp-onoffbasedontwo"><span class="tp-onoff-onstate">On</span><span class="tp-onoff-offstate">Off</span></div>');var b=a.find('input[value="on"]'),d=a.find('input[value="off"]');b.change(function(){b.hasClass("changedbyclick")||c.onoffStatusBasedOnTwo(b,d)}),d.change(function(){b.hasClass("changedbyclick"Line truncated
@@ -0,0 +1,336 @@
//(function() {
if(typeof(rev_lang) == 'undefined'){
rev_lang = {};
rev_lang.slider_revolution_shortcode_creator = 'Slider Revolution Shortcode Creator';
rev_lang.shortcode_generator = 'Shortcode Generator';
rev_lang.please_add_at_least_one_layer = 'Please add at least one Layer.';
rev_lang.choose_image = 'Choose Image';
rev_lang.shortcode_parsing_successfull = 'Shortcode parsing successfull. Items can be found in step 3';
rev_lang.shortcode_could_not_be_correctly_parsed = 'Shortcode could not be parsed.';
}
if(typeof(tinymce) !== 'undefined'){
tinymce.PluginManager.add('revslider_sc_button', function( editor, url ) {
editor.addButton('revslider_sc_button', {
title: rev_lang.slider_revolution_shortcode_creator,
icon: 'icon dashicons-update',
onclick: function() {
opened_by_mce = true;
//reset all options and settings
revslider_tiny_reset_all();
jQuery('#revslider-tiny-dialog-step-1').show();
jQuery('#revslider-tiny-dialog-step-1-5').hide();
editor.windowManager.open({
id : 'revslider-tiny-mce-dialog',
title : '',
width : 900,
height : 600,
resizable: false,
wpDialog : true
},
{
plugin_url : url // Plugin absolute URL
});
}
});
rs_open_editor = editor;
});
}
jQuery(document).ready(function () {
if (typeof QTags !== 'undefined') {
var add_rs_button = true;
if(edButtons !== undefined){
for(var key in edButtons){
if(edButtons[key].id == 'slider-revolution'){
add_rs_button = false;
break;
}
}
}
if(add_rs_button){
QTags.addButton('slider-revolution', 'Slider Revolution', function () {
opened_by_mce = false;
//reset all options and settings
revslider_tiny_reset_all();
jQuery('#revslider-tiny-dialog-step-1').show();
jQuery('#revslider-tiny-dialog-step-1-5').hide();
jQuery('#revslider-tiny-mce-dialog').dialog({
modal:true,
title : '',
width : 900,
height : 600,
resizable: false,
wpDialog : true
});
});
}
}
});
var opened_by_mce = false;
var revslider_is_vc = false;
var rs_cur_vc_obj = false;
var rs_open_editor = false;
/**
* Reset everything do defaults
**/
function revslider_tiny_reset_all(){
revslider_is_vc = false;
//disable Quick Modify Slider button
jQuery('#revslider-tiny-mce-settings-form').trigger('reset');
jQuery('#revslider-tiny-mce-dialog').show();
jQuery('#revslider-existing-slider option[value="-1"]').attr('selected', 'selected');
jQuery('#revslider-tiny-grid-settings-wrap').removeClass('notselectable');
jQuery('#rs-custom-elements-wrap').html(''); //remove all custom build elements
jQuery('#revslider-existing-slider option:selected').change();
jQuery('#rs-shortcode-select-wrapper li').each(function(){
jQuery(this).removeClass('selected');
});
}
function checkOpenRevDialogWindow() {
setTimeout(function() {
var rtmd = jQuery('#revslider-tiny-mce-dialog')
if (rtmd.closest('.ui-dialog:visible'))
rtmd.closest('.ui-dialog').find('.ui-dialog-titlebar-close').click();
},100);
}
jQuery(document).ready(function(){
/**
* Add shortcode with predefined slider to content
**/
if(!jQuery('#rs-add-predefined-slider').hasClass('rs-clicklistener')){
jQuery('#rs-add-predefined-slider').addClass('rs-clicklistener');
jQuery('body').on('change', '#revslider-existing-slider', function(){
var sel = jQuery('#revslider-existing-slider option:selected');
if(sel.data('slidertype') == 'gallery' || sel.data('slidertype') == 'specific_posts' || sel.data('slidertype') == 'current_post'){
jQuery('#rs-modify-predefined-slider').removeClass('nonclickable');
}else{
jQuery('#rs-modify-predefined-slider').addClass('nonclickable');
}
if(sel.val() != '-1'){
jQuery('#rs-add-predefined-slider').removeClass('nonclickable');
}else{
jQuery('#rs-add-predefined-slider').addClass('nonclickable');
}
});
jQuery('#revslider-existing-slider').change();
jQuery(document).ready(function(){
jQuery('.rs-mod-slides-wrapper').sortable();
});
jQuery('body').on('click', '#rs-modify-predefined-slider', function(){
var rs_raw_construct = wp.template( "rs-modify-slide-wrap" );
var sel = jQuery('#revslider-existing-slider option:selected');
if(sel.data('slidertype') == 'gallery' || sel.data('slidertype') == 'specific_posts' || sel.data('slidertype') == 'current_post'){
jQuery('.rs-mod-slides-wrapper').html(''); //reset HTML
//check if id is available
if(typeof(rev_sliders_info) !== 'undefined'){
for(var key in rev_sliders_info){
if(key == sel.data('sliderid')){
//add all found slides, empty the old ones first
for(var sl in rev_sliders_info[key]){
var content = rs_raw_construct(rev_sliders_info[key][sl]);
jQuery('.rs-mod-slides-wrapper').append(content);
}
jQuery('#revslider-tiny-dialog-step-1').hide();
jQuery('#revslider-tiny-dialog-step-1-5').show();
return true;
}
}
}
}
});
jQuery('body').on('click', '#rs-add-predefined-slider', function(){
var form = jQuery(this).parents('form');
checkOpenRevDialogWindow();
if ( ! validateForm( form ) )
return false;
rs_add_shortcode();
return false;
});
function rs_add_shortcode(data){
var slider_handle = jQuery('select[name="revslider-existing-slider"] option:selected').val();
if(slider_handle !== '-1'){
var order = '';
if(data !== undefined){
if(typeof(data.order) !== 'undefined'){
order = ' order="'+data.order.join()+'"';
}
}
var content = '[rev_slider alias="'+slider_handle+'"'+order+'][/rev_slider]';
//Gutenberg addition
if( jQuery('body').hasClass('gutenberg-editor-page') || jQuery('body').hasClass('block-editor-page') || jQuery('body').hasClass('wp-editor') ){
slider_slug = jQuery('.slider_slug');
slider_slug.val(content);
window.revslider_react.state.text = content;
window.revslider_react.props.attributes.text = content;
window.revslider_react.state.sliderTitle = jQuery('select[name="revslider-existing-slider"] option:selected').text();
window.revslider_react.props.attributes.sliderTitle = jQuery('select[name="revslider-existing-slider"] option:selected').text();
window.revslider_react.forceUpdate();
}
if(!revslider_is_vc){
if(opened_by_mce){
tinyMCE.activeEditor.selection.setContent( content );
if(rs_open_editor !== false)
rs_open_editor.windowManager.close();
}else{
QTags.insertContent(content);
}
//jQuery('#revslider-tiny-mce-dialog').closest('.ui-dialog').hide();
}else{
var rs_vc_data = {'alias':slider_handle};
if(data !== undefined){
if(typeof(data.order) !== 'undefined'){
rs_vc_data.order = data.order;
}
}
rs_cur_vc_obj.model.save('params', rs_vc_data);
jQuery('#revslider-tiny-mce-dialog').dialog('close');
}
}
}
jQuery('body').on('click', '#rs-shortcode-select-wrapper li', function(){
if(!jQuery(this).hasClass('rs-slider-modify-new-slider')){
var sliderid = jQuery(this).data('sliderid');
var slideralias = jQuery(this).data('slideralias');
jQuery('#rs-shortcode-select-wrapper li').each(function(){
jQuery(this).removeClass('selected');
});
jQuery(this).addClass('selected');
jQuery('#revslider-existing-slider option[value="'+slideralias+'"]').attr('selected', 'selected');
jQuery('#revslider-existing-slider option:selected').change();
}
});
}
/**
* Add Slider Sorted with the given order, also check for published/unpublished
**/
jQuery('body').on('click', '#revslider-add-custom-shortcode-modify', function(){
var myslides = [];
var heroadded = false;
jQuery('.rs-mod-slides-wrapper li').each(function(){
var sp = jQuery(this).find('.slide-published');
var slideid = jQuery(this).attr('id').replace('slidelist_item_', '');
if(sp.length > 0 && !sp.hasClass('pubclickable')){ //check if we are published
//we are published
myslides.push(slideid);
}else{
//either hero or unpublished
var sq = jQuery(this).find('.slide-unpublished');
if(sq.length > 0 && !sq.hasClass('pubclickable')){ //check if we are unpublished
//we are unpublished
}else{
//we are hero
var sr = jQuery(this).find('.slide-hero-published');
if(sr.length > 0 && !sr.hasClass('pubclickable') && heroadded == false){ //we are hero published
//as we are hero, this is the last step and we can break the each here
myslides.push(slideid);
heroadded = true;
}
}
}
});
rs_add_shortcode({order: myslides});
checkOpenRevDialogWindow();
});
/**
* Go to step 1
**/
jQuery('body').on('click', '.rs-goto-step-1', function(){
jQuery('#revslider-tiny-dialog-step-1').show();
jQuery('#revslider-tiny-dialog-step-1-5').hide();
});
});
var revslider_create_by_predefined = false;
jQuery('body').on('change', 'select[name="revslider-tiny-existing-settings"]', function(){
var choosen_slider = jQuery(this).val();
if(choosen_slider != '-1'){
jQuery('#revslider-tiny-slider-settings-wrap').addClass('notselectable');
jQuery('#revslider-tiny-slider-settings-wrap').find('input, select, textarea').attr('disabled', 'disabled');
}else{
jQuery('#revslider-tiny-slider-settings-wrap').removeClass('notselectable');
jQuery('#revslider-tiny-slider-settings-wrap').find('input, select, textarea').attr('disabled', false);
}
});
jQuery('select[name="revslider-tiny-existing-settings"]').change();
//})();
@@ -0,0 +1,175 @@
window.VcSliderRevolution = vc.shortcode_view.extend({
initialize: function() {
return window.VcSliderRevolution.__super__.initialize.call(this);
},
render: function () {
rs_cur_vc_obj = this;
var params = this.model.get('params');
if(vc.add_element_block_view.$el.is(':visible')){ //hack to check if we just loaded the page or if we rendered it because of adding a new Slider element
rs_vc_show_overlay(params);
}
return window.VcSliderRevolution.__super__.render.call(this);
},
editElement: function() {
rs_cur_vc_obj = this;
var params = this.model.get('params');
rs_vc_show_overlay(params);
return false;
}
});
if(typeof(window.InlineShortcodeView) !== 'undefined'){
var rs_show_frontend_overlay = false;
jQuery(window).on('vc_build',function(){
vc.add_element_block_view.$el.find('[data-element="rev_slider"]').click(function(){ rs_show_frontend_overlay = true; });
});
window.InlineShortcodeView_rev_slider = window.InlineShortcodeView.extend({
render: function() {
rs_cur_vc_obj = this;
var params = this.model.get('params');
if(rs_show_frontend_overlay){
rs_vc_show_overlay(params);
}
window.InlineShortcodeView_rev_slider.__super__.render.call(this);
return this;
},
update: function(model) {
rs_show_frontend_overlay = false;
// same function as backend changedShortcodeParams
window.InlineShortcodeView_rev_slider.__super__.update.call(this,model);
return this;
},
edit: function( e ) {
rs_cur_vc_obj = this;
var params = this.model.get('params');
rs_vc_show_overlay(params);
return false;
}
});
}
function rs_vc_show_overlay(params){
if ( rs_cur_vc_obj !== false && rs_cur_vc_obj.model.get('cloned') === true){
//set cloned to false, so that the edit button will work. Then return as this is at the process where the element gets cloned
rs_cur_vc_obj.model.save('cloned', false);
return; //do not show edit if we cloned
}
revslider_tiny_reset_all();
revslider_is_vc = true; //set for the saving that we are visual composer
jQuery('.wpb-element-edit-modal').hide(); //hide the normal VC window and use own (old vc version)
jQuery('#vc_properties-panel').hide(); //hide the normal VC window and use own (new vc version)
var revslider_vc_variables = {};
revslider_vc_variables['alias'] = (typeof(params.alias) !== 'undefined') ? params.alias : '';
revslider_vc_variables['order'] = (typeof(params.order) !== 'undefined') ? params.order : ''; //.replace(/\'/g, '"')
jQuery('#revslider-tiny-dialog-step-1').show();
jQuery('#revslider-tiny-dialog-step-1-5').hide();
jQuery('#revslider-tiny-mce-dialog').dialog({
id : 'revslider-tiny-mce-dialog',
width : 900,
height : 600,
resizable: false
});
if(revslider_vc_variables['alias'] !== ''){ //only slider with alias
jQuery('select[name="revslider-existing-slider"] option').each(function(){
if(jQuery(this).val() == revslider_vc_variables['alias']){
jQuery(this).attr('selected', true);
var slid = jQuery(this).data('sliderid');
jQuery('#slider_list_item_'+slid).addClass('selected');
jQuery('#revslider-existing-slider option:selected').change();
}
});
if(revslider_vc_variables['order'] != ''){
jQuery('#revslider-tiny-dialog-step-1').hide();
jQuery('#revslider-tiny-dialog-step-1-5').show();
var rs_raw_construct = wp.template( "rs-modify-slide-wrap" );
var sel = jQuery('#revslider-existing-slider option:selected');
jQuery('.rs-mod-slides-wrapper').html(''); //reset HTML
//check if array or string
if(!Array.isArray(revslider_vc_variables['order'])){
revslider_vc_variables['order'] = revslider_vc_variables['order'].split(',');
}
if(typeof(rev_sliders_info) !== 'undefined'){
for(var key in rev_sliders_info){
if(key == sel.data('sliderid')){
var my_entry = new Object();
my_entry = jQuery.extend(true,{},my_entry, rev_sliders_info[key]);
var my_entries = [];
var act_slide = -1;
for(var okey in revslider_vc_variables['order']){
for(var sl in my_entry){
if(my_entry[sl]['slider_type'] == 'hero'){
if(revslider_vc_variables['order'][okey] == my_entry[sl]['id']){
act_slide = my_entry[sl]['id'];
}
}else{
break;
}
}
}
for(var okey in revslider_vc_variables['order']){
for(var sl in my_entry){ //add all found slides, empty the old ones first
if(my_entry[sl]['slider_type'] == 'hero'){
my_entry[sl]['active_slide'] = act_slide;
}
if(revslider_vc_variables['order'][okey] == my_entry[sl]['id']){
my_entry[sl]['mstate'] = 'published';
my_entry[sl]['state'] = 'published';
my_entries.push(my_entry[sl]);
break;
}
}
}
for(var slm in my_entry){
if(my_entry[slm]['mstate'] == undefined){
my_entry[slm]['state'] = 'unpublished';
if(my_entry[slm]['slider_type'] == 'hero'){
my_entry[sl]['active_slide'] = act_slide;
}
my_entries.push(my_entry[slm]);
}
}
for(var ekey in my_entries){
var content = rs_raw_construct(my_entries[ekey]);
jQuery('.rs-mod-slides-wrapper').append(content);
}
}
}
}
}
}else{ }
}