User:ChaoticShadow/chatrail.js

/* ChatRail thing by ChaoticShadow /* Special Thanks to: Slyst, Shining-Armour, RansomTime and others /* /* Minimum Requirements to run this: /* - Potato PC /* /* Features /* - Kick, Ban, AutoKick (Mod only) /* - Music /* - User Info blah blah blah /*

if(wgCanonicalSpecialPageName == 'Chat') { //Rail var rail = $(' ');

var searchbar = $('' +   '' +        '' +            '' +            ' ' +            '' +            ' ' +            '' +        ' ' +    ' ');

var switchrail = $('' +   ' '); var mtrail = $('' +   ' '); var uirail = $('' +   ' '); var aboutbutton = $(' '); //Credit goes to author in Wikipedia function userIsInGroup(group) { if (wgUserGroups) { if ( !group || group.length == 0 ) { group = '*'; }		for(var i in wgUserGroups) if (wgUserGroups[i]==group) return true; }       return false; }   //Thanks to RansomTime, with some modifications function exist (variable) { if (variable == ""){ return false; }       return true; }   function switchMT { uirail.hide; if(userIsInGroup('sysop') || userIsInGroup('bureaucrat') || userIsInGroup('chatmoderator') || userIsInGroup('VSTF')) { mtrail.show; }       else { $.showCustomModal( 'Insuficient rights', 'Your current rights: ' + wgUserGroups.toString + ' Only users with one or more of the following rights can use these functions (Kick, Ban, Autokick): bureaucrat,sysop,chatmoderator,vstf'); }   }    function switchUI { mtrail.hide; uirail.show; }   //Thanks S-A for clearing this up and explaining function kick { var user = $('#userinput').val; if (exist(user) === true ) { mainRoom.kick({               name: user            }); }   }    function ban { var user = $('#userinput').val; if (exist(user) === true ) { mainRoom.ban({               name: user            }); }   }    function autokick { alert('Do not use'); var user = $('#userinput').val; if (exist(user) === true ) { $.showCustomModal mainRoom.kick({               name: user            }); }   }    //Idk what happens if I don't define user every time //I swear slyst pretty much wrote the whole thing: { function userpage { var user = $('#userinfo').val; var open = '/wiki/User:' + user; if (exist(user)) { window.open(open, 'blank'); }   }    function talkpage { var user = $('#userinfo').val; var open = '/wiki/User_talk:' + user; if (exist(user)) { window.open(open, 'blank'); }   }    function blog { var user = $('#userinfo').val; var open = '/wiki/User_blog:' + user; if (exist(user)) { window.open(open, 'blank'); }   }    function contribs { var user = $('#userinfo').val; var open = '/wiki/Special:Contributions/' + user; if (exist(user)) { window.open(open, 'blank'); }   }    function banlog { var user = $('#userinfo').val; var open = '/wiki/Special:Log/chatban?page=User:' + user; if (exist(user)) { window.open(open, 'blank'); }   }    function blocklog { var user = $('#userinfo').val; var open = '/wiki/Special:Log/block?page=User:' + user; if (exist(user)) { window.open(open, 'blank'); }   }    function log { var user = $('#userinfo').val; var open = '/wiki/Special:Log/' + user; if (exist(user)) { window.open(open, 'blank'); }   }    // }    //Look at this terrible formatting function about { $.showCustomModal('About', '\       \            ChatRail α by ChaoticShadow\ \            With lots of help from: Slyst, RansomTime, Shining-Amour, and many more, along with other fantastic scripts other users have made.\        \        \        Features \            Mod Only: \                \                    Kick\                    Ban\                    Autokick\                \            General Usage: \                \                    Search Bar</li>\                    User Info</li>\                </ul>\                \                    \                        User Page</li>\                        Talk Page</li>\                        Blog</li>\                        Contributions</li>\                        Chat Ban Log</li>\ Block Log</li>\ Public Logs</li>\ </ul>\ </ul>\ Features to come \ Random: \ <ol>\ Give a suggestion</li>\ ???</li>\ PROFIT!!!</li>\ </ol>\ ', {           id: 'aboutmodal', width: 500 });       $('#aboutmodal ul').css({ 'display': 'block', 'list-style-type': 'disc', 'margin-bottom': '1 em', 'margin-left': '0', 'margin-right': '0', 'padding-left': '40px' });       $('ol').css({ 'display': 'block', 'list-style-type': 'decimal', 'margin-bottom': '1em', 'margin-left': '0', 'margin-right': '0', 'padding-left': '40px' });   }    $('.WikiaPage').css('left', '176px');    searchbar.insertAfter($('.ChatHeader .wordmark'));    rail.append(aboutbutton);    rail.append(switchrail);    rail.append(mtrail);    rail.append(uirail);

/* Making sure regular users don't get kick/ban/autokick functions */ if(userIsInGroup('sysop') || userIsInGroup('bureaucrat') || userIsInGroup('chatmoderator') || userIsInGroup('VSTF')) { uirail.hide; }   else { mtrail.hide; }   rail.insertAfter($('#WikiaPage')); console.log('Loaded'); }