Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Madagascar/frwp/Faritany_files/MobileRedirect.js
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2011-05-05 18:01:06 (GMT)
committer Bastien Guerry <bzg@altern.org>2011-05-05 18:01:06 (GMT)
commit3082bff9cf33e3cf0042cb23f9c3527431ae51c6 (patch)
tree2a2adc57e03ba6281b1065a2c26acd36ed380586 /Madagascar/frwp/Faritany_files/MobileRedirect.js
parentccb772ca924a8655e4c84226c6ed7a4eb888a7b2 (diff)
Added more Wikipedia pages. Prepare for release 1.
Thanks to Lionel for the list of new pages.
Diffstat (limited to 'Madagascar/frwp/Faritany_files/MobileRedirect.js')
-rw-r--r--Madagascar/frwp/Faritany_files/MobileRedirect.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/Madagascar/frwp/Faritany_files/MobileRedirect.js b/Madagascar/frwp/Faritany_files/MobileRedirect.js
new file mode 100644
index 0000000..b16db4f
--- /dev/null
+++ b/Madagascar/frwp/Faritany_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;
+ }
+}