@regru/browser-update
Advanced tools
Comparing version 1.0.11 to 1.0.12
Changes to the notification / detection script | ||
========== | ||
3.3.16 1.4.20 | ||
- updated browser versions | ||
3.3.15 29.2.20 | ||
- clear cookie in test mode | ||
3.3.14 27.2.20 | ||
- ignore oculus quest browser | ||
- created a detailed test-page for the script https://browser-update.org/test/bar.html | ||
- updated firefox version | ||
- mark discontinued browsers | ||
3.3.13 24.2.20 | ||
- take care of edge version jump between 18 and 79 when specifying relative to latest version | ||
(e.g. with current Edge 80 e:-4 is translated to e:16 instead of e: 76) | ||
- fix #478 | ||
3.3.12 23.2.20 | ||
- updated edge and chrome versions | ||
- fix edge on android detection (where the latest version is still based off chrome 73) | ||
- added option to test the script easier: Add "#ignorecookie-bu" to your url and reload the page. Then the bar will always show no matter if the "the user already saw it cookie was set", see #430 | ||
3.3.11 23.2.20 | ||
- ignore certain OPPO opera browser that cannot be updated | ||
- fixed to not show to iphone 6 anymore, since it does not support ios 13, fixes #472 | ||
- all devices with ios 11 support ios 12 | ||
3.3.10 23.2.20 | ||
- updated browser versions | ||
- removed npm dependency -> only a dev dependency | ||
- added browser info to the options object, so you can get the information on the current browser, fixes #471 | ||
- correct detection of new edge browser | ||
- offer new edge browser on all supported platforms, but for now only to current IE or edge users | ||
3.3.9 8.1.20 | ||
- updated all browser versions | ||
3.3.8 9.11.19 | ||
@@ -213,2 +250,2 @@ - option do disable anonymous browser statistics on every 1000th visit | ||
2.3.3 19.4.18 | ||
- new browser versions | ||
- new browser versions |
{ | ||
"name": "@regru/browser-update", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Remind users to update their browser in an unobtrusive way.", | ||
"main": "index.js", | ||
"scripts": { | ||
"fix": "# Todo: semistandard --fix", | ||
"test": "eslint ./*.js # semistandard" | ||
"test": "eslint ./*.js" | ||
}, | ||
@@ -26,7 +25,3 @@ "repository": { | ||
}, | ||
"homepage": "http://browser-update.org", | ||
"directories": { | ||
"lib": "lib", | ||
"test": "test" | ||
}, | ||
"homepage": "https://browser-update.org", | ||
"eslintConfig": { | ||
@@ -42,6 +37,3 @@ "env": { | ||
"eslint": "^5.16.0" | ||
}, | ||
"peerDependencies": { | ||
"semistandard": "^13.0.1" | ||
} | ||
} |
@@ -67,3 +67,3 @@ # browser-update | ||
* The notification will only appear once a day by default | ||
* If the user **activly** closes the notification, it will reappear after a week | ||
* If the user **actively** closes the notification, it will reappear after a week | ||
* Translated into > 30 languages | ||
@@ -70,0 +70,0 @@ * Browser detection less than 3kb gzipped + rest gets only lazy loaded when an outdated browser was detected |
@@ -7,8 +7,8 @@ //(c)2019, MIT Style License <browser-update.org/LICENSE.txt> | ||
var s=this; | ||
this.version="3.3.8"; | ||
this.vsakt={c:78,f:70,s:"13.0.3",e:18,i:12,ios:"13.2",samsung:10.1,o:64,o_a:54.1,y:"19.10",v:2.8,uc:"12.13"}; | ||
//severly insecure below(!) this version, insecure means remote code execution that is actively being exploited | ||
this.vsinsecure_below = {c:74,f:62,s:"11.1.1",e:16,i:11,ios:"12.4.3",samsung:"8.0",o:55,o_a:50,y:"19.6",v:"2.5",uc:"12.10"}; | ||
this.vsdefault = {c:-3,f:-3,s:-1,e:-3,i:11,ios:10,samsung:7.9,o:-3,o_a:-3,y:19.5,v:2.3,uc:12.8,a:535}; | ||
this.names={c:"Chrome",f:'Firefox',s:'Safari',e:"Edge",i:'Internet Explorer',ios:"iOS",samsung:"Samsung Internet",o:'Opera',o_a:'Opera', y:"Yandex Browser",v:"Vivaldi",uc:"UC Browser",a:"Android Browser",x:"Other",silk:"Silk"}; | ||
this.version="3.3.16"; | ||
this.vsakt={c:"80.0.3987.116",f:74,s:"13.1",e:80,i:12,ios:"13.3",samsung:11.1,o:67,e_a:45,o_a:55.2,y:"20.3.1",v:2.11,uc:"13.0.2"}; | ||
//severely insecure below(!) this version, insecure means remote code execution that is actively being exploited | ||
this.vsinsecure_below = {c:76,f:72,s:"11.1.1",e:16,i:11,ios:"12.4.3",samsung:9.0,o:62,o_a:52,y:"20.0",v:"2.6",uc:"12.10"}; | ||
this.vsdefault = {c:-3,f:-3,s:-1,e:-3,i:11,ios:10,samsung:9.1,o:-3,o_a:-3,y:20.0,v:2.6,uc:12.11,a:535}; | ||
this.names={c:"Chrome",f:'Firefox',s:'Safari',e:"Edge",i:'Internet Explorer',ios:"iOS",samsung:"Samsung Internet",o:'Opera',o_a:'Opera', e_a:"Edge", y:"Yandex Browser",v:"Vivaldi",uc:"UC Browser",a:"Android Browser",x:"Other",silk:"Silk"}; | ||
@@ -19,8 +19,8 @@ this.get_browser = function(ua) { | ||
r.other=ignore("bot","Pagespeed|pingdom|Preview|ktxn|dynatrace|Ruxit|PhantomJS|Headless|Lighthouse|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","EdgA|Falkon|Brave|Classic Browser|Dorado|LBBROWSER|Focus|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"); | ||
ignore("niche browser","OculusBrowser|Falkon|Brave|Classic Browser|Dorado|LBBROWSER|Focus|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","OPR/44.12.2246|cros|kindle|tizen|silk|blackberry|bb10|RIM|PlayBook|meego|nokia|ucweb|ZuneWP7|537.85.10"); | ||
// ignore("android(chrome) web view","; wv"); | ||
r.mobile=(/iphone|ipod|ipad|android|mobile|phone|ios|iemobile/i.test(ua)); | ||
r.discontinued=(/netscape|greenbrowser|camino|flot|fennec|galeon|coolnovo/i.test(ua)); | ||
@@ -35,2 +35,4 @@ var pats=[ | ||
["Edge.VV","e",'e'], | ||
["Edg.VV","e",'c'], | ||
["EdgA.VV","e_a",'c'], | ||
["Vivaldi.VV","v",'c'], | ||
@@ -76,3 +78,3 @@ ["Android.*OPR.VV","o_a",'c'], | ||
if (/iphone|ipod|ipad|ios/i.test(ua)) { | ||
ua.match(new RegExp("OS."+VV,"i"));// | ||
ua.match(new RegExp("OS."+VV,"i")); | ||
r.n="ios"; | ||
@@ -89,2 +91,4 @@ r.fullv=RegExp.$1; | ||
*/ | ||
if (av < 12 && Math.round(r.v)===11)// all devices with ios 11 support ios 12 | ||
av=12 | ||
r.available = {"ios": av}; | ||
@@ -152,4 +156,2 @@ if (parseFloat(r.available.ios)<11) | ||
} | ||
if ((r.n==="c"||r.n==="f"||r.n==="o") && s.less(r.fullv,parseFloat(s.vsakt[r.n])-1)<=0) | ||
r.is_supported=true; //mark also the version before the current version as supported to make the transitions smoother | ||
if (r.n==="ios" && r.v>10.3) | ||
@@ -161,4 +163,7 @@ r.is_supported=true; | ||
r.t = s.names[r.n] + " " + r.vmaj; | ||
r.is_supported = s.less(r.fullv, "15.15063") != 1 | ||
r.is_supported = s.less(r.fullv, "18.15063") != 1 | ||
} | ||
if (r.n in ["c","f","o","e"] && s.less(r.fullv,parseFloat(s.vsakt[r.n])-1)<=0) | ||
r.is_supported=true; //mark also the version before the current version as supported to make the transitions smoother | ||
var releases_per_year={'f':7,'c':8,'o':8,'i':1,'e':1,'s':1}//,'v':1} | ||
@@ -210,3 +215,3 @@ if (releases_per_year[r.n]) { | ||
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 | ||
return 12//latest version for iphone 6 is 12, 13 is for 6S | ||
if (h == 568) // 5/5C/5s/SE or 6/6s/7 and 8 in zoom mode | ||
@@ -246,3 +251,3 @@ return 10 | ||
var vs=op.notify||op.vs||{};//old style config: maximum version to notify | ||
var vs=op.notify||op.vs||{};//legacy config: maximum version to notify | ||
vs.e=vs.e||vs.i; | ||
@@ -258,3 +263,3 @@ vs.i=vs.i||vs.e; | ||
for (b in $bu_.vsdefault) { | ||
if (vs[b]) {//old style: browsers to notify | ||
if (vs[b]) {//legacy style config: browsers to notify | ||
if ($bu_.less(vs[b],0)>=0) // required <= 0 | ||
@@ -267,3 +272,3 @@ required[b]= parseFloat($bu_.vsakt[b])+parseFloat(vs[b])+0.01 | ||
required[b]=$bu_.vsdefault[b] | ||
if ($bu_.less(required[b],0)>=0) // required <= 0 --> relative to current version | ||
if ($bu_.less(required[b],0)>=0) // case for required <= 0 --> relative to latest version | ||
required[b]=parseFloat($bu_.vsakt[b])+parseFloat(required[b]) // TODO: make it work for string version | ||
@@ -275,2 +280,6 @@ if (required_min[b] && $bu_.less(required[b],required_min[b])===1) // required < required_min | ||
if (required.i<79 && required.i>65) | ||
required.i=required.i-60 | ||
if (required.e<79 && required.e>65) | ||
required.e=required.e-60 | ||
op.required=required; | ||
@@ -292,2 +301,3 @@ op.reminder=op.reminder<0.1 ? 0 : op.reminder||(24*7); | ||
op.test=test||op.test||location.hash==="#test-bu"; | ||
op.ignorecookie=op.ignorecookie||location.hash==="#ignorecookie-bu"; | ||
@@ -297,3 +307,3 @@ op.reasons=[]; | ||
function check_show(op) { | ||
var bb=$bu_.get_browser(op.override_ua); | ||
var bb=op.browser=$bu_.get_browser(op.override_ua); | ||
op.is_below_required = required[bb.n] && $bu_.less(bb.fullv,required[bb.n])===1; //bb.fullv<required | ||
@@ -306,2 +316,6 @@ if (bb.other!==false) | ||
op.hide_reasons.push("do not notify mobile") | ||
if (op.apiver<2018.5 || op.apiver>2020.1) {//TODO: remove | ||
if (bb.is_latest)//the latest versions of a browser can not be notified | ||
op.hide_reasons.push("is latest version of the browser") | ||
} | ||
if (bb.no_device_update) | ||
@@ -323,10 +337,15 @@ op.hide_reasons.push("no device update") | ||
op.notified=check_show(op); | ||
op.already_shown=document.cookie.indexOf("browserupdateorg=pause")>-1; | ||
op.already_shown=document.cookie.indexOf("browserupdateorg=pause")>-1 && !op.ignorecookie; | ||
if (!op.test && (!op.notified || op.already_shown)) | ||
return; | ||
op.setCookie=function(hours) { | ||
op.setCookie=function(hours) { //sets a cookie that the user has already seen the notification, closed it or permanently wants to hide it. No information on the user is stored. | ||
document.cookie = 'browserupdateorg=pause; expires='+(new Date(new Date().getTime()+3600000*hours)).toGMTString()+'; path=/; SameSite=None; Secure'; | ||
}; | ||
if (op.already_shown && (op.ignorecookie || op.test)) | ||
op.setCookie(-10)// remove old cookies if in test mode | ||
if (op.reminder>0) | ||
@@ -333,0 +352,0 @@ op.setCookie(op.reminder); |
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
51292
0
579