@charlietango/ddb-widget
Advanced tools
Comparing version 0.1.29 to 0.1.30
@@ -0,1 +1,25 @@ | ||
function initTracking() { | ||
window._ti = window._ti || {}; | ||
window._ti['p_widget'] = 'WidgetName'; | ||
window._tiConfig = window._tiConfig || { | ||
tiDomain: 'responder.wt-safetag.com', | ||
tiId: '476651662471322', | ||
option: {} | ||
}; | ||
(function (c, d, a, f) { c.wts = c.wts || []; var g = function (b) { var a = ""; b.customDomain && b.customPath ? a = b.customDomain + "/" + b.customPath : b.tiDomain && b.tiId && (a = b.tiDomain + "/resp/api/get/" + b.tiId + "?url=" + encodeURIComponent(c.location.href) + "&v=5"); if (b.option) | ||
for (var d in b.option) | ||
a += "&" + d + "=" + encodeURIComponent(b.option[d]); return a; }; if (-1 === d.cookie.indexOf("wt_r=1")) { | ||
var e = d.getElementsByTagName(a)[0]; | ||
a = d.createElement(a); | ||
a.async = !0; | ||
a.onload = function () { if ("undefined" !== typeof c.wt_r && !isNaN(c.wt_r)) { | ||
var b = new Date, a = b.getTime() + 1E3 * parseInt(c.wt_r); | ||
b.setTime(a); | ||
d.cookie = "wt_r=1;path=/;expires=" + b.toUTCString(); | ||
} }; | ||
a.onerror = function () { "undefined" !== typeof c.wt_mcp_hide && "function" === typeof c.wt_mcp_hide.show && (c.wt_mcp_hide.show(), c.wt_mcp_hide.show = function () { }); }; | ||
a.src = "//" + g(f); | ||
e.parentNode.insertBefore(a, e); | ||
} })(window, document, "script", _tiConfig); | ||
} | ||
function isMobileDevice() { | ||
@@ -10,2 +34,5 @@ return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1); | ||
this.isOpen = !this.isOpen; | ||
if (this.isOpen && window["wt"]) { | ||
window["wt"].sendinfo({ linkId: 'e_widget_foldud' }); | ||
} | ||
if (this.isMobile) { | ||
@@ -30,2 +57,3 @@ document.getElementsByTagName('html')[0].style.overflowY = this.isOpen ? 'hidden' : 'auto'; | ||
componentWillLoad() { | ||
initTracking(); | ||
const api = 'https://ddb-be.s1.umbraco.io/api/ddb/list'; | ||
@@ -41,3 +69,3 @@ return this.fetchWidgetData(api); | ||
.then(body => { | ||
const parsedBody = JSON.parse(body); | ||
const parsedBody = typeof body === 'string' ? JSON.parse(body) : body; | ||
this.widgetData = parsedBody; | ||
@@ -52,4 +80,4 @@ }) | ||
const { links, color, launcherLogo, topLogo, promoImage, promoText, settings } = this.widgetData; | ||
return (h("div", { class: `overlay ${this.isOpen ? 'active' : ''}`, onClick: this.handleOverlayClick }, | ||
h("div", { class: 'container' }, | ||
return (h("div", { class: `widget-overlay ${this.isOpen ? 'active' : ''}`, onClick: this.handleOverlayClick }, | ||
h("div", { class: 'widget-container' }, | ||
this.isOpen && | ||
@@ -56,0 +84,0 @@ h("widget-window", { logo: topLogo, onCloseClick: this.handleCloseClick, numberOfItems: links.length }, |
export class LinkList { | ||
constructor() { | ||
this.renderListItem = (item) => { | ||
const urlCharacter = (window.location.href.match(/\?./) ? "&" : "?"); | ||
const extendURL = `${urlCharacter}wt_mc=Intern.Widget:Dit%20Digitale%20Bibliotek`; | ||
return (h("li", { key: item.href, class: 'list-item' }, | ||
h("a", { class: 'link-item', href: item.href, target: '_blank', rel: 'noopener noreferrer' }, | ||
h("a", { class: 'link-item', href: item.href + extendURL, target: '_blank', rel: 'noopener noreferrer' }, | ||
h("div", { class: 'top-container' }, | ||
@@ -19,4 +21,4 @@ h("img", { src: item.icon.src, alt: item.icon.alt || item.icon.src }), | ||
render() { | ||
return (h("div", { class: 'scroll-container' }, | ||
h("ul", { class: 'list' }, this.links.map(this.renderListItem)))); | ||
return (h("div", { class: 'widget-scroll-container' }, | ||
h("ul", { class: 'widget-list' }, this.links.map(this.renderListItem)))); | ||
} | ||
@@ -23,0 +25,0 @@ static get is() { return "link-list"; } |
@@ -28,7 +28,7 @@ export class WidgetLauncher { | ||
render() { | ||
return (h("div", { class: `container | ||
return (h("div", { class: `widget-launcher-container | ||
${this.isReady ? 'loaded' : ''} | ||
${this.isOpen ? 'open' : 'closed'} | ||
${this.isExpanded ? 'expanded' : ''} | ||
` }, | ||
`, style: { borderColor: this.color } }, | ||
h("img", { class: 'launcher-logo', src: this.logo.src, alt: this.logo.alt || this.logo.src }), | ||
@@ -45,4 +45,3 @@ h("div", { class: 'promo' }, !!this.settings.usePromoImage ? | ||
h("path", { d: "M0 0h24v24H0z", fill: "none" })), | ||
h("div", { class: 'inner-circle', style: { backgroundColor: this.color } }), | ||
h("div", { class: 'border-circle', style: { borderColor: this.color } }))); | ||
h("div", { class: 'inner-circle', style: { backgroundColor: this.color } }))); | ||
} | ||
@@ -49,0 +48,0 @@ static get is() { return "widget-launcher"; } |
@@ -28,5 +28,5 @@ function isMobile() { | ||
} | ||
const headerHeight = 60; | ||
const itemHeight = 110; | ||
const margins = 40; | ||
const headerHeight = 72; | ||
const itemHeight = 100; | ||
const margins = 4 * 10 + 18; | ||
const maxHeight = 650; | ||
@@ -37,3 +37,3 @@ return this.numberOfItems >= 5 ? `${maxHeight}px` : `${this.numberOfItems * itemHeight + headerHeight + margins}px`; | ||
render() { | ||
return (h("div", { class: 'container', onClick: this.handleWidgetWindowClick, style: { height: this.calculateContainerHeight() } }, | ||
return (h("div", { class: 'widget-window-container', onClick: this.handleWidgetWindowClick, style: { height: this.calculateContainerHeight() } }, | ||
h("div", { class: "header" }, | ||
@@ -40,0 +40,0 @@ h("img", { src: this.logo.src, alt: this.logo.alt || this.logo.src }), |
@@ -1,1 +0,1 @@ | ||
!function(e,t,r,i,n,s,d,o,c,u,a,l,p,h){for(a=e.DdbWidget=e.DdbWidget||{},(l=t.createElement("style")).innerHTML=c+"{visibility:hidden}.hydrated{visibility:inherit}",l.setAttribute("data-styles",""),p=t.head.querySelector("meta[charset]"),t.head.insertBefore(l,p?p.nextSibling:t.head.firstChild),function(e,t,r){(e["s-apps"]=e["s-apps"]||[]).push("DdbWidget"),r.componentOnReady||(r.componentOnReady=function(){var t=this;function r(r){if(t.nodeName.indexOf("-")>0){for(var i=e["s-apps"],n=0,s=0;s<i.length;s++)if(e[i[s]].componentOnReady){if(e[i[s]].componentOnReady(t,r))return;n++}if(n<i.length)return void(e["s-cr"]=e["s-cr"]||[]).push([t,r])}r(null)}return e.Promise?new e.Promise(r):{then:r}})}(e,0,u),n=n||a.resourcesUrl,l=(p=t.querySelectorAll("script")).length-1;l>=0&&!(h=p[l]).src&&!h.hasAttribute("data-resources-url");l--);p=h.getAttribute("data-resources-url"),!n&&p&&(n=p),!n&&h.src&&(n=(p=h.src.split("/").slice(0,-1)).join("/")+(p.length?"/":"")+"ddb-widget/"),l=t.createElement("script"),function(e,t,r,i){return!(t.search.indexOf("core=esm")>0)&&(!(!(t.search.indexOf("core=es5")>0||"file:"===t.protocol)&&e.customElements&&e.customElements.define&&e.fetch&&e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")&&"noModule"in r)||function(e){try{return new Function('import("")'),!1}catch(e){}return!0}())}(e,e.location,l)?l.src=n+"ddb-widget.vtrgv3uh.js":(l.src=n+"ddb-widget.aplttou1.js",l.setAttribute("type","module"),l.setAttribute("crossorigin",!0)),l.setAttribute("data-resources-url",n),l.setAttribute("data-namespace","ddb-widget"),t.head.appendChild(l)}(window,document,0,0,"https://unpkg.com/@charlietango/ddb-widget/dist/ddb-widget/",0,0,0,"ddb-widget,link-list,widget-launcher,widget-window",HTMLElement.prototype); | ||
!function(e,t,r,i,n,s,d,o,c,a,u,l,p,h){for(u=e.DdbWidget=e.DdbWidget||{},(l=t.createElement("style")).innerHTML=c+"{visibility:hidden}.hydrated{visibility:inherit}",l.setAttribute("data-styles",""),p=t.head.querySelector("meta[charset]"),t.head.insertBefore(l,p?p.nextSibling:t.head.firstChild),function(e,t,r){(e["s-apps"]=e["s-apps"]||[]).push("DdbWidget"),r.componentOnReady||(r.componentOnReady=function(){var t=this;function r(r){if(t.nodeName.indexOf("-")>0){for(var i=e["s-apps"],n=0,s=0;s<i.length;s++)if(e[i[s]].componentOnReady){if(e[i[s]].componentOnReady(t,r))return;n++}if(n<i.length)return void(e["s-cr"]=e["s-cr"]||[]).push([t,r])}r(null)}return e.Promise?new e.Promise(r):{then:r}})}(e,0,a),n=n||u.resourcesUrl,l=(p=t.querySelectorAll("script")).length-1;l>=0&&!(h=p[l]).src&&!h.hasAttribute("data-resources-url");l--);p=h.getAttribute("data-resources-url"),!n&&p&&(n=p),!n&&h.src&&(n=(p=h.src.split("/").slice(0,-1)).join("/")+(p.length?"/":"")+"ddb-widget/"),l=t.createElement("script"),function(e,t,r,i){return!(t.search.indexOf("core=esm")>0)&&(!(!(t.search.indexOf("core=es5")>0||"file:"===t.protocol)&&e.customElements&&e.customElements.define&&e.fetch&&e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")&&"noModule"in r)||function(e){try{return new Function('import("")'),!1}catch(e){}return!0}())}(e,e.location,l)?l.src=n+"ddb-widget.knelzgva.js":(l.src=n+"ddb-widget.esvy2skz.js",l.setAttribute("type","module"),l.setAttribute("crossorigin",!0)),l.setAttribute("data-resources-url",n),l.setAttribute("data-namespace","ddb-widget"),t.head.appendChild(l)}(window,document,0,0,"https://unpkg.com/@charlietango/ddb-widget/dist/ddb-widget/",0,0,0,"ddb-widget,link-list,widget-launcher,widget-window",HTMLElement.prototype); |
// DdbWidget: Host Data, ES Module/es2017 Target | ||
export const DdbWidget = ["ddb-widget","ut4jeiya",1,[["isMobile",16],["isOpen",16],["widgetData",16]],1]; | ||
export const LinkList = ["link-list","ut4jeiya",1,[["color",1,0,1,2],["links",1]],1]; | ||
export const WidgetLauncher = ["widget-launcher","ut4jeiya",1,[["color",1,0,1,2],["isExpanded",16],["isOpen",1,0,"is-open",4],["isReady",16],["logo",1],["promoImage",1],["promoText",1],["settings",1],["usePromoImage",1,0,"use-promo-image",4]],1]; | ||
export const WidgetWindow = ["widget-window","ut4jeiya",1,[["logo",1],["numberOfItems",1,0,"number-of-items",8],["onCloseClick",1]],1]; | ||
export const DdbWidget = ["ddb-widget","ix4w1ibp",1,[["isMobile",16],["isOpen",16],["widgetData",16]],1]; | ||
export const LinkList = ["link-list","ix4w1ibp",1,[["color",1,0,1,2],["links",1]],1]; | ||
export const WidgetLauncher = ["widget-launcher","ix4w1ibp",1,[["color",1,0,1,2],["isExpanded",16],["isOpen",1,0,"is-open",4],["isReady",16],["logo",1],["promoImage",1],["promoText",1],["settings",1],["usePromoImage",1,0,"use-promo-image",4]],1]; | ||
export const WidgetWindow = ["widget-window","ix4w1ibp",1,[["logo",1],["numberOfItems",1,0,"number-of-items",8],["onCloseClick",1]],1]; |
// DdbWidget: Host Data, ES Module/es5 Target | ||
export var DdbWidget = ["ddb-widget","ut4jeiya",1,[["isMobile",16],["isOpen",16],["widgetData",16]],1]; | ||
export var LinkList = ["link-list","ut4jeiya",1,[["color",1,0,1,2],["links",1]],1]; | ||
export var WidgetLauncher = ["widget-launcher","ut4jeiya",1,[["color",1,0,1,2],["isExpanded",16],["isOpen",1,0,"is-open",4],["isReady",16],["logo",1],["promoImage",1],["promoText",1],["settings",1],["usePromoImage",1,0,"use-promo-image",4]],1]; | ||
export var WidgetWindow = ["widget-window","ut4jeiya",1,[["logo",1],["numberOfItems",1,0,"number-of-items",8],["onCloseClick",1]],1]; | ||
export var DdbWidget = ["ddb-widget","ix4w1ibp",1,[["isMobile",16],["isOpen",16],["widgetData",16]],1]; | ||
export var LinkList = ["link-list","ix4w1ibp",1,[["color",1,0,1,2],["links",1]],1]; | ||
export var WidgetLauncher = ["widget-launcher","ix4w1ibp",1,[["color",1,0,1,2],["isExpanded",16],["isOpen",1,0,"is-open",4],["isReady",16],["logo",1],["promoImage",1],["promoText",1],["settings",1],["usePromoImage",1,0,"use-promo-image",4]],1]; | ||
export var WidgetWindow = ["widget-window","ix4w1ibp",1,[["logo",1],["numberOfItems",1,0,"number-of-items",8],["onCloseClick",1]],1]; |
import '../../stencil.core'; | ||
import { WidgetModel } from '../../types'; | ||
declare global { | ||
interface Window { | ||
_ti: any; | ||
_tiConfig: any; | ||
} | ||
} | ||
export declare class DdbWidget { | ||
@@ -4,0 +10,0 @@ widgetData: WidgetModel; |
{ | ||
"name": "@charlietango/ddb-widget", | ||
"version": "0.1.29", | ||
"version": "0.1.30", | ||
"description": "Web Component built with Stencil by Charlie Tango", | ||
@@ -28,3 +28,3 @@ "module": "dist/esm/index.js", | ||
"devDependencies": { | ||
"@stencil/core": "~0.13.2", | ||
"@stencil/core": "^0.16.0", | ||
"@stencil/sass": "^0.1.1", | ||
@@ -31,0 +31,0 @@ "tslint": "^5.11.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
518750
4580