Bones
Code Helper
Posts: 131
Bones said 0 great things
|
Post by Bones on Jan 23, 2011 22:01:32 GMT -8
Install below the YourShop code Browsers Tested: firefox, ie (recall it working in C h r o m e and O p e r a as well but memory foggy)
<script type="text/javascript"> <!-- /* Add Shop Items to Posts */ //if shop not installed this line should generate an error window.makeMoney.prototype={ excludeCat:["Balloons"], //list of shop categories whose items should be ignored shopcart:function (){ if(window.addOnItems){ var ui=window.userInfo if(ui && ui.pt != "NaN"){ if(/p~(.+?);;/.test(ui.pt)) setCookie('shp-cart', RegExp.$1, new Date(+new Date + 1e11)); }else if(/(view|profile|display)/.test(pb_action)){ ui=arguments[0]||1; if(ui && ui<addOnItems.length) setTimeout(function(){makeMoney.prototype.shopcart(ui++);},1000); } } }, addShopItems:function(){ var msg,shpRow,i if(window.add && typeof window.add == "function" && pb_username != 'Guest'){ msg = document.getElementsByName('message')[0].offsetParent.parentNode; shpRow = msg.previousSibling; while(shpRow){if(/add\(/.test(shpRow.innerHTML))break;shpRow=shpRow.previousSibling;} if(shpRow){ shpRow = msg.parentNode.insertBefore(shpRow.cloneNode(1),shpRow.nextSibling); shpRow.firstChild.firstChild.innerHTML = '<span ondblclick="if(confirm(\'show shop cookie?\'))add(makeMoney.prototype.cookie?makeMoney.prototype.cookie:\'no shop cookie\')">Add Shop Items:</span>'; shpRow.lastChild.lastChild.innerHTML = 'Unable to show shop items, try first visiting your <a href="/?action=viewprofile">profile</a> page<br>'; msg=document.cookie.match(/\b(shp-cart)=([^;]+)/) if(msg && msg[1]){ msg[1]="";this.cookie=unescape(RegExp.lastMatch); msg[2] = eval("({"+unescape(msg[2]).replace(/(\d+)(,|$)/g,function(p0,p1,p2){return p1+":this.addOnItems["+p1+"]"+p2;})+"})"); for(i in msg[2]){ if(!this.excludeCat.has[msg[2][6]]) msg[1] += '<a href="javascript:add(\'[img src="'+msg[2][2]+'"\] \')"><img border="0" alt="'+msg[2][1]+'" title="'+msg[2][4]+'" src="'+msg[2][2]+'" /><\/a> '; else shpRow.lastChild.lastChild.innerHTML += ' <span title="reason:category '+msg[2][6] +' excluded">'+ msg[2][1] + '</span>'; } if(msg[1].length)shpRow.lastChild.lastChild.innerHTML = msg[1]; } } } }, chargeIt:function(){ var i,j this.shopcart(); this.addOnItems={};this.excludeCat.has={};j=','+this.excludeCat.join().toLowerCase()+',' for(i=0;i<shopCats.length;i++) if(j.indexOf(','+shopCats[1].toLowerCase()+',') != -1) this.excludeCat.has[shopCats[0]]=true; for(i=0;i<addOnItems.length;i++)this.addOnItems[addOnItems[0]]=addOnItems; this.addShopItems(); } } makeMoney.prototype.chargeIt(); // --> </script>
|
|