]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/templates/ask.html
should now be working for chrome/safari/firefox. still need to fix markdown display...
[osqa.git] / forum / skins / default / templates / ask.html
index c17ea51dedf07b1d65223175881219c513c9e07a..7b34ba4c9743a0e17574225c1b2eb8b02791edd1 100644 (file)
                 }
 
             });
                 }
 
             });
+
         });
 
         });
 
+        function submitClicked(e) {
+            if(!(browserTester('chrome') || browserTester('safari'))) {
+                $("input.submit")[0].disabled=true;
+            }
+            window.removeEventListener('beforeunload', beforeUnload, true);
+        }
+
         function beforeUnload(e) {
             if($("input#id_title")[0].value != "" || $("textarea#editor")[0].value != "" || $("input#id_tags")[0].value != "") {
         function beforeUnload(e) {
             if($("input#id_title")[0].value != "" || $("textarea#editor")[0].value != "" || $("input#id_tags")[0].value != "") {
-                yourWorkWillBeLost(e);
+                return yourWorkWillBeLost(e);
             }
             }
-            return false;
         }
         window.addEventListener('beforeunload', beforeUnload, true);
 
         }
         window.addEventListener('beforeunload', beforeUnload, true);
 
                        <p class="title-desc">
                                {{ form.tags.help_text }}
                        </p>
                        <p class="title-desc">
                                {{ form.tags.help_text }}
                        </p>
-            {% if not request.user.is_authenticated %}
-            <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
+            {% if not request.user.is_authenticated %}                                                                        
+            <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" onclick="submitClicked(event)"/>
                        {% else %}
                        {% else %}
-            <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" onclick="window.removeEventListener('beforeunload', beforeUnload, true)" />
+            <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" onclick="submitClicked(event)"/>
             {% endif %}
         </form>
     </div>
             {% endif %}
         </form>
     </div>