Changeset 2361537
- Timestamp:
- 08/14/2020 11:39:13 PM (6 years ago)
- Location:
- herp-derp
- Files:
-
- 2 edited
- 4 copied
-
tags/1.4 (copied) (copied from herp-derp/trunk)
-
tags/1.4/herpderp.js (copied) (copied from herp-derp/trunk/herpderp.js) (3 diffs)
-
tags/1.4/herpderp.php (copied) (copied from herp-derp/trunk/herpderp.php) (1 diff)
-
tags/1.4/readme.txt (copied) (copied from herp-derp/trunk/readme.txt)
-
trunk/herpderp.js (modified) (3 diffs)
-
trunk/herpderp.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
herp-derp/tags/1.4/herpderp.js
r1988477 r2361537 1 1 /* Herp all the derps. 2 2 3 Copyright © 2012-201 8Jamie Zawinski <jwz@jwz.org>3 Copyright © 2012-2019 Jamie Zawinski <jwz@jwz.org> 4 4 5 5 Permission to use, copy, modify, distribute, and sell this software and its … … 25 25 */ 26 26 27 function derp(pp, herpa) { 28 var aa = pp.getElementsByTagName('p'); 29 for (var i = 0; i < aa.length; i++) { 30 var p = aa[i]; 31 if (! p.herp) { 32 p.herp = p.innerHTML; 33 p.derp = p.innerHTML; 34 p.derp = p.derp.replace (/\n/gi, " "); 35 p.derp = p.derp.replace (/<BR *\/?>/gi, "\n"); 36 p.derp = p.derp.replace (/<P\b[^<>]*>/gi, "\n\n"); 37 p.derp = p.derp.replace (/<[^<>]*>/gi, ""); 38 p.derp = p.derp.replace (/[:.]([^\s])/gi, '$1'); 39 p.derp = p.derp.replace (/([^-.!?,;:\"()\s]+)/gi, 40 function (s) { 41 var hd = ['herp', 'HERP', 'Herp', 42 'derp', 'DERP', 'Derp']; 43 var j; 44 if (s == s.toLowerCase()) j = 0; 45 else if (s.length > 1 && s == s.toUpperCase()) j = 1; 46 else j = 2; 47 if (Math.random() > 0.5) j += 3; 48 return hd[j]; 49 }); 50 p.derp = p.derp.replace (/\n/g, "<BR>"); 27 function derp(p, herpa) { 28 if (! p.herp) { 29 p.herp = p.innerHTML; 30 var aa = p.herp.match (/(<[^<>]*>|[^<>]+)/g); 31 for (var i = 0; i < aa.length; i++) { 32 if (aa[i].match(/^</)) continue; 33 aa[i] = aa[i].replace (/&#?[a-z\d]+;/gi, '_'); 34 aa[i] = aa[i].replace (/([^-.!?,;:\"()\s]+)/gi, 35 function (s) { 36 var hd = ['herp', 'HERP', 'Herp', 37 'derp', 'DERP', 'Derp']; 38 var j; 39 if (s == s.toLowerCase()) j = 0; 40 else if (s.length > 1 && s == s.toUpperCase()) j = 1; 41 else j = 2; 42 if (Math.random() > 0.5) j += 3; 43 return hd[j]; 44 }); 51 45 } 52 p.innerHTML = (herpa ? p.herp : p.derp); 53 p.onclick = herpclerk; 46 p.derp = aa.join(''); 54 47 } 48 p.innerHTML = (herpa ? p.herp : p.derp); 49 p.parentNode.onclick = herpclerk; 55 50 } 56 51 57 52 function herpclerk(e) { 58 var p = e.target; 59 derp (p.parentNode, p.herp != p.innerHTML); 53 var p = e.currentTarget || e.originalTarget || e.target; 54 var aa = Array.from (p.getElementsByTagName('span')); 55 aa.push(p); 56 for (var i = 0; i < aa.length; i++) { 57 if (aa[i].className.match (/\bherpc\b/)) { 58 derp (aa[i], aa[i].herp !== aa[i].innerHTML); 59 } 60 } 60 61 return false; 61 62 } … … 69 70 } 70 71 if (! derpa) { 71 var aa = document.getElementsByTagName(' p');72 var aa = document.getElementsByTagName('span'); 72 73 for (var i = 0; i < aa.length; i++) { 73 if (aa[i].onclick == herpclerk) 74 aa[i].onclick = null; 74 if (aa[i].parentNode.onclick == herpclerk) { 75 aa[i].parentNode.onclick = null; 76 } 75 77 } 76 78 } -
herp-derp/tags/1.4/herpderp.php
r1988477 r2361537 3 3 Plugin Name: Herp Derp 4 4 Plugin URI: https://www.jwz.org/herpderp/ 5 Version: 1. 35 Version: 1.4 6 6 Description: This plugin adds a checkbox to replace the text of your comments with "Herp Derp". 7 7 Author: Jamie Zawinski -
herp-derp/trunk/herpderp.js
r1988477 r2361537 1 1 /* Herp all the derps. 2 2 3 Copyright © 2012-201 8Jamie Zawinski <jwz@jwz.org>3 Copyright © 2012-2019 Jamie Zawinski <jwz@jwz.org> 4 4 5 5 Permission to use, copy, modify, distribute, and sell this software and its … … 25 25 */ 26 26 27 function derp(pp, herpa) { 28 var aa = pp.getElementsByTagName('p'); 29 for (var i = 0; i < aa.length; i++) { 30 var p = aa[i]; 31 if (! p.herp) { 32 p.herp = p.innerHTML; 33 p.derp = p.innerHTML; 34 p.derp = p.derp.replace (/\n/gi, " "); 35 p.derp = p.derp.replace (/<BR *\/?>/gi, "\n"); 36 p.derp = p.derp.replace (/<P\b[^<>]*>/gi, "\n\n"); 37 p.derp = p.derp.replace (/<[^<>]*>/gi, ""); 38 p.derp = p.derp.replace (/[:.]([^\s])/gi, '$1'); 39 p.derp = p.derp.replace (/([^-.!?,;:\"()\s]+)/gi, 40 function (s) { 41 var hd = ['herp', 'HERP', 'Herp', 42 'derp', 'DERP', 'Derp']; 43 var j; 44 if (s == s.toLowerCase()) j = 0; 45 else if (s.length > 1 && s == s.toUpperCase()) j = 1; 46 else j = 2; 47 if (Math.random() > 0.5) j += 3; 48 return hd[j]; 49 }); 50 p.derp = p.derp.replace (/\n/g, "<BR>"); 27 function derp(p, herpa) { 28 if (! p.herp) { 29 p.herp = p.innerHTML; 30 var aa = p.herp.match (/(<[^<>]*>|[^<>]+)/g); 31 for (var i = 0; i < aa.length; i++) { 32 if (aa[i].match(/^</)) continue; 33 aa[i] = aa[i].replace (/&#?[a-z\d]+;/gi, '_'); 34 aa[i] = aa[i].replace (/([^-.!?,;:\"()\s]+)/gi, 35 function (s) { 36 var hd = ['herp', 'HERP', 'Herp', 37 'derp', 'DERP', 'Derp']; 38 var j; 39 if (s == s.toLowerCase()) j = 0; 40 else if (s.length > 1 && s == s.toUpperCase()) j = 1; 41 else j = 2; 42 if (Math.random() > 0.5) j += 3; 43 return hd[j]; 44 }); 51 45 } 52 p.innerHTML = (herpa ? p.herp : p.derp); 53 p.onclick = herpclerk; 46 p.derp = aa.join(''); 54 47 } 48 p.innerHTML = (herpa ? p.herp : p.derp); 49 p.parentNode.onclick = herpclerk; 55 50 } 56 51 57 52 function herpclerk(e) { 58 var p = e.target; 59 derp (p.parentNode, p.herp != p.innerHTML); 53 var p = e.currentTarget || e.originalTarget || e.target; 54 var aa = Array.from (p.getElementsByTagName('span')); 55 aa.push(p); 56 for (var i = 0; i < aa.length; i++) { 57 if (aa[i].className.match (/\bherpc\b/)) { 58 derp (aa[i], aa[i].herp !== aa[i].innerHTML); 59 } 60 } 60 61 return false; 61 62 } … … 69 70 } 70 71 if (! derpa) { 71 var aa = document.getElementsByTagName(' p');72 var aa = document.getElementsByTagName('span'); 72 73 for (var i = 0; i < aa.length; i++) { 73 if (aa[i].onclick == herpclerk) 74 aa[i].onclick = null; 74 if (aa[i].parentNode.onclick == herpclerk) { 75 aa[i].parentNode.onclick = null; 76 } 75 77 } 76 78 } -
herp-derp/trunk/herpderp.php
r1988477 r2361537 3 3 Plugin Name: Herp Derp 4 4 Plugin URI: https://www.jwz.org/herpderp/ 5 Version: 1. 35 Version: 1.4 6 6 Description: This plugin adds a checkbox to replace the text of your comments with "Herp Derp". 7 7 Author: Jamie Zawinski
Note: See TracChangeset
for help on using the changeset viewer.