Added tests for jQuery.
This commit is contained in:
parent
09b50d3b81
commit
1f5df65c48
26
dist/iwmlib.js
vendored
26
dist/iwmlib.js
vendored
@ -9328,7 +9328,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//jquery hyphenate below
|
//jquery hyphenate below
|
||||||
$('.column').not('.overview').children('p').hyphenate('de');
|
if (typeof($) != 'undefined') {
|
||||||
|
$('.column').not('.overview').children('p').hyphenate('de');
|
||||||
|
}
|
||||||
|
|
||||||
//logging
|
//logging
|
||||||
if (src) {
|
if (src) {
|
||||||
@ -9764,7 +9766,7 @@
|
|||||||
let linkRects = links.map(link => {
|
let linkRects = links.map(link => {
|
||||||
let rect = link.getBoundingClientRect();
|
let rect = link.getBoundingClientRect();
|
||||||
let topLeft = Points.fromPageToNode(indexbox, rect);
|
let topLeft = Points.fromPageToNode(indexbox, rect);
|
||||||
let center = Points.fromPageToNode(indexbox, {x: rect.x + rect.width/2, y: rect.y + rect.height/2});
|
let center = Points.fromPageToNode(indexbox, { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 });
|
||||||
return { x: topLeft.x, y: topLeft.y, width: rect.width, height: rect.height, center, link }
|
return { x: topLeft.x, y: topLeft.y, width: rect.width, height: rect.height, center, link }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -9791,7 +9793,7 @@
|
|||||||
let local = Points.fromPageToNode(context, globalClick);
|
let local = Points.fromPageToNode(context, globalClick);
|
||||||
let rect = linkRects[closestLinkIndex];
|
let rect = linkRects[closestLinkIndex];
|
||||||
local.y = rect.center.y;
|
local.y = rect.center.y;
|
||||||
|
|
||||||
Card.loadPopup(event, context, closestLink, local);
|
Card.loadPopup(event, context, closestLink, local);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9820,8 +9822,10 @@
|
|||||||
this._setPopupSource(popup, source);
|
this._setPopupSource(popup, source);
|
||||||
context.popup = popup;
|
context.popup = popup;
|
||||||
|
|
||||||
//jquery hyphenate below
|
if (typeof($) != 'undefined') {
|
||||||
console.log('hyphenated popup:', $('span').hyphenate('de'));
|
//jquery hyphenate below
|
||||||
|
console.log('hyphenated popup:', $('span').hyphenate('de'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static _unsetPopup(context) {
|
static _unsetPopup(context) {
|
||||||
@ -9944,10 +9948,6 @@
|
|||||||
zoomable: 0.5
|
zoomable: 0.5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Make the class available in the global namespace */
|
|
||||||
window.Card = Card;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends the card with scatter functionality.
|
* Extends the card with scatter functionality.
|
||||||
*
|
*
|
||||||
@ -10053,13 +10053,16 @@
|
|||||||
*/
|
*/
|
||||||
static loadAndCreateScatterCard(scatterContainer, item, {
|
static loadAndCreateScatterCard(scatterContainer, item, {
|
||||||
basePath = "../",
|
basePath = "../",
|
||||||
modules = null,
|
modules = [],
|
||||||
onClose = null
|
onClose = null
|
||||||
} = {}) {
|
} = {}) {
|
||||||
console.log(basePath);
|
console.log(basePath);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.loadHTML(basePath + "/" + item + "/index.html")
|
let url = basePath + "/" + item + "/index.html";
|
||||||
|
console.log("Loading", url);
|
||||||
|
this.loadHTML(url)
|
||||||
.then(html => {
|
.then(html => {
|
||||||
|
console.log("Received", html);
|
||||||
let element = this.createCardScatter(html, scatterContainer, {
|
let element = this.createCardScatter(html, scatterContainer, {
|
||||||
basePath,
|
basePath,
|
||||||
modules
|
modules
|
||||||
@ -10205,6 +10208,7 @@
|
|||||||
|
|
||||||
window.CardWrapper = CardWrapper;
|
window.CardWrapper = CardWrapper;
|
||||||
window.Card = Card;
|
window.Card = Card;
|
||||||
|
window.ScatterCard = ScatterCard;
|
||||||
window.Highlight = Highlight$1;
|
window.Highlight = Highlight$1;
|
||||||
window.Theme = Theme;
|
window.Theme = Theme;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import UITest from './uitest.js'
|
|||||||
|
|
||||||
import CardWrapper from './card/wrapper.js'
|
import CardWrapper from './card/wrapper.js'
|
||||||
import Highlight from './card/highlight.js'
|
import Highlight from './card/highlight.js'
|
||||||
import Card from './card/card.js'
|
import {Card, ScatterCard} from './card/card.js'
|
||||||
import Theme from './card/theme.js'
|
import Theme from './card/theme.js'
|
||||||
|
|
||||||
/* Needed to ensure that rollup.js includes class definitions and the classes
|
/* Needed to ensure that rollup.js includes class definitions and the classes
|
||||||
@ -90,5 +90,6 @@ window.randomFloat = randomFloat
|
|||||||
|
|
||||||
window.CardWrapper = CardWrapper
|
window.CardWrapper = CardWrapper
|
||||||
window.Card = Card
|
window.Card = Card
|
||||||
|
window.ScatterCard = ScatterCard
|
||||||
window.Highlight = Highlight
|
window.Highlight = Highlight
|
||||||
window.Theme = Theme
|
window.Theme = Theme
|
||||||
|
@ -29,7 +29,7 @@ const enableNearestNeighborTaps = false
|
|||||||
*
|
*
|
||||||
* The class is used as a namespace and should never called with new.
|
* The class is used as a namespace and should never called with new.
|
||||||
*/
|
*/
|
||||||
export default class Card {
|
export class Card {
|
||||||
|
|
||||||
static setup(context, modules = []) {
|
static setup(context, modules = []) {
|
||||||
console.log("Setup Card...", modules)
|
console.log("Setup Card...", modules)
|
||||||
@ -1253,7 +1253,9 @@ export default class Card {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//jquery hyphenate below
|
//jquery hyphenate below
|
||||||
$('.column').not('.overview').children('p').hyphenate('de')
|
if (typeof($) != 'undefined') {
|
||||||
|
$('.column').not('.overview').children('p').hyphenate('de')
|
||||||
|
}
|
||||||
|
|
||||||
//logging
|
//logging
|
||||||
if (src) {
|
if (src) {
|
||||||
@ -1699,7 +1701,7 @@ export default class Card {
|
|||||||
let linkRects = links.map(link => {
|
let linkRects = links.map(link => {
|
||||||
let rect = link.getBoundingClientRect()
|
let rect = link.getBoundingClientRect()
|
||||||
let topLeft = Points.fromPageToNode(indexbox, rect)
|
let topLeft = Points.fromPageToNode(indexbox, rect)
|
||||||
let center = Points.fromPageToNode(indexbox, {x: rect.x + rect.width/2, y: rect.y + rect.height/2})
|
let center = Points.fromPageToNode(indexbox, { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 })
|
||||||
return { x: topLeft.x, y: topLeft.y, width: rect.width, height: rect.height, center, link }
|
return { x: topLeft.x, y: topLeft.y, width: rect.width, height: rect.height, center, link }
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1726,7 +1728,7 @@ export default class Card {
|
|||||||
let local = Points.fromPageToNode(context, globalClick)
|
let local = Points.fromPageToNode(context, globalClick)
|
||||||
let rect = linkRects[closestLinkIndex]
|
let rect = linkRects[closestLinkIndex]
|
||||||
local.y = rect.center.y
|
local.y = rect.center.y
|
||||||
|
|
||||||
Card.loadPopup(event, context, closestLink, local)
|
Card.loadPopup(event, context, closestLink, local)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1755,8 +1757,10 @@ export default class Card {
|
|||||||
this._setPopupSource(popup, source)
|
this._setPopupSource(popup, source)
|
||||||
context.popup = popup
|
context.popup = popup
|
||||||
|
|
||||||
//jquery hyphenate below
|
if (typeof($) != 'undefined') {
|
||||||
console.log('hyphenated popup:', $('span').hyphenate('de'))
|
//jquery hyphenate below
|
||||||
|
console.log('hyphenated popup:', $('span').hyphenate('de'))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static _unsetPopup(context) {
|
static _unsetPopup(context) {
|
||||||
@ -1879,16 +1883,12 @@ Card.animation = {
|
|||||||
zoomable: 0.5
|
zoomable: 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Make the class available in the global namespace */
|
|
||||||
window.Card = Card
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends the card with scatter functionality.
|
* Extends the card with scatter functionality.
|
||||||
*
|
*
|
||||||
* @class ScatterCard
|
* @class ScatterCard
|
||||||
*/
|
*/
|
||||||
class ScatterCard extends Card {
|
export class ScatterCard extends Card {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1988,13 +1988,16 @@ class ScatterCard extends Card {
|
|||||||
*/
|
*/
|
||||||
static loadAndCreateScatterCard(scatterContainer, item, {
|
static loadAndCreateScatterCard(scatterContainer, item, {
|
||||||
basePath = "../",
|
basePath = "../",
|
||||||
modules = null,
|
modules = [],
|
||||||
onClose = null
|
onClose = null
|
||||||
} = {}) {
|
} = {}) {
|
||||||
console.log(basePath)
|
console.log(basePath)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.loadHTML(basePath + "/" + item + "/index.html")
|
let url = basePath + "/" + item + "/index.html"
|
||||||
|
console.log("Loading", url)
|
||||||
|
this.loadHTML(url)
|
||||||
.then(html => {
|
.then(html => {
|
||||||
|
console.log("Received", html)
|
||||||
let element = this.createCardScatter(html, scatterContainer, {
|
let element = this.createCardScatter(html, scatterContainer, {
|
||||||
basePath,
|
basePath,
|
||||||
modules
|
modules
|
||||||
|
Loading…
Reference in New Issue
Block a user