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 murail = $('\    '); 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 { murail.hide; 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; murail.hide; uirail.show; }   function switchMU { mtrail.hide; uirail.hide; murail.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 messagewall { var user = $('#userinfo').val; var open = '/wiki/Message_Wall:' + 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');        }    }    // }    /* links from the maker of  */    function addmusic {        //var link = $('');        var music1 = ' ';       //var modal = form.append(link);        //var link   = prompt('Add Music');        //$('#musiclist').append(music);        $.showCustomModal( 'Add Music (THIS IS BROKEN)', ' Insert the part of a YouTube video url after the "watch?v=" ', {            id: 'addmusicmodal',            width: 500,            buttons: [                {                    id:'confirm',                    message:'Confirm',                    click: function{                        /*if($('#music').val.length !== 11) {                            alert('Not a valid link');                        }                        else {*/                            var music  = music1 + $('#music').val + music2; $('#musiclist').append(music); //}                   }                }            ]        });    }    function removemusic {        $.showCustomModal( 'Remove Music (THIS IS ALSO BROKEN)', ' ', { id: 'removemusicmodal', width: 500 });   }    //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</li>\ Autokick</li>\ </ul>\ General Usage: \ <ul>\ Add/Remove Music</li>\ Search Bar</li>\ User Info</li>\ </ul>\ <ul>\ <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' });   }    document.getElementById("WikiaPage").style.left = "10%";    searchbar.insertAfter($('.ChatHeader .wordmark'));    rail.append(aboutbutton);    rail.append(switchrail);    rail.append(mtrail);    rail.append(uirail);    rail.append(murail);    murail.hide;

/* 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($('header.ChatHeader')); }