Browse Source

! tweak the way we show the quick modify button/icon

Signed-off-by: Spuds <spuds@simplemachines.org>
Spuds 12 years ago
parent
commit
64ba421f62

+ 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('

+ 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)

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

@@ -308,9 +308,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";
+		}
 	}
 }