Difference between revisions of "MediaWiki:Mobile.js"

From Kiwix
Jump to navigation Jump to search
(Created page with "→‎Any JavaScript here will be loaded for users using the mobile site: →‎"SmartBanner" dialog box for Android: if (navigator.userAgent.toLowerCase().indexOf("android") >...")
 
 
(13 intermediate revisions by the same user not shown)
Line 2: Line 2:


/* "SmartBanner" dialog box for Android */
/* "SmartBanner" dialog box for Android */
if (navigator.userAgent.toLowerCase().indexOf("android") > -1) {
if (document.cookie.indexOf("smartBanner") == -1) {
if (!$.cookie("smartBanner")) {
  if (confirm("Install Kiwix on your device?")) {
    if (confirm("Install Kiwix on your device?")) {
    window.location.href= "market://details?id=org.kiwix.kiwixmobile";
        window.location.href= "market://details?id=org.kiwix.kiwixmobile";
  }
    }
 
    $.cookie("smartBanner", true, { expires : 60 });
  var expiry = new Date();
}
  var now = new Date();
  expiry.setTime(now.getTime()+(100*24*60*60*1000)); // 100 days
  document.cookie="smartBanner=true;expires=" + expiry.toGMTString();
}
}

Latest revision as of 19:26, 8 November 2015

/* Any JavaScript here will be loaded for users using the mobile site */

/* "SmartBanner" dialog box for Android */
if (document.cookie.indexOf("smartBanner") == -1) {
  if (confirm("Install Kiwix on your device?")) {
    window.location.href= "market://details?id=org.kiwix.kiwixmobile";
  }

  var expiry = new Date();
  var now = new Date();
  expiry.setTime(now.getTime()+(100*24*60*60*1000)); // 100 days
  document.cookie="smartBanner=true;expires=" + expiry.toGMTString();
}