Created
February 4, 2010 14:20
-
-
Save mramsden/294659 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="manageable_id_2" class="ep_manageable"> | |
<div class="ep_manageable_data"> | |
<input id="manageable_id_2_check" type="checkbox"> <a href="http://wlbr.local/2/">ZeroWIN Vision Conference</a> | |
</div> | |
<div class="ep_manageable_controls"> | |
<ul> | |
<li>Manage Bookmark</li> | |
<li>Edit Resource</li> | |
<li>Delete Resource</li> | |
</ul> | |
</div> | |
<div style="clear: both;"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.resourceSelection = new Array(); | |
window.resourceSelected = function(element) { | |
return resourceSelection.find(function(n) { return n == element; }); | |
} | |
window.updateResourceSelection = function(event) { | |
var element = event.element(); | |
// There is an issue with event bubbling this is a temporary hack to fix it. | |
if (element.hasClassName('ep_manageable')) { | |
//event.stop(); | |
if (resourceSelected(element)) { | |
resourceSelection = resourceSelection.reject(function(n) { return n.readAttribute('id') == element.readAttribute('id'); }); | |
element.removeClassName('ep_manageable_selected'); | |
$(element.readAttribute('id')+'_check').writeAttribute('checked', false); | |
} else { | |
resourceSelection.push(element); | |
element.addClassName('ep_manageable_selected'); | |
$(element.readAttribute('id')+'_check').writeAttribute('checked', true); | |
} | |
} | |
}; | |
document.observe('dom:loaded', function() { | |
$$('.ep_manageable').each(function(element) { | |
element.observe('click', updateResourceSelection); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment