/* * Script from NETTUTS.com [by James Padolsey] V.2 (ENHANCED, WITH COOKIES!!!) * @requires jQuery($), jQuery UI & sortable/draggable UI modules & jQuery COOKIE plugin */ var iNettuts = { jQuery : $, settings : { columns : '.column', widgetSelector: '.widget', handleSelector: '.widget-head', contentSelector: '.widget-content', /* If you don't want preferences to be saved change this value to false, otherwise change it to the name of the cookie: */ saveToCookie: false, widgetDefault : { movable: true, removable: true, collapsible: true, editable: true, colorClasses : ['color-yellow', 'color-red', 'color-blue', 'color-white', 'color-orange', 'color-green'] }, widgetIndividual : widgets_indiv }, init : function () { //this.attachStylesheet('inettuts.js.css'); this.sortWidgets(); this.addWidgetControls(); this.makeSortable(); }, getWidgetSettings : function (id) { var $ = this.jQuery, settings = this.settings; return (id&&settings.widgetIndividual[id]) ? $.extend({},settings.widgetDefault,settings.widgetIndividual[id]) : settings.widgetDefault; }, addWidgetControls : function () { var iNettuts = this, $ = this.jQuery, settings = this.settings; $(settings.widgetSelector, $(settings.columns)).each(function () { var thisWidgetSettings = iNettuts.getWidgetSettings(this.id); if (thisWidgetSettings.removable) { $('CLOSE').mousedown(function (e) { /* STOP event bubbling */ e.stopPropagation(); }).click(function () { if(confirm('This widget will be removed, ok?')) { $(this).parents(settings.widgetSelector).animate({ opacity: 0 },function () { $(this).wrap('
').parent().slideUp(function () { $(this).remove(); }); }); } return false; }).appendTo($(settings.handleSelector, this)); } if (thisWidgetSettings.editable) { $('EDIT').mousedown(function (e) { /* STOP event bubbling */ e.stopPropagation(); }).toggle(function () { $(this).css({backgroundPosition: '-66px 0', width: '55px'}) .parents(settings.widgetSelector) .find('.edit-box').show().find('input').focus(); return false; },function () { $(this).css({backgroundPosition: '', width: '24px'}) .parents(settings.widgetSelector) .find('.edit-box').hide(); return false; }).appendTo($(settings.handleSelector,this)); $('