Skip to content

Commit e4c4dbd

Browse files
committed
commenting, refact, misc
1 parent 92047c2 commit e4c4dbd

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed

dist/js/ensemble-social-share.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,7 @@
903903

904904

905905
text(data) {
906-
const encoder = this.encoder;
907-
908-
return encoder(
906+
return this.encoder(
909907
data.text
910908
.replace('%url%', data.url)
911909
.replace('%title%', data.title)
@@ -939,11 +937,11 @@
939937

940938

941939
sendEmail(evt, data) {
942-
const {options: opts, encoder} = this;
940+
const opts = this.options;
943941
const locale = opts.locale;
944942

945943
const url = opts.uriform['send-email']
946-
.replace('%subject%', encoder(locale.subject))
944+
.replace('%subject%', this.encoder(locale.subject))
947945
.replace('%text%', this.text(data));
948946

949947
window.open(url, '_self');

dist/js/ensemble-social-share.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ function bundle_banner() {
5454
license: 'MIT License'
5555
};
5656

57-
return '/*!\n\
58-
* ' + pkg.name + '\n\
59-
* @version ' + pkg.version + '\n\
60-
* @link ' + pkg.link + '\n\
61-
* @copyright ' + pkg.copyright + '\n\
62-
* @license ' + pkg.license + '\n\
63-
*/\n';
57+
return `/*!\n\
58+
* ${pkg.name}\n\
59+
* @version ${pkg.version}\n\
60+
* @link ${pkg.link}\n\
61+
* @copyright ${pkg.copyright}\n\
62+
* @license ${pkg.license}\n\
63+
*/\n`;
6464
}
6565

6666
function js() {
@@ -183,7 +183,7 @@ function _css(options) {
183183
}))
184184
.pipe(sass({
185185
loadPaths: [
186-
'./node_modules/@loltgt/ensemble-modal/src/scss'
186+
'./node_modules/ensemble-modal/src/scss'
187187
],
188188
silenceDeprecations: ['import'],
189189
style: options.minify ? 'compressed' : 'expanded',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"@babel/cli": "^7.26.4",
2424
"@babel/core": "^7.26.9",
2525
"@babel/preset-env": "^7.26.9",
26-
"@loltgt/ensemble": "github:loltgt/ensemble",
2726
"@rbnlffl/gulp-rollup": "^0.2.4",
2827
"@rollup/plugin-node-resolve": "^16.0.0",
28+
"ensemble": "github:loltgt/ensemble",
2929
"gulp": "^5.0.0",
3030
"gulp-babel": "^8.0.0",
3131
"gulp-rename": "^2.0.0",

src/js/SocialShare.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @exports SocialShare
1515
*/
1616

17-
import base from "@loltgt/ensemble";
17+
import base from 'ensemble';
1818

1919

2020
/**
@@ -39,7 +39,7 @@ const SocialShareActionEnum = Object.freeze({
3939
* @extends base
4040
* @inheritdoc
4141
* @param {Element} [element] A valid Element node placeholder to replace with the component
42-
* @param {object} options Options object
42+
* @param {object} [options] Options object
4343
* @param {string} [options.ns=share] The namespace for social share
4444
* @param {string} [options.root=body] A root Element node
4545
* @param {string[]} [options.className=social-share] The component CSS class name
@@ -202,8 +202,8 @@ class SocialShare extends base {
202202
super(...arguments);
203203

204204
/**
205+
* Alias for encodeURIComponent
205206
* @see encodeURIComponent
206-
*
207207
* @name encoder
208208
* @function
209209
*/
@@ -248,9 +248,10 @@ class SocialShare extends base {
248248
this.drawer();
249249

250250
/**
251+
* options.onInit callback
251252
* @event #options.onInit
252253
* @type {function}
253-
* @param {object} this
254+
* @param {object} this This component object
254255
*/
255256
opts.onInit.call(this, this);
256257
}
@@ -417,12 +418,13 @@ class SocialShare extends base {
417418
const data = {url, title, text, summary};
418419

419420
/**
421+
* options.onIntent callback
420422
* @event #options.onIntent
421423
* @type {function}
422-
* @param {object} this
423-
* @param {Event} evt
424-
* @param {string} intent
425-
* @param {object} data
424+
* @param {object} this This component object
425+
* @param {Event} evt Event object
426+
* @param {string} intent Current intent
427+
* @param {object} data Sharing data object
426428
*/
427429
opts.onIntent.call(this, this, evt, intent, data);
428430

@@ -451,9 +453,7 @@ class SocialShare extends base {
451453
* @return {string} URL encoded text string
452454
*/
453455
text(data) {
454-
const encoder = this.encoder;
455-
456-
return encoder(
456+
return this.encoder(
457457
data.text
458458
.replace('%url%', data.url)
459459
.replace('%title%', data.title)
@@ -512,11 +512,11 @@ class SocialShare extends base {
512512
* @param {string} data.summary Share summary text
513513
*/
514514
sendEmail(evt, data) {
515-
const {options: opts, encoder} = this;
515+
const opts = this.options;
516516
const locale = opts.locale;
517517

518518
const url = opts.uriform['send-email']
519-
.replace('%subject%', encoder(locale.subject))
519+
.replace('%subject%', this.encoder(locale.subject))
520520
.replace('%text%', this.text(data));
521521

522522
window.open(url, '_self');

0 commit comments

Comments
 (0)