if(typeof CONSYN_WIDGET_ID == "undefined"){ CONSYN_WIDGET_ID = 1; CONSYN_WIDGETS = {}; } ComConsynXss = new function() { var widgets = CONSYN_WIDGETS; this.widgets= CONSYN_WIDGETS; var BASE_URL = 'http://picturepush.com/'; var CONTENT_URL = BASE_URL + 'api.php?data_format=json&module=grid&mode=recent&clid=3005&alid=&tagname=&q=&format=64c&pageSize=15&row=3'; var STYLESHEET_URL = 'http://picturepush.com/widgets/grid.css'; var REQUEST = {"ml_tpl_path":"\/external.js.php","module":"grid","mode":"recent","clid":"3005","alid":"","tagname":"","q":"","format":"64c","pageSize":"15","row":"3"}; function getWidgetId(){ return (CONSYN_WIDGET_ID++); } function findWidget(id){ return document.getElementById("com_consyn_widget_"+id); } function requestStylesheet(stylesheet_url) { stylesheet = document.createElement("link"); stylesheet.rel = "stylesheet"; stylesheet.type = "text/css"; stylesheet.href = stylesheet_url; stylesheet.media = "all"; document.lastChild.firstChild.appendChild(stylesheet); } Widget = { apply: function(htmlElement){ for(var key in this){ if(key!="apply"){ htmlElement[key] = this[key]; } } htmlElement.init(); }, extend: function(obj){ for(var key in this){ if(typeof obj[key]=="undefined" || key=="extend"){ obj[key] = this[key]; } } obj.$super = this; return obj; }, receive: function(data){ alert("received data for widget"+this.$consynWidgetId); }, request: function(data){ if(typeof data=="undefined") data={}; data['callback'] = 'ComConsynXss.widgets['+this.$consynWidgetId+'].receive'; //data['__cookies'] = document.cookie; var script = document.createElement('script'); // How you'd pass the current URL into the request strBuff = []; for(var key in data){ val = data[key]; if(typeof val != "function" && val!=null && key.length>0){ strBuff.push("&"); strBuff.push(key); strBuff.push("="); strBuff.push(encodeURIComponent(val)); } } script.src = CONTENT_URL+strBuff.join(""); document.getElementsByTagName("head")[0].appendChild(script); }, write: function(){ var id = getWidgetId(); document.write("
loading...
"); var w = findWidget(id); this.$consynWidgetId = id; this.apply(w); widgets[id] = w; return w; } } requestStylesheet(STYLESHEET_URL); function img_url(row, format){ return row["server"]+ "/photo/" + format + "/" + ((row["FileType"]=="0" || format=="movie")?row["imagefullname"]:(row["Id"]+".jpg")); }Grid = Widget.extend({ init: function(){ this.className="picturepushGrid"; this.request(); }, receive: function(data){ if(!data) return; var txt = "
"; for(var i=0; i"; i++ if(i!=0 && i%REQUEST['row']==0){ txt+="
"; } } txt+="
"; if(data.UserName){ txt += ""+data.UserName+" @ PicturePush"; }else{ txt += "PicturePush"; } this.innerHTML = txt; } }); Grid.write(); }