$controller->addInlineJavascript(' var WT_INDIVIDUAL = (function () { var instance, jQseparator = jQuery("#separator"), jQsidebar = jQuery ("#sidebar"); function init() { jQuery ("#header_accordion1").accordion ({ active: 0, heightStyle: "content", collapsible: true }); jQuery ("#tabs").tabs ({ // If url has a hash (e.g #stories) then don\'t set an active tab - it overrides the hash // otherwise use cookie active: location.hash ? null : jQuery.cookie ("indi-tab"), activate: function (event, ui) { jQuery.cookie ("indi-tab", jQuery ("#tabs").tabs ("option", "active")); }, // Only load each tab once beforeLoad: function (event, ui) { if (ui.tab.data ("loaded")) { event.preventDefault (); return; } jQuery (ui.panel.selector).append (\'<div class="loading-image"></div>\'); ui.jqXHR.success (function () { ui.tab.data ("loaded", true); }); } }); if (jQsidebar.length) { // Have we got a sidebar ? // toggle sidebar visibility jQuery ("#main").on ("click", "#separator", function (e) { e.preventDefault (); jQsidebar.animate ({width: "toggle"}, { duration: 300, done: function () { jQuery.cookie ("hide-sb", jQsidebar.is (":hidden")); jQseparator.toggleClass("separator-hidden separator-visible"); } }); }); // Set initial sidebar state if (jQuery.cookie ("hide-sb") === "true") { jQsidebar.hide (); jQseparator.addClass("separator-hidden"); } else { jQsidebar.show (); jQseparator.addClass("separator-visible"); } } } return { getInstance: function () { if (!instance) { instance = init (); } return instance; } }; }) (); WT_INDIVIDUAL.getInstance (); ');
$controller->addInlineJavascript(' var WT_INDIVIDUAL = (function () { var instance, jQseparator = jQuery("#separator"), jQsidebar = jQuery ("#sidebar"); function init() { jQuery ("#header_accordion1").accordion ({ active: 0, heightStyle: "content", collapsible: true }); jQuery ("#tabs").tabs ({ // Remember the currently selected tab between pages. active: sessionStorage.getItem("indi-tab"), activate: function (event, ui) { sessionStorage.setItem("indi-tab", jQuery(this).tabs("option", "active")); }, // Only load each tab once beforeLoad: function (event, ui) { if (ui.tab.data ("loaded")) { event.preventDefault (); return; } jQuery (ui.panel.selector).append (\'<div class="loading-image"></div>\'); ui.jqXHR.success (function () { ui.tab.data ("loaded", true); }); } }); if (jQsidebar.length) { // Have we got a sidebar ? // toggle sidebar visibility jQuery ("#main").on ("click", "#separator", function (e) { e.preventDefault (); jQsidebar.animate ({width: "toggle"}, { duration: 300, done: function () { sessionStorage.setItem("hide-sb", jQsidebar.is(":hidden")); jQseparator.toggleClass("separator-hidden separator-visible"); } }); }); // Set initial sidebar state if (sessionStorage.getItem("hide-sb") === "true") { jQsidebar.hide (); jQseparator.addClass("separator-hidden"); } else { jQsidebar.show (); jQseparator.addClass("separator-visible"); } } } return { getInstance: function () { if (!instance) { instance = init (); } return instance; } }; }) (); WT_INDIVIDUAL.getInstance (); ');