Plugin Directory

Changeset 888824


Ignore:
Timestamp:
04/07/2014 03:36:50 PM (12 years ago)
Author:
radu.patron
Message:

changing nativ javascript with jquery.

Location:
audio-comments
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • audio-comments/tags/1.0/audior.php

    r874740 r888824  
    235235    $html .= 'var logged = ' . $logged . ';';
    236236    $html .=  <<<EOF
     237    (function($) {
     238        $(document).on('click', '#commentform .form-submit input[type="submit"]', function() {
     239            if (logged == 0) {
     240                var author = document.getElementById('author').value;
     241                if (author == '') { alert('Please complete the author field!'); return false; }
     242           
     243                var email = document.getElementById('email').value;
     244                if (!validateEmail(email)) { alert('Please complete the e-mail field!'); return false; }
     245            }
     246   
     247            var commentText = document.getElementById('comment').value;
     248            if (commentText == '') { alert('Please complete the comment box'); return false; }
     249
     250            if (startedRec == 0) {
     251                HTMLFormElement.prototype.submit.call(document.getElementById("commentform"));
     252            } else if (recording == 0) {
     253                document.Audior.save();
     254            } else {
     255                alert('Please Stop recording before posting the comment!');
     256            }
     257            return false;
     258        });
     259    })(jQuery);
    237260    window.onload = function() {
    238         document.getElementById("submit").onclick = function() {
    239            
    240             if (logged == 0) {
    241                 var author = document.getElementById('author').value;
    242                 if (author == '') { alert('Please complete the author field!'); return false; }
    243            
    244                 var email = document.getElementById('email').value;
    245                 if (!validateEmail(email)) { alert('Please complete the e-mail field!'); return false; }
    246             }
    247        
    248             var commentText = document.getElementById('comment').value;
    249             if (commentText == '') { alert('Please complete the comment box'); return false; }
    250            
    251             if (startedRec == 0) {
    252                 HTMLFormElement.prototype.submit.call(document.getElementById("commentform"));
    253             } else if (recording == 0) {
    254                 document.Audior.save();
    255             } else {
    256                 alert('Please Stop recording before posting the comment!');
    257             }
    258             return false;
    259         }
     261        // document.getElementById("submit").onclick = function() {
     262//          
     263//          if (logged == 0) {
     264//              var author = document.getElementById('author').value;
     265//              if (author == '') { alert('Please complete the author field!'); return false; }
     266//          
     267//              var email = document.getElementById('email').value;
     268//              if (!validateEmail(email)) { alert('Please complete the e-mail field!'); return false; }
     269//          }
     270//      
     271//          var commentText = document.getElementById('comment').value;
     272//          if (commentText == '') { alert('Please complete the comment box'); return false; }
     273//          
     274//          if (startedRec == 0) {
     275//              HTMLFormElement.prototype.submit.call(document.getElementById("commentform"));
     276//          } else if (recording == 0) {
     277//              document.Audior.save();
     278//          } else {
     279//              alert('Please Stop recording before posting the comment!');
     280//          }
     281//          return false;
     282//      }
    260283    }
    261284</script>
  • audio-comments/trunk/audior.php

    r874740 r888824  
    235235    $html .= 'var logged = ' . $logged . ';';
    236236    $html .=  <<<EOF
     237    (function($) {
     238        $(document).on('click', '#commentform .form-submit input[type="submit"]', function() {
     239            if (logged == 0) {
     240                var author = document.getElementById('author').value;
     241                if (author == '') { alert('Please complete the author field!'); return false; }
     242           
     243                var email = document.getElementById('email').value;
     244                if (!validateEmail(email)) { alert('Please complete the e-mail field!'); return false; }
     245            }
     246   
     247            var commentText = document.getElementById('comment').value;
     248            if (commentText == '') { alert('Please complete the comment box'); return false; }
     249
     250            if (startedRec == 0) {
     251                HTMLFormElement.prototype.submit.call(document.getElementById("commentform"));
     252            } else if (recording == 0) {
     253                document.Audior.save();
     254            } else {
     255                alert('Please Stop recording before posting the comment!');
     256            }
     257            return false;
     258        });
     259    })(jQuery);
    237260    window.onload = function() {
    238         document.getElementById("submit").onclick = function() {
    239            
    240             if (logged == 0) {
    241                 var author = document.getElementById('author').value;
    242                 if (author == '') { alert('Please complete the author field!'); return false; }
    243            
    244                 var email = document.getElementById('email').value;
    245                 if (!validateEmail(email)) { alert('Please complete the e-mail field!'); return false; }
    246             }
    247        
    248             var commentText = document.getElementById('comment').value;
    249             if (commentText == '') { alert('Please complete the comment box'); return false; }
    250            
    251             if (startedRec == 0) {
    252                 HTMLFormElement.prototype.submit.call(document.getElementById("commentform"));
    253             } else if (recording == 0) {
    254                 document.Audior.save();
    255             } else {
    256                 alert('Please Stop recording before posting the comment!');
    257             }
    258             return false;
    259         }
     261        // document.getElementById("submit").onclick = function() {
     262//          
     263//          if (logged == 0) {
     264//              var author = document.getElementById('author').value;
     265//              if (author == '') { alert('Please complete the author field!'); return false; }
     266//          
     267//              var email = document.getElementById('email').value;
     268//              if (!validateEmail(email)) { alert('Please complete the e-mail field!'); return false; }
     269//          }
     270//      
     271//          var commentText = document.getElementById('comment').value;
     272//          if (commentText == '') { alert('Please complete the comment box'); return false; }
     273//          
     274//          if (startedRec == 0) {
     275//              HTMLFormElement.prototype.submit.call(document.getElementById("commentform"));
     276//          } else if (recording == 0) {
     277//              document.Audior.save();
     278//          } else {
     279//              alert('Please Stop recording before posting the comment!');
     280//          }
     281//          return false;
     282//      }
    260283    }
    261284</script>
Note: See TracChangeset for help on using the changeset viewer.