/** * Automatic behaviours * * This class wraps various JavaScript functionalities that are triggered * automatically whenever a certain object is in the DOM or a certain CSS * class was found */ var dw_behaviour = { init: function(){ dw_behaviour.focusMarker(); dw_behaviour.scrollToMarker(); dw_behaviour.removeHighlightOnClick(); dw_behaviour.quickSelect(); dw_behaviour.checkWindowsShares(); dw_behaviour.subscription(); dw_behaviour.revisionBoxHandler(); jQuery('#page__revisions input[type=checkbox]').click( dw_behaviour.revisionBoxHandler ); }, /** * Looks for an element with the ID scroll__here at scrolls to it */ scrollToMarker: function(){ var $obj = jQuery('#scroll__here'); if($obj.length) { $obj[0].scrollIntoView(); } }, /** * Looks for an element with the ID focus__this at sets focus to it */ focusMarker: function(){ jQuery('#focus__this').focus(); }, /** * Remove all search highlighting when clicking on a highlighted term * * @FIXME would be nice to have it fade out */ removeHighlightOnClick: function(){ jQuery('span.search_hit').click( function(e){ jQuery(e.target).removeClass('search_hit'); } ); }, /** * Autosubmit quick select forms * * When a