pinout.vvzero.com/resources/pinout.js

96 lines
2.3 KiB
JavaScript
Raw Normal View History

2015-02-25 01:28:00 +08:00
jQuery(document).ready(function(){
2015-03-28 16:29:11 +08:00
var overlay_slideUp;
var dropdowns = $('#sections ul li .dropdown');
2015-02-25 01:28:00 +08:00
2015-03-22 01:27:02 +08:00
$('pre').addClass('prettyprint').addClass('linenums');
2015-02-25 01:28:00 +08:00
window.prettyPrint&&prettyPrint();
var groups = $('#sections .boards .group');
var group_nav = $('#sections .boards .group-nav li');
groups.hide().filter(':eq(0)').show();
group_nav.removeClass('active').filter(':eq(0)').addClass('active');
group_nav.on('click',function(e){
group_nav.removeClass('active');
$(this).addClass('active');
groups.hide();
var group = $(this).data('group');
groups.filter('.group_' + group).show();
})
2016-01-31 05:59:01 +08:00
2015-03-28 16:43:07 +08:00
$('#container').on('click',function(){
2016-01-31 05:59:01 +08:00
dropdowns.slideUp(100);
2016-01-31 06:14:51 +08:00
});
2015-03-28 16:43:07 +08:00
$('#sections > ul > li > a').on('click',function(e){
2016-01-31 06:14:51 +08:00
e.preventDefault();
e.stopPropagation();
var dropdown = $(this).parent().find('.dropdown');
2016-01-31 06:14:51 +08:00
dropdowns.hide();
dropdown.show();
});
$('#sections > ul > li > a').hover(function(e){
e.preventDefault();
var dropdown = $(this).parent().find('.dropdown');
2015-03-28 16:29:11 +08:00
clearTimeout(overlay_slideUp);
2016-01-31 05:59:01 +08:00
if(dropdowns.filter(':visible').length){
dropdowns.hide();
dropdown.show();
}
else
{
overlay_slideUp = setTimeout(function(){dropdowns.slideUp(100);dropdown.slideDown(100);}, 300);
}
2016-01-31 06:14:51 +08:00
},function(e){
e.preventDefault();
var dropdown = $(this).parent().find('.dropdown');
2015-03-28 16:29:11 +08:00
clearTimeout(overlay_slideUp);
2016-01-31 06:26:03 +08:00
overlay_slideUp = setTimeout(function(){dropdown.slideUp(100);}, 100);
2015-03-28 16:29:11 +08:00
});
2015-03-22 02:35:46 +08:00
dropdowns.on('click',function(e){
e.stopPropagation();
})
dropdowns.hover(function(e){
2016-01-31 06:26:03 +08:00
clearTimeout(overlay_slideUp);
},function(e){
e.preventDefault();
var dropdown = $(this);
clearTimeout(overlay_slideUp);
overlay_slideUp = setTimeout(function(){dropdown.slideUp(100);}, 100);
})
$('article p').each(function(){
html = $(this).html();
html = html.replace(
/Physical\ Pin\ ([0-9]{1,2})/gi,
function(str, c1){
return '<span class="pin-hover" data-pin="' + c1 + '">' + str + '</span>';
}
)
$(this).html(html);
});
$('article p .pin-hover').hover(function(){
var pin = $(this).data('pin');
$('li.pin' + pin).addClass('hover-pin');
},function(){
var pin = $(this).data('pin');
$('li.pin' + pin).removeClass('hover-pin');
});
$('article p').on('click','.pin-hover',function(){
var pin = $(this).data('pin');
$('li.pin' + pin + ' a').trigger('click');
})
2015-02-26 01:29:06 +08:00
});