jQuery(function($) { /** * Edit form */ (function() { var $wikibar = $('#wiki__editbar'); if(!$wikibar.length) return; var $editButtons = $wikibar.find('.editButtons'); // toolbar with proper buttons var $tb = $('#tool__bar').addClass("btn-group").attr("role", "group"); $tb.find('button').addClass('btn btn-default').attr("type","button"); $('#wiki__text').addClass("form-control"); // Make the textarea big when the screen is big var wh = $(window).height(); if(wh > 500) { $('#wiki__text').css({"height":wh*0.7}); } // buttons in different colors $btnCancel = $editButtons.find('button').addClass("btn btn-default"); $btnSave = $editButtons.find('#edbtn__save').removeClass('btn-default').addClass("btn-success"); $btnEdit = $editButtons.find('#edbtn__preview').removeClass('btn-default').addClass("btn-warning"); // full width comment input $wikibar.find('#edit__summary').addClass("form-control"); // Infos and hints in colored boxes $('.editBox .license').addClass("alert alert-warning"); $('.act-edit > .container > p').addClass("alert alert-info"); // Draft status with tick in green $('.act-edit.mode_preview #draft__status').addClass("success"); /* when previewing, scroll to the page preview */ if($('.mode_preview').length) { jQuery('html, body').animate({ scrollTop: $('#preview').position().top }, 600); } })(); /** * Login Form */ (function() { $loginHeadline = $('#login'); if(!$loginHeadline.length) return; $loginContainer = $loginHeadline.parent(); $loginContainer.find('.level1').addClass('alert alert-warning'); $loginContainer.find('form').addClass('form-horizontal'); $loginContainer.find('input[name=u], input[name=p]').addClass('form-control'); $loginContainer.find('form > div').addClass('row panel panel-default'); $loginContainer.find('form > div > fieldset').addClass('col-md-12 panel-body'); $loginContainer.find('form > div > fieldset legend').addClass('hid'); $loginContainer.find('form > div > p').addClass('col-md-12 panel-footer'); $btnLogin = $loginContainer.find('button[type=submit]').addClass("btn btn-primary"); })(); /** * Profile */ (function() { $profileHeadline = $('#update_your_account_profile'); if(!$profileHeadline.length) return; $profileContainer = $profileHeadline.parent(); $registerContainer = $profileContainer.find('#dw__register'); $registerContainer.find('input[type=text], input[type=password], input[type=email]').addClass('form-control'); $registerContainer.find('button[type=submit]').addClass('btn btn-primary'); //$('#dw__register').addClass('panel'); $deleteContainer = $profileContainer.find('#dw__profiledelete'); $deleteContainer.addClass('panel alert alert-danger'); $deleteContainer.find('button').addClass('btn-danger'); //$profileContainer.find('button[type=reset]').addClass('btn btn-default'); })(); /** * Admin Config Manager */ (function() { $adminConfigHeadline = $('#config__manager'); if(!$adminConfigHeadline.length) return; function enableAdvancedLevel($form, level) { var $allPreferences = $form.find('td.label'); var $disabledElements = $allPreferences.filter(function(i, col) { $(col).parent().show(); hide = false; if($(col).find('img[alt=warning]').length) { $(col).parent().addClass('config-advanced'); hide = level < 2; } if($(col).find('img[alt=danger]').length) { $(col).parent().addClass('config-expert'); hide = level < 3; }; return hide; }); $disabledElements.map(function(i, col) { $(col).parent().hide(); }); } $adminConfigContainer = $adminConfigHeadline.parent(); $adminConfigContainer.find('input[type=text], input[type=password], input[type=email], select').addClass('form-control'); $adminConfigContainer.find('button[type=submit]').addClass('btn btn-primary'); $adminConfigContainer.find('td .outkey').removeClass('outkey').addClass('help-block'); // idea: all settings with warnings are advanced. switch $configForm = $('#dw__configform'); $advancedButtons = $('
'); $advancedButtons.append(''); $advancedButtons.append(''); $advancedButtons.append(''); $advancedButtons.on('click', 'button', function(e) { var level = 1; var elem = e.target; $(elem).removeClass('active'); switch(elem.id) { case 'switch-advanced-basic': $(elem).addClass('active'); level = 1; break; case 'switch-advanced-advanced': $(elem).addClass('active'); level = 2; break; case 'switch-advanced-expert': $(elem).addClass('active'); level = 3; break; } enableAdvancedLevel($configForm, level); }); $configForm.prepend($advancedButtons); $('#switch-advanced-basic').click(); })(); /* Manage users */ (function() { $adminUserManager = $('#user__manager'); if(!$adminUserManager.length) return; $adminUserManager.find('input[type=text], input[type=password], input[type=email]').addClass('form-control'); $adminUserManager.find('button').addClass('btn btn-default'); $adminUserManager.find('table').addClass('table table-striped'); $adminUserManager.find('ul.notes').addClass('alert alert-info'); $adminUserManager.find('.import_users').addClass('panel alert alert-warning'); })(); /* Show revisions */ (function() { $revisions = $('#page__revisions'); if(!$revisions.length) return; var potentialCurrent = $revisions.find('.li').first(); if(potentialCurrent.html().trim().match(/\(current\)$/)) { potentialCurrent.html(potentialCurrent.html().replace('(current)','')); potentialCurrent.addClass('bg-success'); } })(); /* Diff revisions */ (function() { $diff = $('#differences'); if(!$diff.length) return; $('.difflink').addClass('btn btn-primary'); $('select[name=difftype]').addClass('form-control'); $('.diffnav').addClass('btn-group'); $('.diffnav > a').addClass('btn btn-default').wrap(''); $('.diffnav > form').addClass('btn-group'); $('.diffnav > form select').addClass('form-control'); })(); /* Admin start page */ (function() { $adminHeadline = $('#administration'); if(!$adminHeadline.length) return; $adminStart = $adminHeadline.parent(); $adminStart.find('.admin_tasks, .admin_plugins').addClass('btn-group-vertical'); $adminStart.find('.admin_tasks li, .admin_plugins li').addClass('btn btn-default text-left'); $adminStart.addClass('row').find('> ul').addClass('col-md-12'); $adminStart.find('> a').attr('style', '').addClass('panel alert alert-danger'); $adminStart.find('#admin__version').addClass('panel alert alert-info col-md-12') })(); (function() { $resendpwHeadline = $('#send_new_password'); if(!$resendpwHeadline.length) return; $resendpw = $resendpwHeadline.parent(); $resendpw.find('.centeralign').removeClass('centeralign').addClass('panel alert alert-info'); $resendpw.find('form input[name=login]').addClass('form-control'); $resendpw.find('button').addClass('btn btn-primary'); })(); (function() { $mediamanager = $('#mediamanager__page'); if(!$mediamanager.length) return; $mediamanager.addClass('row'); $mediamanager.find('.panel.namespaces').addClass('col-md-3'); $mediamanager.find('.panel.filelist').removeClass('ui-resizable').addClass('col-md-6'); $mediamanager.find('.panel.file').addClass('col-md-3'); // resizable does mess with the grid //dw_mediamanager.$resizables().resizable('destroy'); //$mediamanager.find('.tabs').addClass('btn-group'); //$mediamanager.find('.tabs li').addClass('btn btn-default'); // stuff inside ".thumbs" and ".rows" changes dynamically })(); });