Monchoman45

BlogRedirect

May 18th, 2011
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function() {
  2.     if(wgCanonicalNamespace == 'User_blog') {
  3.         if(urlQuery('useskin') != '') {
  4.             window.location = window.location.href + ((window.location.href.indexOf('?') != -1) ? '&' : '?') + 'useskin=wikia';
  5.         }
  6.         else {
  7.             if(url.indexOf('?') != -1) {
  8.                 var url = location.href;
  9.                                 var quot = url.split('?');
  10.                                 for(var j in quot) {
  11.                                         if(quot[j].split('=')[0] == 'title') {
  12.                                                 title = quot[j].split('=')[1].split('&')[0];
  13.                                                 for(var k = 1; k < quot[j].split('&').length; k++) {
  14.                                                         if(quot[j].split('&')[k].split('=')[0] != 'useskin') {var urlquery += '&' + quot[j].split('&')[k];}
  15.                                                 }
  16.                                         }
  17.                                 }
  18.                         }
  19.             else {
  20.                                 var title = url.split('.')[url.split('.').length - 1].substring(url.split('.')[url.split('.').length - 1].indexOf('/', 4) + 1, url.length);
  21.                         }
  22.             window.location = '/index.php?title=' + title + urlquery + '&useskin=wikia';
  23.         }
  24.     }
  25. });
  26.  
  27. function urlQuery(quer) {
  28.     for(i in location.href.split('?')) {
  29.         for(j in location.href.split('?')[i].split('&')) {
  30.             if(location.href.split('?')[i].split('&')[j].split('=')[0] == quer) {
  31.                 return location.href.split('?')[i].split('&')[j].split('=')[1];
  32.             }
  33.         }
  34.     }
  35.     return '';
  36. }
Advertisement
Add Comment
Please, Sign In to add comment