| /* frdl\-Flow\    $.-map: desktop-themes    http://api.webfan.de/api-d/4/js-api/library.js?plugin=wd-themes   
 @requires    library.js   http://api.webfan.de/api-d/4/js-api/library.js 
 @requires    $.WebfanDesktop   http://api.webfan.de/api-d/4/js-api/library.js?plugin=wd-desktop
 @copyright  (c) Till Wehowski - All rights reserved - http://look-up.webfan.de/webdof-license
- set theme option
- install theme
- list themes
*/
(function($){
		
   $.fn['wd_ThemesList'] = function(Themes, method) {
   	   var m = {}, T = this;
  	   
   	   var _themes = [
              $.WebfanDesktop.getDefaultTheme(), 
		    
             {
	        	name : 'Pinnwand', 
		   	    author : 'Till Wehowski, Webfan.de',
		   	    description : 'Pinnwand Theme mit Korkhintergrund',
		   	    wallpaper : 'http://static.webfan.de/icons/pinnwand/kork.jpg',
		   	    css : [ 
		   	       {
						selector : '.maintenance-hint-webfan-desktop',
						attr : 'color',
						value : 'yellow'
					}
		   	    ]
		     }
		];   
	
		
		
	
	  if('undefined' !== typeof Themes){
             $.extend(_themes, Themes);
	   }
	 
	 	
	     
	 
	 m['list'] = function(){
	  var themes = _themes;
	  $(T).html('');
      $(T).append('<h1 class="webfan-blue"><span>Available</span> Themes</h1>'); 
      
      var theme, li, i = 0, ul = Dom.create('ul');
	   
	   $(ul).attr('class', 'list themes');
	   $(ul).appendTo(T);
	      
	   for(i=0;i<themes.length;i++){
	   	  theme = themes[i];
	   	  	   	  
	   	  li = Dom.create("li");
	   	  li.setAttribute("class", 'data-box');
	   	  $(li).html('<h1>'  + theme.name + '</h1>' + theme.description + '<br />' + '(c)' + theme.author);
	   	  li.setAttribute("data-themeIndex", i);
	   	  $(li).css('background', 'url(' + theme.wallpaper + ') repeat');
	   	  $(li).on('click', function(){ 
	   	        var T = themes[parseInt(this.getAttribute('data-themeIndex'))];
	   	        if(true!==confirm("Install theme " + T.name + " now...?"))return;
	   	        $('<div></div>').WebfanDesktopTheme(T);
	   	   });
	   	   $(li).appendTo($(ul));
	   }
	  
	   return this;
	 	
	 };
	 
	 
	 
	 
	  if(null !== method && 'function' === typeof m[method]){
	  	  return  m[method](Array.prototype.slice.call(arguments));
	  } 
	 
	  return this;
	};
	
   $.fn['WebfanDesktopThemesList'] = $.fn['wd_ThemesList'];
})( jQuery );
 |