mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Docs: Improve load time
This commit is contained in:
parent
904e762bc8
commit
6a2fc08525
@ -3,7 +3,7 @@
|
|||||||
html,body{min-height:100%;}
|
html,body{min-height:100%;}
|
||||||
a{text-decoration:none;}
|
a{text-decoration:none;}
|
||||||
#main{transition: transform .3s ease; }
|
#main{transition: transform .3s ease; }
|
||||||
.main-nav{position:fixed;top:0;left:0;width:250px;height:100%;background:#3B3B3B;color:#fff;overflow:hidden;transition:transform .3s ease;transform:translateX(-250px);}
|
div.main-nav{position:fixed;top:0;left:0;width:250px;height:100%;background:#3B3B3B;color:#fff;overflow:hidden;transition:transform .3s ease;transform:translateX(-250px);display:block;}
|
||||||
.main-nav h2{color:#fff;font-size:20px;margin:0 0 15px 30px;}
|
.main-nav h2{color:#fff;font-size:20px;margin:0 0 15px 30px;}
|
||||||
.main-nav em{color:#6cf;font-style:normal;}
|
.main-nav em{color:#6cf;font-style:normal;}
|
||||||
.main-nav .page-links a{display:block;background:linear-gradient(#3e3e3e,#383838);border-top:1px solid #484848;border-bottom:1px solid #2E2E2E;color:#FFF;white-space:nowrap;text-overflow:ellipsis;padding:10px;}
|
.main-nav .page-links a{display:block;background:linear-gradient(#3e3e3e,#383838);border-top:1px solid #484848;border-bottom:1px solid #2E2E2E;color:#FFF;white-space:nowrap;text-overflow:ellipsis;padding:10px;}
|
||||||
|
@ -5,13 +5,17 @@
|
|||||||
<title>jQuery tablesorter 2.0</title>
|
<title>jQuery tablesorter 2.0</title>
|
||||||
|
|
||||||
<!-- Demo stuff -->
|
<!-- Demo stuff -->
|
||||||
<link rel="stylesheet" href="css/bootstrap-v3.min.css">
|
<style>
|
||||||
<link class="ui-theme" rel="stylesheet" href="css/jquery-ui.min.css">
|
#banner h1 em {color:#6cf;}
|
||||||
|
.main-nav {display:none;}
|
||||||
|
</style>
|
||||||
|
<link href="css/bootstrap-v3.min.css" rel="preload" as="style" onload="this.rel='stylesheet'">
|
||||||
|
<link href="css/jquery-ui.min.css" class="ui-theme" rel="preload" as="style" onload="this.rel='stylesheet'">
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/jq.css">
|
<link href="css/jq.css" rel="preload" as="style" onload="this.rel='stylesheet'">
|
||||||
<link rel="stylesheet" href="css/menu.css">
|
<link href="css/menu.css" rel="preload" as="style" onload="this.rel='stylesheet'">
|
||||||
<link href="css/prettify.css" rel="stylesheet">
|
<link href="css/prettify.css" rel="preload" as="style" onload="this.rel='stylesheet'">
|
||||||
<link href="../css/theme.blue.css" rel="stylesheet">
|
<link href="../css/theme.blue.css" rel="preload" as="style" onload="this.rel='stylesheet'">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body id="root">
|
<body id="root">
|
||||||
@ -21,7 +25,7 @@
|
|||||||
<div class="page-search">
|
<div class="page-search">
|
||||||
<h2 class="title">table<em>sorter</em></h2>
|
<h2 class="title">table<em>sorter</em></h2>
|
||||||
<div class="input-group search-group">
|
<div class="input-group search-group">
|
||||||
<div class="status" title="results"></div>
|
<div class="status"></div>
|
||||||
<input type="text" placeholder="Find on page..." size="25" maxlength="25" class="search form-control input-sm">
|
<input type="text" placeholder="Find on page..." size="25" maxlength="25" class="search form-control input-sm">
|
||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
<button type="button" class="search-clear btn btn-default tooltip-top" title="Clear search">
|
<button type="button" class="search-clear btn btn-default tooltip-top" title="Clear search">
|
||||||
@ -8193,25 +8197,27 @@ $.tablesorter.addHeaderResizeEvent( table, true );</pre>
|
|||||||
|
|
||||||
<!-- jQuery -->
|
<!-- jQuery -->
|
||||||
<script src="js/jquery-latest.min.js"></script>
|
<script src="js/jquery-latest.min.js"></script>
|
||||||
<script src="js/jquery-migrate-3.0.0.min.js"></script>
|
<script async src="js/jquery-migrate-3.0.0.min.js"></script>
|
||||||
<script src="js/jquery-ui.min.js"></script>
|
<script async src="js/jquery-ui.min.js"></script>
|
||||||
<script src="js/prettify.js"></script>
|
<script async src="js/prettify.js"></script>
|
||||||
<script src="js/docs.js"></script>
|
<script async src="js/docs.js"></script>
|
||||||
<script src="js/search.js"></script>
|
<script async src="js/search.js"></script>
|
||||||
<!--[if lte IE 8]>
|
<!--[if lte IE 8]>
|
||||||
<script src="js/search-ie.js"></script>
|
<script src="js/search-ie.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
||||||
<!-- Tablesorter: required -->
|
<!-- Tablesorter: required -->
|
||||||
<script src="../js/jquery.tablesorter.combined.js"></script>
|
<script src="../js/jquery.tablesorter.combined.js"></script>
|
||||||
<script>
|
<script async>
|
||||||
$.extend( $.tablesorter.defaults, {
|
$.extend( $.tablesorter.defaults, {
|
||||||
theme: 'blue',
|
theme: 'blue',
|
||||||
widthFixed: true
|
widthFixed: true
|
||||||
});
|
});
|
||||||
$('.compatibility').tablesorter();
|
|
||||||
$('#tablesorter-demo').tablesorter({widgets:['zebra']});
|
$('#tablesorter-demo').tablesorter({widgets:['zebra']});
|
||||||
$('table.options, table.api').tablesorter({widgets:['stickyHeaders']});
|
setTimeout(function(){
|
||||||
|
$('.compatibility').tablesorter();
|
||||||
|
$('table.options, table.api').tablesorter({widgets:['stickyHeaders']});
|
||||||
|
}, 1000);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*jshint browser:true, jquery:true, unused:false */
|
/*jshint browser:true, jquery:true, unused:false */
|
||||||
/*global prettyPrint:false */
|
/*global prettyPrint:false */
|
||||||
(function($){
|
(function($) {
|
||||||
$(function(){
|
$(function() {
|
||||||
var $t, t, v, animating, clicked,
|
var $t, t, v, animating, clicked,
|
||||||
|
|
||||||
cleanupCode = function(code){
|
cleanupCode = function(code) {
|
||||||
return code.replace(/([<>\"\'\t\n]|…)/g, function(m) { return {
|
return code.replace(/([<>\"\'\t\n]|…)/g, function(m) { return {
|
||||||
'<' : '<',
|
'<' : '<',
|
||||||
'>' : '>',
|
'>' : '>',
|
||||||
@ -16,24 +16,24 @@
|
|||||||
}[m];});
|
}[m];});
|
||||||
};
|
};
|
||||||
|
|
||||||
$("a.external").each(function(){this.target = '_new';});
|
$('a.external').each(function() {this.target = '_new';});
|
||||||
|
|
||||||
// get javascript source
|
// get javascript source
|
||||||
if ($("#js").length) {
|
if ($('#js').length) {
|
||||||
$("#javascript pre").addClass('mod').html( cleanupCode( $("#js").html() ) );
|
$('#javascript pre').addClass('mod').html( cleanupCode( $('#js').html() ) );
|
||||||
}
|
}
|
||||||
if ($("#js2").length) {
|
if ($('#js2').length) {
|
||||||
$("#javascript2 pre").addClass('mod').html( cleanupCode( $("#js2").html() ) );
|
$('#javascript2 pre').addClass('mod').html( cleanupCode( $('#js2').html() ) );
|
||||||
}
|
}
|
||||||
if ($("#css").length) {
|
if ($('#css').length) {
|
||||||
$("pre.lang-css").not('.locked').addClass('mod').html( cleanupCode( $("#css").html() ) );
|
$('pre.lang-css').not('.locked').addClass('mod').html( cleanupCode( $('#css').html() ) );
|
||||||
}
|
}
|
||||||
if ($("#demo").length && $("#html pre").length) {
|
if ($('#demo').length && $('#html pre').length) {
|
||||||
$("#html pre").addClass('mod').html( cleanupCode( $("#demo").html() ) );
|
$('#html pre').addClass('mod').html( cleanupCode( $('#demo').html() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply to already pre-formatted blocks to add <br> for IE
|
// apply to already pre-formatted blocks to add <br> for IE
|
||||||
$('pre.prettyprint:not(.mod)').each(function(){
|
$('pre.prettyprint:not(.mod)').each(function() {
|
||||||
$t = $(this);
|
$t = $(this);
|
||||||
$t.html( cleanupCode( $t.html() ) );
|
$t.html( cleanupCode( $t.html() ) );
|
||||||
});
|
});
|
||||||
@ -45,7 +45,7 @@
|
|||||||
// hide child rows
|
// hide child rows
|
||||||
$('#root .tablesorter-childRow').hide();
|
$('#root .tablesorter-childRow').hide();
|
||||||
// toggle child row content, not hiding the row since we are using rowspan
|
// toggle child row content, not hiding the row since we are using rowspan
|
||||||
$('#root .toggle').click(function(){
|
$('#root .toggle').click(function() {
|
||||||
$(this).closest('tr').nextUntil('tr:not(.tablesorter-childRow)').toggle();
|
$(this).closest('tr').nextUntil('tr:not(.tablesorter-childRow)').toggle();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -54,26 +54,26 @@
|
|||||||
clicked = false;
|
clicked = false;
|
||||||
$('.collapsible').hide();
|
$('.collapsible').hide();
|
||||||
|
|
||||||
$('a.permalink').click(function(){
|
$('a.permalink').click(function() {
|
||||||
var $el = $(this);
|
var $el = $(this);
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
if (!animating && !clicked) {
|
if (!animating && !clicked) {
|
||||||
animating = true;
|
animating = true;
|
||||||
$el.closest('tr').find('.collapsible').slideToggle();
|
$el.closest('tr').find('.collapsible').slideToggle();
|
||||||
setTimeout(function(){ animating = false; }, 200);
|
setTimeout(function() { animating = false; }, 200);
|
||||||
}
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$('#root .permalink').dblclick(function(){
|
$('#root .permalink').dblclick(function() {
|
||||||
clicked = true;
|
clicked = true;
|
||||||
window.location.hash = '#' + $(this).closest('tr')[0].id;
|
window.location.hash = '#' + $(this).closest('tr')[0].id;
|
||||||
showProperty();
|
showProperty();
|
||||||
setTimeout(function(){ clicked = false; }, 500);
|
setTimeout(function() { clicked = false; }, 500);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.toggleAll, .showAll, .hideAll').click(function(){
|
$('.toggleAll, .showAll, .hideAll').click(function() {
|
||||||
t = $.trim($(this).text());
|
t = $.trim($(this).text());
|
||||||
// use nextAll to ignore any <br> or other elements between this link and the table
|
// use nextAll to ignore any <br> or other elements between this link and the table
|
||||||
$(this).parent().nextAll('table:first').find('.collapsible')[t]();
|
$(this).parent().nextAll('table:first').find('.collapsible')[t]();
|
||||||
@ -89,7 +89,7 @@
|
|||||||
// add high visibility tags for newest versions
|
// add high visibility tags for newest versions
|
||||||
t = $.tablesorter.version.replace(/(v|version|\+)/g, '').split('.');
|
t = $.tablesorter.version.replace(/(v|version|\+)/g, '').split('.');
|
||||||
v = [ parseInt(t[0], 10) || 1, parseInt(t[1], 10) || 0, parseInt(t[2], 10) || 0 ];
|
v = [ parseInt(t[0], 10) || 1, parseInt(t[1], 10) || 0, parseInt(t[2], 10) || 0 ];
|
||||||
$('.version').each(function(){
|
$('.version').each(function() {
|
||||||
var i;
|
var i;
|
||||||
$t = $(this);
|
$t = $(this);
|
||||||
i = $t.text().replace(/(v|version|\+)/g, '').split('.');
|
i = $t.text().replace(/(v|version|\+)/g, '').split('.');
|
||||||
@ -107,11 +107,11 @@
|
|||||||
|
|
||||||
$t = $('.accordion');
|
$t = $('.accordion');
|
||||||
if ($t.length) {
|
if ($t.length) {
|
||||||
var id, hashId,
|
var hashId,
|
||||||
hash = window.location.hash;
|
hash = window.location.hash;
|
||||||
// add accodion ids
|
// add accodion ids
|
||||||
$t.each(function(i){
|
$t.each(function() {
|
||||||
$(this).children('h3').each(function(i){
|
$(this).children('h3').each(function(i) {
|
||||||
var txt = $(this).find('a').text().toLowerCase().replace(/[-:()\"]/g,'').replace(/[\s+\/]/g,'_');
|
var txt = $(this).find('a').text().toLowerCase().replace(/[-:()\"]/g,'').replace(/[\s+\/]/g,'_');
|
||||||
this.id = txt;
|
this.id = txt;
|
||||||
if (hash && txt === hash.slice(1)) {
|
if (hash && txt === hash.slice(1)) {
|
||||||
@ -120,7 +120,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
// set up accordions
|
// set up accordions
|
||||||
$t.each(function(i){
|
$t.each(function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$this.accordion({
|
$this.accordion({
|
||||||
active: $this.hasClass('start-closed') ? false : hashId,
|
active: $this.hasClass('start-closed') ? false : hashId,
|
||||||
@ -128,12 +128,12 @@
|
|||||||
heightStyle: 'content',
|
heightStyle: 'content',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
create: function() {
|
create: function() {
|
||||||
$this.children('h3').each(function(i){
|
$this.children('h3').each(function(i) {
|
||||||
this.id = $(this).find('a').text().toLowerCase().replace(/[-:()\"]/g,'').replace(/[\s+\/]/g,'_');
|
this.id = $(this).find('a').text().toLowerCase().replace(/[-:()\"]/g,'').replace(/[\s+\/]/g,'_');
|
||||||
$(this).before('<a class="accordion-link link" data-index="' + i + '" href="#' + this.id + '"></a>');
|
$(this).before('<a class="accordion-link link" data-index="' + i + '" href="#' + this.id + '"></a>');
|
||||||
});
|
});
|
||||||
$this.find('.accordion-link').click(function(){
|
$this.find('.accordion-link').click(function() {
|
||||||
$this.accordion( "option", "active", $(this).data('index') );
|
$this.accordion( 'option', 'active', $(this).data('index') );
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
activate: function(e, ui) {
|
activate: function(e, ui) {
|
||||||
@ -154,7 +154,7 @@
|
|||||||
widgets: ['stickyHeaders']
|
widgets: ['stickyHeaders']
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.intlink').click(function(){
|
$('.intlink').click(function() {
|
||||||
openAccordion( $(this).attr('href') );
|
openAccordion( $(this).attr('href') );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -191,7 +191,7 @@
|
|||||||
t = $accordion.find(hash).closest('tr');
|
t = $accordion.find(hash).closest('tr');
|
||||||
t.find('.collapsible').show();
|
t.find('.collapsible').show();
|
||||||
if (t.closest('table').hasClass('hasStickyHeaders')) {
|
if (t.closest('table').hasClass('hasStickyHeaders')) {
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
window.scrollTo( 0, t.offset().top - t.parents('table')[0].config.widgetOptions.$sticky.outerHeight() );
|
window.scrollTo( 0, t.offset().top - t.parents('table')[0].config.widgetOptions.$sticky.outerHeight() );
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showProperty(){
|
function showProperty() {
|
||||||
var prop, $t, wo, stickyHt,
|
var prop, $t, wo, stickyHt,
|
||||||
h = window.location.hash;
|
h = window.location.hash;
|
||||||
if (h && !/[=,]/.test(h)) {
|
if (h && !/[=,]/.test(h)) {
|
||||||
@ -211,7 +211,7 @@
|
|||||||
$('#root .tablesorter-childRow').show();
|
$('#root .tablesorter-childRow').show();
|
||||||
}
|
}
|
||||||
// move below sticky header; added delay as there could be some lag
|
// move below sticky header; added delay as there could be some lag
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
$t = prop.closest('table');
|
$t = prop.closest('table');
|
||||||
if ($t.length && $t[0].config) {
|
if ($t.length && $t[0].config) {
|
||||||
wo = $t[0].config.widgetOptions;
|
wo = $t[0].config.widgetOptions;
|
||||||
@ -229,15 +229,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update stickyHeader when menu closes
|
// update stickyHeader when menu closes
|
||||||
$('#main-nav-check').bind('change', function(){
|
$('#main-nav-check').bind('change', function() {
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
$(window).scroll();
|
$(window).scroll();
|
||||||
}, 350); // transition animation 300ms
|
}, 350); // transition animation 300ms
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).bind('load', function(){
|
$(window).bind('load', function() {
|
||||||
if ($('#root').length) {
|
if ($('#root').length) {
|
||||||
$(window).bind('hashchange', function(){
|
$(window).bind('hashchange', function() {
|
||||||
showProperty();
|
showProperty();
|
||||||
});
|
});
|
||||||
showProperty();
|
showProperty();
|
||||||
@ -246,13 +246,13 @@
|
|||||||
|
|
||||||
// append hidden parsed value to cell
|
// append hidden parsed value to cell
|
||||||
// used by feet-inch-fraction & metric parser demos
|
// used by feet-inch-fraction & metric parser demos
|
||||||
window.addParsedValues = function($t, cols, format){
|
window.addParsedValues = function($t, cols, format) {
|
||||||
var r, val,
|
var r, val,
|
||||||
$r = $t.find('tbody tr'),
|
$r = $t.find('tbody tr'),
|
||||||
c = $t[0].config.cache[0].normalized;
|
c = $t[0].config.cache[0].normalized;
|
||||||
$r.each(function(i){
|
$r.each(function(i) {
|
||||||
r = this;
|
r = this;
|
||||||
$.each(cols, function(v,j){
|
$.each(cols, function(v,j) {
|
||||||
val = format ? format(c[i][j]) : c[i][j];
|
val = format ? format(c[i][j]) : c[i][j];
|
||||||
if (val !== '') {
|
if (val !== '') {
|
||||||
r.cells[j].innerHTML += ' <span class="val hidden removeme">(<span class="results">' + val + '</span>)</span>';
|
r.cells[j].innerHTML += ' <span class="val hidden removeme">(<span class="results">' + val + '</span>)</span>';
|
||||||
@ -260,7 +260,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.toggleparsedvalue').bind('click', function(){
|
$('.toggleparsedvalue').bind('click', function() {
|
||||||
$('.val').toggleClass('hidden');
|
$('.val').toggleClass('hidden');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
* Copyright (c) 2009 Bartek Szopka
|
* Copyright (c) 2009 Bartek Szopka
|
||||||
* Licensed under MIT license.
|
* Licensed under MIT license.
|
||||||
* Modified to require a minimum number of characters before searching
|
* Modified to require a minimum number of characters before searching
|
||||||
*/
|
*//* eslint-disable */
|
||||||
;jQuery.extend({highlight:function(a,c,b,d,f){if(3===a.nodeType){if(c=a.data.match(c))return b=document.createElement(b||"span"),b.className=d||"highlight",a=a.splitText(c.index),a.splitText(c[0].length),d=a.cloneNode(!0),b.appendChild(d),a.parentNode.replaceChild(b,a),1}else if(1===a.nodeType&&a.childNodes&&!/(script|style)/i.test(a.tagName)&&1>$(a).closest(f).length&&(a.tagName!==b.toUpperCase()||a.className!==d))for(var e=0;e<a.childNodes.length;e++)e+=jQuery.highlight(a.childNodes[e],c,b,d,f); return 0}});jQuery.fn.unhighlight=function(a){var c={className:"highlight",element:"span"};jQuery.extend(c,a);return this.find(c.element+"."+c.className).each(function(){var a=this.parentNode;a.replaceChild(this.firstChild,this);a.normalize()}).end()}; jQuery.fn.highlight=function(a,c){var b={className:"highlight",element:"span",caseSensitive:!1,wordsOnly:!1,ignore:"",min:3,error:">= 3",message:function(a){console&&console.log&&console.log(a)}},b=jQuery.extend(b,c);a.constructor===String&&(a=0<a.indexOf(",")?a.replace(/\s+/g," ").split(/\s*,\s*/g):[a]);a=jQuery.grep(a,function(a){return""!==a});if(a.join("").length<b.min)return b.message&&b.message(b.error||""),!1;a=jQuery.map(a,function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}); if(0===a.length)return this;var d=b.caseSensitive?"":"i",f="("+a.join("|")+")";b.wordsOnly&&(f="\\b"+f+"\\b");var e=RegExp(f,d);return this.each(function(){jQuery.highlight(this,e,b.element,b.className,b.ignore)})};
|
;jQuery.extend({highlight:function(a,c,b,d,f) {if(3===a.nodeType) {if(c=a.data.match(c))return b=document.createElement(b||"span"),b.className=d||"highlight",a=a.splitText(c.index),a.splitText(c[0].length),d=a.cloneNode(!0),b.appendChild(d),a.parentNode.replaceChild(b,a),1}else if(1===a.nodeType&&a.childNodes&&!/(script|style)/i.test(a.tagName)&&1>$(a).closest(f).length&&(a.tagName!==b.toUpperCase()||a.className!==d))for(var e=0;e<a.childNodes.length;e++)e+=jQuery.highlight(a.childNodes[e],c,b,d,f); return 0}});jQuery.fn.unhighlight=function(a) {var c={className:"highlight",element:"span"};jQuery.extend(c,a);return this.find(c.element+"."+c.className).each(function() {var a=this.parentNode;a.replaceChild(this.firstChild,this);a.normalize()}).end()}; jQuery.fn.highlight=function(a,c) {var b={className:"highlight",element:"span",caseSensitive:!1,wordsOnly:!1,ignore:"",min:3,error:">= 3",message:function(a) {console&&console.log&&console.log(a)}},b=jQuery.extend(b,c);a.constructor===String&&(a=0<a.indexOf(",")?a.replace(/\s+/g," ").split(/\s*,\s*/g):[a]);a=jQuery.grep(a,function(a) {return""!==a});if(a.join("").length<b.min)return b.message&&b.message(b.error||""),!1;a=jQuery.map(a,function(a) {return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}); if(0===a.length)return this;var d=b.caseSensitive?"":"i",f="("+a.join("|")+")";b.wordsOnly&&(f="\\b"+f+"\\b");var e=RegExp(f,d);return this.each(function() {jQuery.highlight(this,e,b.element,b.className,b.ignore)})};
|
||||||
|
|
||||||
/* tipsy, facebook style tooltips for jquery
|
/* tipsy, facebook style tooltips for jquery
|
||||||
* version 1.0.0a
|
* version 1.0.0a
|
||||||
@ -13,7 +13,7 @@
|
|||||||
* released under the MIT license
|
* released under the MIT license
|
||||||
* Modified to use themes: https://github.com/Mottie/tipsy
|
* Modified to use themes: https://github.com/Mottie/tipsy
|
||||||
*/
|
*/
|
||||||
(function(b){function l(a,c){this.$element=b(a);this.options=c;this.enabled=!0;this.fixTitle()}l.prototype={show:function(){var a=this.getTitle();if(a&&this.enabled){var c=this.tip(),d=this.options.theme[0]||"black",f=this.options.theme[1]||"white",g;c.find(".tipsy-inner").css({background:d,color:f})[this.options.html?"html":"text"](a);c[0].className="tipsy";c.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var a=b.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth, height:this.$element[0].offsetHeight}),f=c[0].offsetWidth,h=c[0].offsetHeight,e="function"==typeof this.options.gravity?this.options.gravity.call(this.$element[0]):this.options.gravity,k;switch(e.charAt(0)){case "n":k={top:a.top+a.height+this.options.offset,left:a.left+a.width/2-f/2};g={"border-bottom-color":d};break;case "s":k={top:a.top-h-this.options.offset,left:a.left+a.width/2-f/2};g={"border-top-color":d};break;case "e":k={top:a.top+a.height/2-h/2,left:a.left-f-this.options.offset};g={"border-left-color":d}; break;case "w":k={top:a.top+a.height/2-h/2,left:a.left+a.width+this.options.offset},g={"border-right-color":d}}2==e.length&&("w"==e.charAt(1)?k.left=a.left+a.width/2-15:k.left=a.left+a.width/2-f+15);c.css(k).addClass("tipsy-"+e);c.find(".tipsy-arrow").css(g)[0].className="tipsy-arrow tipsy-arrow-"+e.charAt(0);this.options.className&&c.addClass("function"==typeof this.options.className?this.options.className.call(this.$element[0]):this.options.className);this.options.fade?c.stop().css({opacity:0,display:"block", visibility:"visible"}).animate({opacity:this.options.opacity}):c.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){b(this).remove()}):this.tip().remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("original-title"))&&a.attr("original-title",a.attr("title")||"").removeAttr("title")},getTitle:function(){var a,b=this.$element,d=this.options;this.fixTitle();d=this.options;"string"== typeof d.title?a=b.attr("title"==d.title?"original-title":d.title):"function"==typeof d.title&&(a=d.title.call(b[0]));return(a=(""+a).replace(/(^\s*|\s*$)/,""))||d.fallback},tip:function(){this.$tip||(this.$tip=b('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'));return this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.options=this.$element=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled= !this.enabled}};b.fn.tipsy=function(a){function c(e){var c=b.data(e,"tipsy");c||(c=new l(e,b.fn.tipsy.elementOptions(e,a)),b.data(e,"tipsy",c));return c}function d(){var b=c(this);b.hoverState="in";0==a.delayIn?b.show():(b.fixTitle(),setTimeout(function(){"in"==b.hoverState&&b.show()},a.delayIn))}function f(){var b=c(this);b.hoverState="out";0==a.delayOut?b.hide():setTimeout(function(){"out"==b.hoverState&&b.hide()},a.delayOut)}if(!0===a)return this.data("tipsy");if("string"==typeof a){var g=this.data("tipsy"); if(g)g[a]();return this}a=b.extend({},b.fn.tipsy.defaults,a);a.live||this.each(function(){c(this)});if("manual"!=a.trigger){var g=a.live?"live":"bind",h="hover"==a.trigger?"mouseleave":"blur";this[g]("hover"==a.trigger?"mouseenter":"focus",d)[g](h,f)}return this};b.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:0.8,title:"title",theme:["black","white"],trigger:"hover"};b.fn.tipsy.elementOptions=function(a,c){return b.metadata? b.extend({},c,b(a).metadata()):c};b.fn.tipsy.autoNS=function(){return b(this).offset().top>b(document).scrollTop()+b(window).height()/2?"s":"n"};b.fn.tipsy.autoWE=function(){return b(this).offset().left>b(document).scrollLeft()+b(window).width()/2?"e":"w"};b.fn.tipsy.autoBounds=function(a,c){return function(){var d=c[0],f=1<c.length?c[1]:!1,g=b(document).scrollTop()+a,h=b(document).scrollLeft()+a,e=b(this);e.offset().top<g&&(d="n");e.offset().left<h&&(f="w");b(window).width()+b(document).scrollLeft()- e.offset().left<a&&(f="e");b(window).height()+b(document).scrollTop()-e.offset().top<a&&(d="s");return d+(f?f:"")}}})(jQuery);
|
(function(b) {function l(a,c) {this.$element=b(a);this.options=c;this.enabled=!0;this.fixTitle()}l.prototype={show:function() {var a=this.getTitle();if(a&&this.enabled) {var c=this.tip(),d=this.options.theme[0]||"black",f=this.options.theme[1]||"white",g;c.find(".tipsy-inner").css({background:d,color:f})[this.options.html?"html":"text"](a);c[0].className="tipsy";c.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var a=b.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth, height:this.$element[0].offsetHeight}),f=c[0].offsetWidth,h=c[0].offsetHeight,e="function"==typeof this.options.gravity?this.options.gravity.call(this.$element[0]):this.options.gravity,k;switch(e.charAt(0)) {case "n":k={top:a.top+a.height+this.options.offset,left:a.left+a.width/2-f/2};g={"border-bottom-color":d};break;case "s":k={top:a.top-h-this.options.offset,left:a.left+a.width/2-f/2};g={"border-top-color":d};break;case "e":k={top:a.top+a.height/2-h/2,left:a.left-f-this.options.offset};g={"border-left-color":d}; break;case "w":k={top:a.top+a.height/2-h/2,left:a.left+a.width+this.options.offset},g={"border-right-color":d}}2==e.length&&("w"==e.charAt(1)?k.left=a.left+a.width/2-15:k.left=a.left+a.width/2-f+15);c.css(k).addClass("tipsy-"+e);c.find(".tipsy-arrow").css(g)[0].className="tipsy-arrow tipsy-arrow-"+e.charAt(0);this.options.className&&c.addClass("function"==typeof this.options.className?this.options.className.call(this.$element[0]):this.options.className);this.options.fade?c.stop().css({opacity:0,display:"block", visibility:"visible"}).animate({opacity:this.options.opacity}):c.css({visibility:"visible",opacity:this.options.opacity})}},hide:function() {this.options.fade?this.tip().stop().fadeOut(function() {b(this).remove()}):this.tip().remove()},fixTitle:function() {var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("original-title"))&&a.attr("original-title",a.attr("title")||"").removeAttr("title")},getTitle:function() {var a,b=this.$element,d=this.options;this.fixTitle();d=this.options;"string"== typeof d.title?a=b.attr("title"==d.title?"original-title":d.title):"function"==typeof d.title&&(a=d.title.call(b[0]));return(a=(""+a).replace(/(^\s*|\s*$)/,""))||d.fallback},tip:function() {this.$tip||(this.$tip=b('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'));return this.$tip},validate:function() {this.$element[0].parentNode||(this.hide(),this.options=this.$element=null)},enable:function() {this.enabled=!0},disable:function() {this.enabled=!1},toggleEnabled:function() {this.enabled= !this.enabled}};b.fn.tipsy=function(a) {function c(e) {var c=b.data(e,"tipsy");c||(c=new l(e,b.fn.tipsy.elementOptions(e,a)),b.data(e,"tipsy",c));return c}function d() {var b=c(this);b.hoverState="in";0==a.delayIn?b.show():(b.fixTitle(),setTimeout(function() {"in"==b.hoverState&&b.show()},a.delayIn))}function f() {var b=c(this);b.hoverState="out";0==a.delayOut?b.hide():setTimeout(function() {"out"==b.hoverState&&b.hide()},a.delayOut)}if(!0===a)return this.data("tipsy");if("string"==typeof a) {var g=this.data("tipsy"); if(g)g[a]();return this}a=b.extend({},b.fn.tipsy.defaults,a);a.live||this.each(function() {c(this)});if("manual"!=a.trigger) {var g=a.live?"live":"bind",h="hover"==a.trigger?"mouseleave":"blur";this[g]("hover"==a.trigger?"mouseenter":"focus",d)[g](h,f)}return this};b.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:0.8,title:"title",theme:["black","white"],trigger:"hover"};b.fn.tipsy.elementOptions=function(a,c) {return b.metadata? b.extend({},c,b(a).metadata()):c};b.fn.tipsy.autoNS=function() {return b(this).offset().top>b(document).scrollTop()+b(window).height()/2?"s":"n"};b.fn.tipsy.autoWE=function() {return b(this).offset().left>b(document).scrollLeft()+b(window).width()/2?"e":"w"};b.fn.tipsy.autoBounds=function(a,c) {return function() {var d=c[0],f=1<c.length?c[1]:!1,g=b(document).scrollTop()+a,h=b(document).scrollLeft()+a,e=b(this);e.offset().top<g&&(d="n");e.offset().left<h&&(f="w");b(window).width()+b(document).scrollLeft()- e.offset().left<a&&(f="e");b(window).height()+b(document).scrollTop()-e.offset().top<a&&(d="s");return d+(f?f:"")}}})(jQuery);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
query-string
|
query-string
|
||||||
@ -22,25 +22,24 @@ https://github.com/sindresorhus/query-string
|
|||||||
by Sindre Sorhus
|
by Sindre Sorhus
|
||||||
MIT License
|
MIT License
|
||||||
*/
|
*/
|
||||||
(function(){var b={parse:function(a){return"string"!==typeof a?{}:(a=a.trim().replace(/^\?/,""))?a.trim().split("&").reduce(function(a,b){var c=b.replace(/\+/g," ").split("=");a[c[0]]=void 0===c[1]?null:decodeURIComponent(c[1]);return a},{}):{}},stringify:function(a){return a?Object.keys(a).map(function(b){return encodeURIComponent(b)+"="+encodeURIComponent(a[b])}).join("&"):""}};"undefined"!==typeof module&&module.exports?module.exports=b:window.queryString=b})();
|
(function() {var b={parse:function(a) {return"string"!==typeof a?{}:(a=a.trim().replace(/^\?/,""))?a.trim().split("&").reduce(function(a,b) {var c=b.replace(/\+/g," ").split("=");a[c[0]]=void 0===c[1]?null:decodeURIComponent(c[1]);return a},{}):{}},stringify:function(a) {return a?Object.keys(a).map(function(b) {return encodeURIComponent(b)+"="+encodeURIComponent(a[b])}).join("&"):""}};"undefined"!==typeof module&&module.exports?module.exports=b:window.queryString=b})();/* eslint-enable */
|
||||||
|
|
||||||
/* page search */
|
/* page search */
|
||||||
/*jshint browser:true, jquery:true */
|
/*jshint browser:true, jquery:true */
|
||||||
/*global queryString:false */
|
/*global queryString:false */
|
||||||
jQuery(function($){
|
jQuery(function($) {
|
||||||
// $("body p").highlight(["jQuery", "highlight", "plugin"]);
|
// $("body p").highlight(["jQuery", "highlight", "plugin"]);
|
||||||
var resultsLength, searching,
|
var resultsLength, searching,
|
||||||
search = window.location.search,
|
search = window.location.search,
|
||||||
$results = [],
|
$results = [],
|
||||||
index = 0,
|
index = 0,
|
||||||
menuWidth = 250,
|
menuWidth = 250,
|
||||||
$window = $(window),
|
|
||||||
$main = $('#main'),
|
$main = $('#main'),
|
||||||
$search = $('.search').val(''), // Firefox retains the input value
|
$search = $('.search').val(''), // Firefox retains the input value
|
||||||
$status = $('.status'),
|
$status = $('.status'),
|
||||||
$word = $('#word'),
|
$word = $('#word'),
|
||||||
$case = $('#cstrue'), // case sensitive
|
$case = $('#cstrue'), // case sensitive
|
||||||
updateStatus = function(){
|
updateStatus = function() { console.log('update status')
|
||||||
var value = $search.val();
|
var value = $search.val();
|
||||||
$status.empty().removeClass('busy');
|
$status.empty().removeClass('busy');
|
||||||
if (resultsLength) {
|
if (resultsLength) {
|
||||||
@ -58,14 +57,14 @@ jQuery(function($){
|
|||||||
message('');
|
message('');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
message = function(text){
|
message = function(text) {
|
||||||
$status
|
$status
|
||||||
.attr('original-title', text)
|
.attr('original-title', text)
|
||||||
.tipsy( text === '' ? 'hide' : 'show' );
|
.tipsy( text === '' ? 'hide' : 'show' );
|
||||||
// make sure the result count doesn't cover the search text
|
// make sure the result count doesn't cover the search text
|
||||||
$search.css('padding-right', $status.width() + 5);
|
$search.css('padding-right', $status.width() + 5);
|
||||||
},
|
},
|
||||||
jumpTo = function(){
|
jumpTo = function() {
|
||||||
if (resultsLength) {
|
if (resultsLength) {
|
||||||
var resultPosition, parentPosition, leftPosition,
|
var resultPosition, parentPosition, leftPosition,
|
||||||
$current = $results.eq(index),
|
$current = $results.eq(index),
|
||||||
@ -88,7 +87,7 @@ jQuery(function($){
|
|||||||
}
|
}
|
||||||
updateStatus();
|
updateStatus();
|
||||||
},
|
},
|
||||||
applySearch = function(){
|
applySearch = function() {
|
||||||
searching = queryString.parse(search);
|
searching = queryString.parse(search);
|
||||||
if (searching.q) {
|
if (searching.q) {
|
||||||
$('#main-nav-check').prop('checked', true);
|
$('#main-nav-check').prop('checked', true);
|
||||||
@ -104,15 +103,15 @@ jQuery(function($){
|
|||||||
|
|
||||||
$search
|
$search
|
||||||
// needed for IE
|
// needed for IE
|
||||||
.on('keyup', function(e){
|
.on('keyup', function(e) {
|
||||||
if (e.which === 13) {
|
if (e.which === 13) {
|
||||||
$(this).trigger('change');
|
$(this).trigger('change');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.add('#word, #letter, #cstrue, #csfalse').on('change', function(event, newIndex){
|
.add('#word, #letter, #cstrue, #csfalse').on('change', function(event, newIndex) {
|
||||||
index = newIndex || 0;
|
index = newIndex || 0;
|
||||||
$status.addClass('busy');
|
$status.addClass('busy');
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
$main
|
$main
|
||||||
.unhighlight()
|
.unhighlight()
|
||||||
.highlight( $search.val(), {
|
.highlight( $search.val(), {
|
||||||
@ -128,7 +127,7 @@ jQuery(function($){
|
|||||||
jumpTo();
|
jumpTo();
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
$('.search-prev, .search-next').click(function(){
|
$('.search-prev, .search-next').click(function() {
|
||||||
if (resultsLength) {
|
if (resultsLength) {
|
||||||
index = index + ($(this).hasClass('search-prev') ? -1 : 1);
|
index = index + ($(this).hasClass('search-prev') ? -1 : 1);
|
||||||
if (index < 0) { index = resultsLength - 1; }
|
if (index < 0) { index = resultsLength - 1; }
|
||||||
@ -136,17 +135,17 @@ jQuery(function($){
|
|||||||
jumpTo();
|
jumpTo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.search-clear').click(function(){
|
$('.search-clear').click(function() {
|
||||||
$search.val('').change();
|
$search.val('').change();
|
||||||
updateStatus();
|
updateStatus();
|
||||||
});
|
});
|
||||||
$main.on('click', '.highlight', function(){
|
$main.on('click', '.highlight', function() {
|
||||||
index = $results.index(this);
|
index = $results.index(this);
|
||||||
updateStatus();
|
updateStatus();
|
||||||
});
|
});
|
||||||
$('#main-nav-check').on('change', function(){
|
$('#main-nav-check').on('change', function() {
|
||||||
var isChecked = this.checked;
|
var isChecked = this.checked;
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
$status.tipsy( isChecked ? 'show' : 'hide' );
|
$status.tipsy( isChecked ? 'show' : 'hide' );
|
||||||
}, 250);
|
}, 250);
|
||||||
});
|
});
|
||||||
@ -156,11 +155,12 @@ jQuery(function($){
|
|||||||
$('.tooltip-edge-left').tipsy({ gravity: 'nw' });
|
$('.tooltip-edge-left').tipsy({ gravity: 'nw' });
|
||||||
$('.tooltip-edge-right').tipsy({ gravity: 'ne' });
|
$('.tooltip-edge-right').tipsy({ gravity: 'ne' });
|
||||||
$('.tooltip-right').tipsy({ gravity: 'w' });
|
$('.tooltip-right').tipsy({ gravity: 'w' });
|
||||||
$('.status').tipsy({
|
$status.tipsy({
|
||||||
gravity: 's',
|
gravity: 's',
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
theme: [ '#d9534f', 'white' ]
|
theme: [ '#d9534f', 'white' ]
|
||||||
});
|
});
|
||||||
|
$status.tipsy('hide');
|
||||||
|
|
||||||
// search on load
|
// search on load
|
||||||
// ?q=array&index=10
|
// ?q=array&index=10
|
||||||
|
Loading…
Reference in New Issue
Block a user