/*##################################################|*/ /* #CMS# */ (function($) { // CMS.$ will be passed for $ $(document).ready(function () { /*! * Sideframe * Controls a cms specific sideframe */ CMS.Sideframe = new CMS.Class({ implement: [CMS.API.Helpers], options: { 'onClose': false, 'sideframeDuration': 300, 'sideframeWidth': 320, 'urls': { 'css_sideframe': 'cms/css/cms.toolbar.sideframe.css' } }, initialize: function (options) { this.options = $.extend(true, {}, this.options, options); this.config = CMS.config; this.settings = CMS.settings; // elements this.sideframe = $('.cms_sideframe'); this.body = $('html'); // states this.click = (document.ontouchstart !== null) ? 'click.cms' : 'touchend.cms click.cms'; this.enforceReload = false; // if the modal is initialized the first time, set the events if(!this.sideframe.data('ready')) this._events(); // ready sideframe this.sideframe.data('ready', true); }, // initial methods _events: function () { var that = this; // attach close event this.sideframe.find('.cms_sideframe-close').bind(this.click, function () { that.close(true); }); // attach hide event this.sideframe.find('.cms_sideframe-hide').bind(this.click, function () { if($(this).hasClass('cms_sideframe-hidden')) { that.settings.sideframe.hidden = false; that._show(that.settings.sideframe.position || that.options.sideframeWidth, true); } else { that.settings.sideframe.hidden = true; that._hide(); } that.settings = that.setSettings(that.settings); }); // attach maximize event this.sideframe.find('.cms_sideframe-maximize').bind(this.click, function () { if($(this).hasClass('cms_sideframe-minimize')) { that.settings.sideframe.maximized = false; that._minimize(); } else { that.settings.sideframe.maximized = true; that.settings.sideframe.hidden = false; that._maximize(); } that.settings = that.setSettings(that.settings); }); this.sideframe.find('.cms_sideframe-resize').bind('mousedown', function (e) { e.preventDefault(); that._startResize(); }); // stopper events $(document).bind('mouseup.cms', function () { that._stopResize(); }); }, // public methods open: function (url, animate) { // prepare iframe var that = this; var language = 'language=' + CMS.config.request.language; var page_id = 'page_id=' + CMS.config.request.page_id; var holder = this.sideframe.find('.cms_sideframe-frame'); var initialized = false; // push required params if defined // only apply params on tree view if(url.indexOf(CMS.config.request.tree) >= 0) { var params = []; if(CMS.config.request.language) params.push(language); if(CMS.config.request.page_id) params.push(page_id); url = this._url(url, params); } var iframe = $('