Socket
Socket
Sign inDemoInstall

jquery-spamguard

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.1.0

gulpfile.js

6

dist/jquery.spamguard.js
/*!
* jQuery Spam Guard v2.0
* https://github.com/philippgithub/jquery-spamguard
* jQuery Spam Guard v2.1.0
* https://github.com/madeinhamburg/jquery-spamguard
*/
!function(c){c.fn.spamguard=function(e){var t={protect:"email",sethref:!0,content:!1,noindex:!0},n=c.extend({},t,e),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ!'§$=?`´€~[]|*#-_.,;:@+/";return this.each(function(){var e=c(this).html(),t=null;for($decoded="",i=0;i<e.length;i++)$prevChar=e[i-1],$thisChar=e[i],-1!==c.inArray($thisChar,o.split(""))?"\\"===$prevChar&&($decoded+=$thisChar):"\\"!==$thisChar&&($decoded+=$thisChar);e=$decoded,"telephone"!==n.protect&&"tel"!==n.protect&&"tele"!==n.protect||(t="tel:"+(e=e.replace(/[^0-9 \+\/\(\)\-\.]+/g,"")).replace(/[^0-9\+]+/g,"")),"email"!==n.protect&&"mail"!==n.protect||(t="mailto:"+e),c(this).is("a")&&!0===n.sethref&&null!==t&&c(this).attr("href",t),!1!==n.content?(!0===n.noindex&&(n.content="\x3c!--noindex--\x3e\x3c!--googleoff: all--\x3e"+n.content+"\x3c!--googleon: all--\x3e\x3c!--/noindex--\x3e"),c(this).html(n.content)):(!0===n.noindex&&(e="\x3c!--noindex--\x3e\x3c!--googleoff: all--\x3e"+e+"\x3c!--googleon: all--\x3e\x3c!--/noindex--\x3e"),c(this).html(e))})},c.spamguardEncode=function(e,t){for(var n=c.extend({},{},t),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ!'§$=?`´€~[]|*#-_.,;:@+/",r="",a=0;a<e.length;a++){for(var i=e[a],l=0;l<o.length;l++)i=i.replace(o[l],"\\"+o[l]);r+=i,r+=c.spamguardRandomString(o)}return r},c.spamguardRandomNum=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},c.spamguardRandomString=function(e){for(var t="",n=0;n<c.spamguardRandomNum(0,3);n++){var o=c.spamguardRandomNum(0,e.length);t+=e.charAt(o,o+1)}return t}}(jQuery);
!function(l){l.fn.spamguard=function(e){var r=l.extend({},{protect:"email",sethref:!0,content:!1,noindex:!0},e);return this.each(function(){var e=l(this).html(),t=null,n="";for(i=0;i<e.length;i++)$prevChar=e[i-1],$thisChar=e[i],-1!==l.inArray($thisChar,"ABCDEFGHIJKLMNOPQRSTUVWXYZ!'§$=?`´€~[]|*#-_.,;:@+/".split(""))?"\\"===$prevChar&&(n+=$thisChar):"\\"!==$thisChar&&(n+=$thisChar);e=n,"telephone"!==r.protect&&"tel"!==r.protect&&"tele"!==r.protect||(t="tel:"+(e=e.replace(/[^0-9 \+\/\(\)\-\.]+/g,"")).replace(/[^0-9\+]+/g,"")),"email"!==r.protect&&"mail"!==r.protect||(t="mailto:"+e),l(this).is("a")&&!0===r.sethref&&null!==t&&l(this).attr("href",t),!1!==r.content?(!0===r.noindex&&(r.content="\x3c!--noindex--\x3e\x3c!--googleoff: all--\x3e"+r.content+"\x3c!--googleon: all--\x3e\x3c!--/noindex--\x3e"),l(this).html(r.content)):(!0===r.noindex&&(e="\x3c!--noindex--\x3e\x3c!--googleoff: all--\x3e"+e+"\x3c!--googleon: all--\x3e\x3c!--/noindex--\x3e"),l(this).html(e))})},l.spamguardEncode=function(e,t){l.extend({},{},t);for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ!'§$=?`´€~[]|*#-_.,;:@+/",r="",a=0;a<e.length;a++){for(var o=e[a],i=0;i<n.length;i++)o=o.replace(n[i],"\\"+n[i]);r+=o,r+=l.spamguardRandomString(n)}return r},l.spamguardRandomNum=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},l.spamguardRandomString=function(e){for(var t="",n=0;n<l.spamguardRandomNum(0,3);n++){var r=l.spamguardRandomNum(0,e.length);t+=e.charAt(r,r+1)}return t}}(jQuery);
{
"name": "jquery-spamguard",
"version": "2.0.1",
"version": "2.1.0",
"repository": {

@@ -23,6 +23,14 @@ "type": "git",

"main": "dist/jquery.spamguard.js",
"scripts": {},
"scripts": {
"build": "gulp build"
},
"dependencies": {
"jquery": ">=1.9"
},
"devDependencies": {
"gulp": "^4.0.0",
"gulp-concat": "^2.6.1",
"gulp-replace": "^1.0.0",
"gulp-uglify": "^3.0.1"
}
}

@@ -21,3 +21,2 @@ # jQuery Spam Guard

| `content` | false (boolean) | `false` *(boolean)* or a custom *string* (see Example II) |
| `detectcrawler` | true (boolean) | No rendering, when crawler is detected |
| `noindex` | true (boolean) | prepend `<!--noindex--><!--googleoff: all-->` |

@@ -24,0 +23,0 @@

@@ -1,8 +0,8 @@

/*!
* jQuery Spam Guard v2.0
* https://github.com/philippgithub/jquery-spamguard
/*!
* jQuery Spam Guard v@version
* @homepage
*/
(function($){
$.fn.spamguard = function($options){
(function($) {
$.fn.spamguard = function($options) {
var $defaults = {

@@ -12,3 +12,2 @@ protect: "email",

content: false,
detectcrawler: true,
noindex: true,

@@ -22,33 +21,33 @@ };

return this.each(function(){
return this.each(function() {
var $content = $(this).html(),
$href = null;
$href = null,
$decoded = "";
$decoded = "";
for(i=0; i < $content.length; i++){
$prevChar = $content[i-1];
for (i = 0; i < $content.length; i++) {
$prevChar = $content[i - 1];
$thisChar = $content[i];
if($.inArray($thisChar, $characters.split("")) !== -1){
if($prevChar === "\\"){
if ($.inArray($thisChar, $characters.split("")) !== -1) {
if ($prevChar === "\\") {
$decoded = $decoded + $thisChar;
}
}
else{
if($thisChar !== "\\"){
} else {
if ($thisChar !== "\\") {
$decoded = $decoded + $thisChar;
}
}
}
}
$content = $decoded;
if($o.protect === "telephone" || $o.protect === "tel" || $o.protect === "tele"){
$content = $content.replace(/[^0-9 \+\/\(\)\-\.]+/g, "");
$href = "tel:"+ $content.replace(/[^0-9\+]+/g, "");
if ($o.protect === "telephone" || $o.protect === "tel" || $o.protect === "tele") {
$content = $content.replace(/[^0-9 \+\/\(\)\-\.]+/g, "");
$href = "tel:" + $content.replace(/[^0-9\+]+/g, "");
}
if($o.protect === "email" || $o.protect === "mail"){
$href = "mailto:"+ $content;
if ($o.protect === "email" || $o.protect === "mail") {
$href = "mailto:" + $content;
}
if($(this).is("a") && $o.sethref === true && $href !== null){
if ($(this).is("a") && $o.sethref === true && $href !== null) {
$(this).attr("href", $href);

@@ -58,11 +57,10 @@ }

if($o.content !== false){
if($o.noindex === true){
$o.content = "<!--noindex--><!--googleoff: all-->"+ $o.content +"<!--googleon: all--><!--/noindex-->";
if ($o.content !== false) {
if ($o.noindex === true) {
$o.content = "<!--noindex--><!--googleoff: all-->" + $o.content + "<!--googleon: all--><!--/noindex-->";
}
$(this).html($o.content);
}
else{
if($o.noindex === true){
$content = "<!--noindex--><!--googleoff: all-->"+ $content +"<!--googleon: all--><!--/noindex-->";
} else {
if ($o.noindex === true) {
$content = "<!--noindex--><!--googleoff: all-->" + $content + "<!--googleon: all--><!--/noindex-->";
}

@@ -76,3 +74,3 @@ $(this).html($content);

$.spamguardEncode = function($string, $options){
$.spamguardEncode = function($string, $options) {
var $o = $.extend({}, {}, $options);

@@ -83,7 +81,7 @@

var $return = "";
for(var i=0; i < $string.length; i++){
for (var i = 0; i < $string.length; i++) {
var $s = $string[i];
for(var j=0; j < $characters.length; j++){
$s = $s.replace($characters[j], "\\"+ $characters[j]);
for (var j = 0; j < $characters.length; j++) {
$s = $s.replace($characters[j], "\\" + $characters[j]);
}

@@ -98,36 +96,14 @@

$.spamguardRandomNum = function($min, $max){
$.spamguardRandomNum = function($min, $max) {
return Math.floor(Math.random() * ($max - $min + 1) + $min);
};
$.spamguardRandomString = function($characters){
$.spamguardRandomString = function($characters) {
var $string = "";
for(var i=0; i < $.spamguardRandomNum(0, 3); i++){
for (var i = 0; i < $.spamguardRandomNum(0, 3); i++) {
var $pos = $.spamguardRandomNum(0, $characters.length);
$string += $characters.charAt($pos, $pos+1);
$string += $characters.charAt($pos, $pos + 1);
}
return $string;
};
$.spamguardIsCrawler = function(){
/*
* This list is part of Crawler Detect - the web crawler detection library.
*
* (c) Mark Beech <m@rkbee.ch>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
https://crawlerdetect.io/?q=
// https://github.com/JayBizzle/Crawler-Detect/blob/master/raw/Crawlers.json
var $crawlers = [];
// https://github.com/JayBizzle/Crawler-Detect/blob/master/raw/Exclusions.json
var $exclusions = [];
return false;
};
})(jQuery);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc