koboprice/userscript/koboprice.user.js

14 lines
67 KiB
JavaScript
Raw Normal View History

2024-07-17 14:21:14 +03:00
// ==UserScript==
// @name Kobo Price
// @namespace https://tertyshny.dev
// @description Find lowest book price on kobo.com
// @noframes
// @match https://www.kobo.com/*/*/ebook/*
// @match https://www.kobo.com/*/*/audiobook/*
// @run-at document-end
2024-07-19 17:21:14 +03:00
// @version 4
2024-07-17 14:21:14 +03:00
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAHdElNRQfoBw8NLTdMz5O6AAACdnpUWHRSYXcgcHJvZmlsZSB0eXBlIHhtcAAAOI2tVVuS3CAM/NcpcgQsCQmO4zHmL1X5zPHTAs/sPDy72ao1VX4gkFqtFqa/v//Qr7iKGckm3YsnW0zsYtmVk7Flc6u2S2Pe++Vy6cyYr6Yxk12yNknaPKlgbbFKWnx1bMziq+5ZDU84FMEmZumyc5LNi6xeDButRTBbOMW3bba7hI0iAtCo9cAh6zTclg8kH24wd4kdetvBKRdtOREHuO5jSjLvYtyAZxERuBCXirlFslRhKaK8YZYlYc6446m4L1KJ29i0HneVxM+Dj/QYKEzWzKpqT6kxDWOkV1wxkqxIp/u4eHes4n0g9hk5xkDCuDPubQYAIhdHfYIRL0gLEcL+iAIQUCoUgq0OpioYwoqr3RYCYd1BbKCaxN7XIgjWhlK/YB4B948yET5AtjWkU4ApRQKgF084bNeq3TkX1xw6eyKEzry/dx5KdCSHNT3cuYx82IQgxeE/eDlL7OukZlg6i3t1efCzalStzqaBg03DhXgO2UaZtKoOZc9N8Kyjm1YL+UFR2BRDuA1OPN4EEoJgIVspWCtQfxtkA1ZGvXNsgUnC+ILoBMEzAAoEmpXRDHCEns2QS9UF6o1GWXR+G9oDVgyNtsC3woKYsGkEpofIIUwJaVoQmF8i15n6U+Acgem7kY9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create;var ye=Object.defineProperty,er=Object.defineProperties,tr=Object.getOwnPropertyDescriptor,rr=Object.getOwnPropertyDescriptors,nr=Object.getOwnPropertyNames,Le=Object.getOwnPropertySymbols,or=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty,ar=Object.prototype.propertyIsEnumerable;var qe=(e,t,r)=>t in e?ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,K=(e,t)=>{for(var r in t||(t={}))Re.call(t,r)&&qe(e,r,t[r]);if(Le)for(var r of Le(t))ar.call(t,r)&&qe(e,r,t[r]);return e},Z=(e,t)=>er(e,rr(t));var ir=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var cr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of nr(t))!Re.call(e,o)&&o!==r&&ye(e,o,{get:()=>t[o],enumerable:!(n=tr(t,o))||n.enumerable});return e};var sr=(e,t,r)=>(r=e!=null?Zt(or(e)):{},cr(t||!e||!e.__esModule?ye(r,"default",{value:e,enumerable:!0}):r,e));var Gt=ir((Ne,He)=>{(function(e,t){typeof Ne=="object"&&typeof He<"u"?He.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self,e.currency=t())})(Ne,function(){function e(a,i){if(!(this instanceof e))return new e(a,i);i=Object.assign({},r,i);var s=Math.pow(10,i.precision);this.intValue=a=t(a,i),this.value=a/s,i.increment=i.increment||1/s,i.groups=i.useVedic?o:n,this.s=i,this.p=s}function t(a,i){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!0,u=i.decimal,d=i.errorOnInvalid,_=i.fromCents,c=Math.pow(10,i.precision),m=a instanceof e;if(m&&_)return a.intValue;if(typeof a=="number"||m)u=m?a.value:a;else if(typeof a=="string")d=new RegExp("[^-\\d"+u+"]","g"),u=new RegExp("\\"+u,"g"),u=(u=a.replace(/\((.*)\)/,"-$1").replace(d,"").replace(u,"."))||0;else{if(d)throw Error("Invalid Input");u=0}return _||(u=(u*c).toFixed(4)),s?Math.round(u):u}var r={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(a,i){var s=i.pattern,u=i.negativePattern,d=i.symbol,_=i.separator,c=i.decimal;i=i.groups;var m=(""+a).replace(/^-/,"").split("."),f=m[0];return m=m[1],(0<=a.value?s:u).replace("!",d).replace("#",f.replace(i,"$1"+_)+(m?c+m:""))},fromCents:!1},n=/(\d)(?=(\d{3})+\b)/g,o=/(\d)(?=(\d\d)+\d\b)/g;return e.prototype={add:function(a){var i=this.s,s=this.p;return e((this.intValue+t(a,i))/(i.fromCents?1:s),i)},subtract:function(a){var i=this.s,s=this.p;return e((this.intValue-t(a,i))/(i.fromCents?1:s),i)},multiply:function(a){var i=this.s;return e(this.intValue*a/(i.fromCents?1:Math.pow(10,i.precision)),i)},divide:function(a){var i=this.s;return e(this.intValue/t(a,i,!1),i)},distribute:function(a){var i=this.intValue,s=this.p,u=this.s,d=[],_=Math[0<=i?"floor":"ceil"](i/a),c=Math.abs(i-_*a);for(s=u.fromCents?1:s;a!==0;a--){var m=e(_/s,u);0<c--&&(m=m[0<=i?"add":"subtract"](1/s)),d.push(m)}return d},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(a){var i=this.s;return typeof a=="function"?a(this,i):i.format(this,Object.assign({},i,a))},toString:function(){var a=this.s,i=a.increment;return(Math.round(this.intValue/this.p/i)*i).toFixed(a.precision)},toJSON:function(){return this.value}},e})});globalThis.l=(...e)=>console.log("KOBOPRICE",...e);var ge="KOBOPRICE",Ae=()=>{localStorage.getItem(ge)||we({books:{},rates:null})},ee=()=>JSON.parse(localStorage.getItem(ge)),we=e=>localStorage.setItem(ge,JSON.stringify(e)),Ve=()=>ee().rates,je=e=>we(Z(K({},ee()),{rates:e})),Ue=e=>ee().books[e],Be=(e,t)=>{let r=ee();r.books[t]=e,we(r)};var ae,w,ze,ur,R,Qe,Je,ve,Ce,be,xe,dr,z={},Ke=[],fr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Pe=Array.isArray;function I(e,t){for(var r in t)e[r]=t[r];return e}function Ze(e){var t=e.parentNode;t&&t.removeChild(e)}function S(e,t,r){var n,o,a,i={};for(a in t)a=="key"?n=t[a]:a=="ref"?o=t[a]:i[a]=t[a];if(arguments.length>2&&(i.children=arguments.length>3?ae.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return re(e,i,n,o,null)}function re(e,t,r,n,o){var a={type:e,props:t,key:r,ref:n,__k:null,_
2024-07-17 14:21:14 +03:00
//# sourceMappingURL=index.js.map