MediaWiki:Test.js

/* Some of the code belongs to their respective owners */ function chatButton(handler, message, visibility, id){ var button = '' + message + ' '; $('.Rail .public').prepend(button); }

function configureChatButtons(boolean_value){ if (boolean_value == "true"){ chatButton('openTestModal', 'Test', 'visible', 'open-test-modal'); chatButton('clearChat', 'Clear Chat', 'hidden', 'clear-chat-button'); }   else if (boolean_value == "false"){ } }

window.onload = configureChatButtons('true');

function clearChat{ chatSize = $('div.Chat:first ul li').size - 1; $('.Chat:first li:lt(' + chatSize + ')').remove; }

function openTestModal{ $.openCustomModal('Test', ' Styles ',          {             id: 'testModalS',             width: 625,             buttons: [                 {                    id: 'closeModalS',                    message: 'Cancel',                    handler: function{                          closeTestModalS;                    }                 },                 {                    id: 'submitTestS',                    defaultButton: true,                    message: 'Submit',                    handler: function{                          submitTestS;                          setInterval(closeTestModalS, 500);                    }                  }             ]    });

function closeTestModalS{ var dialog = $('#testModalS'); dialog.closeModal; }

function submitTestS{ $('head').append('.ChatWindow { background: ' + $("#surround").val + '; font-family: ' + $("#chat-font option:selected").text + ';} .Chat { background: ' + $("#chat-background").val + ';} .Chat .you { background: ' + $("#self-post").val + '; color: ' + $("#self-postcolor").val + '; font-family: ' + $("self-postfont option:selected").text + ';} '); if ($('#clear-chat').is(':checked') && $('#clear-chat-button').is(':hidden')){ $('#clear-chat-button').css('visibility', 'visible'); }       else { $('#clear-chat-button').css('visibility', 'hidden'); }   } }