Current Directory: /home/astoriaah/www/media/com_widgetkit/js
Viewing File: /home/astoriaah/www/media/com_widgetkit/js/joomla.picker.js
"use strict";!function(){function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=t(jQuery);function c(t){var r=window.tinymce.editors[t.attr("id")];return{getContent:function(){return r.getContent()},insertContent:function(t){r.execCommand("mceInsertContent",!1,t)},updateContent:function(t,e,n){var o=this.getContent();o=o.substring(0,e)+t+'<span id="tmp-wkid"></span>'+o.substring(n),r.setContent(o),r.selection.select(r.dom.select("#tmp-wkid")[0],!0),r.selection.collapse(!1),r.dom.remove("tmp-wkid",!1),r.focus()},getCursorPosition:function(){var t=r.selection.getBookmark(0),e=r.dom.select("[data-mce-type=bookmark]");r.selection.select(e[0]),r.selection.collapse();var n="######cursor######",o='<span id="'+n+'"></span>';r.selection.setContent(o);var i=r.getContent({format:"html"}).indexOf(o);return r.dom.remove(n,!1),r.selection.moveToBookmark(t),i}}}function l(r){return{getContent:function(){return r.val()},insertContent:function(t){this.updateContent(t,r.prop("selectionStart"),r.prop("selectionEnd"))},updateContent:function(t,e,n){var o=r.val(),i=e+t.length;o=o.substring(0,e)+t+o.substring(n),r.val(o),r[0].setSelectionRange(i,i),r.focus().trigger("change")},getCursorPosition:function(){return r.prop("selectionStart")}}}function d(t){var o=t.next()[0].CodeMirror;return{getContent:function(){return o.getValue()},insertContent:function(t){o.replaceRange(t,o.getCursor()),o.focus()},updateContent:function(t,e,n){o.replaceRange(t,this.translateOffset(e),this.translateOffset(n)),o.focus()},getCursorPosition:function(){return this.translatePosition(o.getCursor())},translatePosition:function(t){return o.getValue().split("\n",t.line).join("").length+t.line+t.ch},translateOffset:function(t){var e=o.getValue().substring(0,t).split("\n");return{line:e.length-1,ch:e[e.length-1].length}}}}function f(t){var i=window.ace.edit(t.parent().attr("id"));return{getContent:function(){return i.getValue()},insertContent:function(t){i.insert(t),i.focus()},updateContent:function(t,e,n){e=this.translateOffset(e),n=this.translateOffset(n);var o=i.getSelectionRange();o.setStart(e.row,e.column),o.setEnd(n.row,n.column),i.getSession().getDocument().replace(o,t),i.focus()},getCursorPosition:function(){return this.translatePosition(i.getSelection().getCursor())},translatePosition:function(t){return this.getContent().split("\n",t.row).join("").length+t.row+t.column},translateOffset:function(t){var e=this.getContent().substring(0,t).split("\n");return{row:e.length-1,column:e[e.length-1].length}}}}function g(t){var i=window.CKEDITOR.instances[t.attr("id")];return{getContent:function(){return i.getData()},insertContent:function(t){this.updateContent(t,this.getCursorPosition(),this.getCursorPosition())},updateContent:function(t,e,n){var o=i.getData();o=o.substring(0,e)+t+o.substring(n),i.setData(o)},getCursorPosition:function(){return"source"===i.mode?u.default(i.textarea.$).prop("selectionStart"):this.getCursorPositionInWYSIWYG()},getCursorPositionInWYSIWYG:function(){var t=i.getSelection().createBookmarks(),e='<span id="######cursor######"> </span>',n=window.CKEDITOR.dom.element.createFromHtml(e);n.insertBefore(t[0].startNode);var o=this.getContent().indexOf(e);return n.remove(),i.getSelection().selectBookmarks(t),o}}}function w(t){u.default.extend(this,{tag:"",attrs:{},type:"single",content:""},t)}u.default.extend(w,{parse:function(t,e){var n,o=this.regexp(t).exec(e),i={tag:t};return o&&(n=o[4]?"self-closing":o[6]?"closed":"single",i={tag:o[2],attrs:this.attrs(o[3]),type:n,content:o[5]}),new w(i)},attrs:function(t){var e,n=/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*'([^']*)'(?:\s|$)|(\w+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/g,o={};for(t=t.replace(/[\u00a0\u200b]/g," ");e=n.exec(t);)e[1]?o[e[1].toLowerCase()]=e[2]:e[3]?o[e[3].toLowerCase()]=e[4]:!e[5]||"true"!==e[6]&&"1"!==e[6]?!e[5]||"false"!==e[6]&&"0"!==e[6]?e[5]?o[e[5].toLowerCase()]=e[6]:e[7]?o[e[7]]=!0:e[8]&&(o[e[8]]=!0):o[e[5].toLowerCase()]=!1:o[e[5].toLowerCase()]=!0;return o},regexp:function(t){return new RegExp("\\[(\\[?)("+t+")(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)","g")}}),u.default.extend(w.prototype,{string:function(){var n="["+this.tag;return u.default.each(this.attrs,function(t,e){"boolean"==typeof e?n+=" "+t+"="+(e?1:0):""!==e&&(n+=" "+t+'="'+e+'"')}),"single"===this.type?n+"]":"self-closing"===this.type?n+" /]":(n+="]",this.content&&(n+=this.content),n+"[/"+this.tag+"]")}});var n,o,s=window.Joomla;function p(e){var t=s.getOptions("widgetkit").iframe;(n=n||u.default('<div class="modal fade" tabindex="-1" role="dialog">\n <div class="modal-dialog modal-lg jviewport-width90" role="document">\n <div class="modal-content">\n <div class="modal-body">\n <iframe src="'+t+'" style="height: 100%"></iframe>\n </div>\n </div>\n </div>\n </div>').appendTo("body")).find(".modal-body").css("height",.9*window.innerHeight),(o=function(t){var e=window.bootstrap;if(e)return new e.Modal(t);return u.default(t).modal().css({width:"90%",marginLeft:"-45%"}),{show:function(){u.default(t).modal("show")},hide:function(){u.default(t).modal("hide")}}}(n)).show(),window.selectWidget=function(t){e(t),o.hide()}}function i(t,e){var n=t.nextElementSibling,o=e?JSON.stringify(e):n.value,i=function(t){try{return JSON.parse(t)}catch(t){return{}}}(n.value=o),r=s.getOptions("widgetkit");t.textContent=i.name?r.current.replace("%widget%",i.name):r.select}window.insertWidgetkitWidget=function(t){for(var e,n,o,i=(e=u.default("#"+t),new((window.WFEditor||window.JContentEditor||window.tinyMCE)&&!e.is(":visible")?c:window.CodeMirror&&e.next()[0]&&e.next()[0].CodeMirror?d:window.ace?f:window.CKEDITOR?g:l)(e)),r=i.getContent(),s=i.getCursorPosition(),a=/\[widgetkit([^\]]*)\]/gi;o=a.exec(r);)if(o.index<=s&&a.lastIndex>s){n=o[0];break}p(function(t){var e=new w({tag:"widgetkit",attrs:t}).string();n?i.updateContent(e,o.index,a.lastIndex):i.insertContent(e)})},u.default(".widgetkit-widget",".view-module, #module-form, #modules-form").on("click",function(t){var e=this;t.preventDefault(),p(function(t){return i(e,t)})}).each(function(){i(this)})}();