Browse Source

Merge pull request #170 from Spuds/quickmod_tweak

Update to quickmod show button and a couple of fixes
emanuele45 12 years ago
parent
commit
df783ec964

+ 2 - 2
Themes/default/Display.template.php

@@ -568,7 +568,7 @@ function template_main()
 		// Can the user modify the contents of this post?  Show the modify inline image.
 		if ($message['can_modify'])
 			echo '
-							<li class="quick_edit"><img src="', $settings['images_url'], '/icons/modify_inline.png" alt="', $txt['modify_msg'], '" title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" style="cursor: pointer; display: none; margin: 0 0 0 0;" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')" />', $txt['quick_edit'], '</li>';
+							<li class="quick_edit"><img src="', $settings['images_url'], '/icons/modify_inline.png" alt="', $txt['modify_msg'], '" title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" style="cursor: pointer; margin: 0;" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')" />', $txt['quick_edit'], '</li>';
 
 		// Can the user modify the contents of this post?
 		if ($message['can_modify'])
@@ -861,11 +861,11 @@ function template_main()
 					});';
 
 	echo '
-					$(".quick_edit").css("display", "inline");
 					if (\'XMLHttpRequest\' in window)
 					{
 						var oQuickModify = new QuickModify({
 							sScriptUrl: smf_scripturl,
+							sClassName: \'quick_edit\',
 							bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
 							iTopicId: ', $context['current_topic'], ',
 							sTemplateBodyEdit: ', JavaScriptEscape('

+ 1 - 1
Themes/default/languages/index.english.php

@@ -140,7 +140,7 @@ $txt['awaiting_approval'] = 'Awaiting Approval';
 $txt['attach_awaiting_approve'] = 'Attachments awaiting approval';
 $txt['post_awaiting_approval'] = 'Note: This message is awaiting approval by a moderator.';
 $txt['there_are_unapproved_topics'] = 'There are %1$s topics and %2$s posts awaiting approval in this board. Click <a href="%3$s">here</a> to view them all.';
-$txt['sedn_message'] = 'Send message';
+$txt['send_message'] = 'Send message';
 
 $txt['msg_alert_none'] = 'No messages...';
 $txt['msg_alert_you_have'] = 'you have';

+ 9 - 0
Themes/default/scripts/script.js

@@ -28,6 +28,15 @@ if (!('XMLHttpRequest' in window) && 'ActiveXObject' in window)
 // Some older versions of Mozilla don't have this, for some reason.
 if (!('forms' in document))
 	document.forms = document.getElementsByTagName('form');
+	
+// Versions of ie < 9 do not have this built in
+if (!('getElementsByClassName' in document))
+{
+	document.getElementsByClassName = function(className)
+	{
+		return $('".' + className + '"');
+	}
+}
 
 // Load an XML document using XMLHttpRequest.
 function getXMLDocument(sUrl, funcCallback)

+ 9 - 4
Themes/default/scripts/topic.js

@@ -163,7 +163,7 @@ QuickModifyTopic.prototype.modify_topic_done = function (XMLDoc)
 	var subject = message.getElementsByTagName("subject")[0];
 	var error = message.getElementsByTagName("error")[0];
 
-	// No subject or other error>
+	// No subject or other error?
 
 	if (!subject || error)
 		return false;
@@ -172,6 +172,10 @@ QuickModifyTopic.prototype.modify_topic_done = function (XMLDoc)
 	this.set_hidden_topic_areas('');
 	this.bInEditMode = false;
 
+	// redo tips if they are on since we just pulled the rug out on this one 
+	if ($.isFunction($.fn.SMFtooltip));
+		$('.preview').SMFtooltip().smf_tooltip_off;
+	
 	return false;
 }
 
@@ -308,9 +312,10 @@ function QuickModify(oOptions)
 	// Show the edit buttons
 	if (this.bXmlHttpCapable)
 	{
-		for (var i = document.images.length - 1; i >= 0; i--)
-			if (document.images[i].id.substr(0, 14) == 'modify_button_')
-				document.images[i].style.display = '';
+		var aShowQuickModify = document.getElementsByClassName(this.opt.sClassName);
+		for (var i = 0, length = aShowQuickModify.length; i < length; i++) {
+			aShowQuickModify[i].style.display = "inline";
+		}
 	}
 }