forked from ritz078/embed-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(eslint): added eslint-standard
- Loading branch information
Showing
22 changed files
with
504 additions
and
519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,9 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"es6": true, | ||
"browser": true | ||
}, | ||
"parser": "babel-eslint", | ||
"extends": "eslint:recommended", | ||
"extends": "standard", | ||
"rules": { | ||
"no-multi-spaces": 0, | ||
"key-spacing": 0, | ||
"no-return-assign": 0, | ||
"consistent-return": 0, | ||
"no-shadow": 0, | ||
"comma-dangle": 0, | ||
"no-use-before-define": 0, | ||
"no-empty": 0, | ||
"new-parens": 0, | ||
"no-cond-assign": 0, | ||
"no-fallthrough": 0, | ||
"new-cap": 0, | ||
"no-loop-func": 0, | ||
"no-unreachable": 0, | ||
"no-labels": 0, | ||
"no-process-exit": 0, | ||
"camelcase": 0, | ||
"no-console": 0 | ||
"one-var": "off", | ||
"no-tabs": "off", | ||
"no-useless-escape": "off", | ||
"no-new-func": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { ifEmbed } from '../modules/utils' | ||
import base from '../modules/base' | ||
|
||
export default function baseEmbed(input, output, embeds, options, regex, service, flag){ | ||
return ifEmbed(options, service) || (ifEmbed(options, service) && flag) ? base(input, output, embeds, options, regex, service) : [output, embeds] | ||
export default function baseEmbed (input, output, embeds, options, regex, service, flag) { | ||
return ifEmbed(options, service) || (ifEmbed(options, service) && flag) ? base(input, output, embeds, options, regex, service) : [output, embeds] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
import { ifInline, matches } from '../modules/utils' | ||
|
||
function inlineEmbed(_){ | ||
let regexInline = _.options.link ? new RegExp(`([^>]*${_.regex.source})<\/a>`, 'gm') : new RegExp(`([^\\s]*${_.regex.source})`, 'gm'); | ||
_.output = _.output.replace(regexInline, function(match) { | ||
let url = _.options.link ? match.slice(0, -4) : match; | ||
if (_.options.served.indexOf(url) === -1) { | ||
_.options.served.push(url); | ||
if (_.options.link) { | ||
return !_.options.inlineText ? _.template(match.slice(0, -4)) + '</a>' : match + _.template(match.slice(0, -4)) | ||
} else { | ||
return !_.options.inlineText ? _.template(match) : match + _.template(match) | ||
} | ||
} else { | ||
return match; //TODO : check whether this should be `match` | ||
} | ||
}); | ||
return [_.output, _.embeds]; | ||
function inlineEmbed (_) { | ||
let regexInline = _.options.link ? new RegExp(`([^>]*${_.regex.source})<\/a>`, 'gm') : new RegExp(`([^\\s]*${_.regex.source})`, 'gm') | ||
_.output = _.output.replace(regexInline, function (match) { | ||
let url = _.options.link ? match.slice(0, -4) : match | ||
if (_.options.served.indexOf(url) === -1) { | ||
_.options.served.push(url) | ||
if (_.options.link) { | ||
return !_.options.inlineText ? _.template(match.slice(0, -4)) + '</a>' : match + _.template(match.slice(0, -4)) | ||
} else { | ||
return !_.options.inlineText ? _.template(match) : match + _.template(match) | ||
} | ||
} else { | ||
return match // TODO : check whether this should be `match` | ||
} | ||
}) | ||
return [_.output, _.embeds] | ||
} | ||
|
||
function normalEmbed(_){ | ||
let match; | ||
while ((match = matches(_.regex, _.input)) !== null) { | ||
let url = match[0]; | ||
if (!(_.options.served.indexOf(url) === -1) || (_.options.served.length && _.options.singleEmbed)) continue; | ||
_.options.served.push(url); | ||
let text = _.template(url); | ||
_.embeds.push({ | ||
text : text, | ||
index: match.index | ||
}) | ||
} | ||
return [_.output, _.embeds]; | ||
function normalEmbed (_) { | ||
let match | ||
while ((match = matches(_.regex, _.input)) !== null) { | ||
let url = match[0] | ||
if (!(_.options.served.indexOf(url) === -1) || (_.options.served.length && _.options.singleEmbed)) continue | ||
_.options.served.push(url) | ||
let text = _.template(url) | ||
_.embeds.push({ | ||
text: text, | ||
index: match.index | ||
}) | ||
} | ||
return [_.output, _.embeds] | ||
} | ||
|
||
export default function embed(_){ | ||
return (ifInline(_.options, _.service)) ? inlineEmbed(_) : normalEmbed(_) | ||
export default function embed (_) { | ||
return (ifInline(_.options, _.service)) ? inlineEmbed(_) : normalEmbed(_) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export default function (data, fullData, embedUrl, options) { | ||
if (data.host === 'vimeo') { | ||
return options.template.detailsVimeo(data, fullData, embedUrl, options) | ||
} else if (data.host === 'youtube') { | ||
return options.template.detailsYoutube(data, fullData, embedUrl, options) | ||
} | ||
if (data.host === 'vimeo') { | ||
return options.template.detailsVimeo(data, fullData, embedUrl, options) | ||
} else if (data.host === 'youtube') { | ||
return options.template.detailsYoutube(data, fullData, embedUrl, options) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import playVideo from './playVideo' | ||
import playVideo from './playVideo' | ||
import getDetailsTemplate from './getDetailsTemplate' | ||
import applyPlyr from './applyPlyr' | ||
import applyVideoJS from './applyVideoJS'; | ||
import destroyVideos from './destroyVideos' | ||
import embed from './embed' | ||
import template from './template' | ||
import baseEmbed from './baseEmbed' | ||
import asyncEmbed from './asyncEmbed' | ||
|
||
import applyPlyr from './applyPlyr' | ||
import applyVideoJS from './applyVideoJS' | ||
import destroyVideos from './destroyVideos' | ||
import embed from './embed' | ||
import template from './template' | ||
import baseEmbed from './baseEmbed' | ||
import asyncEmbed from './asyncEmbed' | ||
|
||
export {playVideo, getDetailsTemplate, applyPlyr, applyVideoJS, destroyVideos, embed, template, baseEmbed, asyncEmbed} |
Oops, something went wrong.