1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Refactor: Pull more classes into baselib

This commit is contained in:
gnosygnu
2021-12-19 16:19:19 -05:00
parent 48559edffe
commit 0e80d7ef6d
7999 changed files with 1375876 additions and 1365947 deletions

View File

@@ -1,52 +1,52 @@
ul.tabbernav {
margin: 0;
padding: 3px 0;
border-bottom: 1px solid #CCC;
font: bold 12px Verdana, sans-serif;
}
ul.tabbernav li {
list-style: none;
margin: 0;
display: inline;
}
ul.tabbernav li a {
padding: 3px .5em;
margin-left: 3px;
border: 1px solid #CCC;
border-bottom: none;
background: #F2F7FF;
text-decoration: none;
}
ul.tabbernav li a:link {
color: #448;
}
ul.tabbernav li a:visited {
color: #667;
}
ul.tabbernav li a:hover {
color: #000;
background: #FFF9F2;
border-color: #CCC;
}
ul.tabbernav li.tabberactive a {
background-color: #FFF;
border-bottom: 1px solid #FFF;
}
ul.tabbernav li.tabberactive a:hover {
color: #000;
background: #FFF;
border-bottom: 1px solid #FFF;
}
.tabber .tabbertab {
padding: 5px;
border: 1px solid #CCC;
border-top: 0;
}
ul.tabbernav {
margin: 0;
padding: 3px 0;
border-bottom: 1px solid #CCC;
font: bold 12px Verdana, sans-serif;
}
ul.tabbernav li {
list-style: none;
margin: 0;
display: inline;
}
ul.tabbernav li a {
padding: 3px .5em;
margin-left: 3px;
border: 1px solid #CCC;
border-bottom: none;
background: #F2F7FF;
text-decoration: none;
}
ul.tabbernav li a:link {
color: #448;
}
ul.tabbernav li a:visited {
color: #667;
}
ul.tabbernav li a:hover {
color: #000;
background: #FFF9F2;
border-color: #CCC;
}
ul.tabbernav li.tabberactive a {
background-color: #FFF;
border-bottom: 1px solid #FFF;
}
ul.tabbernav li.tabberactive a:hover {
color: #000;
background: #FFF;
border-bottom: 1px solid #FFF;
}
.tabber .tabbertab {
padding: 5px;
border: 1px solid #CCC;
border-top: 0;
}

View File

@@ -1,57 +1,57 @@
(function($) {
$.fn.tabber = function() {
return this.each(function() {
// create tabs
var $this = $(this),
tabContent = $this.children('.tabbertab'),
nav = $('<ul>').addClass('tabbernav');
tabContent.each(function() {
var anchor = $('<a>').text(this.title).attr('title', this.title).attr('href', 'javascript:void(0);');
$('<li>').append(anchor).appendTo(nav);
});
$this.prepend(nav);
/**
* Internal helper function for showing content
* @param string title to show, matching only 1 tab
* @return true if matching tab could be shown
*/
function showContent(title) {
var content = tabContent.filter('[title="' + title + '"]');
if (content.length !== 1) return false;
tabContent.hide();
content.show();
nav.find('.tabberactive').removeClass('tabberactive');
nav.find('a[title="' + title + '"]').parent().addClass('tabberactive');
return true;
}
// setup initial state
var loc = location.hash.replace('#', '');
if ( loc == '' || !showContent(loc) ) {
var active_tabs = tabContent.filter('[data-active="true"]');
var initial_tab = null;
if (active_tabs.length == 0) {
initial_tab = tabContent.first().attr('title');
}
else {
initial_tab = active_tabs.attr('title');
}
showContent(initial_tab);
}
// Repond to clicks on the nav tabs
nav.on('click', 'a', function(e) {
var title = $(this).attr('title');
e.preventDefault();
location.hash = '#' + title;
showContent( title );
});
$this.addClass('tabberlive');
});
};
})(jQuery);
$(document).ready(function() {
$('.tabber').tabber();
});
(function($) {
$.fn.tabber = function() {
return this.each(function() {
// create tabs
var $this = $(this),
tabContent = $this.children('.tabbertab'),
nav = $('<ul>').addClass('tabbernav');
tabContent.each(function() {
var anchor = $('<a>').text(this.title).attr('title', this.title).attr('href', 'javascript:void(0);');
$('<li>').append(anchor).appendTo(nav);
});
$this.prepend(nav);
/**
* Internal helper function for showing content
* @param string title to show, matching only 1 tab
* @return true if matching tab could be shown
*/
function showContent(title) {
var content = tabContent.filter('[title="' + title + '"]');
if (content.length !== 1) return false;
tabContent.hide();
content.show();
nav.find('.tabberactive').removeClass('tabberactive');
nav.find('a[title="' + title + '"]').parent().addClass('tabberactive');
return true;
}
// setup initial state
var loc = location.hash.replace('#', '');
if ( loc == '' || !showContent(loc) ) {
var active_tabs = tabContent.filter('[data-active="true"]');
var initial_tab = null;
if (active_tabs.length == 0) {
initial_tab = tabContent.first().attr('title');
}
else {
initial_tab = active_tabs.attr('title');
}
showContent(initial_tab);
}
// Repond to clicks on the nav tabs
nav.on('click', 'a', function(e) {
var title = $(this).attr('title');
e.preventDefault();
location.hash = '#' + title;
showContent( title );
});
$this.addClass('tabberlive');
});
};
})(jQuery);
$(document).ready(function() {
$('.tabber').tabber();
});