Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Madagascar/frwp/Radama_II_files/MobileRedirect.js
diff options
context:
space:
mode:
Diffstat (limited to 'Madagascar/frwp/Radama_II_files/MobileRedirect.js')
-rw-r--r--Madagascar/frwp/Radama_II_files/MobileRedirect.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/Madagascar/frwp/Radama_II_files/MobileRedirect.js b/Madagascar/frwp/Radama_II_files/MobileRedirect.js
new file mode 100644
index 0000000..b16db4f
--- /dev/null
+++ b/Madagascar/frwp/Radama_II_files/MobileRedirect.js
@@ -0,0 +1,23 @@
+/** Mobile Redirect Helper
+ *
+ * Redirects to a wikimedia-mobile installation for viewers on iPhone, iPod
+ * Touch, Palm Pre, and Android devices.
+ *
+ * You can turn off the redirect by setting the cookie "stopMobileRedirect=true"
+ */
+if ( /(iPhone|iPod|Android.*Mobile|webOS|NetFront|Opera Mini|SEMC-Browser|PlayStation Portable|Nintendo Wii|BlackBerry)/
+ .test( navigator.userAgent ) )
+{
+ if ( (document.cookie.indexOf("irect=t") < 0) // Don't redirect if we have the stop cookie ... only testing a subportion of the cookie. Should be REALLY unique!
+ && (wgNamespaceNumber >= 0) // Don't redirect special pages
+ && (wgAction == "view")) // Don't redirect URLs that aren't simple page views
+ {
+ // If we've made it here, then we are going ahead with the redirect
+
+ // If we are NOT on the main page, then set the pageName!
+ if (wgPageName != wgMainPageTitle.replace(/ /g, '_')) {
+ wgWikimediaMobileUrl += '/' + encodeURI(wgPageName);
+ }
+ document.location = wgWikimediaMobileUrl;
+ }
+}