gemilowidget_thl = { name: '', el: '', scriptSrc: '', html: '', style: '', height: '300px', width: '150px', inrun: '', init: function(name) { if(typeof(jQuery)=='undefined') { var JQ = document.createElement('script'); JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js'; JQ.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(JQ); window.setTimeout(function(){gemilowidget_thl.init(name)}, 100); return; } this.name = name; this.scriptSrc = $('#gemilo-widget-thl').attr('src'); this.drawWidget(); }, drawWidget: function() { this.el = $("
"); var style = $(""); this.el.attr('id', 'gemilo-widget-'+this.name+'-content'); this.el.css('height', this.height); this.el.css('width', this.width); var that = this; var p1 = this.queryString('p1'); var p2 = this.queryString('p2'); var html = ''; $.getJSON("http://kolmaspiste.net/gemilo/widget-"+this.name+".php?p1="+p1+"&p2="+p2+"&jsoncallback=?", function(data){ style.attr('href', data.css); style.attr('rel', 'stylesheet'); style.attr('type', 'text/css'); $('head').append(style); this.style = data.css; if(data.height) that.el.css('height', data.height); if(data.width) that.el.css('width', data.width); html = data.html; that.el.html(html); $('#gemilo-widget-'+that.name).after(that.el); }); }, queryString: function (parameter) { var loc = this.scriptSrc; var param_value = false; var params = loc.split("&"); for (i=0; i