/** * IP.Links v3.2.0 by the IPS Community Developers * JS Library * * ID: $Id: links.js 20 2009-12-29 03:42:57Z brandond $ * Last Updated: $Date: 2009-12-28 22:42:57 -0500 (Mon, 28 Dec 2009) $ * * @author $Author: brandond $ * @link http://community.invisionpower.com/ * @version $Revision: 20 $ */ var _links = window.IPBoard; _links.prototype.links = { /** * Constructor: init events * * @param void * @return void */ init: function() { document.observe( 'dom:loaded', function() { /* Mod form submission */ if ( $( 'modform' ) ) { $( 'modform' ).observe( 'submit', ipb.forums.submitModForm ); } /* Link listing filters */ if ( $( 'filter_form' ) ) { $( 'filter_form' ).hide(); $( 'show_filters' ).show(); } /* Statistic Links */ $$( '.link_slink' ).each( function( elem ) { ipb.links.initStatPopups( elem ); } ); /* Resizing images? */ if ( $( 'theComments' ) ) { ipb.global.findImgs( 'theComments' ); } /* AJAX mark category as read */ $$( '.linksMarkCat' ).each( function( elem ) { ipb.links.initCatMarker( elem ); } ); /* Delete reasons */ if ( $( 'frmRejections' ) ) { $$( '.deleteReason' ).each( function( elem ) { $( elem.id ).observe( 'focus', function( e ) { elem = Event.element( e ); if ( $F( elem.id ).match( 'Tip: Click here to enter a reason for the rejection of' ) ) { elem.value = ''; } } ); } ); } } ); }, initStatPopups: function( elem ) { var statType = elem.id.replace( 'slink_', '' ); var url = ipb.vars[ 'base_url' ] + "&app=links&module=ajax&secure_key=" + ipb.vars[ 'secure_hash' ] + "&do=" + statType; $( elem ).observe( 'click', function( e ) { Event.stop( e ); popup = new ipb.Popup( 'statsPane', { type: 'pane', modal: false, w: '500px', h: '400px', ajaxURL: url, hideAtStart: false, close: 'a[rel="close"]' } ); } ); }, initCatMarker: function( elem ) { var catId = elem.id.replace( 'links_cat_img_', '' ); var url = ipb.vars[ 'base_url' ] + "&app=links&module=ajax§ion=markread&secure_key=" + ipb.vars[ 'secure_hash' ] + "&do=markread&marktype=cat&cid=" + catId; var classes = $w( elem.className ); $( elem ).observe( 'click', function( e ) { new Ajax.Request( url, { method: 'post', onSuccess: function( t ) { $( elem ).replace( ipb.global.boardMarkers[ classes[ classes.length - 1 ] ] ); } } ); Event.stop( e ); } ); } } ipb.links.init();