107 lines
65 KiB
JavaScript
107 lines
65 KiB
JavaScript
|
/*!
|
||
|
ProtoFluid 3.02, protofluid.com
|
||
|
Endlessly tweaked by Edward Cant. @opticswerve. */
|
||
|
|
||
|
var a,protoFluidResetCSS="data:text/css;base64,aHRtbCxib2R5LGRpdixzcGFuLGFwcGxldCxvYmplY3QsaWZyYW1lLGgxLGgyLGgzLGg0LGg1LGg2LHAsYmxvY2txdW90ZSxwcmUsYSxhYmJyLGFjcm9ueW0sYWRkcmVzcyxiaWcsY2l0ZSxjb2RlLGRlbCxkZm4sZW0saW1nLGlucyxrYmQscSxzLHNhbXAsc21hbGwsc3RyaWtlLHN0cm9uZyxzdWIsc3VwLHR0LHZhcixiLHUsaSxjZW50ZXIsZGwsZHQsZGQsb2wsdWwsbGksZmllbGRzZXQsZm9ybSxsYWJlbCxsZWdlbmQsdGFibGUsY2FwdGlvbix0Ym9keSx0Zm9vdCx0aGVhZCx0cix0aCx0ZCxhcnRpY2xlLGFzaWRlLGNhbnZhcyxkZXRhaWxzLGVtYmVkLGZpZ3VyZSxmaWdjYXB0aW9uLGZvb3RlcixoZWFkZXIsaGdyb3VwLG1lbnUsbmF2LG91dHB1dCxydWJ5LHNlY3Rpb24sc3VtbWFyeSx0aW1lLG1hcmssYXVkaW8sdmlkZW97bWFyZ2luOjA7cGFkZGluZzowO2JvcmRlcjowO2ZvbnQtc2l6ZToxMDAlO2ZvbnQ6aW5oZXJpdDt2ZXJ0aWNhbC1hbGlnbjpiYXNlbGluZTt9YXJ0aWNsZSxhc2lkZSxkZXRhaWxzLGZpZ2NhcHRpb24sZmlndXJlLGZvb3RlcixoZWFkZXIsaGdyb3VwLG1lbnUsbmF2LHNlY3Rpb257ZGlzcGxheTpibG9jazt9Ym9keXtsaW5lLWhlaWdodDoxO31vbCx1bHtsaXN0LXN0eWxlOm5vbmU7fWJsb2NrcXVvdGUscXtxdW90ZXM6bm9uZTt9YmxvY2txdW90ZTpiZWZvcmUsYmxvY2txdW90ZTphZnRl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.prompt("New css rule:"):b;var c=document.createElement("style");c.type="text/css";document.getElementsByTagName("head")[0].appendChild(c);c[typeof document.body.style.WebkitAppearance=="string"?"innerText":"innerHTML"]=b};this.injectExternal=function(b){if(b===undefined)return false;jQuery("head").append('<link href="'+b+'" rel="stylesheet" type="text/css" />')};this.refresh=function(){var b,c,d;c=document.getElementsByTagName("link");
|
||
|
for(b=0;b<c.length;b++){d=c[b];if(d.rel.toLowerCase().match(/stylesheet/)&&d.href){var e=d.href.replace(/(&|%5C?)forceReload=\d+/,"");d.href=e+(e.match(/\?/)?"&":"?")+"forceReload="+(new Date).valueOf()}}};return true}function FlameResource(){return true}
|
||
|
function FlameResourceManager(){this.id="ResourceManager";this.flameResourceManager=function(){this.bCloseGaps=true;this.resources=[];this.totalCountEver=this.totalCount=0};this.flameResourceManagerDestructor=function(){this.removeAll();delete this.resources;bFlameDebug&&console.log("- All "+this.id+" resources deleted")};this.destroy=function(){this.flameResourceManagerDestructor()};this.add=function(b){if(b===undefined||b.id===undefined)bFlameDebug&&console.error(this.id+" resource add failed. Resource or id is not defined.");
|
||
|
else{var c=this.get(b.id);if(c!==undefined){c.refCount++;bFlameDebug&&console.log("- "+this.id+" repeat resource. refCount["+c.refCount+"]")}else{if(this.full()){bFlameDebug&&console.warn(this.id+" resource cap has been reached. ["+b.id+"] not added.");return}b.refCount=1;c=this.firstAvailableSlot();this.resources[c]=b;bFlameDebug&&console.log("- "+this.id+" fresh resource. id["+b.id+"], refCount["+this.resources[c].refCount+"]");this.totalCount++;this.totalCountEver++}return b}};this.closeGaps=function(){for(var b=
|
||
|
this.resources.length;b--;)if(this.resources[b]===undefined){if(b===this.resources.length-1)delete this.resources[b];else{this.resources[b]=this.resources[this.resources.length-1];delete this.resources[this.resources.length-1]}this.resources.length--}};this.firstAvailableSlot=function(){if(this.bCloseGaps)return this.resources.length;for(var b=0;b<this.resources.length;b++)if(this.resources[b]===undefined)return b;return this.resources.length};this.full=function(){if(this.bCloseGaps){if(this.maxResources!==
|
||
|
undefined&&this.maxResources===this.resources.length)return true;return false}if(this.maxResources!==undefined&&this.maxResources===this.totalCount)return true;return false};this.get=function(b){var c=this.resources.length;if(this.bCloseGaps)for(;c--;){if(b===this.resources[c].id)return this.resources[c]}else for(;c--;)if(this.resources[c]!==undefined&&b===this.resources[c].id)return this.resources[c]};this.getIndexOf=function(b){var c=this.resources.length;if(this.bCloseGaps)for(;c--;){if(b===this.resources[c].id)return c}else for(;c--;)if(this.resources[c]!==
|
||
|
undefined&&b===this.resources[c].id)return c};this.lastAvailableSlot=function(){for(var b=this.resources.length;b--;)if(this.resources[b]===undefined)return b;return this.resources.length};this.numSlotsEmpty=function(){if(this.maxResources!==undefined)bFlameDebug&&console.log(this.id+" max resources not defined, tonnes of empty slots");else return this.bCloseGaps?this.maxResources-this.resources.length:this.maxResources-this.totalCount};this.remove=function(b,c){if(b!==undefined){var d=this.getIndexOf(b);
|
||
|
if(d===undefined)bFlameDebug&&console.log(this.id+" attempted deletion of non-existent resource ["+b+"]");else c!==undefined&&c===true?this.removeByIndex(d,true):this.removeByIndex(d,false)}};this.removeAll=function(){var b=this.bCloseGaps;this.bCloseGaps=false;for(var c=0;c<this.resources.length;c++)this.removeByIndex(c,true);this.bCloseGaps=b;this.totalCount=this.resources.length=0};this.removeByIndex=function(b,c){if(!(b===undefined||this.resources[b]===undefined)){if(c===undefined)c=false;this.resources[b].refCount--;
|
||
|
bFlameDebug&&console.log(this.id+" resource deletion. id["+this.resources[b].id+"], index["+b+"]");if(c||this.resources[b].refCount<=0){this.resources[b].destroy!==undefined&&this.resources[b].destroy();b=delete this.resources[b];bFlameDebug&&!b&&console.warn("- Deletion failed");this.bCloseGaps&&this.closeGaps();this.totalCount--}else bFlameDebug&&console.log("- refCount reduced to "+this.resources[b].refCount)}};return true}
|
||
|
function FlameLicense(){this.id="FlameLicense";this.flameLicense=function(){this.app="OpticSwerve";this.localStorage=new FlameLocalStorage;this.localStorage.flameLocalStorage();this.uri=new FlameURI;this.uri.flameURI();this.bStore=this.bCut=false;this.count=0;this.trialCount=10};this.check=function(b,c){if(c!==undefined){if(c===""){try{flameEngine.flameModalManager.addNotification("Please supply a license key")}catch(d){alert("Please supply a license key")}return"fail"}if(c.length<40||c.search(new RegExp("[g-z]",
|
||
|
"g"))!==-1)return"fail";if(!navigator.onLine){try{flameEngine.flameModalManager.addNotification("No connection. Cannot authorise key.")}catch(e){alert("No connection. Cannot authorise key.")}return"fail"}if(jQuery.support.cors===true)return this.process(c,b);else{try{flameEngine.flameModalManager.addNotification("CORS not supported. Cannot authorise key. Upgrade browser.")}catch(f){alert("CORS not supported. Cannot authorise key. Upgrade your browser.")}return"fail"}}if(this.localStorage.get(this.app+
|
||
|
"Plan")!==undefined){this.plan=this.localStorage.get(this.app+"Plan");this.plan!==undefined&&b(this.plan)}else{if(this.localStorage.get(this.app+"Count"))this.count=this.localStorage.getInt(this.app+"Count");this.localStorage.set(this.app+"Count",this.count+1);if(this.localStorage.check(this.app+"Count")){if(this.count>this.trialCount){this.bCut=true;bFlameDebug&&console.log("Usage count expired")}}else{this.bCut=true;bFlameDebug&&console.log("Trial expired. Could not access local storage.")}bFlameDebug&&
|
||
|
console.log("FREE license. "+this.count+" uses. Cut: "+this.bCut);b("free")}};this.greaterThan=function(b){if(this.plan===undefined||b===this.plan)return false;if(b==="free")return true;if(b==="standard")if(this.plan==="pro"||this.plan==="elite")return true;if(b==="pro")if(this.plan==="elite")return true;return false};this.input=function(b){b=b.open("licenseModal");b.bAutoDismiss=false;b.setContent('<form id="licenseForm"><input autocorrect="off" id="licenseInput" type="text" placeholder="license key" /><input class="osButton" id="submitLicense" type="submit" value="submit"></input></form>');
|
||
|
b.show();var c=b.domElement.find("#licenseInput"),d=this;jQuery("#licenseForm").submit(function(){d.check(function(e){d.plan=e;if(d.plan==="standard"){alert("Thank you for purchasing "+d.app);window.location.reload(true)}else if(d.plan==="pro"||d.plan==="elite"){alert("Thank you for purchasing "+d.app+" "+d.plan.substr(0,1).toUpperCase()+d.plan.substr(1));window.location.reload(true)}else alert("Sorry, the supplied license is not valid.")},c.attr("value"));return false})};this.matchesLocal=function(){if(this.localStorage.check(this.app+
|
||
|
"Key"))if(this.localStorage.get(this.app+"Key")===this.k)if(this.localStorage.check(this.app+"Plan"))return true;return false};this.process=function(b,c){try{if(this.app===undefined){console.log("FlameLicense - App name not defined");c("free");return}}catch(d){console.log("App name not present");c("free");return}var e=this.app.replace(" ","_"),f=this;$.post("http://license.opticswerve.com",{app:e,key:b},function(i){if(i==="standard"||i==="pro"||i==="elite"){f.k=b;f.plan=i;f.save()}c(i)})};this.processURI=
|
||
|
function(b){if(this.uri.getHashVar(this.app+"Key")!==undefined){var c=this.uri.getHashVar(this.app+"Key");this.uri.removeHashVar(this.app+"Key");this.process(c,b)}};this.save=function(){if(this.plan!=="free"){try{if(this.localStorage.get(this.app+"Key")!==this.k){this.localStorage.set(this.app+"Key",this.k);this.localStorage.set(this.app+"Plan",this.plan);console.log("Saved local license. Plan: "+this.plan)}}catch(b){bFlameDebug&&console.warn("Could not save license");return false}return true}};this.toString=
|
||
|
function(){alert(this.app+" "+this.plan.substr(0,1).toUpperCase()+this.plan.substr(1))};return true}
|
||
|
function FlameLocalStorage(){this.id="FlameLocalStorage";this.flameLocalStorage=function(){this.bSupported=false;try{if("localStorage"in window&&window.localStorage!==null)this.bSupported=true}catch(b){}this.bSupported&&window.addEventListener!==undefined&&window.addEventListener("storage",function(c){try{flameEngine.flameLocalStorage.storagePolicy!==undefined&&flameEngine.flameLocalStorage.storagePolicy(c)}catch(d){bFlameDebug&&console.log("FlameLocalStorage event listener failed to initialise")}},
|
||
|
false)};this.check=function(b){if(this.bSupported===undefined||this.bSupported===false)return false;b=localStorage.getItem(b);if(b===null||b===undefined||b==="undefined")return false;return true};this.clear=function(b){b===undefined?localStorage.clear():this.remove(b)};this.get=function(b){if(this.check(b)){b=localStorage.getItem(b);if(b==="true")return true;else if(b==="false")return false;return b}};this.getFloat=function(b){if(this.check(b))return parseFloat(localStorage.getItem(b))};this.getInt=
|
||
|
function(b){if(this.check(b))return parseInt(localStorage.getItem(b))};this.length=function(){return localStorage.length};this.remove=function(b){localStorage.removeItem(b)};this.set=function(b,c){try{if(c===true)c="true";else if(c===false)c="false";localStorage.setItem(b,c)}catch(d){bFlameDebug&&console.warn("Could not set local storage key. "+d.message)}};return true}FlameLocalStorage.prototype=new FlameResource;
|
||
|
function FlameModalManager(){this.id="FlameModalManager";this.flameModalManager=function(){this.flameResourceManager();this.bCloseAll=true;this.bMultiModal=false;this.notifyDelay=5E3};this.clearNotifyTimeout=function(){if(this.notifyTimeout!==undefined){clearTimeout(this.notifyTimeout);this.notifyTimeout=undefined}};this.close=function(b){var c=this.get(b);if(c!==undefined){c.bNotification&&this.clearNotifyTimeout();this.remove(b)}};this.closeAll=function(b){if(b===true){this.removeAll();this.clearNotifyTimeout()}else for(b=
|
||
|
this.resources.length;b--;)this.resources[b].bNotification||this.removeByIndex(b)};this.closeAllNotifications=function(){this.clearNotifyTimeout();for(var b=this.resources.length;b--;)this.resources[b].bNotification&&this.removeByIndex(b)};this.isOpen=function(b){if(this.get(b)===undefined)return false;return true};this.numOpen=function(b){for(var c=0,d=this.resources.length;d--;)b===true&&this.resources[d].bNotification||c++};this.open=function(b,c){if(this.bMultiModal){if(this.get(b)!==undefined)return}else this.removeAll();
|
||
|
b=this.add(new FlameModal(b));b.flameModal();if(c!==undefined)b.parent=$(c);return b};this.openNotification=function(b,c){var d;if(this.isOpen(b)){d=this.get(b);d.setStrong()}else{this.bMultiModal||this.removeAll();d=this.add(new FlameModal(b));d.flameModal();d.bNotification=true;if(c!==undefined)d.parent=$(c);d.show()}try{flameEngine.flameTimer.addTrigger(b,function(){flameEngine.flameModalManager.remove(b)},this.notifyDelay,false)}catch(e){var f=this;this.clearNotifyTimeout();this.notifyTimeout=
|
||
|
setTimeout(function(){f.remove(b)},this.notifyDelay)}return d};return true}FlameModalManager.prototype=new FlameResource;FlameModalManager.prototype=new FlameResourceManager;
|
||
|
function FlameModal(b){this.id=b!==undefined?b:"modal"+flameEngine.flameModalManager.totalCount;this.flameModal=function(){this.bNotification=false;this.bAutoDismiss=true;this.content=""};this.destroy=function(){if(this.bNotification)try{flameEngine.flameTimer.removeTrigger(this.id)}catch(c){}if(this.domElement!==undefined)this.hidePolicy!==undefined?this.hidePolicy():this.domElement.remove();delete this.domElement;delete this.hidePolicy;delete this.showPolicy};this.append=function(c){this.content+=
|
||
|
c;this.domElement!==undefined&&this.domElement.find(".wrapper").html(c)};this.centre=function(){this.centreX();this.centreY()};this.centreX=function(){var c,d=document.documentElement.clientWidth;if(this.domElement!==undefined)c=this.domElement.outerWidth();else if(this.width!==undefined)c=this.width;else return;this.x=c>=d?0:d/2-c/2;this.domElement!==undefined&&this.domElement.css("left",this.x)};this.centreY=function(){var c,d=document.documentElement.clientHeight;if(this.domElement!==undefined)c=
|
||
|
this.domElement.outerHeight();else if(this.height!==undefined)c=this.height;this.y=c>=d?0:d/2-c/2;this.domElement!==undefined&&this.domElement.css("top",this.y)};this.isString=function(c){return typeof c=="string"};this.prepend=function(c){this.content=c+this.content;this.domElement!==undefined&&this.domElement.find(".wrapper").html(c)};this.setContent=function(c){this.content=c;this.domElement!==undefined&&this.domElement.find(".wrapper").html(c)};this.setHeight=function(c){this.height=this.isString(c)&&
|
||
|
c.indexOf("%")!==-1?document.documentElement.clientHeight*parseInt(c.replace("%",""))/100:c;this.domElement!==undefined&&this.domElement.height(c)};this.setStrong=function(){this.domElement!==undefined&&this.domElement.addClass("modalStrong")};this.setWidth=function(c){this.width=this.isString(c)&&c.indexOf("%")!==-1?document.documentElement.clientWidth*parseInt(c.replace("%",""))/100:c;this.domElement!==undefined&&this.domElement.width(c)};this.setX=function(c){this.x=c;this.domElement!==undefined&&
|
||
|
this.domElement.offset({left:c})};this.setY=function(c){this.y=c;this.domElement!==undefined&&this.domElement.offset({top:c})};this.show=function(){this.domElement=$("#"+this.id);if(this.domElement.length===0){this.parent!==undefined?this.parent.append('<div class="modal" id="'+this.id+'"><div class="wrapper"></div></div>'):$("body").append('<div class="modal" id="'+this.id+'"><div class="wrapper"></div></div>');this.domElement=$("#"+this.id)}this.bNotification&&this.domElement.addClass("notify");
|
||
|
this.setContent(this.content);this.showPolicy!==undefined?this.showPolicy():this.domElement.show();this.height!==undefined&&this.domElement.height(this.height);this.width!==undefined&&this.domElement.width(this.width);this.x!==undefined&&this.domElement.offset({left:this.x});this.y!==undefined&&this.domElement.offset({top:this.y})};return true}FlameModal.prototype=new FlameResource;
|
||
|
function FlameURI(){this.id="FlameURI";this.flameURI=function(){this.bExecute=true};this.clean=function(){if(this.location.indexOf("#")===this.location.length-1)this.location=this.location.replace("#","")};this.convert=function(b){if(b===undefined||b===true||b===false)return b;else if(b==="")return;else if(b==="true")return true;else if(b==="false")return false;else if(isFinite(b))return Number(b);return b};this.get=function(){if(this.location!==undefined)return this.location;return window.location.href};
|
||
|
this.getHostname=function(){return window.location.hostname};this.getPathname=function(){return window.location.pathname};this.getQuery=function(){if(window.location.search!=="")return window.location.search};this.getQueryVar=function(b){var c=this.getQuery();if(c!==undefined){var d=c.indexOf("?");c=c.substring(d+1);return this.convert(this.getVar(b,c))}};this.getQueryVarParams=function(b,c){if(c===undefined)c=",";b=this.getQueryVar(b);if(b!==undefined)return b.split(c)};this.getVar=function(b,c){c=
|
||
|
c.split("&");for(var d=0;d<c.length;d++){var e=c[d].split("=");if(e[0]===b){if(e[1]!==undefined)return decodeURIComponent(e[1]);return true}}};this.inHostname=function(b){if(this.getHostname().indexOf(b)>-1)return true;return false};this.inPathname=function(b){if(this.getPathname().indexOf(b)>-1)return true;return false};this.inURL=function(b){if(this.get().indexOf(b)>-1)return true;return false};this.isLocal=function(){if(this.getHostname()===localhost)return true;return false};this.numHashVars=
|
||
|
function(){var b=this.getHash();if(b==="")return 0;return b.match(/[\?\&]/gi).length};this.pop=function(){};this.push=function(){this.location=window.location.href};this.sameDomain=function(){this.getHostName()};this.toString=function(){if(this.location!==undefined)return this.location;return window.location.href};return true}a=FlameURI.prototype;
|
||
|
a.addHashVar=function(b,c){var d;d=this.getHash();if(d!==undefined)if(this.hashVarPresent(b)){var e;e=new RegExp(b+"(?==|&|$)(?:=?[a-zA-Z0-9_,%.*\\+-]*)","g");b=c===undefined?d.replace(e,b):d.replace(e,b+"="+encodeURIComponent(c.toString()))}else b=c===undefined?d+"&"+b:d+"&"+b+"="+encodeURIComponent(c.toString());else b=c===undefined?"?"+b:"?"+b+"="+encodeURIComponent(c.toString());this.removeHash();this.location+="#"+b;if(this.bExecute)window.location.hash=b};
|
||
|
a.getHash=function(){if(this.location!==undefined){var b=this.location.indexOf("#");if(b!==-1)if(b!==this.location.length-1)return this.location.substr(b+1)}else if(window.location.hash!=="")return window.location.hash.substr(1)};a.getHashVar=function(b){var c=this.getHash();if(c!==undefined){var d=c.indexOf("?");if(d!==-1)c=c.substring(d+1);return this.convert(this.getVar(b,c))}};
|
||
|
a.getHashVarParams=function(b,c){if(c===undefined)c=",";b=this.getHashVar(b);if(b!==undefined){c=b.split(c);for(b=0;b<c.length;b++)c[b]=this.convert(c[b]);return c}};a.hashVarPresent=function(b){var c=this.getHash();if(c===undefined)return false;if(c.search(new RegExp("(^|[?&]{1})"+b+"(?==|&|$)(?:=?[a-zA-Z0-9_,%.*\\+-]*)","g"))===-1)return false;return true};
|
||
|
a.removeHash=function(){if(this.location!==undefined){var b=this.location.indexOf("#");if(b!==-1)this.location=this.location.substring(0,b)}if(this.bExecute)window.location.hash=""};
|
||
|
a.removeHashVar=function(b){if(window.location.hash==="")return false;var c=new RegExp("(^|[?&]{1})"+b+"(?==|&|$)(?:=?[a-zA-Z0-9_,%.*\\+-]*)","g");if(this.hashVarPresent(b)){b=this.getHash().replace(c,"");if(b.charAt(0)==="&")b="?"+b.substr(1);this.removeHash();this.location+="#"+b;if(this.bExecute)window.location.hash=b}};var bExecProtoFluid=false,bFlameDebug=false,bProtoFluidExecuted=false,bProtoFluidReady=false,protoFluid;
|
||
|
window.Modernizr=function(b,c,d){function e(g,h){for(var j in g)if(s[g[j]]!==d)return h=="pfx"?g[j]:true;return false}function f(g,h){return typeof g===h}function i(g){s.cssText=g}var k={},v=c.documentElement;c.head||c.getElementsByTagName("head");var m=c.createElement("modernizr"),s=m.style;m={};var w=[],u=function(g,h,j,t){var o,l=c.createElement("div");if(parseInt(j,10))for(;j--;){o=c.createElement("div");o.id=t?t[j]:"modernizr"+(j+1);l.appendChild(o)}j=["­<style>",g,"</style>"].join("");l.id=
|
||
|
"modernizr";l.innerHTML+=j;v.appendChild(l);g=h(l,g);l.parentNode.removeChild(l);return!!g},n,p={}.hasOwnProperty,q;!f(p,d)&&!f(p.call,d)?(q=function(g,h){return p.call(g,h)}):(q=function(g,h){return h in g&&f(g.constructor.prototype[h],d)});for(var r in m)q(m,r)&&(n=r.toLowerCase(),k[n]=m[r](),w.push((k[n]?"":"no-")+n));i("");m=null;k._version="2.0.6";k.mq=function(g){if(b.matchMedia)return matchMedia(g).matches;var h;u("@media "+g+" { #modernizr { position: absolute; } }",function(j){h=(b.getComputedStyle?
|
||
|
getComputedStyle(j,null):j.currentStyle).position=="absolute"});return h};k.testProp=function(g){return e([g])};k.testStyles=u;return k}(this,this.document);
|
||
|
(function(){var b=new FlameURI;b.flameURI();if(b.hashVarPresent("protoFluid")){var c=b.getHashVar("protoFluid");bExecProtoFluid=c===undefined||c===false?false:true}if(parent.bExecProtoFluid===true)if(typeof jQuery=="undefined")alert("ProtoFluid requires jQuery.\nhttp://protofluid.com/?c=docs");else{if(parent.bProtoFluidExecuted!==true){console.log("ProtoFluid v3.02. http://protofluid.com. Endlessly tweaked by Edward Cant. @opticswerve.\n\n");if(!Modernizr.mq("(min-device-width: 768px)")||!jQuery.support.opacity){if(b.hashVarPresent("protoFluid")){b.removeHashVar("protoFluidOrientation");
|
||
|
b.removeHashVar("protoFluidScroll");b.removeHashVar("protoFluid")}screen.width<768?alert("ProtoFluid requires a screen width of at least 768 pixels.\n\nPlease try again on a screen that is at least the size of an iPad."):alert("ProtoFluid requires a modern browser like Google Chrome. Please upgrade.");bProtoFluidReady=true;jQuery(document).ready(function(){protoFluidEvents()});return}}else bProtoFluidReady=true;jQuery(document).ready(function(){if(parent.bProtoFluidExecuted===true){parent.protoFluid.readyTimeout===
|
||
|
undefined&&parent.protoFluid.onLocationChange();removeProtoFluidCode();jQuery("body").addClass("protoFluid");window.onunload=function(){bFlameDebug&&console.log("UNLOAD frame");protoFluid.onLocationChange()};jQuery("body").click(function(d){if(jQuery(d.target).hasClass("exitProtoFluid")){b.location=parent.window.location.href;b.hashVarPresent("protoFluid")?exitProtoFluid():alert("ProtoFluid is set to automatically execute. Disable this if you wish to use an exit button.\n\nhttp://protofluid.com/?c=docs#execution");
|
||
|
return false}else if(jQuery(d.target).hasClass("launchProtoFluid")){alert("ProtoFluid is already running");return false}else if(jQuery(d.target).hasClass("previewProtoFluid")){var e=jQuery(d.target);d=e.attr("data-width");var f=e.attr("data-height"),i=e.attr("data-desc"),k=e.attr("data-scroll");e=e.attr("data-orientation");protoFluid.uri.addHashVar("protoFluid",d+","+f+","+i);e!==undefined?protoFluid.uri.addHashVar("protoFluidOrientation",e):protoFluid.uri.removeHashVar("protoFluidOrientation");k!==
|
||
|
undefined?protoFluid.uri.addHashVar("protoFluidScroll",k):protoFluid.uri.removeHashVar("protoFluidScroll");parent.window.location.reload(true);return false}});parent.protoFluid.bFrameReady=true;bFlameDebug&&console.log("Frame READY");protoFluid=parent.protoFluid}else{bProtoFluidExecuted=true;window.onhashchange=function(){bFlameDebug&&console.log("WINDOW hash change");if(!b.hashVarPresent("protoFluid")||b.getHashVar("protoFluid")===false)window.location.reload(true)};jQuery("*").unbind();jQuery(window).unbind();
|
||
|
jQuery("html, body").height(document.documentElement.clientHeight);protoFluid=new ProtoFluid;protoFluid.protoFluid();protoFluid.bDemo||protoFluid.uri.addHashVar("protoFluid","ready");jQuery("head").append('<meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-status-bar-style" content="black" />');window.onunload=function(){var d=protoFluid;if(d.localStorage.bSupported){d.frameURI.location!==undefined&&d.localStorage.set("pfLocation",d.frameURI.location);d.localStorage.set("pfRestrictHeight",
|
||
|
d.bRestrictHeight);d.localStorage.set("pfTechInfo",d.bTechInfo);d.localStorage.set("pfLandscape",d.bLandscape);d.localStorage.set("pfFrameIndex",d.currentFrameIndex)}}}})}else{bProtoFluidReady=true;b.bExecute=false;b.push();b.addHashVar("protoFluid");console.log("To enable ProtoFluid, supply a hashtag of #protoFluid. So, "+b.toString()+"\n\n");if(typeof jQuery=="undefined")alert("ProtoFluid requires jQuery.\nhttp://protofluid.com/?c=docs#jQuery");else{removeProtoFluidCode();jQuery(document).ready(function(){window.onhashchange=
|
||
|
function(){bFlameDebug&&console.log("FRAME hash change");b.hashVarPresent("protoFluid")&&b.getHashVar("protoFluid")!==false&&window.location.reload(true)};protoFluidEvents()})}}})();function addProtoFluidFrame(b,c,d,e){if(protoFluid!==undefined&&!protoFluid.bDemo){protoFluid.addFrame(b,c,d,e);protoFluid.currentFrame===undefined&&protoFluid.setFrame(0)}}
|
||
|
function clearProtoFluidFrames(){try{if(protoFluid!==undefined&&!protoFluid.bDemo){protoFluid.clearFrames();protoFluid.updateBar()}}catch(b){bFlameDebug&&console.log("Failed to clear ProtoFluid frames")}}function exitProtoFluid(){try{protoFluid.cleanHash();parent.window.location.reload(true);return false}catch(b){bFlameDebug&&console.log("Failed ProtoFluid exit")}}
|
||
|
function launchProtoFluid(){try{var b=new FlameURI;b.flameURI();b.addHashVar("protoFluid");window.location.reload(true)}catch(c){bFlameDebug&&console.log("Failed ProtoFluid launch")}}
|
||
|
function protoFluidEvents(){jQuery("body").click(function(b){if(jQuery(b.target).hasClass("exitProtoFluid")){alert("ProtoFluid is not running");return false}else if(jQuery(b.target).hasClass("launchProtoFluid")){launchProtoFluid();return false}else if(jQuery(b.target).hasClass("previewProtoFluid")){var c=new FlameURI;c.flameURI();var d=jQuery(b.target);b=d.attr("data-width");var e=d.attr("data-height"),f=d.attr("data-desc"),i=d.attr("data-orientation");d=d.attr("data-scroll");c.addHashVar("protoFluid",
|
||
|
b+","+e+","+f);i!==undefined&&c.addHashVar("protoFluidOrientation",i);d!==undefined&&c.addHashVar("protoFluidScroll",d);window.location.reload(true);return false}})}function protoFluidReady(b){if(b===undefined){if(bProtoFluidReady===true)return true;return false}protoFluidReady()&&typeof jQuery!="undefined"&&jQuery(document).ready(function(){b()})}
|
||
|
function removeProtoFluidCode(){for(var b=jQuery("head link"),c=0;c<b.length;c++)if(b.eq(c).attr("href")===undefined||b.eq(c).attr("href").indexOf("protoFluid")!==-1)b.eq(c).remove();b=jQuery("head script");for(c=0;c<b.length;c++)if(b.eq(c).attr("src")===undefined||b.eq(c).attr("src").indexOf("protoFluid")!==-1)b.eq(c).remove()}function setProtoFluidFrame(b){try{protoFluid!==undefined&&protoFluid.setFrame(b)}catch(c){bFlameDebug&&console.log("Failed to set ProtoFluid frame")}}
|
||
|
function ProtoFluid(){this.protoFluid=function(){this.bLandscape=this.bHideMenu=this.bFrameReady=this.bFrameLoaded=this.bDemo=false;this.bRestrictHeight=true;this.bSameDomain=false;this.bShowFrame=true;this.bTechInfo=false;this.frameURI=new FlameURI;this.frameURI.flameURI();this.frameURI.bExecute=false;this.uri=new FlameURI;this.uri.flameURI();this.localStorage=new FlameLocalStorage;this.localStorage.flameLocalStorage();this.modalManager=new FlameModalManager;this.modalManager.flameModalManager();
|
||
|
this.frames=[];this.loadFrames();this.scrollY=this.scrollX=0;var b=this.uri.getHashVar("protoFluid");if(b!==undefined&&b.toString().indexOf(",")!==-1)this.bDemo=true;if(this.bDemo){b=this.uri.getHashVarParams("protoFluid");if(screen.width===b[0]){removeProtoFluidCode();this.cleanHash();window.location.reload("true")}var c=this.uri.getHashVar("protoFluidOrientation");if(c===undefined)c=true;var d=this.uri.getHashVar("protoFluidScroll");if(d===undefined)d=true;this.removeClientCode();this.clearFrames();
|
||
|
b.length===3?this.addFrame(b[0],b[1],b[2],c,d):this.addFrame(b[0],b[1],"Custom",c,d);this.setFrame(0)}else this.removeClientCode();b=new FlameCSS;b.flameCSS();b.injectExternal(protoFluidResetCSS);b.injectExternal(protoFluidCSS);jQuery("body").html('<!-- Your code is neatly contained in the following frame --\><iframe class="protoFluid" scrolling="no"></iframe>');this.viewport=jQuery("iframe");jQuery("body").append('<div id="protoFluidFrame"><div class="glare"></div></div>');jQuery("body").append('<a id="info"></a>');
|
||
|
jQuery("body").append('<div id="protoFluid"></div>');jQuery("#protoFluid").append('<div class="menuBar" id="menuBar"><ul></ul></div>');b=jQuery("#menuBar ul");if(this.bDemo){b.addClass("demo");b.append('<li><a class="button" id="rotate">Rotate<div class="icon phoneIcon"><div class="phoneIconButton"></div></div></a></li>');b.append('<li><a class="button" id="height">Restrict height<div class="icon heightIcon"></div></a></li>');this.modalManager.notifyDelay=8E3;setTimeout(function(){var f=protoFluid.modalManager.openNotification("demoNotify",
|
||
|
"#protoFluid");f.setContent('<a class = "exe" href="http://protofluid.com">'+protoFluid.currentFrame.desc+" — A ProtoFluid Viewport</a>");f.domElement.animate({bottom:129},400)},1E3)}else{b.append('<li><a class="button" id="previous">Previous<div class="icon arrowIcon"></div></a></li>');b.append('<li><a class="button" id="next">Next<div class="icon arrowIcon"></div></a></li>');b.append('<li><a class="button" id="rotate">Rotate<div class="icon phoneIcon"><div class="phoneIconButton"></div></div></a></li>');
|
||
|
b.append('<li><a class="button" id="height">Restrict height<div class="icon heightIcon"></div></a></li>');b.append('<li><a class="button" id="link">Link<div class="icon linkIcon"><div class="linkIconHead"></div><div class="linkIconHead linkIconTail"></div></div></a></li>');b.append('<li><a class="button" id="settings">Settings<div class="icon spannerIcon"><div class="spannerEnd"></div><div class="spannerHandle"></div></div></a></li>')}if(this.bDemo)protoFluid.free();else{this.license=new FlameLicense;
|
||
|
this.license.flameLicense();this.license.app="ProtoFluid";this.license.check(function(f){if(f==="standard")protoFluid.standard();else if(f==="pro")protoFluid.pro();else f==="elite"?protoFluid.elite():protoFluid.free()})}this.frameURI.location=this.localStorage.check("pfLocation")&&this.uri.getHashVar("protoFluid")==="ready"?this.localStorage.get("pfLocation"):window.location.href;bFlameDebug&&console.log("Initial URL: "+this.frameURI.location);this.frameURI.removeHashVar("protoFluid");this.frameURI.removeHashVar("protoFluidOrientation");
|
||
|
this.frameURI.removeHashVar("protoFluidScroll");this.frameURI.clean();bFlameDebug&&console.log("Cleaned URL: "+this.frameURI.location);this.viewport[0].contentWindow.location=this.frameURI.location;if(this.bDemo)this.setFrame(0);else this.localStorage.check("pfFrameIndex")?this.setFrame(this.localStorage.getInt("pfFrameIndex")):this.setFrame(0);if(this.bHideMenu){var e=jQuery("#menuBar");e.hover(function(){e.removeClass("min");return false},function(){e.addClass("min");return false});b=document.getElementById("menuBar");
|
||
|
b.addEventListener("touchstart",function(){e.removeClass("min");return false},false);b.addEventListener("touchend",function(){},false)}this.bHideMenu&&setTimeout(function(){jQuery("#menuBar").addClass("min");console.log("menubar hidden")},1E3);this.license!==undefined&&!this.license.bCut&&this.loadPreviousSettings();this.viewport.load(function(){protoFluid.bFrameLoaded=true;bFlameDebug&&console.log("Frame LOADED");protoFluid.bFrameReady||protoFluid.onLocationChangeComplete()});setTimeout(function(){window.onfocus=
|
||
|
function(){protoFluid.updateFrame()};window.onresize=function(){jQuery("html, body").height(document.documentElement.clientHeight);protoFluid.updateFrame()};if(!protoFluid.bDemo&&protoFluid.license.bCut){var f=protoFluid.modalManager.openNotification("upgradeNotify","#protoFluid");f.setStrong();f.setContent("<p>Trial expired. Please buy a license.</p>");jQuery("body").append('<a class="exe" href="http://protofluid.com" id="buy">Buy ProtoFluid</a>');jQuery("#buy").hide();jQuery("#buy").fadeIn(400)}},
|
||
|
1E3)};this.destroy=function(){for(var b=0;b<this.frames.length;b++)delete this.frames[b];delete this.frames;this.currentFrame=undefined};this.addFrame=function(b,c,d,e,f){this.frames.push(new ProtoFluidFrame(b,c,d,e,f))};this.cleanHash=function(){this.uri.removeHashVar("protoFluidOrientation");this.uri.removeHashVar("protoFluidScroll");this.uri.removeHashVar("protoFluid")};this.clearFrames=function(){for(var b=this.frames.length;b--;)delete this.frames[b];this.currentFrame=undefined;this.currentFrameIndex=
|
||
|
0;this.frames.length=0};this.cutNotice=function(){var b=protoFluid.modalManager.openNotification("expireNotify","#protoFluid");b.setStrong();b.setContent("<p>Available in the full app. Please support ProtoFluid and buy a license.</p>")};this.disableButtons=function(){jQuery("#height").addClass("disabled");jQuery("#link").addClass("disabled");jQuery("#next").addClass("disabled");jQuery("#previous").addClass("disabled");jQuery("#rotate").addClass("disabled");jQuery("#settings").addClass("disabled")};
|
||
|
this.elite=function(){this.pro()};this.enableButtons=function(){jQuery("#height").removeClass("disabled");jQuery("#link").removeClass("disabled");jQuery("#next").removeClass("disabled");jQuery("#previous").removeClass("disabled");jQuery("#rotate").removeClass("disabled");jQuery("#settings").removeClass("disabled")};this.free=function(){this.initCoreEvents();if(this.license!==undefined&&this.license.bCut){bFlameDebug&&console.log("Cutting features");jQuery("#height").addClass("disabled");jQuery("#rotate").addClass("disabled");
|
||
|
jQuery("#height").click(function(){protoFluid.cutNotice();protoFluid.updateBar();return false});jQuery("#rotate").click(function(){protoFluid.cutNotice();protoFluid.updateBar();return false})}else this.initStandardEvents()};this.heightToggle=function(){if(this.currentFrame===undefined){this.noFrameNotice();this.updateBar()}else{this.modalManager.isOpen("heightNotify")&&this.modalManager.get("heightNotify").setStrong();this.modalManager.closeAll(true);(this.bRestrictHeight=!this.bRestrictHeight)&&
|
||
|
window.scrollTo(0,0);this.updateFrame()}};this.initCoreEvents=function(){jQuery("body, .body").click(function(b){if(jQuery(b.target).hasClass("modal")){b=jQuery(b.target).attr("id");var c=protoFluid.modalManager.get(b);c!==undefined&&c.bAutoDismiss&&protoFluid.modalManager.close(b);protoFluid.updateBar();return false}else if(jQuery(b.target).hasClass("exe"))return true;else if(jQuery(b.target).is("input"))return true;protoFluid.modalManager.closeAll(true);protoFluid.updateBar();return false});jQuery("#menuBar").click(function(){return false});
|
||
|
jQuery("#info").click(function(){protoFluid.bTechInfo=!protoFluid.bTechInfo;protoFluid.updateInfo();return false});jQuery("#link").click(function(){protoFluid.link();return false});jQuery("#next").click(function(){protoFluid.next();return false});jQuery("#previous").click(function(){protoFluid.previous();return false});jQuery("#settings").click(function(){protoFluid.settings();return false})};this.initStandardEvents=function(){jQuery("#height").click(function(){protoFluid.heightToggle();return false});
|
||
|
jQuery("#rotate").click(function(){protoFluid.rotate();return false})};this.link=function(){if(this.currentFrame===undefined)this.noFrameNotice();else if(this.modalManager.isOpen("linkModal"))this.modalManager.remove("linkModal");else if(this.bFrameReady!==true)this.modalManager.openNotification("linkNotify","#protoFluid").setContent("The current location does not support ProtoFluid");else{savedURI=this.frameURI.location;this.frameURI.addHashVar("protoFluid",this.currentFrame.width+","+this.currentFrame.height+
|
||
|
","+this.currentFrame.desc);this.frameURI.addHashVar("protoFluidOrientation",this.currentFrame.orientation);if(!this.modalManager.isOpen("linkModal")){var b=this.modalManager.open("linkModal","#protoFluid");b.bAutoDismiss=false;b.setContent('<div><input type="url" value="'+this.frameURI.location+'" /></div>');b.append('<div><a class="button exe" href="https://twitter.com/share?text='+encodeURI(document.title)+"&related=OpticSwerve&via=ProtoFluid&url="+encodeURIComponent(this.frameURI.location)+'" id="tweet" target="_blank">tweet</a></div>');
|
||
|
b.show()}this.frameURI.location=savedURI;if(this.frameURI.location.indexOf("localhost")!==-1){jQuery("#tweet").addClass("disabled");bFlameDebug&&console.log("Cannot share a local resource.");jQuery("#tweet").click(function(){protoFluid.modalManager.openNotification("tweetNotify","#protoFluid").setContent("Cannot tweet a local resource");protoFluid.updateBar();return false})}}this.updateBar()};this.loadFrames=function(b){if(b!=="android")if(b==="apple"){this.addFrame(320,480,"iPhone",true);this.addFrame(768,
|
||
|
1024,"iPad",true);this.addFrame(1366,768,"11-inch MacBook Air",false);this.addFrame(1440,900,"13-inch MacBook Air",false);this.addFrame(2560,1440,"27-inch iMac",false)}else if(b==="windows")this.addFrame(480,800,"Nokia Lumia 800",true);else if(b==="standards"){this.addFrame(320,200,"CGA",false);this.addFrame(640,480,"VGA",false);this.addFrame(800,600,"SVGA",false);this.addFrame(854,480,"WVGA",false);this.addFrame(1400,1050,"SXGA+",false);this.addFrame(1600,1200,"UXGA",false);this.addFrame(1680,1050,
|
||
|
"WSXGA+",false);this.addFrame(2048,1080,"2K",false);this.addFrame(4096,2304,"4K",false)}else if(b==="tv"){this.addFrame(852,480,"480p",false);this.addFrame(1280,720,"HD — 720p",false);this.addFrame(1920,1080,"HD — 1080p",false)}else if(b==="viewports"){this.addFrame(520,520,"Facebook Page Tab",false);this.addFrame(760,800,"Facebook Canvas App",false);this.addFrame(980,1470,"iOS Safari Viewport (portrait)",false);this.addFrame(980,653,"iOS Safari Viewport (landscape)",false)}else{this.addFrame(320,
|
||
|
480,"iPhone",true);this.addFrame(520,520,"Facebook Page Tab",false);this.addFrame(600,1024,"Kindle Fire",true);this.addFrame(768,1024,"iPad",true);this.addFrame(800,600,"SVGA",false);this.addFrame(980,1470,"iOS Safari Viewport",false);this.addFrame(1280,720,"HD — 720p",false);this.addFrame(1440,900,"13-inch MacBook Air",false);this.addFrame(1680,1050,"WSXGA+",false)}};this.loadPreviousSettings=function(){if(this.localStorage.bSupported){if(this.localStorage.check("pfLandscape"))this.bLandscape=
|
||
|
this.localStorage.get("pfLandscape");if(this.localStorage.check("pfRestrictHeight"))this.bRestrictHeight=this.localStorage.get("pfRestrictHeight");if(this.localStorage.check("pfTechInfo"))this.bTechInfo=this.localStorage.get("pfTechInfo")}};this.next=function(){if(this.currentFrame===undefined){this.noFrameNotice();this.updateBar()}else{this.modalManager.isOpen("nextNotify")?this.modalManager.get("nextNotify").setStrong():this.modalManager.closeAll(true);if(this.currentFrameIndex<this.frames.length-
|
||
|
1){this.setFrame(this.currentFrameIndex+1);this.updateFrame()}else{this.modalManager.openNotification("nextNotify","#protoFluid").setContent("No more viewports available. You've reached the end of the list.");this.updateBar()}}};this.noFrameNotice=function(){var b=protoFluid.modalManager.openNotification("noViewportNotify","#protoFluid");b.setStrong();b.setContent("<p>There are no available viewports</p>")};this.onLocationChange=function(){if(this.readyTimeout===undefined){this.bFrameReady=this.bFrameLoaded=
|
||
|
false;this.locationChangeAttempt=0}else if(this.locationChangeAttempt>10){bFlameDebug&&console.log("Gave up on location change");protoFluid.onLocationChangeComplete();return}bFlameDebug&&console.log("Location change attempt: "+this.locationChangeAttempt);this.locationChangeAttempt++;this.readyTimeout=setTimeout(function(){protoFluid.bFrameReady===true?protoFluid.onLocationChangeComplete():protoFluid.onLocationChange()},500)};this.onLocationChangeComplete=function(){clearTimeout(this.readyTimeout);
|
||
|
this.locationChangeAttempt=this.readyTimeout=undefined;if(this.bFrameReady)bFlameDebug&&console.log("Frame SUPPORTS ProtoFluid");else bFlameDebug&&console.log("Frame DOES NOT support ProtoFluid");this.bSameDomain=false;this.currentHostname=undefined;this.frameWindow=this.frameDocument=this.frameURI.location=undefined;this.updateFrameRefs();if(this.originalHostname===undefined)this.originalHostname=this.frameWindow.location.hostname;try{this.currentHostname=this.frameWindow.location.hostname;this.frameURI.location=
|
||
|
this.frameWindow.location.href;bFlameDebug&&console.log("Location change complete: "+this.frameURI.location)}catch(b){bFlameDebug&&console.log("Location update error. "+b.message)}if(this.currentHostname===this.originalHostname){bFlameDebug&&console.log("SAME DOMAIN. Original was "+this.originalHostname+". New is "+this.currentHostname+".");this.bSameDomain=true}else{bFlameDebug&&console.log("CROSS DOMAIN. Original: "+this.originalHostname+". New: "+this.currentHostname);var c=this.modalManager.openNotification("domainNotify",
|
||
|
"#protoFluid");c.setContent("Left original domain. Some features disabled.");c.setStrong()}this.updateFrame()};this.previous=function(){if(this.currentFrame===undefined){this.noFrameNotice();this.updateBar()}else{this.modalManager.isOpen("previousNotify")?this.modalManager.get("previousNotify").setStrong():this.modalManager.closeAll(true);if(this.currentFrameIndex!==0){this.setFrame(this.currentFrameIndex-1);this.updateFrame()}else protoFluid.modalManager.openNotification("previousNotify","#protoFluid").setContent("No more viewports available. This is the first one.")}};
|
||
|
this.pro=function(){this.standard()};this.removeClientCode=function(){for(var b=jQuery("head").find("link"),c=0;c<b.length;c++)if(b.eq(c).attr("href")===undefined||b.eq(c).attr("href").indexOf("protoFluid")===-1)b.eq(c).remove();b=jQuery("head").find("script");for(c=0;c<b.length;c++)if(b.eq(c).attr("src")===undefined||b.eq(c).attr("src").indexOf("protoFluid")===-1)b.eq(c).remove()};this.rotate=function(){if(this.currentFrame===undefined){this.noFrameNotice();this.updateBar()}else{this.modalManager.isOpen("rotateNotify")?
|
||
|
this.modalManager.get("rotateNotify").setStrong():this.modalManager.closeAll(true);if(protoFluid.currentFrame.orientation){protoFluid.bLandscape=!protoFluid.bLandscape;protoFluid.updateFrame()}else{protoFluid.modalManager.openNotification("rotateNotify","#protoFluid").setContent("Orientation switching is disabled for this viewport");return false}}};this.scroll=function(b,c){this.scrollX+=b;this.scrollY+=c;this.frameWindow!==undefined&&this.frameWindow.scrollTo(this.scrollX,this.scrollY)};this.setFrame=
|
||
|
function(b){if(b<0||b>=this.frames.length){bFlameDebug&&console.log("Tried to set non-existent frame");b=0}this.currentFrameIndex=b;this.currentFrame=this.frames[b]};this.setHeight=function(b){this.viewport.height(b)};this.setWidth=function(b){this.viewport.width(b)};this.settings=function(){if(this.modalManager.isOpen("settingsModal"))this.modalManager.remove("settingsModal");else if(this.modalManager.isOpen("licenseModal"))this.modalManager.remove("licenseModal");else{var b=this.modalManager.open("settingsModal",
|
||
|
"#protoFluid");b.bAutoDismiss=false;var c=this.license.plan;if(c===undefined)c="free";c=c.substr(0,1).toUpperCase()+c.substr(1);b.setContent('<div><a class="osButton" id="aLicense">activate key</a></div><div>ProtoFluid '+c+"</div>");b.show();jQuery("#aLicense").click(function(){protoFluid.license.input(protoFluid.modalManager);return false})}this.updateBar()};this.sortFrames=function(){};this.standard=function(){this.free()};this.updateBar=function(){if(this.currentFrame===undefined){this.disableButtons();
|
||
|
this.modalManager.isOpen("settingsModal")||this.modalManager.isOpen("licenseModal")?jQuery("#settings").addClass("disabled"):jQuery("#settings").removeClass("disabled")}else{if(this.bDemo||!this.license.bCut){jQuery("#height").removeClass("disabled");this.bRestrictHeight?jQuery("#height").removeClass("on"):jQuery("#height").addClass("on");if(this.currentFrame.orientation){jQuery("#rotate").removeClass("disabled");this.bLandscape?jQuery("#rotate").addClass("on"):jQuery("#rotate").removeClass("on")}else{jQuery("#rotate").addClass("disabled");
|
||
|
this.currentFrame.width>this.currentFrame.height?jQuery("#rotate").addClass("on"):jQuery("#rotate").removeClass("on")}}if(!this.bDemo){this.currentFrameIndex===0?jQuery("#previous").addClass("disabled"):jQuery("#previous").removeClass("disabled");this.currentFrameIndex===this.frames.length-1?jQuery("#next").addClass("disabled"):jQuery("#next").removeClass("disabled");this.modalManager.isOpen("linkModal")?jQuery("#link").addClass("disabled"):jQuery("#link").removeClass("disabled");this.modalManager.isOpen("settingsModal")||
|
||
|
this.modalManager.isOpen("licenseModal")?jQuery("#settings").addClass("disabled"):jQuery("#settings").removeClass("disabled")}}};this.updateFrame=function(){bFlameDebug&&console.log("UPDATE frame. Including container, bar and info.");if(this.currentFrame===undefined)bFlameDebug&&console.log("FAILED frame update. Frame not defined.");else{this.updateFrameWidth();this.updateFrameHeight();this.viewport.css("visibility")==="hidden"&&this.viewport.css("visibility","visible");this.updateFrameContainer();
|
||
|
this.updateBar();this.updateInfo()}};this.updateFrameContainer=function(){if(this.currentFrame===undefined)bFlameDebug&&console.log("FAILED frame container update. Frame not defined.");else{var b=jQuery("#protoFluidFrame");(this.bShowFrame=this.bLandscape&&this.currentFrame.orientation?this.currentFrame.height>=document.documentElement.clientWidth?false:true:this.currentFrame.width>=document.documentElement.clientWidth?false:true)?this.viewport.css("margin","66px 0 160px"):this.viewport.css("margin",
|
||
|
"50px 0 128px");if(this.bShowFrame){b.height(this.viewport.height()+64);b.width(this.viewport.width()+30);b.show();b.offset({left:this.viewport.offset().left-16,top:16})}else b.hide()}};this.updateFrameHeight=function(){navigator.userAgent.indexOf("Firefox")!==-1&&this.setHeight(16);if(this.bLandscape&&this.currentFrame.orientation)if(this.bRestrictHeight)this.setHeight(this.currentFrame.width);else this.bSameDomain?this.setHeight(this.frameDocument.scrollHeight):this.setHeight(4096);else if(this.bRestrictHeight)this.setHeight(this.currentFrame.height);
|
||
|
else this.bSameDomain?this.setHeight(this.frameDocument.scrollHeight):this.setHeight(4096);if(this.bRestrictHeight)if(this.bLandscape&&this.currentFrame.orientation)this.currentFrame.width+240>document.documentElement.clientHeight?jQuery("body").css("overflow","auto"):jQuery("body").css("overflow","hidden");else this.currentFrame.height+240>document.documentElement.clientHeight?jQuery("body").css("overflow","auto"):jQuery("body").css("overflow","hidden");else if(this.bSameDomain)this.frameDocument.scrollHeight+
|
||
|
240>document.documentElement.clientHeight?jQuery("body").css("overflow","auto"):jQuery("body").css("overflow","hidden");else jQuery("body").css("overflow","auto")};this.updateFrameRefs=function(){try{this.frameWindow=this.viewport[0].contentWindow}catch(b){this.frameWindow=undefined;bFlameDebug&&console.log("Could not get ProtoFluid frame window reference");return false}try{this.frameDocument=this.viewport[0].contentDocument.documentElement}catch(c){this.frameDocument=undefined;bFlameDebug&&console.log("Could not get ProtoFluid frame document reference. "+
|
||
|
c.message);return false}return true};this.updateFrameWidth=function(){this.bLandscape&&this.currentFrame.orientation?this.setWidth(this.currentFrame.height):this.setWidth(this.currentFrame.width)};this.updateInfo=function(){var b=jQuery("#info");if(this.bShowFrame){b.removeClass("noFrame");b.offset({left:this.viewport.offset().left});this.bLandscape&&this.currentFrame.orientation?b.width(this.currentFrame.height):b.width(this.currentFrame.width)}else{b.addClass("noFrame");b.width(this.currentFrame.width);
|
||
|
b.offset({left:0})}if(this.currentFrame.orientation)if(this.bTechInfo)if(this.bLandscape)this.bRestrictHeight?jQuery("#info").html(this.currentFrame.height+" x "+this.currentFrame.width):jQuery("#info").html(this.currentFrame.height+" x 100%");else this.bRestrictHeight?jQuery("#info").html(this.currentFrame.width+" x "+this.currentFrame.height):jQuery("#info").html(this.currentFrame.width+" x 100%");else if(this.bLandscape)if(this.bRestrictHeight)jQuery("#info").html(this.currentFrame.desc+" — landscape");
|
||
|
else this.bSameDomain?jQuery("#info").html(this.currentFrame.desc+" — landscape — document height"):jQuery("#info").html(this.currentFrame.desc+" — landscape — viewport fitted height");else if(this.bRestrictHeight)jQuery("#info").html(this.currentFrame.desc);else this.bSameDomain?jQuery("#info").html(this.currentFrame.desc+" — document height"):jQuery("#info").html(this.currentFrame.desc+" — viewport fitted height");else if(this.bTechInfo)this.bRestrictHeight?jQuery("#info").html(this.currentFrame.width+
|
||
|
" x "+this.currentFrame.height):jQuery("#info").html(this.currentFrame.width+" x 100%");else this.bRestrictHeight?jQuery("#info").html(this.currentFrame.desc):jQuery("#info").html(this.currentFrame.desc+" — document height")};return true}
|
||
|
function ProtoFluidFrame(b,c,d,e,f){this.width=b;this.height=c;this.desc=d;this.orientation=e;this.scroll=f;this.toString=function(){return this.desc+". "+this.width+" x "+this.height+"px. Orientation: "+this.orientation+", scrolling: "+this.scroll};return true}FlameModal.prototype.hidePolicy=function(){var b=this.domElement;this.domElement.fadeOut(400,function(){b.remove()})};
|
||
|
FlameModal.prototype.showPolicy=function(){this.domElement.show();this.domElement.addClass("menuBar");this.domElement.css("bottom",129);this.bNotification?this.domElement.css("left",document.documentElement.clientWidth/2-this.domElement.outerWidth()/2):this.domElement.css("left",0)};
|