text: (function(){$.widget("ncri.hallohtml",{options:{editable:null,toolbar:null,uuid:"",lang:"en",dialogOpts:{autoOpen:!1,width:600,height:"auto",modal:!1,resizable:!0,draggable:!0,dialogClass:"htmledit-dialog"},dialog:null,buttonCssClass:null},translations:{en:{title:"Edit HTML",update:"Update"},de:{title:"HTML bearbeiten",update:"Aktualisieren"}},texts:null,populateToolbar:function(a){var b,c,d,e;return e=this,this.texts=this.translations[this.options.lang],this.options.toolbar=a,this.options.dialog=$("<div>").attr("id",""+this.options.uuid+"-htmledit-dialog"),c=$("<span>").addClass(e.widgetName),d=""+this.options.uuid+"-htmledit",b=$("<span>"),b.hallobutton({label:this.texts.title,icon:"icon-list-alt",editable:this.options.editable,command:null,queryState:!1,uuid:this.options.uuid,cssClass:this.options.buttonCssClass}),c.append(b),this.button=b,this.button.click(function(){return e.options.dialog.dialog("isOpen")?e._closeDialog():e._openDialog(),!1}),this.options.editable.element.on("hallodeactivated",function(){return e._closeDialog()}),a.append(c),this.options.dialog.dialog(this.options.dialogOpts),this.options.dialog.dialog("option","title",this.texts.title)},_openDialog:function(){var a,b,c,d,e,f=this;return c=this,a=$(this.options.editable.element),d=a.offset().left+a.outerWidth()+10,e=this.options.toolbar.offset().top-$(document).scrollTop(),this.options.dialog.dialog("option","position",[d,e]),this.options.editable.keepActivated(!0),this.options.dialog.dialog("open"),this.options.dialog.on("dialogclose",function(){return $("label",f.button).removeClass("ui-state-active"),f.options.editable.element.focus(),f.options.editable.keepActivated(!1)}),this.options.dialog.html($("<textarea>").addClass("html_source")),b=this.options.editable.element.html(),this.options.dialog.children(".html_source").val(b),this.options.dialog.prepend($("<button>"+this.texts.update+"</button>")),this.options.dialog.on("click","button",function(){return b=c.options.dialog.children(".html_source").val(),c.options.editable.element.html(b),c.options.editable.element.trigger("change"),!1})},_closeDialog:function(){return this.options.dialog.dialog("close")}}),function(a){return a.widget("IKS.hallolists",{options:{editable:null,toolbar:null,uuid:"",lists:{ordered:!0,unordered:!0},buttonCssClass:null},populateToolbar:function(b){var c,d,e=this;return d=a('<span class="'+this.widgetName+'"></span>'),c=function(b,c){var f;return f=a("<span></span>"),f.hallobutton({uuid:e.options.uuid,editable:e.options.editable,label:c,command:"insert"+b+"List",icon:"icon-list-"+c.toLowerCase(),cssClass:e.options.buttonCssClass}),d.append(f)},this.options.lists.ordered&&c("Ordered","OL"),this.options.lists.unordered&&c("Unordered","UL"),d.hallobuttonset(),b.append(d)}})}(jQuery),function(a){return a.widget("IKS.halloformat",{options:{editable:null,uuid:"",formattings:{bold:!0,italic:!0,strikeThrough:!1,underline:!1},buttonCssClass:null},populateToolbar:function(b){var c,d,e,f,g,h,i=this;g=this,d=a('<span class="'+g.widgetName+'"></span>'),c=function(b){var c;return c=a("<span></span>"),c.hallobutton({label:b,editable:i.options.editable,command:b,uuid:i.options.uuid,cssClass:i.options.buttonCssClass}),d.append(c)},h=this.options.formattings;for(f in h)e=h[f],e&&c(f);return d.hallobuttonset(),b.append(d)}})}(jQuery),function(a){return a.widget("IKS.hallolink",{options:{editable:null,uuid:"",link:!0,image:!0,defaultUrl:"http://",dialogOpts:{autoOpen:!1,width:540,height:95,title:"Enter Link",buttonTitle:"Insert",buttonUpdateTitle:"Update",modal:!0,resizable:!1,draggable:!1,dialogClass:"hallolink-dialog"},buttonCssClass:null},populateToolbar:function(b){var c,d,e,f,g,h,i,j,k,l,m=this;return l=this,h=""+this.options.uuid+"-dialog",c=this.options.dialogOpts.buttonTitle,d=this.options.dialogOpts.buttonUpdateTitle,g=a('<div id="'+h+'">        <form action="#" method="post" class="linkForm">          <input class="url" type="text" name="url"            value="'+this.options.defaultUrl+'" />          <input type="submit" id="addlinkButton" value="'+c+'"/>        </form></div>'),k=a("input[name=url]",g).focus(function(){return this.select()}),j=function(a){return RegExp(/^\s*$/).test(a)?!0:a===l.options.defaultUrl?!0:!1},i=function(a){var b,c;return a.preventDefault(),b=k.val(),l.options.editable.restoreSelection(l.lastSelection),j(b)?(c=l.lastSelection.startContainer,l.lastSelection.collapsed&&(l.lastSelection.setStartBefore(c),l.lastSelection.setEndAfter(c),window.getSelection().addRange(l.lastSelection)),document.execCommand("unlink",null,"")):(/:\/\//.test(b)||/^mailto:/.test(b)||(b="http://"+b),void 0===l.lastSelection.startContainer.parentNode.href?document.execCommand("createLink",null,b):l.lastSelection.startContainer.parentNode.href=b),l.options.editable.element.trigger("change"),l.options.editable.removeAllSelections(),g.dialog("close"),!1},g.find("input[type=submit]").click(i),f=a('<span class="'+l.widgetName+'"></span>'),e=function(b){var e,h,i;return i=""+m.options.uuid+"-"+b,h=a("<span></span>"),h.hallobutton({label:"Link",icon:"icon-link",editable:m.options.editable,command:null,queryState:!1,uuid:m.options.uuid,cssClass:m.options.buttonCssClass}),f.append(h),e=h,e.on("click",function(){var e,f;return l.lastSelection=l.options.editable.getSelection(),k=a("input[name=url]",g),f=l.lastSelection.startContainer.parentNode,f.href?(k.val(a(f).attr("href")),e="input[type=submit]",a(k[0].form).find(e).val(d)):(k.val(l.options.defaultUrl),a(k[0].form).find("input[type=submit]").val(c)),l.options.editable.keepActivated(!0),g.dialog("open"),g.on("dialogclose",function(){return a("label",h).removeClass("ui-state-active"),l.options.editable.element.focus(),l.options.editable.keepActivated(!1)}),!1}),m.element.on("keyup paste change mouseup",function(){var c,d;return d=a(l.options.editable.getSelection().startContainer),c=d.prop("nodeName")?d.prop("nodeName"):d.parent().prop("nodeName"),c&&"A"===c.toUpperCase()?(a("label",e).addClass("ui-state-active"),void 0):a("label",e).removeClass("ui-state-active")})},this.options.link&&e("A"),this.options.link?(b.append(f),f.hallobuttonset(),g.dialog(this.options.dialogOpts)):void 0}})}(jQuery),$.widget("ncri.hallo-image-insert-edit",{options:{editable:null,toolbar:null,uuid:"",insert_file_dialog_ui_url:null,lang:"en",dialogOpts:{autoOpen:!1,width:560,height:"auto",modal:!1,resizable:!0,draggable:!0,dialogClass:"insert-image-dialog"},dialog:null,buttonCssClass:null},translations:{en:{title_insert:"Insert Image",title_properties:"Image Properties",insert:"Insert",chage_image:"Change Image:",source:"URL",width:"Width",height:"Height",alt:"Alt Text",padding:"Padding","float":"Float",float_left:"left",float_right:"right",float_none:"No"},de:{title_insert:"Bild einf\u00fcgen",title_properties:"Bildeigenschaften",insert:"Einf\u00fcgen",chage_image:"Bild \u00e4ndern:",source:"URL",width:"Breite",height:"H\u00f6he",alt:"Alt Text",padding:"Padding","float":"Float",float_left:"Links",float_right:"Rechts",float_none:"Nein"}},texts:null,dialog_image_selection_ui_loaded:!1,$image:null,populateToolbar:function(a){var b,c,d,e;return e=this,this.texts=this.translations[this.options.lang],this.options.toolbar=a,d="<div id='hallo_img_properties'></div>",this.options.insert_file_dialog_ui_url&&(d+="<div id='hallo_img_file_select_ui'></div>"),this.options.dialog=$("<div>").attr("id",""+this.options.uuid+"-insert-image-dialog").html(d),c=$("<span>").addClass(this.widgetName),b=$("<span>"),b.hallobutton({label:this.texts.title_insert,icon:"icon-picture",editable:this.options.editable,command:null,queryState:!1,uuid:this.options.uuid,cssClass:this.options.buttonCssClass}),c.append(b),this.button=b,this.button.click(function(){return e.options.dialog.dialog("isOpen")?e._closeDialog():(e.lastSelection=e.options.editable.getSelection(),e._openDialog()),!1}),this.options.editable.element.on("halloselected, hallounselected",function(){return e.options.dialog.dialog("isOpen")?e.lastSelection=e.options.editable.getSelection():void 0}),this.options.editable.element.on("hallodeactivated",function(){return e._closeDialog()}),$(this.options.editable.element).on("click","img",function(){return e._openDialog($(this)),!1}),this.options.editable.element.on("halloselected",function(b,c){var d;return d=e.options.editable.options.toolbar,"halloToolbarContextual"===d&&$(c.originalEvent.target).is("img")?(a.hide(),!1):void 0}),a.append(c),this.options.dialog.dialog(this.options.dialogOpts)},_openDialog:function(a){var b,c,d,e,f=this;return this.$image=a,c=this,b=$(this.options.editable.element),d=b.offset().left+b.outerWidth()+10,e=this.$image?this.$image.offset().top-$(document).scrollTop():this.options.toolbar.offset().top-$(document).scrollTop(),this.options.dialog.dialog("option","position",[d,e]),this.options.editable.keepActivated(!0),this.options.dialog.dialog("open"),this.$image?(this.options.dialog.dialog("option","title",this.texts.title_properties),$(document).keyup(function(a){return(46===a.keyCode||8===a.keyCode)&&($(document).off(),c._closeDialog(),c.$image.remove(),c.$image=null),a.preventDefault()}),this.options.editable.element.on("click",function(){return c.$image=null,c._closeDialog()})):(this.options.dialog.children("#hallo_img_properties").hide(),this.options.dialog.dialog("option","title",this.texts.title_insert),$("#hallo_img_file_select_title").length>0&&$("#hallo_img_file_select_title").text("")),this._load_dialog_image_properties_ui(),this.options.dialog.on("dialogclose",function(){var a;return $("label",f.button).removeClass("ui-state-active"),a=$(document).scrollTop(),f.options.editable.element.focus(),$(document).scrollTop(a),f.options.editable.keepActivated(!1)}),this.options.insert_file_dialog_ui_url&&!this.dialog_image_selection_ui_loaded?(this.options.dialog.on("click",".reload_link",function(){return c._load_dialog_image_selection_ui(),!1}),this.options.dialog.on("click",".file_preview img",function(){var a;return c.$image?(a=$(this).attr("src").replace(/-thumb/,""),c.$image.attr("src",a),$("#hallo_img_source").val(a)):c._insert_image($(this).attr("src").replace(/-thumb/,"")),!1}),this._load_dialog_image_selection_ui()):void 0},_insert_image:function(a){return this.options.editable.restoreSelection(this.lastSelection),document.execCommand("insertImage",null,a),this.options.editable.element.trigger("change"),this.options.editable.removeAllSelections(),this._closeDialog()},_closeDialog:function(){return this.options.dialog.dialog("close")},_load_dialog_image_selection_ui:function(){var a;return a=this,$.ajax({url:this.options.insert_file_dialog_ui_url,success:function(b){var e,f,g;return f="",e=a.options.dialog.children("#hallo_img_properties"),e.is(":visible")&&(f=a.texts.change_image),g="<div id='hallo_img_file_select_title'>"+f+"</div>",a.options.dialog.children("#hallo_img_file_select_ui").html(g+b),a.dialog_image_selection_ui_loaded=!0},beforeSend:function(){return a.options.dialog.children("#hallo_img_file_select_ui").html('<div class="hallo_insert_file_loader"></div>')}})},_load_dialog_image_properties_ui:function(){var a,b,c,d,e,f;return e=this,a=this.options.dialog.children("#hallo_img_properties"),this.$image?(f=this.$image.is("[width]")?this.$image.attr("width"):"",c=this.$image.is("[height]")?this.$image.attr("height"):"",d=this._property_input_html("source",this.$image.attr("src"),{label:this.texts.source})+this._property_input_html("alt",this.$image.attr("alt")||"",{label:this.texts.alt})+this._property_row_html(this._property_input_html("width",f,{label:this.texts.width,row:!1})+this._property_input_html("height",c,{label:this.texts.height,row:!1}))+this._property_input_html("padding",this.$image.css("padding"),{label:this.texts.padding})+this._property_row_html(this._property_cb_html("float_left","left"===this.$image.css("float"),{label:this.texts.float_left,row:!1})+this._property_cb_html("float_right","right"===this.$image.css("float"),{label:this.texts.float_right,row:!1})+this._property_cb_html("unfloat","none"===this.$image.css("float"),{label:this.texts.float_none,row:!1}),this.texts.float),a.html(d),a.show()):this.options.insert_file_dialog_ui_url||(a.html(this._property_input_html("source","",{label:this.texts.source})),a.show()),this.$image?(this.options.insert_file_dialog_ui_url||$("#insert_image_btn").remove(),$("#hallo_img_file_select_title").length>0&&$("#hallo_img_file_select_title").text(this.texts.chage_image),$("#hallo_img_properties #hallo_img_source").keyup(function(){return e.$image.attr("src",this.value)}),$("#hallo_img_properties #hallo_img_alt").keyup(function(){return e.$image.attr("alt",this.value)}),$("#hallo_img_properties #hallo_img_padding").keyup(function(){return e.$image.css("padding",this.value)}),$("#hallo_img_properties #hallo_img_height").keyup(function(){return e.$image.css("height",this.value),e.$image.attr("height",this.value)}),$("#hallo_img_properties #hallo_img_width").keyup(function(){return e.$image.css("width",this.value),e.$image.attr("width",this.value)}),$("#hallo_img_properties #hallo_img_float_left").click(function(){return this.checked?(e.$image.css("float","left"),$("#hallo_img_properties #hallo_img_float_right").removeAttr("checked"),$("#hallo_img_properties #hallo_img_unfloat").removeAttr("checked")):!1}),$("#hallo_img_properties #hallo_img_float_right").click(function(){return this.checked?(e.$image.css("float","right"),$("#hallo_img_properties #hallo_img_unfloat").removeAttr("checked"),$("#hallo_img_properties #hallo_img_float_left").removeAttr("checked")):!1}),$("#hallo_img_properties #hallo_img_unfloat").click(function(){return this.checked?(e.$image.css("float","none"),$("#hallo_img_properties #hallo_img_float_right").removeAttr("checked"),$("#hallo_img_properties #hallo_img_float_left").removeAttr("checked")):!1})):this.options.insert_file_dialog_ui_url?void 0:(b='<button id="insert_image_btn">'+this.texts.insert+"</button>",a.after(b),$("#insert_image_btn").click(function(){var a;return a=$("#hallo_img_properties #hallo_img_source"),e._insert_image(a.val())}))},_property_col_html:function(a){return"<div class='hallo_img_property_col'>"+a+"</div>"},_property_row_html:function(a,b){return null==b&&(b=""),a=this._property_col_html(b)+this._property_col_html(a),"<div class='hallo_img_property_row'>"+a+"</div>"},_property_html:function(a,b){var c;return null==b&&(b={}),b.row===!1?(b.label&&(c=""+b.label+" "+a,a="<span class='img_property_entry'>"+c+"</span>"),a):(c="<span class='img_property_entry'>"+a+"</span>",this._property_row_html(c,b.label))},_property_input_html:function(a,b,c){var d;return null==c&&(c={}),d="<input type='text' id='hallo_img_"+a+"' value='"+b+"'>",this._property_html(d,c)},_property_cb_html:function(a,b,c){var d,e;return null==c&&(c={}),e=b?"checked=checked":"",d="<input type='checkbox' id='hallo_img_"+a+"' "+e+"'>",this._property_html(d,c)}}),function(a){return a.widget("IKS.halloblock",{options:{editable:null,toolbar:null,uuid:"",elements:["h1","h2","h3","p","pre","blockquote"],buttonCssClass:null},populateToolbar:function(b){var c,d,e;return c=a('<span class="'+this.widgetName+'"></span>'),d=""+this.options.uuid+"-"+this.widgetName+"-data",e=this._prepareDropdown(d),b.append(c),c.hallobuttonset(),c.append(e),c.append(this._prepareButton(e))},_prepareDropdown:function(b){var c,d,e,f,g,h,i,j=this;for(e=a('<div id="'+b+'"></div>'),d=this.options.editable.element.get(0).tagName.toLowerCase(),c=function(b){var c,e,f;return c=a("<button class='blockselector'>          <"+b+' class="menu-item">'+b+"</"+b+">        </button>"),d===b&&c.addClass("selected"),"div"!==d&&c.addClass("disabled"),c.on("click",function(){var a;return a=b.toUpperCase(),c.hasClass("disabled")?void 0:"Microsoft Internet Explorer"===navigator.appName?(j.options.editable.execute("FormatBlock","<"+a+">"),void 0):j.options.editable.execute("formatBlock",a)}),f=function(){var d;return d=document.queryCommandValue("formatBlock"),d.toLowerCase()===b?(c.addClass("selected"),void 0):c.removeClass("selected")},e="keyup paste change mouseup",j.options.editable.element.on(e,f),j.options.editable.element.on("halloenabled",function(){return j.options.editable.element.on(e,f)}),j.options.editable.element.on("hallodisabled",function(){return j.options.editable.element.off(e,f)}),c},i=this.options.elements,g=0,h=i.length;h>g;g++)f=i[g],e.append(c(f));return e},_prepareButton:function(b){var c;return c=a("<span></span>"),c.hallodropdownbutton({uuid:this.options.uuid,editable:this.options.editable,label:"block",icon:"icon-text-height",target:b,cssClass:this.options.buttonCssClass}),c}})}(jQuery),function(a){return a.widget("IKS.halloheadings",{options:{editable:null,uuid:"",formatBlocks:["p","h1","h2","h3"],buttonCssClass:null},populateToolbar:function(b){var c,d,e,f,g,h,i,j,k,l=this;for(h=this,d=a('<span class="'+h.widgetName+'"></span>'),g="Microsoft Internet Explorer"===navigator.appName,e=g?"FormatBlock":"formatBlock",c=function(b){var c;return c=a("<span></span>"),c.hallobutton({label:b,editable:l.options.editable,command:e,commandValue:g?"<"+b+">":b,uuid:l.options.uuid,cssClass:l.options.buttonCssClass,queryState:function(){var d,f,h,i,j,k,l,m;try{if(j=document.queryCommandValue(e),g){for(f={p:"normal"},m=[1,2,3,4,5,6],k=0,l=m.length;l>k;k++)i=m[k],f["h"+i]=i;d=j.match(RegExp(f[b],"i"))}else d=j.match(RegExp(b,"i"));return h=d?!0:!1,c.hallobutton("checked",h)}catch(n){}}}),c.find("button .ui-button-text").text(b.toUpperCase()),d.append(c)},k=this.options.formatBlocks,i=0,j=k.length;j>i;i++)f=k[i],c(f);return d.hallobuttonset(),b.append(d)}})}(jQuery),function(a){return a.widget("IKS.halloreundo",{options:{editable:null,toolbar:null,uuid:"",buttonCssClass:null},populateToolbar:function(b){var c,d,e=this;return d=a('<span class="'+this.widgetName+'"></span>'),c=function(b,c){var f;return f=a("<span></span>"),f.hallobutton({uuid:e.options.uuid,editable:e.options.editable,label:c,icon:"undo"===b?"icon-undo":"icon-repeat",command:b,queryState:!1,cssClass:e.options.buttonCssClass}),d.append(f)},c("undo","Undo"),c("redo","Redo"),d.hallobuttonset(),b.append(d)}})}(jQuery),function(a){return a.widget("IKS.halloimage",{options:{editable:null,toolbar:null,uuid:"",limit:8,search:null,searchUrl:null,suggestions:null,loaded:null,upload:null,uploadUrl:null,dialogOpts:{autoOpen:!1,width:270,height:"auto",title:"Insert Images",modal:!1,resizable:!1,draggable:!0,dialogClass:"halloimage-dialog"},dialog:null,buttonCssClass:null,entity:null,vie:null,dbPediaUrl:"http://dev.iks-project.eu/stanbolfull",maxWidth:250,maxHeight:250},populateToolbar:function(b){var c,d,e,f,g,h,i;return this.options.toolbar=b,i=this,e=""+this.options.uuid+"-image-dialog",this.options.dialog=a('<div id="'+e+'">        <div class="nav">          <ul class="tabs">          </ul>          <div id="'+this.options.uuid+'-tab-activeIndicator"            class="tab-activeIndicator" />        </div>        <div class="dialogcontent">        </div>'),h=a(".tabs",this.options.dialog),g=a(".dialogcontent",this.options.dialog),i.options.suggestions&&this._addGuiTabSuggestions(h,g),(i.options.search||i.options.searchUrl)&&this._addGuiTabSearch(h,g),(i.options.upload||i.options.uploadUrl)&&this._addGuiTabUpload(h,g),this.current=a('<div class="currentImage"></div>').halloimagecurrent({uuid:this.options.uuid,imageWidget:this,editable:this.options.editable,dialog:this.options.dialog,maxWidth:this.options.maxWidth,maxHeight:this.options.maxHeight}),a(".dialogcontent",this.options.dialog).append(this.current),d=a('<span class="'+i.widgetName+'"></span>'),f=""+this.options.uuid+"-image",c=a("<span></span>"),c.hallobutton({label:"Images",icon:"icon-picture",editable:this.options.editable,command:null,queryState:!1,uuid:this.options.uuid,cssClass:this.options.buttonCssClass}),d.append(c),this.button=c,this.button.on("click",function(){return i.options.dialog.dialog("isOpen")?i._closeDialog():i._openDialog(),!1}),this.options.editable.element.on("hallodeactivated",function(){return i._closeDialog()}),a(this.options.editable.element).delegate("img","click",function(){return i._openDialog()}),b.append(d),this.options.dialog.dialog(this.options.dialogOpts),this._handleTabs()},setCurrent:function(a){return this.current.halloimagecurrent("setImage",a)},_handleTabs:function(){var b;return b=this,a(".nav li",this.options.dialog).on("click",function(){var c,d;return a("."+b.widgetName+"-tab").hide(),c=a(this).attr("id"),a("#"+c+"-content").show(),d=a(this).position().left+a(this).width()/2,a("#"+b.options.uuid+"-tab-activeIndicator").css({"margin-left":d})}),a(".nav li",this.options.dialog).first().click()},_openDialog:function(){var b,c,d,e,f,g,h,i,j=this;return g=this,b=function(){return window.setTimeout(function(){var b;return b=a(".imageThumbnail"),a(b).each(function(){var b;return b=a("#"+this.id).width(),20>=b?a("#"+this.id).parent("li").remove():void 0})},15e3)},e="#"+this.options.uuid+"-tab-suggestions-content",d=function(){return a(".imageThumbnailActive",e).first().attr("src")},a("#"+this.options.uuid+"-sugg-activeImage").attr("src",d()),a("#"+this.options.uuid+"-sugg-activeImageBg").attr("src",d()),this.lastSelection=this.options.editable.getSelection(),c=a(this.options.editable.element),f=a(this.options.toolbar),h=c.offset().left+c.outerWidth()-3,i=f.offset().top+f.outerHeight()+29,i-=a(document).scrollTop(),this.options.dialog.dialog("option","position",[h,i]),b(),g.options.loaded=1,this.options.editable.keepActivated(!0),this.options.dialog.dialog("open"),this.options.dialog.on("dialogclose",function(){return a("label",j.button).removeClass("ui-state-active"),j.options.editable.element.focus(),j.options.editable.keepActivated(!1)})},_closeDialog:function(){return this.options.dialog.dialog("close")},_addGuiTabSuggestions:function(b,c){var d;return b.append(a('<li id="'+this.options.uuid+'-tab-suggestions"        class="'+this.widgetName+"-tabselector "+this.widgetName+'-tab-suggestions">          <span>Suggestions</span>        </li>')),d=a('<div id="'+this.options.uuid+'-tab-suggestions-content"        class="'+this.widgetName+'-tab tab-suggestions"></div>'),c.append(d),d.halloimagesuggestions({uuid:this.options.uuid,imageWidget:this,entity:this.options.entity})},_addGuiTabSearch:function(b,c){var d,e,f;return f=this,d=""+this.options.uuid+"-image-dialog",b.append(a('<li id="'+this.options.uuid+'-tab-search"        class="'+this.widgetName+"-tabselector "+this.widgetName+'-tab-search">          <span>Search</span>        </li>')),e=a('<div id="'+this.options.uuid+'-tab-search-content"        class="'+f.widgetName+'-tab tab-search"></div>'),c.append(e),e.halloimagesearch({uuid:this.options.uuid,imageWidget:this,searchCallback:this.options.search,searchUrl:this.options.searchUrl,limit:this.options.limit,entity:this.options.entity})},_addGuiTabUpload:function(b,c){var d;return b.append(a('<li id="'+this.options.uuid+'-tab-upload"        class="'+this.widgetName+"-tabselector "+this.widgetName+'-tab-upload">          <span>Upload</span>        </li>')),d=a('<div id="'+this.options.uuid+'-tab-upload-content"        class="'+this.widgetName+'-tab tab-upload"></div>'),c.append(d),d.halloimageupload({uuid:this.options.uuid,uploadCallback:this.options.upload,uploadUrl:this.options.uploadUrl,imageWidget:this,entity:this.options.entity})}})}(jQuery),function(a){return a.widget("Liip.hallooverlay",{options:{editable:null,toolbar:null,uuid:"",overlay:null,padding:10,background:null},_create:function(){var b;return b=this,this.options.bound?void 0:(this.options.bound=!0,this.options.editable.element.on("halloactivated",function(c){return b.options.currentEditable=a(c.target),b.options.visible?void 0:b.showOverlay()}),this.options.editable.element.on("hallomodified",function(c){return b.options.currentEditable=a(c.target),b.options.visible?b.resizeOverlay():void 0}),this.options.editable.element.on("hallodeactivated",function(c){return b.options.currentEditable=a(c.target),b.options.visible?b.hideOverlay():void 0}))},showOverlay:function(){return this.options.visible=!0,null===this.options.overlay&&(a("#halloOverlay").length>0?this.options.overlay=a("#halloOverlay"):(this.options.overlay=a('<div id="halloOverlay"            class="halloOverlay">'),a(document.body).append(this.options.overlay)),this.options.overlay.on("click",a.proxy(this.options.editable.turnOff,this.options.editable))),this.options.overlay.show(),null===this.options.background&&(a("#halloBackground").length>0?this.options.background=a("#halloBackground"):(this.options.background=a('<div id="halloBackground"            class="halloBackground">'),a(document.body).append(this.options.background))),this.resizeOverlay(),this.options.background.show(),this.options.originalZIndex||(this.options.originalZIndex=this.options.currentEditable.css("z-index")),this.options.currentEditable.css("z-index","350")},resizeOverlay:function(){var a;return a=this.options.currentEditable.offset(),this.options.background.css({top:a.top-this.options.padding,left:a.left-this.options.padding,width:this.options.currentEditable.width()+2*this.options.padding,height:this.options.currentEditable.height()+2*this.options.padding})},hideOverlay:function(){return this.options.visible=!1,this.options.overlay.hide(),this.options.background.hide(),this.options.currentEditable.css("z-index",this.options.originalZIndex)},_findBackgroundColor:function(a){var b;return b=a.css("background-color"),"rgba(0, 0, 0, 0)"!==b&&"transparent"!==b?b:a.is("body")?"white":this._findBackgroundColor(a.parent())}})}(jQuery),function(a){return a.widget("IKS.halloindicator",{options:{editable:null,className:"halloEditIndicator"},_create:function(){var a=this;return this.element.on("halloenabled",function(){return a.buildIndicator()})},populateToolbar:function(){},buildIndicator:function(){var b;return b=a('<div><i class="icon-edit"></i> Edit</div>'),b.addClass(this.options.className),b.hide(),this.element.before(b),this.bindIndicator(b),this.setIndicatorPosition(b)},bindIndicator:function(b){var c=this;return b.on("click",function(){return c.options.editable.element.focus()}),this.element.on("halloactivated",function(){return b.hide()}),this.element.on("hallodisabled",function(){return b.remove()}),this.options.editable.element.hover(function(){return a(this).hasClass("inEditMode")?void 0:b.show()},function(c){return a(this).hasClass("inEditMode")||c.relatedTarget===b.get(0)?void 0:b.hide()})},setIndicatorPosition:function(a){var b;return a.css("position","absolute"),b=this.element.position(),a.css("top",b.top+2),a.css("left",b.left+2)}})}(jQuery),function(a){var b;return b=null,void 0!==this.VIE&&(b=new VIE,b.use(new b.StanbolService({proxyDisabled:!0,url:"http://dev.iks-project.eu:8081"}))),a.widget("IKS.halloannotate",{options:{vie:b,editable:null,toolbar:null,uuid:"",select:function(){},decline:function(){},remove:function(){},buttonCssClass:null},_create:function(){var b,c,d;if(d=this,void 0===this.options.vie)throw Error("The halloannotate plugin requires VIE");if("function"!=typeof this.element.annotate)throw Error("The halloannotate plugin requires annotate.js");return this.state="off",this.instantiate(),c=function(){var b;return b=this,a(b).halloannotate("turnOff")},b=this.options.editable.element,b.on("hallodisabled",c)},populateToolbar:function(b){var c,d=this;return c=a('<span class="'+this.widgetName+'"></span>'),this.button=c.hallobutton({label:"Annotate",icon:"icon-tags",editable:this.options.editable,command:null,uuid:this.options.uuid,cssClass:this.options.buttonCssClass,queryState:!1}),c.on("change",function(){return"pending"!==d.state?"off"===d.state?d.turnOn():d.turnOff():void 0}),c.buttonset(),b.append(this.button)},cleanupContentClone:function(b){return"on"===this.state?b.find(".entity:not([about])").each(function(){return a(this).replaceWith(a(this).html())}):void 0},instantiate:function(){var b;return b=this,this.options.editable.element.annotate({vie:this.options.vie,debug:!1,showTooltip:!0,select:this.options.select,remove:this.options.remove,success:this.options.success,error:this.options.error}).on("annotateselect",function(){return b.options.editable.setModified()}).on("annotateremove",function(){return a.noop()})},turnPending:function(){return this.state="pending",this.button.hallobutton("checked",!1),this.button.hallobutton("disable")},turnOn:function(){var a,b=this;this.turnPending(),a=this;try{return this.options.editable.element.annotate("enable",function(a){return a?(b.state="on",b.button.hallobutton("checked",!0),b.button.hallobutton("enable")):void 0})}catch(c){return alert(c)}},turnOff:function(){return this.options.editable.element.annotate("disable"),this.state="off",this.button?(this.button.attr("checked",!1),this.button.find("label").removeClass("ui-state-clicked"),this.button.button("refresh")):void 0}})}(jQuery),function(a){return a.widget("IKS.halloimagesearch",{options:{imageWidget:null,searchCallback:null,searchUrl:null,limit:5},_create:function(){return this.element.html('<div>        <form method="get">          <input type="text" class="searchInput" placeholder="Search" />          <input type="submit" class="btn searchButton" value="OK" />        </form>        <div class="searchResults imageThumbnailContainer">          <div class="activitySpinner">Loading images...</div>          <ul></ul>        </div>      </div>')},_init:function(){var b=this;return this.options.searchUrl&&!this.options.searchCallback&&(this.options.searchCallback=this._ajaxSearch),a(".activitySpinner",this.element).hide(),a("form",this.element).submit(function(c){var d;return c.preventDefault(),a(".activitySpinner",b.element).show(),d=a(".searchInput",b.element.element).val(),b.options.searchCallback(d,b.options.limit,0,function(a){return b._showResults(a)})})},_showResult:function(b){var c,d=this;return b.label||(b.label=b.alt),c=a('<li>        <img src="'+b.url+'" class="imageThumbnail"          title="'+b.label+'"></li>'),c.on("click",function(){return d.options.imageWidget.setCurrent(b)}),a("img",c).on("mousedown",function(a){return a.preventDefault(),d.options.imageWidget.setCurrent(b)}),a(".imageThumbnailContainer ul",this.element).append(c)},_showNextPrev:function(b){var c,d=this;return c=a("imageThumbnailContainer ul",this.element),c.prepend(a('<div class="pager-prev" style="display:none" />')),c.append(a('<div class="pager-next" style="display:none" />')),b.offset>0&&a(".pager-prev",c).show(),b.offset<b.total&&a(".pager-next",c).show(),a(".pager-prev",c).click(function(){var c;return c=b.offset-d.options.limit,d.options.searchCallback(query,d.options.limit,c,function(a){return d._showResults(a)})}),a(".pager-next",c).click(function(){var c;return c=b.offset+d.options.limit,d.options.searchCallback(query,d.options.limit,c,function(a){return d._showResults(a)})})},_showResults:function(b){var c,d,e,f;for(a(".activitySpinner",this.element).hide(),a(".imageThumbnailContainer ul",this.element).empty(),a(".imageThumbnailContainer ul",this.element).show(),f=b.assets,d=0,e=f.length;e>d;d++)c=f[d],this._showResult(c);return this.options.imageWidget.setCurrent(b.assets.shift()),this._showNextPrev(b)},_ajaxSearch:function(b,c,d,e){var f;return f=this.searchUrl+"?"+a.param({q:b,limit:c,offset:d}),a.getJSON(f,e)}})}(jQuery),function(a){return a.widget("IKS.halloimageupload",{options:{uploadCallback:null,uploadUrl:null,imageWidget:null,entity:null},_create:function(){return this.element.html('        <form class="upload">        <input type="file" class="file" name="userfile" accept="image/*" />        <input type="hidden" name="tags" value="" />        <input type="text" class="caption" name="caption" placeholder="Title" />        <button class="uploadSubmit">Upload</button>        </form>      ')},_init:function(){var b;return b=this,b.options.uploadUrl&&!b.options.uploadCallback&&(b.options.uploadCallback=b._iframeUpload),a(".uploadSubmit",this.element).on("click",function(a){return a.preventDefault(),a.stopPropagation(),b.options.uploadCallback({widget:b,success:function(a){return b.options.imageWidget.setCurrent({url:a,label:""})
  }})})},_prepareIframe:function(b){var c,d;return d=""+b.widgetName+"_postframe_"+b.options.uuid,d=d.replace(/-/g,"_"),c=a("#"+d),c.length?c:(c=a('<iframe name="'+d+'" id="'+d+'"        class="hidden" style="display:none" />'),this.element.append(c),c.get(0).name=d,c)},_iframeUpload:function(b){var c,d,e,f;return f=b.widget,c=f._prepareIframe(f),d=a("form.upload",f.element),e="function"==typeof f.options.uploadUrl?f.options.uploadUrl(f.options.entity):f.options.uploadUrl,c.on("load",function(){var a;return a=c.get(0).contentWindow.location.href,f.element.hide(),b.success(a)}),d.attr("action",e),d.attr("method","post"),d.attr("target",c.get(0).name),d.attr("enctype","multipart/form-data"),d.attr("encoding","multipart/form-data"),d.submit()}})}(jQuery),function(a){return a.widget("IKS.halloimagesuggestions",{loaded:!1,options:{entity:null,vie:null,dbPediaUrl:null,getSuggestions:null,thumbnailUri:"<http://dbpedia.org/ontology/thumbnail>"},_create:function(){return this.element.html('      <div id="'+this.options.uuid+'-tab-suggestions">        <div class="imageThumbnailContainer">          <div class="activitySpinner">Loading images...</div>          <ul></ul>        </div>      </div>')},_init:function(){return a(".activitySpinner",this.element).hide()},_normalizeRelated:function(a){return _.isString(a)?a:_.isArray(a)?a.join(","):a.pluck("@subject").join(",")},_prepareVIE:function(){return this.options.vie||(this.options.vie=new VIE),!this.options.vie.services.dbpedia&&this.options.dbPediaUrl?this.options.vie.use(new vie.DBPediaService({url:this.options.dbPediaUrl,proxyDisabled:!0})):void 0},_getSuggestions:function(){var b,c,d;if(!this.loaded&&this.options.entity)return a(".activitySpinner",this.element).show(),d=this.options.entity.get("skos:related"),0===d.length?(a("#activitySpinner").html("No images found."),void 0):(a(".imageThumbnailContainer ul",this.element).empty(),c=this._normalizeRelated(d),b=this.options.limit,this.options.getSuggestions&&this.options.getSuggestions(c,b,0,this._showSuggestions),this._prepareVIE(),this.options.vie.services.dbpedia&&this._getSuggestionsDbPedia(d),this.loaded=!0)},_getSuggestionsDbPedia:function(b){var c,d;return d=this,c=1,_.each(b,function(b){return vie.load({entity:b}).using("dbpedia").execute().done(function(c){return a(".activitySpinner",this.element).hide(),_.each(c,function(a){var c,e;return(e=a.attributes[d.options.thumbnailUri])?(_.isObject(e)&&(c=e[0].value),_.isString(e)&&(c=d.options.entity.fromReference(e)),d._showSuggestion({url:c,label:b})):void 0})})})},_showSuggestion:function(b){var c,d=this;return c=a('<li>        <img src="'+b.url+'" class="imageThumbnail"          title="'+b.label+'">        </li>'),c.on("click",function(){return d.options.imageWidget.setCurrent(b)}),a(".imageThumbnailContainer ul",this.element).append(c)},_showSuggestions:function(b){var c=this;return a(".activitySpinner",this.element).hide(),_.each(b,function(a){return c._showSuggestion(a)})}})}(jQuery),function(a){return a.widget("IKS.halloimagecurrent",{options:{imageWidget:null,startPlace:"",draggables:[],maxWidth:400,maxHeight:200},_create:function(){return this.element.html('<div>        <div class="activeImageContainer">          <div class="rotationWrapper">            <div class="hintArrow"></div>              <img src="" class="activeImage" />            </div>            <img src="" class="activeImage activeImageBg" />          </div>        </div>'),this.element.hide(),this._prepareDnD()},_init:function(){var b,c;return b=a(this.options.editable.element),c=this,a("img",b).each(function(a,d){return c._initDraggable(d,b)}),a("p",b).each(function(b,d){return a(d).data("jquery_droppable_initialized")?void 0:(a(d).droppable({tolerance:"pointer",drop:function(a,b){return c._handleDropEvent(a,b)},over:function(a,b){return c._handleOverEvent(a,b)},out:function(a,b){return c._handleLeaveEvent(a,b)}}),a(d).data("jquery_droppable_initialized",!0))})},_prepareDnD:function(){var b,c,d;return d=this,b=a(this.options.editable.element),this.options.offset=b.offset(),this.options.third=parseFloat(b.width()/3),c={width:this.options.third,height:b.height()},this.overlay={big:a("<div/>").addClass("bigOverlay").css({width:2*this.options.third,height:b.height()}),left:a("<div/>").addClass("smallOverlay smallOverlayLeft"),right:a("<div/>").addClass("smallOverlay smallOverlayRight")},this.overlay.left.css(c),this.overlay.right.css(c).css("left",2*this.options.third),b.on("halloactivated",function(){return d._enableDragging()}),b.on("hallodeactivated",function(){return d._disableDragging()})},setImage:function(b){return b?(this.element.show(),a(".activeImage",this.element).attr("src",b.url),b.label&&a("input",this.element).val(b.label),this._initImage(a(this.options.editable.element))):void 0},_delayAction:function(a,b){var c;return c=clearTimeout(c),c?void 0:c=setTimeout(a,b)},_calcDropPosition:function(a,b){var c,d;return c=a.left+this.options.third,d=a.left+2*this.options.third,b.pageX>=c&&d>=b.pageX?"middle":c>b.pageX?"left":b.pageX>d?"right":void 0},_createInsertElement:function(b,c){var d,e;return d=a("<img>"),e=new Image,a(e).on("load",function(){}),e.src=b.src,d.attr({src:e.src,alt:c?void 0:a(b).attr("alt"),"class":c?"halloTmp":"imageInText"}),d.show(),d},_createLineFeedbackElement:function(){return a("<div/>").addClass("halloTmpLine")},_removeFeedbackElements:function(){return this.overlay.big.remove(),this.overlay.left.remove(),this.overlay.right.remove(),a(".halloTmp, .halloTmpLine",this.options.editable.element).remove()},_removeCustomHelper:function(){return a(".customHelper").remove()},_showOverlay:function(b){var c,d;switch(d=a(this.options.editable.element),c=d.height(),c+=parseFloat(d.css("paddingTop")),c+=parseFloat(d.css("paddingBottom")),this.overlay.big.css({height:c}),this.overlay.left.css({height:c}),this.overlay.right.css({height:c}),b){case"left":return this.overlay.big.addClass("bigOverlayLeft"),this.overlay.big.removeClass("bigOverlayRight"),this.overlay.big.css({left:this.options.third}),this.overlay.big.show(),this.overlay.left.hide(),this.overlay.right.hide();case"middle":return this.overlay.big.removeClass("bigOverlayLeft bigOverlayRight"),this.overlay.big.hide(),this.overlay.left.show(),this.overlay.right.show();case"right":return this.overlay.big.addClass("bigOverlayRight"),this.overlay.big.removeClass("bigOverlayLeft"),this.overlay.big.css({left:0}),this.overlay.big.show(),this.overlay.left.hide(),this.overlay.right.hide()}},_checkOrigin:function(b){return 0!==a(b.target).parents("[contenteditable]").length?!0:!1},_createFeedback:function(a,b){var c;return"middle"===b?this._createLineFeedbackElement():(c=this._createInsertElement(a,!0),c.addClass("inlineImage-"+b))},_handleOverEvent:function(b,c){var d,e,f;return f=this,d=a(this.options.editable),e=function(){var e,g;return window.waitWithTrash=clearTimeout(window.waitWithTrash),e=f._calcDropPosition(f.options.offset,b),a(".trashcan",c.helper).remove(),d[0].element.append(f.overlay.big),d[0].element.append(f.overlay.left),d[0].element.append(f.overlay.right),f._removeFeedbackElements(),g=a(b.target),g.prepend(f._createFeedback(c.draggable[0],e)),"middle"===e?(g.prepend(f._createFeedback(c.draggable[0],"right")),a(".halloTmp",b.target).hide()):(g.prepend(f._createFeedback(c.draggable[0],"middle")),a(".halloTmpLine",b.target).hide()),f._showOverlay(e)},setTimeout(e,5)},_handleDragEvent:function(b){var d,e,f;return d=this._calcDropPosition(this.options.offset,b),d!==this._lastPositionDrag?(this._lastPositionDrag=d,e=a(".halloTmp",this.options.editable.element),f=a(".halloTmpLine",this.options.editable.element),"middle"===d?(f.show(),e.hide()):(f.hide(),e.removeClass("inlineImage-left inlineImage-right"),e.addClass("inlineImage-"+d),e.show()),this._showOverlay(d)):void 0},_handleLeaveEvent:function(b,c){var d;return d=function(){return a("div.trashcan",c.helper).length?void 0:(a(c.helper).append(a('<div class="trashcan"></div>')),a(".bigOverlay, .smallOverlay").remove())},window.waitWithTrash=setTimeout(d,200),this._removeFeedbackElements()},_handleStartEvent:function(b){var d;return d=this._checkOrigin(b),d&&a(b.target).remove(),a(document).trigger("startPreventSave"),this.options.startPlace=a(b.target)},_handleStopEvent:function(b){var d;return d=this._checkOrigin(b),d?a(b.target).remove():a(this.options.editable.element).trigger("change"),this.overlay.big.hide(),this.overlay.left.hide(),this.overlay.right.hide(),a(document).trigger("stopPreventSave")},_handleDropEvent:function(b,c){var d,e,f,g,h,i;return e=a(this.options.editable.element),g=this._checkOrigin(b),i=this._calcDropPosition(this.options.offset,b),this._removeFeedbackElements(),this._removeCustomHelper(),f=this._createInsertElement(c.draggable[0],!1),d="inlineImage-middle inlineImage-left inlineImage-right","middle"===i?(f.show(),f.removeClass(d),h=e.width(),h+=parseFloat(e.css("paddingLeft")),h+=parseFloat(e.css("paddingRight")),h-=f.attr("width"),f.addClass("inlineImage-"+i).css({position:"relative",left:h/2}),f.insertBefore(a(b.target))):(f.removeClass(d),f.addClass("inlineImage-"+i),f.css("display","block"),a(b.target).prepend(f)),this.overlay.big.hide(),this.overlay.left.hide(),this.overlay.right.hide(),e.trigger("change"),this._initImage(e)},_createHelper:function(b){return a("<div>").css({backgroundImage:"url("+a(b.currentTarget).attr("src")+")"}).addClass("customHelper").appendTo("body")},_initDraggable:function(b,c){var d;return d=this,b.jquery_draggable_initialized||(b.jquery_draggable_initialized=!0,a(b).draggable({cursor:"move",helper:function(a){return d._createHelper(a)},drag:function(a,b){return d._handleDragEvent(a,b)},start:function(a,b){return d._handleStartEvent(a,b)},stop:function(a,b){return d._handleStopEvent(a,b)},disabled:!c.hasClass("inEditMode"),cursorAt:{top:50,left:50}})),d.options.draggables.push(b)},_initImage:function(b){var c;return c=this,a(".rotationWrapper img",this.options.dialog).each(function(a,d){return c._initDraggable(d,b)})},_enableDragging:function(){return a.each(this.options.draggables,function(b,c){return a(c).draggable("option","disabled",!1)})},_disableDragging:function(){return a.each(this.options.draggables,function(b,c){return a(c).draggable("option","disabled",!0)})}})}(jQuery),function(a){return a.widget("IKS.hallojustify",{options:{editable:null,toolbar:null,uuid:"",buttonCssClass:null},populateToolbar:function(b){var c,d,e=this;return d=a('<span class="'+this.widgetName+'"></span>'),c=function(b){var c;return c=a("<span></span>"),c.hallobutton({uuid:e.options.uuid,editable:e.options.editable,label:b,command:"justify"+b,icon:"icon-align-"+b.toLowerCase(),cssClass:e.options.buttonCssClass}),d.append(c)},c("Left"),c("Center"),c("Right"),d.hallobuttonset(),b.append(d)}})}(jQuery),function(a){return a.widget("IKS.halloblacklist",{options:{tags:[]},_init:function(){return-1!==this.options.tags.indexOf("br")?this.element.on("keydown",function(a){return 13===a.originalEvent.keyCode?a.preventDefault():void 0}):void 0},cleanupContentClone:function(b){var c,d,e,f,g;for(f=this.options.tags,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(a(c,b).remove());return g}})}(jQuery),function(a){return a.widget("Liip.hallotoolbarlinebreak",{options:{editable:null,uuid:"",breakAfter:[]},populateToolbar:function(b){var c,d,e,f,g,h,i,j,k,l,m;for(e=a(".ui-buttonset",b),f=a(),h=0,m=this.options.breakAfter,i=0,k=m.length;k>i;i++)for(g=m[i],h++,c='<div          class="halloButtonrow halloButtonrow-'+h+'" />',j=0,l=e.length;l>j;j++)if(d=e[j],f=a(f).add(a(d)),a(d).hasClass(g)){f.wrapAll(c),e=e.not(f),f=a();break}return e.length>0?(h++,c='<div          class="halloButtonrow halloButtonrow-'+h+'" />',e.wrapAll(c)):void 0}})}(jQuery),function(a){return a.widget("IKS.hallobutton",{button:null,isChecked:!1,options:{uuid:"",label:null,icon:null,editable:null,command:null,commandValue:null,queryState:!0,cssClass:null},_create:function(){var a,b,c,d,e,f=this;return null==(e=(d=this.options).icon)&&(d.icon="icon-"+this.options.label.toLowerCase()),b=""+this.options.uuid+"-"+this.options.label,c=this.options,this.button=this._createButton(b,c.command,c.label,c.icon),this.element.append(this.button),this.options.cssClass&&this.button.addClass(this.options.cssClass),this.options.editable.options.touchScreen&&this.button.addClass("btn-large"),this.button.data("hallo-command",this.options.command),this.options.commandValue&&this.button.data("hallo-command-value",this.options.commandValue),a="ui-state-hover",this.button.on("mouseenter",function(){return f.isEnabled()?f.button.addClass(a):void 0}),this.button.on("mouseleave",function(){return f.button.removeClass(a)})},_init:function(){var a,b,c,d=this;return this.button||(this.button=this._prepareButton()),this.element.append(this.button),c=this.options.queryState===!0?function(){var b,c;if(d.options.command)try{return d.options.commandValue?(c=document.queryCommandValue(d.options.command),b=c.match(RegExp(d.options.commandValue,"i")),d.checked(b?!0:!1)):d.checked(document.queryCommandState(d.options.command))}catch(e){}}:this.options.queryState,this.options.command&&this.button.on("click",function(){return d.options.commandValue?d.options.editable.execute(d.options.command,d.options.commandValue):d.options.editable.execute(d.options.command),c(),!1}),this.options.queryState?(a=this.options.editable.element,b="keyup paste change mouseup hallomodified",a.on(b,c),a.on("halloenabled",function(){return a.on(b,c)}),a.on("hallodisabled",function(){return a.off(b,c)})):void 0},enable:function(){return this.button.removeAttr("disabled")},disable:function(){return this.button.attr("disabled","true")},isEnabled:function(){return"true"!==this.button.attr("disabled")},refresh:function(){return this.isChecked?this.button.addClass("ui-state-active"):this.button.removeClass("ui-state-active")},checked:function(a){return this.isChecked=a,this.refresh()},_createButton:function(b,c,d,e){var f;return f=["ui-button","ui-widget","ui-state-default","ui-corner-all","ui-button-text-only",""+c+"_button"],a('<button id="'+b+'"        class="'+f.join(" ")+'" title="'+d+'">          <span class="ui-button-text">            <i class="'+e+'"></i>          </span>        </button>')}}),a.widget("IKS.hallobuttonset",{buttons:null,_create:function(){return this.element.addClass("ui-buttonset")},_init:function(){return this.refresh()},refresh:function(){var a;return a="rtl"===this.element.css("direction"),this.buttons=this.element.find(".ui-button"),this.buttons.removeClass("ui-corner-all ui-corner-left ui-corner-right"),a?(this.buttons.filter(":first").addClass("ui-corner-right"),this.buttons.filter(":last").addClass("ui-corner-left")):(this.buttons.filter(":first").addClass("ui-corner-left"),this.buttons.filter(":last").addClass("ui-corner-right"))}})}(jQuery),function(a){return a.widget("IKS.hallodropdownbutton",{button:null,options:{uuid:"",label:null,icon:null,editable:null,target:"",cssClass:null},_create:function(){var a,b;return null!=(b=(a=this.options).icon)?b:a.icon="icon-"+this.options.label.toLowerCase()},_init:function(){var b,c=this;return b=a(this.options.target),b.css("position","absolute"),b.addClass("dropdown-menu"),b.hide(),this.button||(this.button=this._prepareButton()),this.button.on("click",function(){return b.hasClass("open")?(c._hideTarget(),void 0):c._showTarget()}),b.on("click",function(){return c._hideTarget()}),this.options.editable.element.on("hallodeactivated",function(){return c._hideTarget()}),this.element.append(this.button)},_showTarget:function(){var b;return b=a(this.options.target),this._updateTargetPosition(),b.addClass("open"),b.show()},_hideTarget:function(){var b;return b=a(this.options.target),b.removeClass("open"),b.hide()},_updateTargetPosition:function(){var b,c,d,e;return c=a(this.options.target),e=this.button.position(),d=e.top,b=e.left,d+=this.button.outerHeight(),c.css("top",d),c.css("left",b-20)},_prepareButton:function(){var b,c,d;return d=""+this.options.uuid+"-"+this.options.label,c=["ui-button","ui-widget","ui-state-default","ui-corner-all","ui-button-text-only"],b=a('<button id="'+d+'"       class="'+c.join(" ")+'" title="'+this.options.label+'">       <span class="ui-button-text"><i class="'+this.options.icon+'"></i></span>       </button>'),this.options.cssClass&&b.addClass(this.options.cssClass),b}})}(jQuery),function(a){return a.widget("IKS.halloToolbarFixed",{toolbar:null,options:{parentElement:"body",editable:null,toolbar:null,affix:!0,affixTopOffset:2},_create:function(){var b,c,d=this;return this.toolbar=this.options.toolbar,this.toolbar.show(),a(this.options.parentElement).append(this.toolbar),this._bindEvents(),a(window).resize(function(){return d.setPosition()}),a(window).scroll(function(){return d.setPosition()}),"body"===this.options.parentElement?(b=a(this.element),c=parseFloat(b.css("padding-left")),c+=parseFloat(b.css("padding-right")),c+=parseFloat(b.css("border-left-width")),c+=parseFloat(b.css("border-right-width")),c+=2*parseFloat(b.css("outline-width")),c+=2*parseFloat(b.css("outline-offset")),a(this.toolbar).css("width",b.width()+c)):void 0},_getPosition:function(a){var c,d,e;if(a)return e=parseFloat(this.element.css("outline-width")),c=e+parseFloat(this.element.css("outline-offset")),d={top:this.element.offset().top-this.toolbar.outerHeight()-c,left:this.element.offset().left-c}},_getCaretPosition:function(b){var c,d,e;return e=a("<span/>"),c=rangy.createRange(),c.setStart(b.endContainer,b.endOffset),c.insertNode(e.get(0)),d={top:e.offset().top,left:e.offset().left},e.remove(),d},setPosition:function(){var b,c,d,e,f,g;if("body"===this.options.parentElement)return this.toolbar.css("position","absolute"),this.toolbar.css("top",this.element.offset().top-this.toolbar.outerHeight()),this.options.affix&&(f=a(window).scrollTop(),e=this.element.offset(),d=this.element.height(),g=this.options.affixTopOffset,c=e.top-(this.toolbar.height()+this.options.affixTopOffset),b=d-g+(e.top-this.toolbar.height()),f>c&&b>f&&(this.toolbar.css("position","fixed"),this.toolbar.css("top",this.options.affixTopOffset))),this.toolbar.css("left",this.element.offset().left-2)},_updatePosition:function(){},_bindEvents:function(){var a=this;return this.element.on("halloactivated",function(){return a.setPosition(),a.toolbar.show()}),this.element.on("hallodeactivated",function(){return a.toolbar.hide()})}})}(jQuery),function(a){return a.widget("IKS.halloToolbarContextual",{toolbar:null,options:{parentElement:"body",editable:null,toolbar:null,positionAbove:!1},_create:function(){var b=this;return this.toolbar=this.options.toolbar,a(this.options.parentElement).append(this.toolbar),this._bindEvents(),a(window).resize(function(a){return b._updatePosition(b._getPosition(a))})},_getPosition:function(a,b){var c,d;if(a)switch(c=a.type){case"keydown":case"keyup":case"keypress":return this._getCaretPosition(b);case"click":case"mousedown":case"mouseup":return d={top:a.pageY,left:a.pageX}}},_getCaretPosition:function(b){var c,d,e;return e=a("<span/>"),c=rangy.createRange(),c.setStart(b.endContainer,b.endOffset),c.insertNode(e.get(0)),d={top:e.offset().top,left:e.offset().left},e.remove(),d},setPosition:function(){return"body"!==this.options.parentElement&&(this.options.parentElement="body",a(this.options.parentElement).append(this.toolbar)),this.toolbar.css("position","absolute"),this.toolbar.css("top",this.element.offset().top-20),this.toolbar.css("left",this.element.offset().left)},_updatePosition:function(b,c){var d,e,f,g,h;return null==c&&(c=null),b&&b.top&&b.left?(f=this.toolbar.outerHeight()+10,c&&!c.collapsed&&c.nativeRange?(e=c.nativeRange.getBoundingClientRect(),h=this.options.positionAbove?e.top-f:e.bottom+10,g=a(window).scrollTop()+h,d=a(window).scrollLeft()+e.left):(h=this.options.positionAbove?-10-f:20,g=b.top+h,d=b.left-this.toolbar.outerWidth()/2+30),this.toolbar.css("top",g),this.toolbar.css("left",d)):void 0},_bindEvents:function(){var a=this;return this.element.on("halloselected",function(b,c){var d;return(d=a._getPosition(c.originalEvent,c.selection))?(a._updatePosition(d,c.selection),""!==a.toolbar.html()?a.toolbar.show():void 0):void 0}),this.element.on("hallounselected",function(){return a.toolbar.hide()}),this.element.on("hallodeactivated",function(){return a.toolbar.hide()})}})}(jQuery),function(a){return a.widget("IKS.hallo",{toolbar:null,bound:!1,originalContent:"",previousContent:"",uuid:"",selection:null,_keepActivated:!1,originalHref:null,options:{editable:!0,plugins:{},toolbar:"halloToolbarContextual",parentElement:"body",buttonCssClass:null,toolbarCssClass:null,toolbarPositionAbove:!1,toolbarOptions:{},placeholder:"",forceStructured:!0,checkTouch:!0,touchScreen:null},_create:function(){var b,c,d,e=this;this.id=this._generateUUID(),this.options.checkTouch&&null===this.options.touchScreen&&this.checkTouch(),d=this.options.plugins;for(c in d)b=d[c],a.isPlainObject(b)||(b={}),a.extend(b,{editable:this,uuid:this.id,buttonCssClass:this.options.buttonCssClass}),a(this.element)[c](b);return this.element.one("halloactivated",function(){return e._prepareToolbar()}),this.originalContent=this.getContents()},_init:function(){return this.options.editable?this.enable():this.disable()},destroy:function(){var b,c,d;this.disable(),this.toolbar&&(this.toolbar.remove(),this.element[this.options.toolbar]("destroy")),d=this.options.plugins;for(c in d)b=d[c],a(this.element)[c]("destroy");return a.Widget.prototype.destroy.call(this)},disable:function(){var b=this;return this.element.attr("contentEditable",!1),this.element.off("focus",this._activated),this.element.off("blur",this._deactivated),this.element.off("keyup paste change",this._checkModified),this.element.off("keyup",this._keys),this.element.off("keyup mouseup",this._checkSelection),this.bound=!1,a(this.element).removeClass("isModified"),a(this.element).removeClass("inEditMode"),this.element.parents("a").andSelf().each(function(c,d){var e;return e=a(d),e.is("a")&&b.originalHref?e.attr("href",b.originalHref):void 0}),this._trigger("disabled",null)},enable:function(){var b=this;return this.element.parents("a[href]").andSelf().each(function(c,d){var e;return e=a(d),e.is("a[href]")?(b.originalHref=e.attr("href"),e.removeAttr("href")):void 0}),this.element.attr("contentEditable",!0),this.element.html().trim()||(this.element.html(this.options.placeholder),this.element.css({"min-width":this.element.innerWidth(),"min-height":this.element.innerHeight()})),this.bound||(this.element.on("focus",this,this._activated),this.element.on("blur",this,this._deactivated),this.element.on("keyup paste change",this,this._checkModified),this.element.on("keyup",this,this._keys),this.element.on("keyup mouseup",this,this._checkSelection),this.bound=!0),this.options.forceStructured&&this._forceStructured(),this._trigger("enabled",null)},activate:function(){return this.element.focus()},containsSelection:function(){var a;return a=this.getSelection(),this.element.has(a.startContainer).length>0},getSelection:function(){var a,b;return b=rangy.getSelection(),a=null,a=b.rangeCount>0?b.getRangeAt(0):rangy.createRange()},restoreSelection:function(a){var b;return b=rangy.getSelection(),b.setSingleRange(a)},replaceSelection:function(a){var b,c,d,e,f;return"Microsoft Internet Explorer"===navigator.appName?(f=document.selection.createRange().text,c=document.selection.createRange(),c.pasteHTML(a(f))):(e=window.getSelection(),d=e.getRangeAt(0),b=document.createTextNode(a(d.extractContents())),d.insertNode(b),d.setStartAfter(b),e.removeAllRanges(),e.addRange(d))},removeAllSelections:function(){return"Microsoft Internet Explorer"===navigator.appName?range.empty():window.getSelection().removeAllRanges()},getContents:function(){var b,c,d;c=this.element.clone();for(d in this.options.plugins)b=a(this.element).data("IKS-"+d).cleanupContentClone,a.isFunction(b)&&a(this.element)[d]("cleanupContentClone",c);return c.html()},setContents:function(a){return this.element.html(a)},isModified:function(){return this.previousContent||(this.previousContent=this.originalContent),this.previousContent!==this.getContents()},setUnmodified:function(){return a(this.element).removeClass("isModified"),this.previousContent=this.getContents()},setModified:function(){return a(this.element).addClass("isModified"),this._trigger("modified",null,{editable:this,content:this.getContents()})},restoreOriginalContent:function(){return this.element.html(this.originalContent)},execute:function(a,b){return document.execCommand(a,!1,b)?this.element.trigger("change"):void 0},protectFocusFrom:function(a){var b=this;return a.on("mousedown",function(a){return a.preventDefault(),b._protectToolbarFocus=!0,setTimeout(function(){return b._protectToolbarFocus=!1},300)})},keepActivated:function(a){this._keepActivated=a},_generateUUID:function(){var a;return a=function(){return(0|65536*(1+Math.random())).toString(16).substring(1)},""+a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()},_prepareToolbar:function(){var b,c,d,e;this.toolbar=a('<div class="hallotoolbar"></div>').hide(),this.options.toolbarCssClass&&this.toolbar.addClass(this.options.toolbarCssClass),b={editable:this,parentElement:this.options.parentElement,toolbar:this.toolbar,positionAbove:this.options.toolbarPositionAbove},e=$.extend({},b,this.options.toolbarOptions),this.element[this.options.toolbar](e);for(c in this.options.plugins)d=a(this.element).data("IKS-"+c).populateToolbar,a.isFunction(d)&&this.element[c]("populateToolbar",this.toolbar);return this.element[this.options.toolbar]("setPosition"),this.protectFocusFrom(this.toolbar)},changeToolbar:function(a,b,c){var d;return null==c&&(c=!1),d=this.options.toolbar,this.options.parentElement=a,b&&(this.options.toolbar=b),this.toolbar?(this.element[d]("destroy"),this.toolbar.remove(),this._prepareToolbar(),c?this.toolbar.hide():void 0):void 0},_checkModified:function(a){var b;return b=a.data,b.isModified()?b.setModified():void 0},_keys:function(a){var b,c;return c=a.data,27===a.keyCode?(b=c.getContents(),c.restoreOriginalContent(a),c._trigger("restored",null,{editable:c,content:c.getContents(),thrown:b}),c.turnOff()):void 0},_rangesEqual:function(a,b){return a.startContainer!==b.startContainer?!1:a.startOffset!==b.startOffset?!1:a.endContainer!==b.endContainer?!1:a.endOffset!==b.endOffset?!1:!0},_checkSelection:function(a){var b;if(27!==a.keyCode)return b=a.data,setTimeout(function(){var c;return c=b.getSelection(),b._isEmptySelection(c)||b._isEmptyRange(c)?(b.selection&&(b.selection=null,b._trigger("unselected",null,{editable:b,originalEvent:a})),void 0):b.selection&&b._rangesEqual(c,b.selection)?void 0:(b.selection=c.cloneRange(),b._trigger("selected",null,{editable:b,selection:b.selection,ranges:[b.selection],originalEvent:a}))},0)},_isEmptySelection:function(a){return"Caret"===a.type?!0:!1},_isEmptyRange:function(a){return a.collapsed?!0:a.isCollapsed?"function"==typeof a.isCollapsed?a.isCollapsed():a.isCollapsed:!1},turnOn:function(){return this.getContents()===this.options.placeholder&&this.setContents(""),a(this.element).addClass("inEditMode"),this._trigger("activated",null,this)},turnOff:function(){return a(this.element).removeClass("inEditMode"),this._trigger("deactivated",null,this),this.getContents()?void 0:this.setContents(this.options.placeholder)},_activated:function(a){return a.data.turnOn()},_deactivated:function(b){return b.data._keepActivated?void 0:b.data._protectToolbarFocus!==!0?b.data.turnOff():setTimeout(function(){return a(b.data.element).focus()},300)},_forceStructured:function(){try{return document.execCommand("styleWithCSS",0,!1)}catch(b){try{return document.execCommand("useCSS",0,!0)}catch(b){try{return document.execCommand("styleWithCSS",!1,!1)}catch(b){}}}},checkTouch:function(){return this.options.touchScreen=!!("createTouch"in document)}})}(jQuery)}).call(this);