Skip to content

Instantly share code, notes, and snippets.

@ricardodantas
Created November 17, 2014 22:45
Show Gist options
  • Select an option

  • Save ricardodantas/08caec7b9684a7d3b500 to your computer and use it in GitHub Desktop.

Select an option

Save ricardodantas/08caec7b9684a7d3b500 to your computer and use it in GitHub Desktop.
Mobify merge tag for mobile and tablet projects.
<!-- MOBIFY - DO NOT ALTER - PASTE IMMEDIATELY AFTER OPENING HEAD TAG -->
<script type="text/javascript">
/*<![CDATA[*/(function(c,f){function h(a){if(a.mode){var b=g("mobify-mode");b&&a[b]||(b=a.mode(d.ua));return a[b]}return a}function m(){function a(a){c.addEventListener(a,function(){d[a]=+new Date},!1)}c.addEventListener&&(a("DOMContentLoaded"),a("load"))}function n(){var a=new Date;a.setTime(a.getTime()+3E5);f.cookie="mobify-path=; expires="+a.toGMTString()+"; path=/";c.location.reload()}function p(){k({src:"https://preview.mobify.com/v7/"})}function g(a){if(a=f.cookie.match(RegExp("(^|; )"+a+"((=([^;]*))|(; |$))")))return a[4]||""}function l(a){f.write('<plaintext style="display:none">');setTimeout(function(){e.capturing=!0;a()},0)}function k(a,b){var c=f.getElementsByTagName("script")[0],d=f.createElement("script"),e;for(e in a)d[e]=a[e];b&&d.setAttribute("class",b);c.parentNode.insertBefore(d,c)}var e=c.Mobify={},d=e.Tag={};e.points=[+new Date];e.tagVersion=[7,0];d.ua=c.navigator.userAgent;d.getOptions=h;d.init=function(a){d.options=a;if(""!==g("mobify-path"))if(m(),a.skipPreview||"true"!=g("mobify-path")&&!/mobify-path=true/.test(c.location.hash)){var b=h(a);if(b){var e=function(){b.post&&b.post()};a=function(){b.pre&&b.pre();k({id:"mobify-js",src:b.url,onerror:n,onload:e},"mobify")};!1===b.capture?a():l(a)}}else l(p)}})(window,document);(function(){Mobify.Tag.init({mode:function(c){return/ip(hone|od)|android.*(mobile)|blackberry.*applewebkit|bb1\d.*mobile/i.test(c)?"smartphone":/ipad|android(?!.*mobile)/i.test(c)?"tablet":"desktop"},smartphone:{url:"//cdn.mobify.com/sites/PROJECTNAME-mobile/production/adaptive.min.js"},tablet:{url:"//cdn.mobify.com/sites/PROJECTNAME-tablet/production/adaptive.min.js"},desktop:{capture:!1,url:"//a.mobify.com/PROJECTNAME-mobile/a.js"}})})();/*]]>*/
</script>
<!-- END MOBIFY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment