@regru/browser-update
Advanced tools
Comparing version 1.0.1 to 1.0.2
Changes to the notification / detection script | ||
========== | ||
3.2.0 26.7.18 | ||
- fix when permanently ignoring did not work on some sites (where reminder=0 was set), fixes #399 | ||
- updated chrome version | ||
- ignore CM browser | ||
- add option "notify_lts" to also notify firefox browser that has still "Long term support" (LTS). Normal behaviour is to ignore this version as long as it is supported, fixes #362 | ||
- better detection of firefox ESR. E.g. Firefox 52.0.2 is no ESR version, Firefox 52.2 is!, fixes #362 | ||
- in test mode, print if the cookie to temporarily ignore the bar is set | ||
- better readability of debug message in test mode | ||
- better detection if iOS devices can be updated to the latest version of iOS | ||
@@ -4,0 +13,0 @@ 3.1.13 17.6.18 |
{ | ||
"name": "@regru/browser-update", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Remind users to update their browser in an unobtrusive way.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,15 +7,15 @@ //(c)2017, MIT Style License <browser-update.org/LICENSE.txt> | ||
var s=this; | ||
this.vsakt={e:17,i:15,f:60,o:53,o_a:45.1,s:11.1,c:67,y:"18.4",v:1.15,uc:12.5,samsung:6.4,ios:11.4}; | ||
this.vsakt={e:17,i:15,f:61,o:53,o_a:45.1,s:11.1,c:68,y:"18.6",v:1.15,uc:12.5,samsung:6.4,ios:11.4}; | ||
//severly insecure below(!) this version, insecure means remote code execution that is actively being exploited | ||
this.vsinsecure_below = {i:11,e:15,c:63,f:"57.0.1",y:18.1,s:"10.1.2",ios:"9.3.5",v:"1.12",uc:"12.1",samsung:"6.0",o_a:42,o:49}; | ||
this.vsdefault = {e:-3,i:11,f:-3,o:-3,o_a:-3,s:-1,c:-3,a:535,y:18.4,v:1.12,uc:12.1,samsung:6.1,ios:9}; | ||
this.vsdefault = {e:-3,i:11,f:-3,o:-3,o_a:-3,s:-1,c:-3,a:535,y:18.6,v:1.12,uc:12.1,samsung:6.1,ios:9}; | ||
this.names={i:'Internet Explorer',e:"Edge",f:'Firefox',o:'Opera',o_a:'Opera',s:'Safari',c:"Chrome",a:"Android Browser", y:"Yandex Browser",v:"Vivaldi",uc:"UC Browser",samsung:"Samsung Internet",x:"Other",ios:"iOS",silk:"Silk"}; | ||
this.get_browser = function(ua) { | ||
var n,ua=(ua||navigator.userAgent).replace("_","."),r={n:"x",v:0,t:"other browser",age_years:undefined,no_device_update:false}; | ||
var n,ua=(ua||navigator.userAgent).replace("_","."),r={n:"x",v:0,t:"other browser",age_years:undefined,no_device_update:false,available:s.vsakt}; | ||
function ignore(reason,pattern){if (new RegExp(pattern,"i").test(ua)) return reason;return false} | ||
r.other=ignore("bot","bot|spider|archiver|transcoder|crawl|checker|monitoring|prerender|screenshot|python-|php|uptime|validator|fetcher|facebook|slurp|google|yahoo|node|mail.ru|github|cloudflare|addthis|thumb|proxy|feed|fetch|favicon|link|http|scrape|seo|page|search console|AOLBuild|Teoma|Gecko Expeditor")|| | ||
r.other=ignore("bot","bot|spider|archiver|transcoder|crawl|checker|monitoring|prerender|screenshot|python-|php|uptime|validator|fetcher|facebook|slurp|google|yahoo|node|mail.ru|github|cloudflare|addthis|thumb|proxy|feed|fetch|favicon|link|http|scrape|seo|page|search console|AOLBuild|Teoma|Expeditor")|| | ||
// ignore("discontinued browser","camino|flot|fennec|galeon|coolnovo") || | ||
ignore("TV","SMART-TV|SmartTV") || | ||
ignore("niche browser","Dorado|waterfox|Firefox/56.2|Firefox/56.3|Whale|MIDP|k-meleon|sparrow|wii|Chromium|Puffin|Opera Mini|maxthon|maxton|dolfin|dolphin|seamonkey|opera mini|netfront|moblin|maemo|arora|kazehakase|epiphany|konqueror|rekonq|symbian|webos|PaleMoon|QupZilla|Otter|Midori|qutebrowser") || | ||
ignore("niche browser","Dorado|LBBROWSER|waterfox|Firefox/56.2|Firefox/56.3|Whale|MIDP|k-meleon|sparrow|wii|Chromium|Puffin|Opera Mini|maxthon|maxton|dolfin|dolphin|seamonkey|opera mini|netfront|moblin|maemo|arora|kazehakase|epiphany|konqueror|rekonq|symbian|webos|PaleMoon|QupZilla|Otter|Midori|qutebrowser") || | ||
ignore("mobile without upgrade path or landing page","cros|kindle|tizen|silk|blackberry|bb10|RIM|PlayBook|meego|nokia|ucweb|ZuneWP7|537.85.10"); | ||
@@ -57,6 +57,9 @@ // ignore("android(chrome) web view","; wv"); | ||
r.v=parseFloat(r.fullv); | ||
// Special treatment of some systems | ||
//do not notify old systems since there is no up-to-date browser available | ||
if (/windows.nt.5.0|windows.nt.4.0|windows.95|windows.98|os x 10.2|os x 10.3|os x 10.4|os x 10.5|os x 10.6|os x 10.7/i.test(ua)) | ||
if (/windows.nt.5.0|windows.nt.4.0|windows.95|windows.98|os x 10.2|os x 10.3|os x 10.4|os x 10.5/i.test(ua)) { | ||
r.no_device_update=true; | ||
r.available={} | ||
} | ||
//iOS | ||
@@ -69,6 +72,26 @@ if (/iphone|ipod|ipad|ios/i.test(ua)) { | ||
r.engine='ios'; | ||
var h = Math.max(window.screen.height, window.screen.width); | ||
if (!r.v>11.0 && (h<=480 || window.devicePixelRatio<2) || r.v<8) //iphone <5 and old iPads // (h>568 -->iphone 6+) | ||
r.no_device_update=true; | ||
r.available = {"ios": s.available_ios(ua,v)} | ||
if (r.available.ios<11) | ||
r.no_device_update=true; | ||
} | ||
//winxp/vista/2003 | ||
if (/windows.nt.5.1|windows.nt.5.2|windows.nt.6.0/i.test(ua)) { | ||
r.available={"c":49.9,"f":52.9} | ||
} | ||
//old mac | ||
if (/os x 10.6/i.test(ua)) { | ||
r.available = {"s": "5.1.10", "c": 49.9, "f": 48} | ||
r.no_device_update=true; | ||
} | ||
if (/os x 10.7|os x 10.8/i.test(ua)) { | ||
r.available = {"s": "6.2.8", "c": 49.9, "f": 48} | ||
r.no_device_update=true; | ||
} | ||
if (/os x 10.9/i.test(ua)) | ||
r.available.s="9.1.3" | ||
if (/os x 10.10/i.test(ua)) | ||
r.available.s="10.1.2" | ||
//check for android stock browser | ||
@@ -84,2 +107,3 @@ if (ua.indexOf('Android')>-1 && r.n==="s") { | ||
// Special treatment of some browsers | ||
if (r.n==="so") { | ||
@@ -106,7 +130,7 @@ r.v=r.fullv=4.0; | ||
if ((r.n==="f" && (r.vmaj===52 || r.vmaj===60)) || (r.n==="i" && r.vmaj===11)) { | ||
if ((r.n==="f" && ((r.vmaj===52 && r.v>=52.1) || (r.vmaj===60 && r.v>=60.1))) || (r.n==="i" && r.vmaj===11)) { | ||
r.is_supported=true; | ||
r.is_insecure=false; | ||
if (r.n==="f") | ||
r.lts=true; | ||
r.esr=true; | ||
} | ||
@@ -149,2 +173,27 @@ if ((r.n==="c"||r.n==="f"||r.n==="o") && s.less(r.fullv,parseFloat(s.vsakt[r.n])-1)<=0) | ||
} | ||
this.available_ios=function(ua,v) { | ||
var h = Math.max(window.screen.height, window.screen.width),pr = window.devicePixelRatio | ||
if (/ipad/i.test(ua)) { | ||
if (h == 1024 && pr == 2) // iPad 3 (iOS 9), 4, 5, Mini 2, Mini 3, Mini 4, Air, Air 2, Pro 9.7 | ||
return 10//? only ipad 4 has ios 10, all other can have ios 11 | ||
if (h == 1112)// iPad Pro 10.5 | ||
return 15; | ||
if (h == 1366)//iPad Pro 12.9, Pro 12.9 (2nd Gen) | ||
return 15 | ||
if (h == 1024 && v < 6) | ||
return 5 // iPad | ||
return 9 // iPad 2, iPad Mini | ||
} | ||
if (pr == 1)// 1/3G/3GS | ||
return 6//for 3GS | ||
if (h == 812)// && pr == 3)// X | ||
return 11 + 4 | ||
if ((h == 736 || h == 667))// && pr == 3)// 6+/6s+/7+ and 8+ or // 6+/6s+/7+ and 8+ in zoom mode + // 6/6s/7 and 8 | ||
return 8 + 5 | ||
if (h == 568) // 5/5C/5s/SE or 6/6s/7 and 8 in zoom mode | ||
return 10 | ||
if (h == 480) // i4/4s | ||
return 7 | ||
return 6 | ||
} | ||
/* | ||
@@ -174,3 +223,3 @@ this.sub= function(v,minus) { | ||
op.apiver=op.api||op.c||-1; | ||
op.jsv="3.1.13npm"; | ||
op.jsv="3.2.0npm"; | ||
@@ -228,4 +277,4 @@ var required_min=(op.apiver<2018&&{i:10,f:11,o:21,s:8,c:30})||{}; | ||
op.hide_reasons.push("is other browser:" + bb.other) | ||
if ( bb.lts)// || (bb.is_supported && !op.notify_also_supported)) | ||
op.hide_reasons.push("LTS support") | ||
if ( bb.esr && !op.notify_esr)// || (bb.is_supported && !op.notify_also_supported)) | ||
op.hide_reasons.push("Extended support (ESR)") | ||
if (bb.mobile&&op.mobile===false) | ||
@@ -249,3 +298,3 @@ op.hide_reasons.push("do not notify mobile") | ||
op.notified=check_show(op); | ||
op.already_shown=document.cookie.indexOf("browserupdateorg=pause")>-1 && op.reminder>0; | ||
op.already_shown=document.cookie.indexOf("browserupdateorg=pause")>-1; | ||
@@ -455,4 +504,3 @@ if (!op.test && (!op.notified || op.already_shown)) | ||
op.onshow(op); | ||
};/* | ||
/* | ||
if (op.test && !op.dont_show_debuginfo) { | ||
@@ -463,6 +511,5 @@ var e = document.createElement("script"); | ||
} | ||
*/ | ||
}; | ||
*/ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42773
521