var ivo_ckeditor_link_structure = false; // Alerts (function($){$.alerts={verticalOffset:-75,horizontalOffset:0,repositionOnResize:true,overlayOpacity:.01,overlayColor:'#FFF',draggable:false,okButton:' OK ',cancelButton:' Cancel ',dialogClass:null,alert:function(message,title,callback){if(title==null)title='Alert';$.alerts._show(title,message,null,'alert',function(result){if(callback)callback(result);});},confirm:function(message,title,callback){if(title==null)title='Confirm';$.alerts._show(title,message,null,'confirm',function(result){if(callback)callback(result);});},prompt:function(message,value,title,callback){if(title==null)title='Prompt';$.alerts._show(title,message,value,'prompt',function(result){if(callback)callback(result);});},_show:function(title,msg,value,type,callback){$.alerts._hide();$.alerts._overlay('show');$("BODY").append('');if($.alerts.dialogClass)$("#popup_container").addClass($.alerts.dialogClass);var pos=($.browser.msie&&parseInt($.browser.version)<=6)?'absolute':'fixed';$("#popup_container").css({position:pos,zIndex:99999,padding:0,margin:0});$("#popup_title").text(title);$("#popup_content").addClass(type);$("#popup_message").text(msg);$("#popup_message").html($("#popup_message").text().replace(/\n/g,'
'));$("#popup_container").css({minWidth:$("#popup_container").outerWidth(),maxWidth:$("#popup_container").outerWidth()});$.alerts._reposition();$.alerts._maintainPosition(true);switch(type){case'alert':$("#popup_message").after('');$("#popup_ok").click(function(){$.alerts._hide();callback(true);});$("#popup_ok").focus().keypress(function(e){if(e.keyCode==13||e.keyCode==27)$("#popup_ok").trigger('click');});break;case'confirm':$("#popup_message").after('');$("#popup_ok").click(function(){$.alerts._hide();if(callback)callback(true);});$("#popup_cancel").click(function(){$.alerts._hide();if(callback)callback(false);});$("#popup_ok").focus();$("#popup_ok, #popup_cancel").keypress(function(e){if(e.keyCode==13)$("#popup_ok").trigger('click');if(e.keyCode==27)$("#popup_cancel").trigger('click');});break;case'prompt':$("#popup_message").append('
').after('');$("#popup_prompt").width($("#popup_message").width());$("#popup_ok").click(function(){var val=$("#popup_prompt").val();$.alerts._hide();if(callback)callback(val);});$("#popup_cancel").click(function(){$.alerts._hide();if(callback)callback(null);});$("#popup_prompt, #popup_ok, #popup_cancel").keypress(function(e){if(e.keyCode==13)$("#popup_ok").trigger('click');if(e.keyCode==27)$("#popup_cancel").trigger('click');});if(value)$("#popup_prompt").val(value);$("#popup_prompt").focus().select();break;} if($.alerts.draggable){try{$("#popup_container").draggable({handle:$("#popup_title")});$("#popup_title").css({cursor:'move'});}catch(e){}}},_hide:function(){$("#popup_container").remove();$.alerts._overlay('hide');$.alerts._maintainPosition(false);},_overlay:function(status){switch(status){case'show':$.alerts._overlay('hide');$("BODY").append('');$("#popup_overlay").css({position:'absolute',zIndex:99998,top:'0px',left:'0px',width:'100%',height:$(document).height(),background:$.alerts.overlayColor,opacity:$.alerts.overlayOpacity});break;case'hide':$("#popup_overlay").remove();break;}},_reposition:function(){var top=(($(window).height()/2)-($("#popup_container").outerHeight()/2))+$.alerts.verticalOffset;var left=(($(window).width()/2)-($("#popup_container").outerWidth()/2))+$.alerts.horizontalOffset;if(top<0)top=0;if(left<0)left=0;if($.browser.msie&&parseInt($.browser.version)<=6)top=top+$(window).scrollTop();$("#popup_container").css({top:top+'px',left:left+'px'});$("#popup_overlay").height($(document).height());},_maintainPosition:function(status){if($.alerts.repositionOnResize){switch(status){case true:$(window).bind('resize',$.alerts._reposition);break;case false:$(window).unbind('resize',$.alerts._reposition);break;}}}} jAlert=function(message,title,callback){$.alerts.alert(message,title,callback);} jConfirm=function(message,title,callback){$.alerts.confirm(message,title,callback);};jPrompt=function(message,value,title,callback){$.alerts.prompt(message,value,title,callback);};})(jQuery); // XLazyLoader /* * xLazyLoader 1.5 - Plugin for jQuery * * Load js, css and images asynchron and get different callbacks * * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * * Depends: * jquery.js * * Copyright (c) 2010 Oleg Slobodskoi (jsui.de) */ !function(e){function t(){function t(e,t){d[e](t,function(e){"error"==e?h.push(t):u.push(t)&&a.each(t),i()},"lazy-loaded-"+(a.name?a.name:(new Date).getTime()),a[e+"Key"]?"?key="+a[e+"Key"]:"")}function o(e){a.complete(e,u,h),a[e]("error"==e?h:u),clearTimeout(s),clearTimeout(c)}function i(){u.length==f.length?o("success"):u.length+h.length==f.length&&o("error")}function r(){h.push(this.src),i()}var a,s,c,l,d=this,u=[],h=[],f=[];this.init=function(n){if(n){if(a=e.extend({},e.xLazyLoader.defaults,n),l={js:a.js,css:a.css,img:a.img},e.each(l,function(e,t){"string"==typeof t&&(t=t.split(",")),f=f.concat(t)}),!f.length)return void o("error");a.timeout&&(s=setTimeout(function(){var t=u.concat(h);e.each(f,function(n,o){-1==e.inArray(o,t)&&h.push(o)}),o("error")},a.timeout)),e.each(l,function(n,o){e.isArray(o)?e.each(o,function(e,o){t(n,o)}):"string"==typeof o&&t(n,o)})}},this.js=function(t,o,i,a){var s=e('script[src*="'+t+'"]');if(s.length)return void(s.attr("pending")?s.bind("scriptload",o):o());var c=document.createElement("script");c.setAttribute("type","text/javascript"),c.setAttribute("charset","UTF-8"),c.setAttribute("src",t+a),c.setAttribute("id",i),c.setAttribute("pending",1),c.onerror=r,e(c).bind("scriptload",function(){e(this).removeAttr("pending"),o(),setTimeout(function(){e(c).unbind("scriptload")},10)});var l=!1;c.onload=c.onreadystatechange=function(){l||this.readyState&&!/loaded|complete/.test(this.readyState)||(l=!0,c.onload=c.onreadystatechange=null,e(c).trigger("scriptload"))},n.appendChild(c)},this.css=function(t,o,i,r){if(e('link[href*="'+t+'"]').length)return void o();var a=e('')[0];if(e.browser.msie)e.browser.version<11?a.onreadystatechange=function(){("loaded"==a.readyState||"complete"==a.readyState)&&(a.onreadystatechange=null,o())}:a.onload=o;else if(e.browser.opera)a.onload=o;else{var s=location.hostname.replace("www.",""),l=/http:/.test(t)?/^(\w+:)?\/\/([^\/?#]+)/.exec(t)[2]:s;s!=l&&e.browser.mozilla?o():function(){try{a.sheet.cssRules}catch(e){return void(c=setTimeout(arguments.callee,20))}o()}()}n.appendChild(a)},this.img=function(e,t,n,o){var i=new Image;i.onload=t,i.onerror=r,i.src=e+o},this.disable=function(t){e("#lazy-loaded-"+t,n).attr("disabled","disabled")},this.enable=function(t){e("#lazy-loaded-"+t,n).removeAttr("disabled")},this.destroy=function(t){e("#lazy-loaded-"+t,n).remove()}}e.xLazyLoader=function(e,n){"object"==typeof e&&(n=e,e="init"),(new t)[e](n)},e.xLazyLoader.defaults={js:[],css:[],img:[],jsKey:null,cssKey:null,imgKey:null,name:null,timeout:2e4,success:e.noop,error:e.noop,complete:e.noop,each:e.noop};var n=document.getElementsByTagName("head")[0]}(jQuery); $.xLazyLoader({js:['/global/js/jquery/chosen.jquery.min.js'],css:['/global/css/jquery/chosen.css']}); // Tipsy // tipsy, facebook style tooltips for jquery // version 1.0.0a // (c) 2008-2010 jason frame [jason@onehackoranother.com] // released under the MIT license !function(t){function i(t,i){return"function"==typeof t?t.call(i):t}function e(t){for(;t=t.parentNode;)if(t==document)return!0;return!1}function s(i,e){this.$element=t(i),this.options=e,this.enabled=!0,this.fixTitle()}s.prototype={show:function(){var e=this.getTitle();if(e&&this.enabled){var s=this.tip();s.find(".tipsy-inner")[this.options.html?"html":"text"](e),s[0].className="tipsy",s.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var n,o=t.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),l=s[0].offsetWidth,a=s[0].offsetHeight,f=i(this.options.gravity,this.$element[0]);switch(f.charAt(0)){case"n":n={top:o.top+o.height+this.options.offset,left:o.left+o.width/2-l/2};break;case"s":n={top:o.top-a-this.options.offset,left:o.left+o.width/2-l/2};break;case"e":n={top:o.top+o.height/2-a/2,left:o.left-l-this.options.offset};break;case"w":n={top:o.top+o.height/2-a/2,left:o.left+o.width+this.options.offset}}2==f.length&&(n.left="w"==f.charAt(1)?o.left+o.width/2-15:o.left+o.width/2-l+15),s.css(n).addClass("tipsy-"+f),s.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+f.charAt(0),this.options.className&&s.addClass(i(this.options.className,this.$element[0])),this.options.fade?s.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):s.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){t(this).remove()}):this.tip().remove()},fixTitle:function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("original-title"))&&t.attr("original-title",t.attr("title")||"").removeAttr("title")},getTitle:function(){var t,i=this.$element,e=this.options;this.fixTitle();var t,e=this.options;return"string"==typeof e.title?t=i.attr("title"==e.title?"original-title":e.title):"function"==typeof e.title&&(t=e.title.call(i[0])),t=(""+t).replace(/(^\s*|\s*$)/,""),t||e.fallback},tip:function(){return this.$tip||(this.$tip=t('
').html('
'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},t.fn.tipsy=function(i){function e(e){var n=t.data(e,"tipsy");return n||(n=new s(e,t.fn.tipsy.elementOptions(e,i)),t.data(e,"tipsy",n)),n}function n(){var t=e(this);t.hoverState="in",0==i.delayIn?t.show():(t.fixTitle(),setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn))}function o(){var t=e(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)}if(i===!0)return this.data("tipsy");if("string"==typeof i){var l=this.data("tipsy");return l&&l[i](),this}if(i=t.extend({},t.fn.tipsy.defaults,i),i.live||this.each(function(){e(this)}),"manual"!=i.trigger){var a=i.live?"live":"bind",f="hover"==i.trigger?"mouseenter":"focus",h="hover"==i.trigger?"mouseleave":"blur";this[a](f,n)[a](h,o)}return this},t.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},t.fn.tipsy.revalidate=function(){t(".tipsy").each(function(){var i=t.data(this,"tipsy-pointee");i&&e(i)||t(this).remove()})},t.fn.tipsy.elementOptions=function(i,e){return t.metadata?t.extend({},e,t(i).metadata()):e},t.fn.tipsy.autoNS=function(){return t(this).offset().top>t(document).scrollTop()+t(window).height()/2?"s":"n"},t.fn.tipsy.autoWE=function(){return t(this).offset().left>t(document).scrollLeft()+t(window).width()/2?"e":"w"},t.fn.tipsy.autoBounds=function(i,e){return function(){var s={ns:e[0],ew:e.length>1?e[1]:!1},n=t(document).scrollTop()+i,o=t(document).scrollLeft()+i,l=t(this);return l.offset().top
Vennligst vent...
'); if($('#ivo-blockui').length == 0) { $('body').append(blockui_container); } if($(e.currentTarget.activeElement).hasClass('blockui')) { $('#ivo-blockui').addClass('active'); } else { pixy_settings.pixy_timer = setTimeout(function() { $('#ivo-blockui').addClass('active'); }, 200); } }); $(document).ajaxStop(function(){ clearTimeout(pixy_settings.pixy_timer); $('#ivo-blockui').removeClass('active'); }); $(document).ajaxError(function(e, xhr, settings, exception){ if(xhr.status == 200) { $.fn.pixy({exec: 'alert', type: 'error', msg: 'En ukjent feil oppstod'}); } else if (xhr.status != 0) { $.fn.pixy({exec: 'alert', type: 'error', msg: xhr.statusText+' ('+xhr.status+')'}); } }); $.ajaxSetup({ timeout: 30000 }); function updateOptionalLocations() { if ($('.pixy-element-insert-container').length > 0) { $('.hidden-if-empty').each(function() { if ($(this).find('.pixy-element-insert-container').length > 0) { $(this).show(); } else if ($(this).find('.location .element_contents').filter(function(){return $(this).html().length != 0;}).length > 0) { $(this).show(); } else { $(this).hide(); } }); } else { $('.hidden-if-empty').each(function() { if ($('#pixymainpanel').length == 0) { if ($(this).find('.location').filter(function(){return $(this).html().length != 0;}).length > 0) { $(this).show(); } else { $(this).hide(); } } else if ($(this).find('.location .element_contents').filter(function(){return $(this).html().length != 0;}).length > 0) { $(this).show(); } else { $(this).hide(); } }); } } $(document).ready(function(){ $.fn.pixy = function(options) { var defaults = { padding: 20, mouseOverColor : '#000000', mouseOutColor : '#ffffff', pixy_controller_url : '/pixy/', } var options = $.extend(defaults, options); switch(options.init) { case 'toolbar_links': $("#pixypanel #pixymainpanel li a.ivo_modal").each(function(index) { $(this).bind('click', function() { $("#pixypanel div.subpanel").hide(); $("#pixypanel li a").removeClass('active'); $.fn.pixy({exec: 'pixy_modal', url: $(this).attr('href')}); return false; }); }); $("#pixypanel #pixymainpanel a.external").each(function(index) { $(this).bind('click', function() { window.open($(this).attr('href'), '_blank'); window.focus(); return false; }); }); $("#pixypanel #logout, #pixylanguages ul a").bind('click', function() { $.fn.pixy({exec: 'pixy_load', url: $(this).attr('href'), callback: function(data) { $.fn.pixy({exec: 'parse_return', object: data}); }}); return false; }); $("#pixypanel a.file_browser_images").bind('click', function() { $.fn.pixy({exec: 'browse_images'}); return false; }); $("#pixypanel a.file_browser_files").bind('click', function() { $.fn.pixy({exec: 'browse_files'}); return false; }); if(pixy_settings.page_is_deletable == 'false') { $('#delete_page').hide(); } else { $('#delete_page').bind('click', function() { $.fn.pixy({exec: 'pixy_delete_page'}); return false; }); } $('a.pixy_modal').live('click', function(){ $.fn.pixy({exec: 'pixy_modal', url: $(this).attr('href')}); return false; }); $('a.pixy_confirm').live('click', function(){ $.fn.pixy({exec: 'confirm', url: $(this).attr('href')}); return false; }); break; case 'element_containers': if(pixy_settings.pageID) { $(".pixy-element:not(.pixy-dummy-element)").each(function(index) { $(this).css('z-index', '900'); $(this).bind('mouseenter', function() { $(this).pixy({exec: 'pixy_element'}); }); }); } break; case 'element_blog_container': if(pixy_settings.blog_enabled != undefined && pixy_settings.blog_enabled == true) { var container = $('
'); container.appendTo('body'); $('a.pixy_blog_actions_edit').bind('click', function() { var id = pixy_settings.blog_active_post.replace(/blog_post_/, ''); var container = $('#'+pixy_settings.blog_active_post).closest('.pixy-element').attr('id'); $.fn.pixy({exec: 'pixy_modal', url: '/pixy/blog/edit.json?id='+id+'&goto=close_modal_refresh&container='+container}); return false; }); $('a.pixy_blog_actions_delete').bind('click', function() { var id = pixy_settings.blog_active_post.replace(/blog_post_/, ''); $.fn.pixy({exec: 'confirm', url: options.pixy_controller_url+'blog/delete.json?id='+id+'&hide_post=true'}); return false; }); $(".pixy-element-blog-post").live('mouseenter', function() { $(this).pixy({exec: 'pixy_blog_element'}); }); } break; case 'disable_autocomplete': $('#pixy-search').attr('autocomplete','off'); break; case 'all': var init=['toolbar_links', 'element_containers', 'element_blog_container', 'disable_autocomplete']; $.each(init, function(intIndex, objValue) { $.fn.pixy({init: objValue}); }); break; default: break; } switch(options.exec) { case 'pixy_blog_element': return this.each(function() { var element = $(this); var offset = element.offset(); var width = element.width(); if(offset.left < 60) { offset.left = offset.left+width; } pixy_settings.blog_active_post = element.attr('id'); var container = $('#pixy-element-blog-post-actions'); container.css({'display': 'block', 'top': offset.top, 'left': (offset.left-58)}); }); break; case 'pixy_element': $('.element_container_toolbox').remove(); var pixy_type = []; pixy_type['copyright'] = 'Kopirett'; pixy_type['heading'] = 'Overskrift'; pixy_type['subheading'] = 'Underoverskift'; pixy_type['primary-navigation'] = 'Primær Navigasjon'; pixy_type['page-name'] = 'Sidenavn'; pixy_type['logo'] = 'Logo'; return this.each(function() { var element = $(this); if(element.hasClass('ivo_toolbox_disable')) return; var offset = element.offset(); var element_width = element.width(); element_width += parseInt(element.css("padding-left"), 10) + parseInt(element.css("padding-right"), 10); //Total Padding Width /*element_width += parseInt(element.css("margin-left"), 10) + parseInt(element.css("margin-right"), 10); //Total Margin Width*/ element_width += parseInt(element.css("borderLeftWidth"), 10) + parseInt(element.css("borderRightWidth"), 10); //Total Border Width var element_height = element.height(); element_height += parseInt(element.css("padding-top"), 10) + parseInt(element.css("padding-bottom"), 10); //Total Padding Width /*element_width += parseInt(element.css("margin-left"), 10) + parseInt(element.css("margin-right"), 10); //Total Margin Width*/ element_height += parseInt(element.css("borderTopWidth"), 10) + parseInt(element.css("borderBottomWidth"), 10); //Total Border Width var element_top = offset.top; var element_left = offset.left; var toolbox_border_width = 2; var toolbox_height = 30; var toolbox_width = (element_width+(toolbox_border_width*2)); var toolbox_top = (element_top-toolbox_height); var toolbox_left = (element_left-toolbox_border_width); var toolbox_border_bottom_top = (element_top+element_height); var toolbox_border_left_left = (element_left-toolbox_border_width); var toolbox_border_right_left = (element_left+element_width); if(toolbox_top < 0) { toolbox_top = toolbox_border_bottom_top; toolbox_border_bottom_top = element_top; } var container_toolbox_border_left = $('
'); $('body').append(container_toolbox_border_left); container_toolbox_border_left.css({'top' : element_top+'px', 'left': toolbox_border_left_left+'px', 'width': toolbox_border_width+'px', 'height': element_height+'px'}); var container_toolbox_border_right = $('
'); $('body').append(container_toolbox_border_right); container_toolbox_border_right.css({'top' : element_top+'px', 'left': toolbox_border_right_left+'px', 'width': toolbox_border_width+'px', 'height': element_height+'px'}); var container_toolbox_border_bottom = $('
'); $('body').append(container_toolbox_border_bottom); container_toolbox_border_bottom.css({'top' : toolbox_border_bottom_top+'px', 'left': toolbox_border_left_left+'px', 'width': toolbox_width+'px', 'height': toolbox_border_width+'px'}); var container_toolbox = $('
'); $('body').append(container_toolbox); container_toolbox.css({'top' : toolbox_top+'px', 'left': toolbox_left+'px', 'width': toolbox_width+'px', 'height': toolbox_height+'px'}); var toolbar_menu = []; toolbar_menu.push(''); container_toolbox.html(toolbar_menu.join('')); container_toolbox.find('.toolbox_edit').bind('click', function() { $.fn.pixy({exec: 'pixy_edit_element', id: element.attr('id')}); return false; }); container_toolbox.find('.logo_edit').bind('click', function() { $.fn.pixy({exec: 'pixy_edit_logo'}); return false; }); container_toolbox.find('.toolbox_new_page').bind('click', function() { /*$.fn.pixy({exec: 'pixy_new_page', id: element.attr('id')});*/ $.fn.pixy({exec: 'pixy_modal', url: $(this).attr('href')}); return false; }); container_toolbox.find('.toolbox_move').bind('click', function() { $.fn.pixy({exec: 'pixy_move_element', id: element.attr('id')}); return false; }); container_toolbox.find('.toolbox_delete').bind('click', function() { $.fn.pixy({exec: 'pixy_delete_element', id: element.attr('id')}); return false; }); container_toolbox.bind('mouseleave', function() { $('.element_container_toolbox').remove(); }); $('li.toolbox_type').width(element_width-icon_width-10); $("#element_container_toolbox_menu li a").tipsy({gravity: 's', offset: 5, html: true}); $('.element_container_toolbox').show(); }); break; case 'pixy_disable_toolbox': $('.element_container_toolbox').hide(); $(".pixy-element").each(function(index) { $(this).unbind('mouseenter'); }); break; case 'pixy_move_element': if(options.id != undefined) { $('#'+options.id).attr('id', options.id+'-temp').hide(); $.fn.pixy({exec: 'pixy_insert_element', id: options.id, temp_selector: '#'+options.id+'-temp', move: true}); } break; case 'pixy_refresh_element': var location = $("#"+options.id); var location_id = location.parent('.location').attr('id'); var move_params = { element_id: options.id, location_id: location_id, pageID: pixy_settings.pageID, themeID: pixy_settings.themeID, element_width: location.parent('.location').find('.pixy-dummy-element .element_contents').width(), element_height: location.height() }; $.fn.pixy({exec: 'pixy_load', url: options.pixy_controller_url+'element/refresh.json', params: move_params, callback: function(data){ if(data.status == true && data.contents != undefined) { location.replaceWith(data.contents); $.fn.pixy({init: 'element_containers'}); } else if(data.status == true && data.force_refresh == true) { $.fn.pixy({exec: 'reload_page'}); } }}); break; case 'pixy_build_insert_block': var insert_element = '
'; return insert_element; break; case 'pixy_insert_element': if(options.id != undefined) { $.fn.pixy({exec: 'pixy_disable_toolbox'}); if(options.move == undefined) options.move == false; $(document).bind('keyup', function(e) { if (e.keyCode == 27) { $('.pixy-element-insert-container').remove(); if(options.move == true) $(options.temp_selector).attr('id', options.id).show(); $.fn.pixy({init: 'element_containers'}); $(document).unbind('keyup'); $('div.tipsy').remove(); updateOptionalLocations(); }}); var insert_element_local = '
'; var insert_element_parent = '
'; var insert_element_only_parent = '
'; var insert_element_global = '
'; var insert_element_only_global = '
'; $('.location').each(function(index) { var location = $(this); var dummy = location.find('.pixy-dummy-element'); var elements = location.find('.pixy-element:visible:not(.pixy-dummy-element)'); var num = elements.size(); var last_element = false; if(num > 0) { elements.each(function(index) { if(index > 0) { if(last_element.hasClass('pixy-element-identity-local')) { if($(this).hasClass('pixy-element-identity-parent')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'parent': true, 'local': true})).insertAfter(last_element); } else if($(this).hasClass('pixy-element-identity-global')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true, 'parent': true, 'local': true})).insertAfter(last_element); } else if($(this).hasClass('pixy-element-identity-local')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'local': true})).insertAfter(last_element); } } else if(last_element.hasClass('pixy-element-identity-global')) { if($(this).hasClass('pixy-element-identity-parent')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true, 'parent': true})).insertAfter(last_element); } else if($(this).hasClass('pixy-element-identity-local')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true, 'parent': true, 'local': true})).insertAfter(last_element); } else if($(this).hasClass('pixy-element-identity-global')) { if($(this).hasClass('pixy-element-position-bottom') && last_element.hasClass('pixy-element-position-top')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true, 'parent': true, 'local': true})).insertAfter(last_element); $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true, 'parent': true, 'local': true})).insertAfter(last_element); } else if($(this).hasClass('pixy-element-position-bottom') && last_element.hasClass('pixy-element-position-bottom')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true})).insertAfter(last_element); } else { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true})).insertAfter(last_element); } } } else if(last_element.hasClass('pixy-element-identity-parent')) { if($(this).hasClass('pixy-element-identity-local')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'parent': true, 'local': true})).insertAfter(last_element); } else if($(this).hasClass('pixy-element-identity-parent')) { if($(this).hasClass('pixy-element-position-bottom') && last_element.hasClass('pixy-element-position-top')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'parent': true, 'local': true})).insertAfter(last_element); } else { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'parent': true})).insertAfter(last_element); } } else if($(this).hasClass('pixy-element-identity-global')) { if($(this).hasClass('pixy-element-position-bottom') && last_element.hasClass('pixy-element-position-top')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true, 'parent': true, 'local': true})).insertAfter(last_element); $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'parent': true, 'local': true})).insertAfter(last_element); } else { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true, 'parent': true, 'local': true})).insertAfter(last_element); } } } } else { if($(this).hasClass('pixy-element-identity-global')) { if($(this).hasClass('pixy-element-position-bottom')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true, 'parent': true, 'local': true})).insertAfter(dummy); $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true, 'parent': true, 'local': true})).insertAfter(dummy); } else { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true})).insertAfter(dummy); } } else if($(this).hasClass('pixy-element-identity-parent')) { if($(this).hasClass('pixy-element-position-bottom')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'parent': true, 'local': true})).insertAfter(dummy); $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true, 'parent': true, 'local': true})).insertAfter(dummy); } else { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true, 'parent': true})).insertAfter(dummy); } } else if($(this).hasClass('pixy-element-identity-local')) { if($(this).hasClass('pixy-element-position-bottom')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'local': true})).insertAfter(dummy); $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true, 'parent': true, 'local': true})).insertAfter(dummy); } else { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true, 'parent': true, 'local': true})).insertAfter(dummy); } } } last_element = $(this); }); if(last_element.hasClass('pixy-element-position-top')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true, 'parent': true, 'local': true})).insertAfter(last_element); } else { if(last_element.hasClass('pixy-element-identity-global')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true})).insertAfter(last_element); } else if(last_element.hasClass('pixy-element-identity-parent')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true, 'parent': true})).insertAfter(last_element); } else if(last_element.hasClass('pixy-element-identity-local')) { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'bottom', 'global': true, 'parent': true, 'local': true})).insertAfter(last_element); } } } else { $($.fn.pixy({exec: 'pixy_build_insert_block', 'position': 'top', 'global': true, 'parent': true, 'local': true})).insertAfter(dummy); } }); $('.pixy-element-insert-container').each(function(index){ if($(this).width() < 200) { $(this).find('.insert_local').html('Sett inn'); } }); $(".pixy-element-insert-container ul li a").tipsy({gravity: 's', offset: 5, html: true}); updateOptionalLocations(); $('.pixy-element-insert-container a').bind('click', function() { //$('#'+options.id).remove(); $('div.tipsy').remove(); var new_location = $(this).parent().parent().parent(); var new_location_id = new_location.parent('.location').attr('id'); var insert_type = $(this).attr('class'); var move_params = { element_id: options.id, location_id: new_location_id, pageID: pixy_settings.pageID, element_width: new_location.parent('.location').find('.pixy-dummy-element .element_contents').width(), element_height: new_location.height(), themeID: pixy_settings.themeID }; if($(this).hasClass('bottom')) { move_params.insert_position = 'bottom'; } else { move_params.insert_position = 'top'; } if($(this).hasClass('insert_local')) { move_params.insert_type = 'insert_local'; } else if($(this).hasClass('insert_parent')) { move_params.insert_type = 'insert_parent'; } else if($(this).hasClass('insert_global')) { move_params.insert_type = 'insert_global'; } var next = new_location.next('.pixy-element:visible'); var next_id = next.attr('id'); if(next_id != undefined) { move_params.relate_type='prevto'; move_params.relate_id=next_id; } if(next_id == undefined) { var prev = new_location.prev('.pixy-element:visible'); var prev_id = prev.attr('id'); if(prev_id != undefined) { move_params.relate_type='nextto'; move_params.relate_id=prev_id; } } /* move_params.insert_position='top'; if(next.hasClass('pixy-element-position-bottom')) { move_params.insert_position='bottom'; } else { var prev = new_location.prev('.pixy-element:visible'); if(prev.hasClass('pixy-element-position-bottom')) { move_params.insert_position='bottom'; } else if(prev.hasClass('pixy-element-identity-local')) { move_params.insert_position='bottom'; } }*/ $.fn.pixy({exec: 'pixy_load', url: options.pixy_controller_url+'element/move.json', params: move_params, callback: function(data){ if(data.status == true && data.contents != undefined) { new_location.replaceWith(data.contents); } else if(data.status == true && data.force_refresh == true) { $.fn.pixy({exec: 'reload_page'}); } $('.pixy-element-insert-container').remove(); if(options.move == true) $(options.temp_selector).remove(); $.fn.pixy({init: 'element_containers'}); updateOptionalLocations(); }}); return false; }); } break; case 'pixy_edit_element': if(options.id != undefined) { if(options.id == 'page_name') url = '/pixy/page/settings.json?pageID=vPPPQ'; else url = options.pixy_controller_url+'element/edit.json'; var element = $('#'+options.id); var element_width = element.width(); element_width += parseInt(element.css("padding-left"), 10) + parseInt(element.css("padding-right"), 10); //Total Padding Width element_width += parseInt(element.css("borderLeftWidth"), 10) + parseInt(element.css("borderRightWidth"), 10); //Total Border Width var element_height = element.height(); element_height += parseInt(element.css("padding-top"), 10) + parseInt(element.css("padding-bottom"), 10); //Total Padding Width element_height += parseInt(element.css("borderTopWidth"), 10) + parseInt(element.css("borderBottomWidth"), 10); //Total Border Width $.getJSON(url, { element_id: options.id, pageID: pixy_settings.pageID, element_width: element_width, element_height: element_height }, function(data) { if(data.modal != undefined) { $.fn.pixy({exec: 'simple_modal', object: data.modal}); } $.fn.pixy({exec: 'parse_return', object: data}); }); } break; case 'pixy_edit_logo': var url = options.pixy_controller_url+'website/logo.json'; $.getJSON(url, { pageID: pixy_settings.pageID }, function(data) { if(data.modal != undefined) { $.fn.pixy({exec: 'simple_modal', object: data.modal}); } $.fn.pixy({exec: 'parse_return', object: data}); }); break; case 'pixy_delete_element': if(options.id != undefined) { $.getJSON(options.pixy_controller_url+'element/delete.json', { element_id: options.id, pageID: pixy_settings.pageID, confirm: (options.confirm == undefined ? 'false' : 'true') }, function(data) { $.fn.pixy({exec: 'parse_return', object: data}); }); } break; case 'pixy_delete_page': $.fn.pixy({exec: 'confirm', url: options.pixy_controller_url+'page/delete.json?id='+(options.id == undefined ? pixy_settings.pageID : options.id)}); break; case 'form_submit': return this.each(function() { var form = $(this); if(options.file_upload != undefined) { $(form).ajaxForm({ beforeSubmit: function(a,f,o) { o.dataType = 'json'; //$('#uploadOutput').html('Submitting...'); }, success: function(data) { if(data.modal != undefined) { $.fn.pixy({exec: 'simple_modal', object: data.modal}); } $.fn.pixy({exec: 'parse_return', object: data}); } }); } else { $(form).bind('submit', function(e) { $('
').insertBefore('#ivo-modal-setup .ivo-modal-actions'); $('.tipsy').remove(); var error_wrapper = $(form).find('div.form-errors-wrapper'); var error_list = $(form).find('div.form-errors-wrapper ul'); error_wrapper.hide(); error_list.html(''); $(this).find('div').removeClass('field-error'); $(this).ajaxSubmit({ //target: '#output' type: 'post', dataType: 'json', data: { 'form_save_close': (pixy_settings.form_save_close != undefined && pixy_settings.form_save_close == true ? 'true' : 'false'), 'form_has_save_close': ($(this).find('input.submit-close-button').length ? 'true' : 'false'), }, success: function(data, statusText, xhr, $form){ $('#ivo-modal-setup .ivo-modal-button-disable').remove(); $('.tipsy').show(); $('a.ivo-modal-bind-form-submit').html('Lagret...'); // Quickfix: Unbind live click events from Pixy Image, TODO fix this in the plugin $('a.ivo_gallery_delete').die('click'); $('a.ivo_gallery_link').die('click'); $('a.ivo_gallery_caption').die('click'); $('a.ivo_gallery_primary').die('click'); $('a.ivo_image_delete').die('click'); $('a.ivo_image_link').die('click'); $('a.ivo_image_caption').die('click'); $('a.ivo_image_primary').die('click'); pixy_settings.pixy_form_timer = setTimeout(function() { $('a.ivo-modal-bind-form-submit').html('Lagre'); }, 3000); if(data.form_errors != undefined) { jQuery.each(data.form_errors, function(i, val) { var field_wrapper = $(form).find('#'+i+'-field-wrapper'); field_wrapper.addClass('field-error'); var field_label = field_wrapper.find('label').text().replace('* ', ''); if (field_label.length > 0) { field_label += ': '; } if(typeof(val)=='string') { error_list.append('
  • '+field_label+val+'
  • '); } else { jQuery.each(val, function(i2, val2) { error_list.append('
  • '+field_label+val2+'
  • '); }); } }); error_wrapper.show(); } else { //if ($('textarea.ckeditor').length) {try {var editor = $('textarea.ckeditor').ckeditorGet();} catch(e) {}if (editor != undefined) {editor.destroy();}} $.fn.pixy({exec: 'parse_return', object: data}); if(data.modal != undefined) { $.fn.pixy({exec: 'simple_modal', object: data.modal}); } } pixy_settings.form_save_close = false; } }); return false; }); } }); break; case 'reload_page': window.location.reload(); break; case 'reload_page_force': window.location.reload(true); break; case 'redirect': if (options.url != undefined) { window.location = options.url; } break; case 'pixy_load': if(!options.params) options.params = {}; $.getJSON(options.url, options.params, options.callback); break; case 'name_to_url': if(options.str != undefined) { return options.str.toLowerCase().replace(/ +/g, '-').replace(/ø/g,'o').replace(/å/g,'a').replace(/æ/g,'ae').replace(/[^a-zA-Z\-0-9]+/g,''); } break; case 'pixy_modal': if ($('textarea.ckeditor').length) {try {var editor = $('textarea.ckeditor').ckeditorGet();} catch(e) {}if (editor != undefined) {editor.destroy();}} $('.tipsy').remove(); if(options.url != undefined) { if(!options.params) options.params = {}; if(options.params.pageID == undefined) { options.params.pageID = pixy_settings.pageID; } $.fn.pixy({exec: 'pixy_load', url: options.url, params: options.params, callback: function(data) { if(data.modal != undefined) { $.fn.pixy({exec: 'simple_modal', object: data.modal}); } $.fn.pixy({exec: 'parse_return', object: data}); }}); } else if(options.contents != undefined) { $.fn.pixy({exec: 'simple_modal', object: options.contents.modal}); if(options.contents.modal.js != undefined) { eval(options.contents.modal.js); } } break; case 'simple_modal': pixy_settings.on_close = undefined; pixy_settings.modal_active = true; if(options.object.fullscreen) { $('#ivo-modal-setup').width($(window).width()-20); pixy_settings.modal_fullscreen = true; } else { $('#ivo-modal-setup').width(1000); pixy_settings.modal_fullscreen = false; } //$('#ivo-modal-setup') $('#ivo-modal-setup .ivo-modal-title').html(options.object.title); if(options.object.description) { $('#ivo-modal-setup .ivo-modal-description').html('
    '+options.object.description+'
    '); } else { $('#ivo-modal-setup .ivo-modal-description div').remove(); } if(options.object.contents) { $('#ivo-modal-setup .ivo-modal-contents').html(options.object.contents); } if(options.object.tabs) { $('#ivo-modal-setup .ivo-modal-tabs').html(options.object.tabs); } if(options.object.is_form != undefined) { $('#ivo-modal-setup .ivo-modal-actions').html('LagreLukk'); $('.ivo-modal-bind-form-submit').bind('click', function() { $('form.modal_form').trigger('submit'); return false; }); $('.ivo-modal-bind-form-cancel').bind('click', function() { $.fn.pixy({exec: 'simple_modal_close'}); return false; }); } else { $('#ivo-modal-setup .ivo-modal-actions').html('Lukk'); $('.ivo-modal-bind-close').bind('click', function() { $.fn.pixy({exec: 'simple_modal_close'}); return false; }); } /*if(options.object.sidepanel) { $('#pixy-modal-setup div.small div.column-left').html(options.object.sidepanel); } if(options.object.search) { $('#pixy-modal-setup div.search').show(); var org_contents = options.object.contents; var last_search = ''; $('#pixy-search').live('keyup', function() { if(this.value != '') { if(last_search != this.value) { $.getJSON('/pixy/search/'+options.object.search_tag+'.json', {query: this.value}, function(data) { if(data.contents) { $(data.selector).html(data.contents); } $.fn.pixy({exec: 'parse_return', object: data}); }); last_search = this.value; } } else { $('#pixy-modal-setup div.large div').html(org_contents); } }); } else { $('#pixy-modal-setup div.search').hide(); }*/ $('#ivo-modal-setup').modal({overlayClose:true,autoPosition:false,onClose:function(dialog) {$.fn.pixy({exec: 'simple_modal_close'})}}); $.fn.pixy({exec: 'simple_modal_resize'}); break; case 'simple_modal_resize': var height = $(window).height(); var modal_width = 1000; var modal_height = height-20; var modal_left = 10; var modal_top = 10; var modal_contents_height = modal_height-95; if($('#ivo-modal-setup .ivo-modal-description div').length) { modal_contents_height = modal_contents_height-$('#ivo-modal-setup .ivo-modal-description div').outerHeight()-10; } if($('#ivo-modal-setup .ivo-modal-tabs ul').length) { modal_contents_height = modal_contents_height-$('#ivo-modal-setup .ivo-modal-tabs ul').outerHeight()-33; } $('#ivo-modal-setup').height(modal_height); $('#ivo-modal-setup .ivo-modal-contents').height(modal_contents_height); $('#simplemodal-container').css({'width': modal_width+'px', 'height': modal_height+'px', 'top': modal_top+'px', 'left': modal_left+'px'}); break; case 'simple_modal_close': if ($('textarea.ckeditor').length) { try { var editor = $('textarea.ckeditor').ckeditorGet(); } catch(e) { } //console.log(editor); if (editor != undefined) { editor.destroy(); } } if(pixy_settings.on_close != undefined) { var on_close = pixy_settings.on_close; pixy_settings.on_close = undefined; eval(on_close); } pixy_settings.modal_active = false; $('#pixy-search').die(); $.modal.close(); $('#ivo-modal-setup').unbind(); break; case 'parse_return': if(options.object.status == false) { $.fn.pixy({exec: 'alert', type: 'error', msg: options.object.msg}); } if(options.object.js != undefined) { eval(options.object.js); } if(options.object.on_close != undefined) { pixy_settings.on_close = options.object.on_close; } if(options.object.modal != undefined) { if(options.object.modal.js != undefined) { eval(options.object.modal.js); } } break; case 'alert': /* * type * msg */ if (options.type == undefined) { switch (options.type) { default: case 'error': $.alerts.dialogClass = 'pixyerror'; break; case 'warning': $.alerts.dialogClass = 'pixywarning'; break; case 'info': $.alerts.dialogClass = 'pixyinfo'; break; } } else { $.alerts.dialogClass = 'pixyerror'; } if(options.ok != undefined) $.alerts.okButton = options.ok; else $.alerts.okButton = 'OK'; if(options.cancel != undefined) $.alerts.cancelButton = options.cancel; else $.alerts.cancelButton = 'Avbryt'; if(options.title == undefined) options.title = 'Feil'; if(options.callback == undefined) options.callback = null; $.alerts.alert(options.msg, options.title, options.callback); break; case 'request': break; case 'confirm': if(options.url != undefined) { $.getJSON(options.url, { pageID: pixy_settings.pageID, confirm: (options.confirm == undefined ? 'false' : 'true'), }, function(data) { if(data.confirm != undefined) { if(data.confirm.title == undefined) { var title = 'Bekreft'; } else { var title = data.confirm.title; } jConfirm(data.confirm.message, title, function(r) { if(r==true) { $.getJSON(options.url, { pageID: pixy_settings.pageID, confirm: true, }, function(data) { $.fn.pixy({exec: 'parse_return', object: data}); }); } else { } }); } else { } }); } else { if(options.title == undefined) { var title = 'Bekreft'; } else { var title = options.title; } jConfirm(options.confirm_message, title, function(r) { if(r==true) { if(options.action_confirm.exec != undefined) { opt = {}; opt.exec = options.action_confirm.exec; if(options.action_confirm.url != undefined) opt.url = options.action_confirm.url; if(options.action_confirm.callback != undefined) opt.callback = options.action_confirm.callback; if(options.action_confirm.confirm != undefined) opt.confirm = options.action_confirm.confirm; if(options.action_confirm.id != undefined) opt.id = options.action_confirm.id; $.fn.pixy(opt); } } else { if(options.action_cancel == undefined || options.action_cancel == false) { } else { eval(options.action_cancel); } } }); } break; case 'remove_element': $('#'+options.id).remove(); $('#element_container_toolbox').hide(); break; case 'browse_files': window.KCFinder = { callBack: function (url) { window.KCFinder = null; } }; var kcfinder_width = $(document).width()*0.8; var kcfinder_height = $(document).height()*0.7; var kcfinder_left = (window.screen.width - kcfinder_width) / 2; var kcfinder_top = (window.screen.height - kcfinder_height) / 2; window.open('/global/utils/kcfinder/browse.php?type=files&language=no', 'kcfinder_image', 'status=0, toolbar=0, location=0, menubar=0, ' + 'directories=0, resizable=1, scrollbars=0, width='+kcfinder_width+', height='+kcfinder_height+', left='+kcfinder_left+', top='+kcfinder_top+', screenX='+kcfinder_left+', screenY='+kcfinder_top ); break; case 'browse_images': window.KCFinder = { callBack: function (url) { window.KCFinder = null; } }; var kcfinder_width = $(document).width()*0.8; var kcfinder_height = $(document).height()*0.7; var kcfinder_left = (window.screen.width - kcfinder_width) / 2; var kcfinder_top = (window.screen.height - kcfinder_height) / 2; window.open('/global/utils/kcfinder/browse.php?type=images&language=no', 'kcfinder_image', 'status=0, toolbar=0, location=0, menubar=0, ' + 'directories=0, resizable=1, scrollbars=0, width='+kcfinder_width+', height='+kcfinder_height+', left='+kcfinder_left+', top='+kcfinder_top+', screenX='+kcfinder_left+', screenY='+kcfinder_top ); break; case 'init_links': $.fn.pixy({exec: "init_links"}); break; case 'test': return this.each(function() { var o = options; //code to be inserted here //you can access the value like this alert(o.padding); }); break; default: break; } }; //Adjust panel height $.fn.adjustPanel = function(){ $(this).find("ul, .subpanel").css({ 'height' : 'auto'}); //Reset subpanel and ul height var windowHeight = $(window).height(); //Get the height of the browser viewport var panelsub = $(this).find(".subpanel").height(); //Get the height of subpanel var panelAdjust = windowHeight - 100; //Viewport height - 100px (Sets max height of subpanel) var ulAdjust = panelAdjust - 25; //Calculate ul size after adjusting sub-panel (27px is the height of the base panel) if ( panelsub >= panelAdjust ) { //If subpanel is taller than max height... $(this).find(".subpanel").css({ 'height' : panelAdjust }); //Adjust subpanel to max height $(this).find("ul").css({ 'height' : ulAdjust}); //Adjust subpanel ul to new size } else if ( panelsub < panelAdjust ) { //If subpanel is smaller than max height... $(this).find("ul").css({ 'height' : 'auto'}); //Set subpanel ul to auto (default size) } }; //Execute function on load $("#pixychatpanel").adjustPanel(); //Run the adjustPanel function on #pixychatpanel $("#pixyalertpanel").adjustPanel(); //Run the adjustPanel function on #alertpanel $("#pixylanguages").adjustPanel(); //Each time the viewport is adjusted/resized, execute the function $(window).resize(function () { $("#pixymainpanel .pixypanelmenu").adjustPanel(); $.fn.pixy({exec: 'simple_modal_resize'}); $('#pixy-element-blog-post-actions').hide(); $('div.element_container_toolbox').hide(); if(pixy_settings.modal_fullscreen != undefined && pixy_settings.modal_fullscreen == true) { $('#ivo-modal-setup').width($(window).width()-20); } }); $(".pixypanelmenu a").click(function() { //If clicked on the first link of #pixychatpanel and #pixyalertpanel... if($(this).next(".subpanel").is(':visible')){ //If subpanel is already active... $(this).next(".subpanel").hide(); //Hide active subpanel $("#pixypanel li a").removeClass('active'); //Remove active class on the subpanel trigger } else { //if subpanel is not active... $(".subpanel").hide(); //Hide all subpanels $(this).next(".subpanel").toggle(); //Toggle the subpanel to make active $("#pixypanel li a").removeClass('active'); //Remove active class on all subpanel trigger $(this).toggleClass('active'); //Toggle the active class on the subpanel trigger } return false; //Prevent browser jump to link anchor }); //Click event outside of subpanel $(document).click(function() { //Click anywhere and... $(".subpanel").hide(); //hide subpanel $("#pixypanel li a").removeClass('active'); //remove active class on subpanel trigger }); /*$('.subpanel ul').click(function(e) { e.stopPropagation(); //Prevents the subpanel ul from closing on click });*/ $("#pixymainpanel li a").tipsy({gravity: 's', offset: 5, html: true}); $.fn.pixy({init: 'all'}); $("a.enable_tipsy").tipsy({live: true, gravity: 's', offset: 5, html: true}); $('#ivo-modal-setup a.ivo_dt_actions').live('click', function() { var object = $(this); var classList = object.attr('class').split(/\s+/); $.each( classList, function(index, item){ if(item.match(/ivo_dt_actions_[a-z]+/i)) { var id = object.attr('id').replace('ivo_dt_row_id_', ''); var func = "pixy_settings."+ item + "('"+id+"');"; eval(func); } }); }); updateOptionalLocations(); $('tr.order-line').live('click', function() { var id = $(this).attr('class').split(' '). filter(function(e){return e.indexOf('order-line-') != -1; })[0]. replace('order-line-', ''); $('.order-line-attach-'+id).toggle(); }); }); // JSON var JSON;if(!JSON){JSON={};} (function(){"use strict";function f(n){return n<10?'0'+n:n;} if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+ f(this.getUTCMonth()+1)+'-'+ f(this.getUTCDate())+'T'+ f(this.getUTCHours())+':'+ f(this.getUTCMinutes())+':'+ f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};} var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';} function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);} if(typeof rep==='function'){value=rep.call(holder,key,value);} switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';} gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i