afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-11-19 04:45 pm

[dw-free] Show HTML and example text for default crossposting footer on setting page

[commit: http://hg.dwscoalition.org/dw-free/rev/a110390a7520]

http://bugs.dwscoalition.org/show_bug.cgi?id=1511

Don't show any traces of the dynamic preview if JavaScript is disabled.

Patch by [personal profile] allen.

Files modified:
  • cgi-bin/DW/Setting/XPostAccounts.pm
--------------------------------------------------------------------------------
diff -r a9a663f628bd -r a110390a7520 cgi-bin/DW/Setting/XPostAccounts.pm
--- a/cgi-bin/DW/Setting/XPostAccounts.pm	Thu Nov 19 16:36:36 2009 +0000
+++ b/cgi-bin/DW/Setting/XPostAccounts.pm	Thu Nov 19 16:45:03 2009 +0000
@@ -145,7 +145,7 @@ sub option {
         value     => $footer_text
     }) . "<br/><br/>";
 
-    $ret .= "" . $class->ml('setting.xpost.preview') . "\n";
+    $ret .= "<div id='preview_section' style='display: none;'>" . $class->ml('setting.xpost.preview') . "\n";
 
     my $baseurl = $LJ::SITEROOT;
     my $alttext = $class->ml('setting.xpost.option.footer.vars.comment_image.alttext');
@@ -153,6 +153,7 @@ sub option {
 
     $ret .= qq [
       <div id='footer_preview' class='xpost_footer_preview'></div>
+      </div>
       <script type="text/javascript">
         function updatePreview() {
           var previewString = \$('${key}crosspost_footer_text').value;
@@ -165,6 +166,7 @@ sub option {
           previewString = previewString.replace(/%%comment_image%%/, '<img src="$baseurl/tools/commentcount?samplecount=23" width="30" height="12" alt="$alttext" style="vertical-align: middle;"/>');
           \$('footer_preview').innerHTML = previewString;
         }
+        \$('preview_section').style.display = 'block';
         updatePreview();
       </script>
     ];
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org