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