mirror of
https://github.com/webslides/WebSlides.git
synced 2025-08-17 18:37:00 +02:00
Removing counter link when index is disabled #88
This commit is contained in:
@@ -48,7 +48,7 @@ export default class Navigation {
|
|||||||
* Counter Element.
|
* Counter Element.
|
||||||
* @type {Element}
|
* @type {Element}
|
||||||
*/
|
*/
|
||||||
this.counter = Navigation.createCounter(ELEMENT_ID.COUNTER);
|
this.counter = Navigation.createCounter(ELEMENT_ID.COUNTER, wsInstance);
|
||||||
/**
|
/**
|
||||||
* @type {WebSlides}
|
* @type {WebSlides}
|
||||||
* @private
|
* @private
|
||||||
@@ -81,7 +81,11 @@ export default class Navigation {
|
|||||||
* @param {string|number} max Max slide number.
|
* @param {string|number} max Max slide number.
|
||||||
*/
|
*/
|
||||||
updateCounter(current, max) {
|
updateCounter(current, max) {
|
||||||
|
if (this.ws_.options.showIndex) {
|
||||||
this.counter.childNodes[0].textContent = `${current} / ${max}`;
|
this.counter.childNodes[0].textContent = `${current} / ${max}`;
|
||||||
|
} else {
|
||||||
|
this.counter.textContent = `${current} / ${max}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,14 +105,17 @@ export default class Navigation {
|
|||||||
/**
|
/**
|
||||||
* Creates the navigation counter.
|
* Creates the navigation counter.
|
||||||
* @param {!String} id Desired ID for the counter.
|
* @param {!String} id Desired ID for the counter.
|
||||||
|
* @param {WebSlides} ws_ WebSlides object.
|
||||||
* @return {Element} The arrow element.
|
* @return {Element} The arrow element.
|
||||||
*/
|
*/
|
||||||
static createCounter(id) {
|
static createCounter(id, ws_) {
|
||||||
const counter = DOM.createNode('span', id);
|
const counter = DOM.createNode('span', id);
|
||||||
|
if (ws_.options.showIndex) {
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = '#';
|
link.href = '#';
|
||||||
link.title = 'View all slides';
|
link.title = 'View all slides';
|
||||||
counter.appendChild(link);
|
counter.appendChild(link);
|
||||||
|
}
|
||||||
|
|
||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* Name: WebSlides
|
* Name: WebSlides
|
||||||
* Version: 1.3.1
|
* Version: 1.3.1
|
||||||
* Date: 2017-08-02
|
* Date: 2017-08-04
|
||||||
* Description: Making HTML presentations easy
|
* Description: Making HTML presentations easy
|
||||||
* URL: https://github.com/webslides/webslides#readme
|
* URL: https://github.com/webslides/webslides#readme
|
||||||
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* Name: WebSlides
|
* Name: WebSlides
|
||||||
* Version: 1.3.1
|
* Version: 1.3.1
|
||||||
* Date: 2017-08-02
|
* Date: 2017-08-04
|
||||||
* Description: Making HTML presentations easy
|
* Description: Making HTML presentations easy
|
||||||
* URL: https://github.com/webslides/webslides#readme
|
* URL: https://github.com/webslides/webslides#readme
|
||||||
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
* Credits: @jlantunez, @LuisSacristan, @Belelros
|
||||||
@@ -1887,7 +1887,7 @@ var Navigation = function () {
|
|||||||
* Counter Element.
|
* Counter Element.
|
||||||
* @type {Element}
|
* @type {Element}
|
||||||
*/
|
*/
|
||||||
this.counter = Navigation.createCounter(ELEMENT_ID.COUNTER);
|
this.counter = Navigation.createCounter(ELEMENT_ID.COUNTER, wsInstance);
|
||||||
/**
|
/**
|
||||||
* @type {WebSlides}
|
* @type {WebSlides}
|
||||||
* @private
|
* @private
|
||||||
@@ -1926,7 +1926,11 @@ var Navigation = function () {
|
|||||||
}, {
|
}, {
|
||||||
key: 'updateCounter',
|
key: 'updateCounter',
|
||||||
value: function updateCounter(current, max) {
|
value: function updateCounter(current, max) {
|
||||||
|
if (this.ws_.options.showIndex) {
|
||||||
this.counter.childNodes[0].textContent = current + ' / ' + max;
|
this.counter.childNodes[0].textContent = current + ' / ' + max;
|
||||||
|
} else {
|
||||||
|
this.counter.textContent = current + ' / ' + max;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1980,17 +1984,20 @@ var Navigation = function () {
|
|||||||
/**
|
/**
|
||||||
* Creates the navigation counter.
|
* Creates the navigation counter.
|
||||||
* @param {!String} id Desired ID for the counter.
|
* @param {!String} id Desired ID for the counter.
|
||||||
|
* @param {WebSlides} ws_ WebSlides object.
|
||||||
* @return {Element} The arrow element.
|
* @return {Element} The arrow element.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
key: 'createCounter',
|
key: 'createCounter',
|
||||||
value: function createCounter(id) {
|
value: function createCounter(id, ws_) {
|
||||||
var counter = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].createNode('span', id);
|
var counter = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].createNode('span', id);
|
||||||
|
if (ws_.options.showIndex) {
|
||||||
var link = document.createElement('a');
|
var link = document.createElement('a');
|
||||||
link.href = '#';
|
link.href = '#';
|
||||||
link.title = 'View all slides';
|
link.title = 'View all slides';
|
||||||
counter.appendChild(link);
|
counter.appendChild(link);
|
||||||
|
}
|
||||||
|
|
||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
4
static/js/webslides.min.js
vendored
4
static/js/webslides.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user