Active
Project:
Showcase
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Mar 2007 at 22:53 UTC
Updated:
22 Mar 2007 at 15:06 UTC
I have showcases set to only show on particular pages - but the showcase.js is refreshing all my pages and running the queries on all the pages... is there any way it can be prevented (testing for the block being present or something?)
Comments
Comment #1
liquidcms commentedseems like it would be a good idea to only add JS when the showcase block is on a particular page.. but i don't seem to see a drupal function that will let me know if a certain block is on a page.
The last rev of this module (0.7) add some additions to it that i thought stopped it from causing issues when you went to a page that didnt have the block - someone else provided the changes though so i didnt test thoroughly - do you have 0.7?
Comment #2
csc4 commentedI downloaded it yesterday (tried to check for a new version but had to wait for your site to come back) but haven't installed it yet.
I ran a diff on the JS and the only change was the change I gave you which I've already manually added - is that the change you mean?
If the JS is on all pages could it only refresh on pages with showcase content? or set the refresh really long on 'empty of showcase' pages?
Comment #3
liquidcms commentedyes, the changes you suggested are the only ones i have done recently.
the correct way to do this would be to only load the JS when the block is there.. but not sure how to do this... will think about it and see if i can come up with something... luckily i am much more drupal happy than when i created this module.. and really wish i knew about jquery when i did it... makes AJAX code go from 200 lines to under 10.
Comment #4
csc4 commentedThanks for looking into this for me.
The jquery sounds interesting - I am running the jquery47 for jrating
I was thinking about other 'active Javascript' Drupal modules but the only one I can think of is Taxonomy Ticker don't know if there are any ideas there?
Comment #5
csc4 commentedI did try setting a variable showcase_page thinking maybe the Javascript could test for it.
I also stumbled across http://drupal.org/node/58281 with $closure which suggests some sort of post page load test might be possible?
Comment #6
csc4 commentedWhile using the Firebug DOM inspector in Firefox - I noticed that it was making reference to
and to drupal.js line 53 which says
Don't know if that helps at all.