Created
October 28, 2010 09:25
-
-
Save millken/650993 to your computer and use it in GitHub Desktop.
miiduu_mini
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MiiduuNameSpace = typeof(MiiduuNameSpace)=="undefined" ? {} : MiiduuNameSpace; | |
| MiiduuNameSpace.Mini = function (obj) { | |
| this.options = {product_id:0,width:0,height:0,RT:false,itemSize:'single',button:'buynow',ref:escape(location.href),host:'www.miiduu.com'}; | |
| for(var name in this.options) { | |
| if(typeof(obj[name]) !== 'undefined') this.options[name] = obj[name]; | |
| } | |
| } | |
| MiiduuNameSpace.Mini.prototype = { | |
| getWidth: function (){return this.options.width? this.options.width : MiiduuNameSpace.Mini.config.style[this.options.itemSize].width;}, | |
| getHeight: function (){return this.options.height? this.options.height : MiiduuNameSpace.Mini.config.style[[this.options.itemSize]].height;}, | |
| getFrameSource: function () { | |
| return 'http://' + this.options.host + '/' + MiiduuNameSpace.Mini.config.baseUrl + '&' + | |
| '&product_id=' + this.options.product_id + | |
| '&button=' + this.options.button + | |
| '&ref=' + this.options.ref ; | |
| }, | |
| renderIframe: function(){ | |
| var html = ''; | |
| html += '<iframe ALLOWTRANSPARENCY=true style="width: '+this.getWidth()+'px; ' + | |
| 'height: '+this.getHeight()+'px;" ' + | |
| 'src="'+this.getFrameSource()+'" scrolling="no" frameborder="0">' + | |
| '</iframe>'; | |
| if(this.options.RT) return html; | |
| document.write(html); | |
| } | |
| } | |
| MiiduuNameSpace.Mini.config = { | |
| style: { | |
| thumbnail: {height: 93, width: 98}, | |
| gallery: {height: 180, width: 184}, | |
| single: {height: 200, width:200} | |
| }, | |
| baseUrl: "index.php?route=product/mini" | |
| }; | |
| //<script type='text/javascript'>new MiiduuNameSpace.Mini({'host':'cikitest53.miiduu.lo','product_id':463,'width':240,'height':300,'button':'addtocart'}).renderIframe();</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment