can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r17906: LJSUP-7518: Add checkboxes for removing ...

Committer: dpetrov
LJSUP-7518: Add checkboxes for removing posts from Top entries admin tool
A   trunk/htdocs/js/admin/
A   trunk/htdocs/js/admin/topentries.js
Added: trunk/htdocs/js/admin/topentries.js
===================================================================
--- trunk/htdocs/js/admin/topentries.js	                        (rev 0)
+++ trunk/htdocs/js/admin/topentries.js	2010-12-13 04:58:30 UTC (rev 17906)
@@ -0,0 +1,23 @@
+jQuery( function( $ ) {
+	var CONFIG = {
+		container: "#delete-posts",
+		selectall: "li:first input[type=checkbox]",
+		elements: "li:not(:first) input[type=checkbox]"
+	}
+
+	var container = $( CONFIG.container ),
+		selectall = container.find( CONFIG.selectall ),
+		elements = container.find( CONFIG.elements );
+
+	function selectAllCheckboxes() {
+		var checked = !!selectall.attr( 'checked' );
+		elements.attr( 'checked', checked );
+	}
+
+	selectall.change( function() { setTimeout( selectAllCheckboxes, 0 ) } );
+	elements.change( function() {
+		if( !this.checked ) {
+			selectall.attr( 'checked', false );
+		}
+	} );
+} );

Tags: can3p, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments