Advertisement
Joeytje50

Untitled

Sep 23rd, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (document.getElementById('ask_form')) {
  2. document.getElementById('ask_form').onsubmit = function(e) {
  3.     var expr = document.getElementById('answers_ask_field').value.replace(',','')
  4.     var regex = /^(what( i|')s )?([- \d\.\*\+\/\(\)\^=<>]|\de[\d-]|ln|exp|trunc|floor|ceil|abs|a?(sin|cos|tan)|not|and|or|pi)*$/i;
  5.     if (expr.match(regex)) {
  6.         e.preventDefault();
  7.         location = wgServer + wgArticlePath.replace('$1',expr);
  8.         return false;
  9.     } else { return askQuestion() }
  10. };
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement