minor jquery speedups

pull/1/head
Andromeda Yelton 2012-02-07 13:41:21 -05:00
parent e51148254b
commit e579fdfc96
8 changed files with 27 additions and 31 deletions

View File

@ -12,7 +12,6 @@
<script type="text/javascript" src={{ jquery_ui_home }}></script>
<script type="text/javascript" src="/static/js/greenpanel.js"></script>
<script type="text/javascript" src="/static/js/toggle.js"></script>
<script type="text/javascript" src="/static/js/tabs.js"></script>
{% endblock %}
{% block topsection %}
@ -56,7 +55,7 @@
<div id="content-block">
<div class="content-block-heading ungluing" id="tabs">
<ul class="tabs">
<li class="tabs2 active"><a href="#">Being Unglued</a></li>
<li class="tabs2 active"><a href="#">Active</a></li>
</ul>
<ul class="book-list-view">

View File

@ -55,7 +55,7 @@
<div class="content-block-heading ungluing" id="tabs">
<ul class="tabs">
<li class="tabs1"><a href="#">Unglued</a></li>
<li class="tabs2 active"><a href="#">Being Unglued</a></li>
<li class="tabs2 active"><a href="#">Active</a></li>
<li class="tabs3"><a href="#">Unglue It!</a></li>
</ul>
<div class="badges listspage">

View File

@ -6,7 +6,7 @@
function() {
$j(this).toggleClass("active");
$j("#user-block-hide").slideToggle(300);
$j("a#readon").toggleClass("down");
$j("#readon").toggleClass("down");
}
);
});

View File

@ -1,12 +1,12 @@
var $j =jQuery.noConflict();
$j(document).ready(function(){
$j('.book-list').bind("mouseenter", (function()
$j('div.book-list').bind("mouseenter", (function()
{
$j(this).children('.panelfront').removeClass('side1').addClass('side2');
$j(this).children('.panelback').removeClass('side2').addClass('side1');
}));
$j('.book-list').bind("mouseleave", (function()
$j('div.book-list').bind("mouseleave", (function()
{
$j(this).children('.panelback').removeClass('side1').addClass('side2');
$j(this).children('.panelfront').removeClass('side2').addClass('side1');

View File

@ -9,15 +9,12 @@
);
// caching selections to speed up response
var tabs = $j('.tabs');
var tabs = $j('ul.tabs');
var tabsId = $j('#tabs');
var tabs1 = $j('.tabs1');
var tabs2 = $j('.tabs2');
var tabs3 = $j('.tabs3');
var contentBlockContent = $j('#content-block-content');
var tabsDash1 = $j('.tabs-1');
var tabsDash2 = $j('.tabs-2');
var tabsDash3 = $j('.tabs-3');
tabs1.click(function(){
tabs.find('.active').removeClass('active');

View File

@ -3,10 +3,10 @@
$j(document).ready(function(){
// caching the selections to speed up response
var tabs = $j('#tabs');
var tabs1 = $j('.tabs1');
var tabs2 = $j('.tabs2');
var tabs3 = $j('.tabs3');
var tabs4 = $j('.tabs4');
var tabs1 = $j('li.tabs1');
var tabs2 = $j('li.tabs2');
var tabs3 = $j('li.tabs3');
var tabs4 = $j('li.tabs4');
var tabId1 = $j('#tabs-1');
var tabId2 = $j('#tabs-2');
var tabId3 = $j('#tabs-3');
@ -14,45 +14,45 @@
var contentBlockContent = $j('#content-block-content');
tabs1.click(function(){
tabs.find('.active').removeClass('active');
tabs.find('div.active').removeClass('active');
$j(this).addClass('active');
contentBlockContent.find('.active').removeClass('active');
contentBlockContent.find('div.active').removeClass('active');
tabId1.addClass('active').show(300);
tabId2.hide(200);
tabId3.hide(200);
tabId4.hide(200);
});
tabs2.click(function(){
tabs.find('.active').removeClass('active');
tabs.find('div.active').removeClass('active');
$j(this).addClass('active');
contentBlockContent.find('.active').removeClass('active');
contentBlockContent.find('div.active').removeClass('active');
tabId2.addClass('active').show(300);
tabId1.hide(200);
tabId3.hide(200);
tabId4.hide(200);
});
tabs3.click(function(){
tabs.find('.active').removeClass('active');
tabs.find('div.active').removeClass('active');
$j(this).addClass('active');
contentBlockContent.find('.active').removeClass('active');
contentBlockContent.find('div.active').removeClass('active');
tabId3.addClass('active').show(300);
tabId2.hide(200);
tabId1.hide(200);
tabId4.hide(200);
});
tabs4.click(function(){
tabs.find('.active').removeClass('active');
tabs.find('div.active').removeClass('active');
$j(this).addClass('active');
contentBlockContent.find('.active').removeClass('active');
contentBlockContent.find('div.active').removeClass('active');
tabId4.addClass('active').show(300);
tabId2.hide(200);
tabId1.hide(200);
tabId3.hide(200);
});
$j('.findtheungluers').click(function(){
tabs.find('.active').removeClass('active');
tabs.find('div.active').removeClass('active');
$j('#supporters').addClass('active');
contentBlockContent.find('.active').removeClass('active');
contentBlockContent.find('div.active').removeClass('active');
tabId3.addClass('active').show(300);
tabId2.hide(200);
tabId1.hide(200);

View File

@ -12,13 +12,13 @@ $j(document).ready(function() {
});
function toggleList() {
$j('.panelview').addClass("listview").removeClass("panelview");
$j('div.panelview').addClass("listview").removeClass("panelview");
$j(this).css({opacity: 1});
$j('#toggle-panel').css({opacity: .2});
}
function togglePanel() {
$j('.listview').addClass("panelview").removeClass("listview");
$j('div.listview').addClass("panelview").removeClass("listview");
$j(this).css({opacity: 1});
$j('#toggle-list').css({opacity: .2});
}

View File

@ -2,7 +2,7 @@ var $j = jQuery.noConflict();
$j('#content-block').ready(function() {
$j(".add-wishlist").each(function (index, element) {
$j("div.add-wishlist").each(function (index, element) {
$j(element).click(function() {
var span = $j(element).find("span");
var gb_id = span.attr('id')
@ -24,7 +24,7 @@ $j('#content-block').ready(function() {
});
});
$j(".remove-wishlist").each(function (index, element) {
$j("div.remove-wishlist").each(function (index, element) {
$j(element).click(function() {
var span = $j(element).find("span");
var work_id = span.attr('id')
@ -35,7 +35,7 @@ $j('#content-block').ready(function() {
});
});
$j(".create-account").each(function (index, element) {
$j("div.create-account").each(function (index, element) {
$j(element).click(function() {
var span = $j(element).find("span");
var work_url = span.attr('title')
@ -48,7 +48,7 @@ $j('#content-block').ready(function() {
// so: slightly different versions ahoy
// note also that we don't have the Django ORM here so we can't readily get from work.id to googlebooks_id
// we're going to have to tell /wishlist/ that we're feeding it a different identifier
$j(".remove-wishlist-workpage").each(function (index, element) {
$j("div.remove-wishlist-workpage").each(function (index, element) {
$j(element).click(function() {
var span = $j(element).find("span");
var work_id = span.attr('id')
@ -74,7 +74,7 @@ var $k = jQuery.noConflict();
// can't bind this to document ready because the .add-wishlist-workpage div doesn't exist until remove-wishlist is executed
// need to use delegate and listen for it
// fyi delegate will be deprecated in favor of live() in jquery 1.7 (this was written for 1.6.3)
$k(document).delegate(".add-wishlist-workpage span", "click", function() {
$k(document).delegate("div.add-wishlist-workpage span", "click", function() {
var span = $k(this);
var work_id = span.attr("class");
if (!work_id || work_id === "on-wishlist") return;