[pLog-svn] r2437 - plog/branches/plog-1.0.2/js/ui

oscar at devel.plogworld.net oscar at devel.plogworld.net
Thu Sep 1 22:25:41 GMT 2005


Author: oscar
Date: 2005-09-01 22:25:40 +0000 (Thu, 01 Sep 2005)
New Revision: 2437

Modified:
   plog/branches/plog-1.0.2/js/ui/common.js
Log:
this solves issue http://bugs.plogworld.net/view.php?id=484, finally safari is able to show the post preview again!


Modified: plog/branches/plog-1.0.2/js/ui/common.js
===================================================================
--- plog/branches/plog-1.0.2/js/ui/common.js	2005-09-01 21:36:48 UTC (rev 2436)
+++ plog/branches/plog-1.0.2/js/ui/common.js	2005-09-01 22:25:40 UTC (rev 2437)
@@ -291,12 +291,15 @@
 
 function previewPost( formId )
 {
+
     form = document.getElementById( formId )
     
-    if( submitNewPost( form )) {
-        preview = window.open( 'about:blank', '', 'scrollbars=yes,resizable=yes,toolbar=no' );
+    if( submitNewPost( form )) { 
+        preview = window.open( '', '', 'scrollbars=yes,resizable=yes,toolbar=no' );
+        preview.focus();
         
-        // write the contents as a form with hidden fields
+        // write the contents as a form with hidden fields        
+        preview.document.open();
         preview.document.write( '<html><body><div style="display:none">' +
                                 '<form name="previewForm" method="post" action="admin.php">' +
                                 '<input type="hidden" name="op" value="previewPost">' );
@@ -310,7 +313,7 @@
         else {
         	postText = form.postText.value;
         	postExtendedText = form.postExtendedText.value;
-    	}
+    	}    	
         preview.document.write( '<textarea name="postText">' + postText + '</textarea>' +
                                 '<textarea name="postTopic">' + form.postTopic.value + '</textarea>' +
                                 '<textarea name="postExtendedText">' + postExtendedText + '</textarea>' +
@@ -324,7 +327,8 @@
             if( form.postCategories.options[i].selected )
                 preview.document.write( '<option selected="selected" value="' + form.postCategories.options[i].value + '">test</option>' );
         }
-        preview.document.write( '</select>' );        
+        
+        preview.document.write( '</select>' );                        
         // custom fields -- since we don't know their exact names and amount, we need to loop through the whole form to find them!        
         for(var i = 0; i < form.elements.length; i++ ) {
             var itemName = form.elements[i].name;
@@ -342,9 +346,10 @@
         preview.document.write( '</form></div>' +
                                 '<b>Loading preview, please wait...</b>' +
                                 '</body></html>' );
+        preview.document.close();
     
         // and submit the form
-        preview.document.previewForm.submit();        
+        preview.document.previewForm.submit();
     }
 }
 




More information about the pLog-svn mailing list