can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r20129: LJSUP-9819: Notes text of checkbox "Stic...

Committer: dpetrov
LJSUP-9819: Notes text of checkbox "Stick this post to the top" does not change when you change value in the settings "Post to"
U   branches/delayed_entries/htdocs/js/entry.js
Modified: branches/delayed_entries/htdocs/js/entry.js
===================================================================
--- branches/delayed_entries/htdocs/js/entry.js	2011-09-26 09:01:34 UTC (rev 20128)
+++ branches/delayed_entries/htdocs/js/entry.js	2011-09-26 09:12:29 UTC (rev 20129)
@@ -12,12 +12,16 @@
 }
 
 function editdate(){
-	clearInterval(settime.interval);
 	var currentDate = jQuery('#currentdate'),
 		modifyDate = jQuery('#modifydate'),
 		cal = modifyDate.find('.wrap-calendar'),
 		calVal = modifyDate.find('.wrap a');
 
+	if (settime.interval) {
+		currentDate.data('dotime', '1');
+	}
+	clearInterval(settime.interval);
+
 	currentDate.hide();
 	modifyDate.css('display', '');
 
@@ -37,6 +41,50 @@
 	});
 }
 
+function revertdate() {
+	var currentDate = jQuery('#currentdate'),
+		modifyDate = jQuery('#modifydate'),
+		cal = modifyDate.find('.wrap-calendar');
+
+	if (cal.is(':lj-calendar')) {
+		cal.calendar('destroy');
+	}
+
+	currentDate.css('display', '');
+	modifyDate.hide();
+
+	if (currentDate.data('dotime')) {
+		settime.interval = setInterval(function() { settime(); }, 1000);
+		settime();
+	}
+}
+
+function setPostingPermissions(journal) {
+	if (!Site.remote_permissions[journal]) { return; }
+
+	var modifyDate = jQuery('#modifydate'),
+		stickyCheckbox = jQuery('#sticky_type'),
+		stickyLabel = jQuery('#sticky_type_label'),
+		currentDateEdit = jQuery('#currentdate-edit');
+
+		journal = Site.remote_permissions[journal];
+
+	if (!journal.can_post_delayed) {
+		if (modifyDate.is(':visible')) {
+			revertdate();
+		}
+		currentDateEdit.hide();
+	} else {
+		currentDateEdit.show();
+	}
+
+	stickyCheckbox.attr('disabled', !journal.can_create_sticky);
+	stickyLabel.html(journal.is_replace_sticky ? 
+			Site.ml_text['entryform.sticky_replace.edit'] :
+			Site.ml_text['entryform.sticky.edit']);
+
+}
+
 function showEntryTabs(){
 	document.getElementById('entry-tabs').style.visibility = 'visible';
 }
@@ -602,7 +650,7 @@
 	f.date_ymd_yyyy.value = newTime.getFullYear() < 1900 ? newTime.getFullYear() + 1900 : newTime.getFullYear();
 	f.date_ymd_mm.selectedIndex = twodigit(newTime.getMonth() + 1);
 	f.date_ymd_dd.value = twodigit(newTime.getDate());
-	if (!newTime) {
+	if (!time) {
 		f.hour.value = twodigit(newTime.getHours());
 		f.min.value = twodigit(newTime.getMinutes());
 	}

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