MediaWiki:Chameleon.js

From VGD Wiki Farm
Revision as of 13:12, 3 January 2021 by WikiVisor (talk | contribs)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
docReady(function() {
	injectDatatables();
});

function docReady(fn) {
    // see if DOM is already available
    if (document.readyState === 'complete' || document.readyState === 'interactive') {
        // call on next available tick
        setTimeout(fn, 1);
    } else {
        document.addEventListener('DOMContentLoaded', fn);
    }
}
function injectDatatables(){
	var elementExists = document.getElementById('dataTable');
	if(elementExists){
		$(elementExists).dataTable({
            dom: '<"top d-flex flex-column flex-md-row justify-content-between"if>t<"bottom"p><"clear">',
            responsive: true,
            pageLength: 50,
            order: [ 0, 'desc' ],
            aoColumns: [
                null,
                {
                    'bSortable': true
                }
            ],
            language: {
                "sSearch":              "",
            },
            fnInitComplete: function() {
                    $('div.dataTables_filter input').addClass('rounded-0 ml-0 p-3 bg-white').css({'border':'2px solid rgb(140, 185, 175)','box-shadow':'none'}).prop('placeholder', 'Filter ...');
                    $('a.paginate_button.current').css({"background":"#f6f6f6"}).addClass('border-0 text-primary');
                    $('.paginate_button').hover(function () {
					    $(this).addClass('bg-light');
					}, function () {
						$(this).removeClass('bg-light');
					}
           		);
        	}
		});
	}
}