Снорк (nely_snork) wrote in changelog,
Снорк
nely_snork
changelog

[livejournal] r17224: LJSUP-6657: If the user selects not publ...

Committer: narefieva
LJSUP-6657: If the user selects not public post in the update.bml the flags facebook and twitter should be disabled
U   trunk/htdocs/js/entry.js
Modified: trunk/htdocs/js/entry.js
===================================================================
--- trunk/htdocs/js/entry.js	2010-08-30 08:07:28 UTC (rev 17223)
+++ trunk/htdocs/js/entry.js	2010-08-30 08:50:44 UTC (rev 17224)
@@ -61,6 +61,34 @@
     return false;
 }
 
+function updateRepostButtons(stateIndex)
+{
+    var boxes = ['facebook', 'twitter'],
+        input, label, parentNode,
+        parentDisableClass = 'b-repost-item-disabled';
+
+    for(var i in boxes)
+    {
+        input = $('repost_' + boxes[i]);
+        if(!input) continue;
+
+        parentNode = input.parentNode;
+        label = parentNode.getElementsByTagName('label')[0];
+
+        if(stateIndex > 0 || parentNode.className.indexOf(parentDisableClass) != -1)
+        {
+            input.setAttribute('disabled', 'disabled');
+            label.className = "repost_disabled";
+            input.checked = false;
+        }
+        else {
+            input.removeAttribute('disabled');
+            label.className = "repost_" + boxes[i];
+        }
+    }
+
+}
+
 function customboxes (e) {
     if (! e) var e = window.event;
     if (! document.getElementById) return false;
@@ -71,6 +99,8 @@
     
     var custom_boxes = $('custom_boxes');
     if (! custom_boxes) return false;
+
+    updateRepostButtons(f.security.selectedIndex);
     
     if (f.security.selectedIndex != 3) {
         custom_boxes.style.display = 'none';

Tags: js, livejournal, nely_snork
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