Difference between revisions of "MediaWiki:Mobile.js"

From Kiwix
Jump to navigation Jump to search
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") < 0) {
  if (confirm("Install Kiwix on your device?")) {
alert('You are using Android')
    window.location.href= "market://details?id=org.kiwix.kiwixmobile";
if (!$.cookie("smartdBanner")) {
  }
alert('Have you already tried Kiwix for Android?')
 
    if (confirm("Install Kiwix on your device?")) {
  expiry = new Date();
        window.location.href= "market://details?id=org.kiwix.kiwixmobile";
  expiry.setTime(date.getTime()+(10*60*1000)); // Ten minutes
    }
  document.cookie = "smartBanner=true; expires=" + expiry.toGMTString();
    $.cookie("smartBanner", true, { expires : 60 });
}
}
}

Revision as of 19:15, 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") < 0) {
  if (confirm("Install Kiwix on your device?")) {
    window.location.href= "market://details?id=org.kiwix.kiwixmobile";
  }

  expiry = new Date();
  expiry.setTime(date.getTime()+(10*60*1000)); // Ten minutes
  document.cookie = "smartBanner=true; expires=" + expiry.toGMTString();
}