diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 83c4bd7..15639c0 100755 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -93,6 +93,7 @@ gulp.task('watch', ['build'], () => { $.runSequence('icons', $.livereload.reload); }); gulp.watch(['./src/scripts/**/*']).on('change', () => { + $.runSequence('lint.js'); $.runSequence('js', $.livereload.reload); }); gulp.watch(['./src/styles/**/*']).on('change', () => { @@ -153,6 +154,16 @@ gulp.task('js', () => { return buildJS(target); }); +gulp.task('lint.js', () => { // generate a zip + return gulp.src(['./src/scripts/background/*.js', './src/scripts/components/**/*.js', './src/scripts/config/*.js', './src/scripts/utils/*.js']).pipe($.eslint()) + // $.eslint.format() outputs the lint results to the console. + // Alternatively use $.eslint.formatEach() (see Docs). + .pipe($.eslint.format()) + // To have the process exit with an error code (1) on + // lint error, return the stream and pipe to failAfterError last. + // .pipe($.eslint.failAfterError()); +}); + gulp.task('styles', () => { return gulp.src([`src/styles/index.${target}.scss`]) .pipe($.plumber()) @@ -213,6 +224,7 @@ gulp.task('dist', (cb) => { // generate a zip $.runSequence('build', 'zip', cb); }); + gulp.task('zip', () => { return pipe(`./build/${target}/**/*`, $.zip(`${target}.zip`), './dist'); }); @@ -258,7 +270,7 @@ function buildJS(target) { let tasks = files.map(file => { return browserify({ entries: 'src/scripts/' + file.source, - debug: true + debug: !production }) .transform('babelify', { presets: [ diff --git a/src/scripts/background/data.js b/src/scripts/background/data.js index b017249..6978d6b 100644 --- a/src/scripts/background/data.js +++ b/src/scripts/background/data.js @@ -63,7 +63,7 @@ const data = (() => { }); } - //clean all tickets an user acount data; + // //clean all tickets an user acount data; function cleanAll() { console.log('>-------- The app is cleaned'); setStorage({ @@ -181,7 +181,7 @@ const data = (() => { filtertTickets: filtertTickets, filtertTicketsAmout: filtertTickets.length, allTicketsFromThisWebsite: amountTicketsOnWebsite, - allTicketsFromThisWebsiteAmount: amountTicketsOnWebsite.length, + allTicketsFromThisWebsiteAmount: amountTicketsOnWebsite.length }); }).catch(function (err) { @@ -216,7 +216,7 @@ const data = (() => { account: { userName: accountUserName, passWord: accountPassword, - token: accountToken, + token: accountToken }, tool: { project: toolProjectId, diff --git a/src/scripts/background/findUserData.js b/src/scripts/background/findUserData.js index e3c199d..566f354 100644 --- a/src/scripts/background/findUserData.js +++ b/src/scripts/background/findUserData.js @@ -17,10 +17,40 @@ var data = (() => { browserVersion: browserConfig.version, osversion: browserConfig.osversion, user_agent: window.navigator.appVersion, - os: (browserConfig.mac) ? 'mac' : false || (browserConfig.windows) ? 'windows' : false || (browserConfig.windowsphone) ? 'windowsphone' : false || (browserConfig.linux) ? 'linux' : false || (browserConfig.chromeos) ? 'chromeos' : false || (browserConfig.android) ? 'android' : false || (browserConfig.ios) ? 'ios' : false || (browserConfig.blackberry) ? 'blackberry' : false || (browserConfig.firefoxos) ? 'firefoxos' : false || (browserConfig.webos) ? 'webos' : false || (browserConfig.bada) ? 'bada' : false || (browserConfig.tizen) ? 'tizen' : false || (browserConfig.sailfish) ? 'sailfish' : false + os: getOs() }; }; + function getOs() { + if (browserConfig.mac) { + return 'mac'; + } else if (browserConfig.windows) { + return 'windows'; + } else if (browserConfig.windowsphone) { + return 'windowsphone'; + } else if (browserConfig.linux) { + return 'linux'; + } else if (browserConfig.chromeos) { + return 'chromeos'; + } else if (browserConfig.android) { + return 'android'; + } else if (browserConfig.ios) { + return 'ios'; + } else if (browserConfig.blackberry) { + return 'blackberry'; + } else if (browserConfig.firefoxos) { + return 'firefoxos'; + } else if (browserConfig.webos) { + return 'webos'; + } else if (browserConfig.bada) { + return 'bada'; + } else if (browserConfig.tizen) { + return 'tizen'; + } else if (browserConfig.sailfish) { + return 'sailfish'; + } + return false; + } /** * Get specific user data @@ -35,7 +65,7 @@ var data = (() => { shortlink: shortlink, hostname: hostname, time: new Date(), - screenresolution: screenresolution, + screenresolution: screenresolution // history: getHistory() }; diff --git a/src/scripts/background/mantisApi.js b/src/scripts/background/mantisApi.js index 33d6984..fcec127 100644 --- a/src/scripts/background/mantisApi.js +++ b/src/scripts/background/mantisApi.js @@ -95,7 +95,12 @@ let mantisApi = (() => { message: 'Your credentials are wrong' }); } else { - resolve(res); + //if there is only one project in mantis the api returns a object instead of a array + if (res.item) { + resolve([res.item]); + } else { + resolve(res); + } } } @@ -136,10 +141,10 @@ let mantisApi = (() => { os_build: newTicketObject.data.browserData.osversion, priority: { id: (newTicketObject.isImportant === true) ? IMPORTANT_WEIGHT : NOMAL_WEIGHT, - name: (newTicketObject.isImportant === true) ? 'height' : 'normal', + name: (newTicketObject.isImportant === true) ? 'height' : 'normal' }, steps_to_reproduce: JSON.stringify(newTicketObject.data), - category: 'General', //This one is requert by mantis. + category: 'General' //This one is requert by mantis. // attachments: newTicketObject.assets }; diff --git a/src/scripts/components/button.js b/src/scripts/components/button.js index c0e5894..2bb17c9 100644 --- a/src/scripts/components/button.js +++ b/src/scripts/components/button.js @@ -1,7 +1,7 @@ 'use strict'; /* Setup ==================================================================== */ -import React, {Component} from 'react'; +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars /* Component ==================================================================== */ class Button extends Component { diff --git a/src/scripts/components/commentbox/fileItem.js b/src/scripts/components/commentbox/fileItem.js index 2f1a22d..33d2629 100644 --- a/src/scripts/components/commentbox/fileItem.js +++ b/src/scripts/components/commentbox/fileItem.js @@ -1,7 +1,7 @@ 'use strict'; /* Setup ==================================================================== */ -import React, {Component} from 'react'; +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars import helpers, {translate} from '../../utils/helpers'; diff --git a/src/scripts/components/commentbox/index.js b/src/scripts/components/commentbox/index.js index d945c45..01944d2 100644 --- a/src/scripts/components/commentbox/index.js +++ b/src/scripts/components/commentbox/index.js @@ -1,13 +1,14 @@ 'use strict'; /* Setup ==================================================================== */ +/*eslint-disable no-unused-vars*/ import React, {Component} from 'react'; import Anime from 'react-anime'; import message from '../../utils/message.js'; //import components -import Button from '../button' +import Button from '../button'; import TextareaAutosize from '../textareaAutosize'; import FileItem from './fileItem'; import Loader from '../loader'; @@ -17,6 +18,7 @@ import helpers, {translate} from '../../utils/helpers'; import generalConfig from '../../config/general'; // import data from '../../utils/data''Turn Layernotes On' import routerHelper from '../router/routerHelper'; +/*eslint-enable no-unused-vars*/ /* Component ==================================================================== */ class CommentBox extends Component { @@ -60,15 +62,9 @@ class CommentBox extends Component { super(props); this.state = { isError: false, //it the error should be shown - errorText: '', // the error text - scale: [1] //Do not scale by default + errorText: '' // the error text }; } - componentWillUnmount() { - this.setState({ - scale: [1, 0.3] - }); - } /** * Adds for normal inputs @@ -233,8 +229,19 @@ class CommentBox extends Component { //set the posiotn of the comment box _setPosition = () => { const MAX_POSITON_BOTTOM = 250; + const HEIGHT = { + CONTENTMODE: 231, + ELSE: 192, + EDDITMODE: 480 + }; + const SPACEING = 100; + const PADDING = 15; //-------------------------------------------------------------------------------standard height with edit bar: standard height without eddit bar ------------------------------------------- the margin; - const commentBoxHeight = (document.querySelector('.ln-commentbox') === null) ? ((this.props.inEditMode) ? 231 : 192) : document.querySelector('.ln-commentbox').getBoundingClientRect().height + 15; + const commentBoxHeight = (document.querySelector('.ln-commentbox') === null) + ? ((this.props.inEditMode) + ? HEIGHT.CONTENTMODE + : HEIGHT.ELSE) + : document.querySelector('.ln-commentbox').getBoundingClientRect().height + PADDING; //this comment box is used 2 times in the app. When creating and edditigng isseu; let position = { @@ -249,8 +256,8 @@ class CommentBox extends Component { position.style.left = this.props.ticket.position.x; //when the position of the box is on the right side posion the box on the right; - if (this.props.ticket.position.x > (generalConfig.maxX(0) / 2) - 100) { - position.style.left = this.props.ticket.position.x - 480 + this.props.ticket.position.width; + if (this.props.ticket.position.x > (generalConfig.maxX(0) / 2) - SPACEING) { + position.style.left = this.props.ticket.position.x - HEIGHT.EDDITMODE + this.props.ticket.position.width; position.class = 'ln-commentbox-right'; } position.style.top = this.props.ticket.position.height + this.props.ticket.position.y; //only add the top prop to the style when creating; @@ -260,7 +267,7 @@ class CommentBox extends Component { } if (this.props.ticket.position.y > helpers.pageHeight() - this.props.ticket.position.height - MAX_POSITON_BOTTOM) { - position.style.transform = - (commentBoxHeight + this.props.ticket.position.height); + position.style.transform = -(commentBoxHeight + this.props.ticket.position.height); position.class = position.class + ' ln-commentbox-top'; } @@ -346,7 +353,7 @@ class CommentBox extends Component { render = () => { return ( - +
{this._renderOverLay()} diff --git a/src/scripts/components/inputText/index.js b/src/scripts/components/inputText/index.js index 9a8fa62..de256c5 100644 --- a/src/scripts/components/inputText/index.js +++ b/src/scripts/components/inputText/index.js @@ -3,7 +3,7 @@ /* Setup ==================================================================== */ //imports -import React, {Component} from 'react'; +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars import validate from '../../utils/validate'; import {translate} from '../../utils/helpers'; diff --git a/src/scripts/components/loader/index.js b/src/scripts/components/loader/index.js index dda68e0..937b12a 100644 --- a/src/scripts/components/loader/index.js +++ b/src/scripts/components/loader/index.js @@ -3,7 +3,7 @@ /* Setup ==================================================================== */ //imports -import React, {Component} from 'react'; +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars /* Component ==================================================================== */ class Loader extends Component { diff --git a/src/scripts/components/rootElement/index.js b/src/scripts/components/rootElement/index.js index 677963c..ba5ab01 100644 --- a/src/scripts/components/rootElement/index.js +++ b/src/scripts/components/rootElement/index.js @@ -1,13 +1,14 @@ 'use strict'; /* Setup ==================================================================== */ -import React, {Component} from 'react'; + +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars //import helpers import helpers from '../../utils/helpers'; // Components -import Router from '../router'; +import Router from '../router'; // eslint-disable-line no-unused-vars /* Component ==================================================================== */ class Root extends Component { diff --git a/src/scripts/components/router/index.js b/src/scripts/components/router/index.js index 3c28fba..daa2540 100644 --- a/src/scripts/components/router/index.js +++ b/src/scripts/components/router/index.js @@ -1,6 +1,7 @@ 'use strict'; /* Setup ==================================================================== */ +/*eslint-disable no-unused-vars*/ import React, {Component} from 'react'; import Tour from '../../components/userTour'; @@ -9,8 +10,9 @@ import ext from '../../utils/ext'; // Components import ToolBar from '../toolbar'; import Selector from '../selector'; -import Setup from '../setup' +import Setup from '../setup'; import TicketsOnPage from '../ticketsOnPage'; +/*eslint-disable no-unused-vars*/ //data import tourSteps from '../../config/tourSteps'; diff --git a/src/scripts/components/selector/SelectorBackground.js b/src/scripts/components/selector/SelectorBackground.js index 447cdbf..6c1f6e5 100644 --- a/src/scripts/components/selector/SelectorBackground.js +++ b/src/scripts/components/selector/SelectorBackground.js @@ -1,7 +1,7 @@ 'use strict'; /* Setup ==================================================================== */ -import React, {Component} from 'react'; +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars /* Component ==================================================================== */ class SelectorBackground extends Component { diff --git a/src/scripts/components/selector/index.js b/src/scripts/components/selector/index.js index 5f1ed1b..1186a66 100644 --- a/src/scripts/components/selector/index.js +++ b/src/scripts/components/selector/index.js @@ -1,19 +1,19 @@ 'use strict'; /* Setup ==================================================================== */ -import React, {Component} from 'react'; +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars //tools import generalConfig from '../../config/general'; //helpers import {setMinMaxWidth} from '../../utils/helpers'; -import SelectorHelper from './selectorHelper'; -import routerHelper from '../router/routerHelper' +import SelectorHelper from './selectorHelper'; // eslint-disable-line no-unused-vars +import routerHelper from '../router/routerHelper'; //components -import SelectorBackground from './SelectorBackground' -import CommentBox from './../commentbox'; +import SelectorBackground from './SelectorBackground'; // eslint-disable-line no-unused-vars +import CommentBox from './../commentbox'; // eslint-disable-line no-unused-vars import helpers, {translate} from '../../utils/helpers'; import message from '../../utils/message'; @@ -99,7 +99,7 @@ class Selector extends Component { this.setState({ isDrawing: true, //set drawing state startX: this.state.x, //x position - startY: this.state.y, //y position + startY: this.state.y //y position }); this._onMouseMove(e); } @@ -127,7 +127,7 @@ class Selector extends Component { content: image.data, show: false, file_type: 'image/jpeg', - id: helpers.generateUUID(), //a random genreated id + id: helpers.generateUUID() //a random genreated id }; oldState.push(newScreenshot); let newStateTicket = helpers.setNewState(_this.state.ticket, 'assets', oldState); diff --git a/src/scripts/components/selector/selectorHelper.js b/src/scripts/components/selector/selectorHelper.js index d8d93c6..33f3433 100644 --- a/src/scripts/components/selector/selectorHelper.js +++ b/src/scripts/components/selector/selectorHelper.js @@ -1,7 +1,7 @@ 'use strict'; /* Setup ==================================================================== */ -import React, {Component} from 'react'; +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars import generalConfig from '../../config/general'; //helpers diff --git a/src/scripts/components/setup/index.js b/src/scripts/components/setup/index.js index 4339f46..b36a377 100644 --- a/src/scripts/components/setup/index.js +++ b/src/scripts/components/setup/index.js @@ -1,14 +1,14 @@ 'use strict'; /* Setup ==================================================================== */ -import React, {Component} from 'react'; +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars //Component -import Input from '../inputText'; -import Loader from '../loader'; +import Input from '../inputText'; // eslint-disable-line no-unused-vars +import Loader from '../loader'; // eslint-disable-line no-unused-vars //general funcions -import {translate} from '../../utils/helpers' +import {translate} from '../../utils/helpers'; import generalData from '../../config/general'; //helpers @@ -27,7 +27,7 @@ class Setup extends Component { value: 'mantis' }, { name: 'Github', - value: 'github', + value: 'github' }, { name: translate('setupExistingProject'), @@ -103,6 +103,11 @@ class Setup extends Component { //check the credentials from the user _checkCredetionals = (e) => { + const SLIDES = { + ONE: 1, + TWO: 2, + TREE: 3 + }; let _this = this; e.preventDefault(); if (this.state.accountUserName.length < 2 && this.state.accountPassword.length < 2 && this.state.toolUrl.length < 2) { @@ -127,7 +132,7 @@ class Setup extends Component { //go the the next step setTimeout(function() { - _this._nextStep(3); + _this._nextStep(SLIDES.TREE); }, 500); } else { @@ -148,24 +153,34 @@ class Setup extends Component { //the first stpe submit _selectBugtracker = (e) => { + const SLIDES = { + ONE: 1, + TWO: 2, + TREE: 3 + }; + e.preventDefault(); if (this.state.toolName.length < 1) { this._setError(translate('setupMissingBugtracker')); } else if (this.state.toolName === 'existing') { //check if the user chooses a existing login. If this happens go to the 3th step. - this._nextStep(3); + this._nextStep(SLIDES.TREE); } else { //the user chooses a new tool. - this._nextStep(2); + this._nextStep(SLIDES.TWO); } } //the second step - _setProject = (e) =>{ + _setProject = () =>{ + const SLIDES = { + FOUR: 4 + }; + let _this = this; this._setLoading(translate('setupSaving')); setTimeout(function() { - _this._nextStep(4); + _this._nextStep(SLIDES.FOUR); }, 2000); //save the ticket diff --git a/src/scripts/components/textareaAutosize/index.js b/src/scripts/components/textareaAutosize/index.js index ddff38a..44ebad9 100644 --- a/src/scripts/components/textareaAutosize/index.js +++ b/src/scripts/components/textareaAutosize/index.js @@ -1,3 +1,5 @@ +/*eslint-disable no-unused-vars*/ + //based on https://github.com/andreypopp/react-textarea-autosize/blob/master/src/TextareaAutosize.js /** * @@ -83,14 +85,14 @@ export default class TextareaAutosize extends React.Component { maxRows: _maxRows, onHeightChange: _onHeightChange, useCacheForDOMMeasurements: _useCacheForDOMMeasurements, - ...props, + ...props } = this.props; if (typeof valueLink === 'object') { props.value = valueLink.value; } props.style = { ...props.style, - height: this.state.height || 0, + height: this.state.height || 0 }; let maxHeight = Math.max( props.style.maxHeight ? props.style.maxHeight : Infinity, diff --git a/src/scripts/components/ticketsOnPage/index.js b/src/scripts/components/ticketsOnPage/index.js index 24aff68..6cba7fa 100644 --- a/src/scripts/components/ticketsOnPage/index.js +++ b/src/scripts/components/ticketsOnPage/index.js @@ -1,10 +1,11 @@ 'use strict'; /* Setup ==================================================================== */ +/*eslint-disable no-unused-vars*/ import React, {Component} from 'react'; import Anime from 'react-anime'; -import generalData from '../../config/general' +import generalData from '../../config/general'; //components import ToolBar from '../../components/toolbar'; @@ -16,6 +17,8 @@ import CommentBox from '../../components/commentbox'; import {translate} from '../../utils/helpers'; import message from '../../utils/message'; +/*eslint-disable no-unused-vars*/ + /* Component ==================================================================== */ class TicketsOnPage extends Component { constructor(props) { @@ -29,7 +32,7 @@ class TicketsOnPage extends Component { loadingText: translate('loadingText'), total: 0, filtertTotal: 0 - } + }; } componentWillMount() { @@ -41,7 +44,6 @@ class TicketsOnPage extends Component { hostname: generalData.hostname, shortlink: generalData.shortlink }).then(function(tickets) { - //set all tickets _this.setState({savedTickets: tickets.data.filtertTickets, filtertTotal: tickets.data.filtertTicketsAmout, total: tickets.data.allTicketsFromThisWebsiteAmount}); }); @@ -102,6 +104,8 @@ class TicketsOnPage extends Component { _renderIcons = () => { let _this = this; let savedTickets = this.state.savedTickets.map(function(ticket) { + console.log('_this.state.selectedTicket', _this.state.selectedTicket); + console.log('ticket.id', ticket.id); let buttonClass = (_this.state.selectedTicket.id === ticket.id) ? 'active' : ''; diff --git a/src/scripts/components/toolbar/index.js b/src/scripts/components/toolbar/index.js index 7fd1426..498891c 100644 --- a/src/scripts/components/toolbar/index.js +++ b/src/scripts/components/toolbar/index.js @@ -3,8 +3,8 @@ /* Setup ==================================================================== */ //imports -import React, {Component} from 'react'; -import Anime from 'react-anime'; +import React, {Component} from 'react'; // eslint-disable-line no-unused-vars +import Anime from 'react-anime'; // eslint-disable-line no-unused-vars //tools import ext from '../../utils/ext'; diff --git a/src/scripts/components/userTour/helpers/position-helpers.js b/src/scripts/components/userTour/helpers/position-helpers.js index 6dd6b4f..c2a2a42 100755 --- a/src/scripts/components/userTour/helpers/position-helpers.js +++ b/src/scripts/components/userTour/helpers/position-helpers.js @@ -13,7 +13,7 @@ const positions = { positioned: 'left' }; }, - top: ({position, tourElHeight, arrowSize, margin}) => { + top: ({position}) => { return { left: position.left, top: (position.top + window.pageYOffset), @@ -27,7 +27,7 @@ const positions = { positioned: 'topLeft' }; }, - bottom: ({position, arrowSize, offsetHeight, margin}) => { + bottom: ({position, arrowSize, offsetHeight}) => { return { left: position.left, top: (position.top + window.pageYOffset) + offsetHeight + arrowSize, diff --git a/src/scripts/components/userTour/index.js b/src/scripts/components/userTour/index.js index fe36a99..2456c3d 100755 --- a/src/scripts/components/userTour/index.js +++ b/src/scripts/components/userTour/index.js @@ -1,5 +1,6 @@ //Modified from https://github.com/socialtables/react-user-tour +/*eslint-disable no-unused-vars*/ import React, {Component} from 'react'; import Anime from 'react-anime'; @@ -7,6 +8,7 @@ import Button from '../button'; import positions from './helpers/position-helpers'; import * as viewBoxHelpers from './helpers/viewbox-helpers'; import scrollToPosition from './helpers/scroll-to-position'; +/*eslint-disable no-unused-vars*/ /* Component ==================================================================== */ export default class ReactUserTour extends Component { diff --git a/src/scripts/config/icon.js b/src/scripts/config/icon.js index e7f272a..c880dd9 100644 --- a/src/scripts/config/icon.js +++ b/src/scripts/config/icon.js @@ -4,9 +4,12 @@ import ext from '../utils/ext'; // config import generalConfig from '../config/general'; +import helpers from '../utils/helpers'; //helpers -import {translate} from '../utils/helpers'; +import { + translate +} from '../utils/helpers'; /* Component ==================================================================== */ let iconConfig = (() => { @@ -29,14 +32,16 @@ let iconConfig = (() => { // badgeColor : 'red', title: translate('toolOn'), action: function (tab) { - - if (opendTabNumer === null) - opendTabNumer = tab.id; - - ext.webNavigation.onCompleted.addListener(scrirptListener.bind(this, tab)); - - injectSripts(tab); - console.log('The exention is turned on'); + ///check if the tab is a http of https site when it isn't sutch site do not inject; + if (helpers.isURL(tab.url)) { + if (opendTabNumer === null) { + opendTabNumer = tab.id; + } + + ext.webNavigation.onCompleted.addListener(scrirptListener.bind(this, tab)); + injectSripts(tab); + console.log('The exention is turned on'); + } }, nextState: 'on' } @@ -50,16 +55,16 @@ let iconConfig = (() => { if (tab.id === opendTabNumer) { //insert js; ext.tabs.executeScript(tab.id, { - file: 'scripts/contentscript/index.js', + file: 'scripts/contentscript/index.js' // frameId: tab.id // // "run_at": "document_start", -// "all_frames": true + // "all_frames": true }); //insert css; ext.tabs.insertCSS(tab.id, { - file: 'styles/index.css', + file: 'styles/index.css' // cssOrigin: 'user' }); } else { @@ -79,12 +84,20 @@ let iconConfig = (() => { }); ext.webNavigation.onCompleted.removeListener(scrirptListener); - var removingCSS = ext.tabs.removeCSS(tab.id, { - file: 'styles/index.css' - }); - removingCSS.then(function () { + //check if ext.tabs.removeCSS is supported because Chrome does not support it. + if (ext.tabs.removeCSS) { + + var removingCSS = ext.tabs.removeCSS(tab.id, { + file: 'styles/index.css' + }); + + //when the css is removeed + removingCSS.then(function () { + opendTabNumer = null; + }, onError); + } else { opendTabNumer = null; - }, onError); + } } function onError(error) { diff --git a/src/scripts/config/tourSteps.js b/src/scripts/config/tourSteps.js index cfa8ed3..995f148 100644 --- a/src/scripts/config/tourSteps.js +++ b/src/scripts/config/tourSteps.js @@ -21,7 +21,7 @@ const tourSteps = [{ body: translate('userTourStepTreeBody'), onStart: () => { routerHelper.setStateApp('startIssue'); - }, + } }, { step: 4, selector: '.ln-tickets-on-page--ticket', // a ticket diff --git a/src/scripts/utils/ext.js b/src/scripts/utils/ext.js index 61be5fa..3238074 100755 --- a/src/scripts/utils/ext.js +++ b/src/scripts/utils/ext.js @@ -47,7 +47,9 @@ function Extension() { if (browser[api]) { _this[api] = browser[api]; } - } catch (e) {} + } catch (e) { + + } try { _this.api = browser.extension[api]; } catch (e) {} diff --git a/src/scripts/utils/helpers.js b/src/scripts/utils/helpers.js index f365b97..b9f56bb 100644 --- a/src/scripts/utils/helpers.js +++ b/src/scripts/utils/helpers.js @@ -2,8 +2,7 @@ import ext from './ext'; import generalData from '../config/general'; - -import anime from "animejs"; +import anime from 'animejs'; /* Component ==================================================================== */ const helpers = (() => { @@ -97,12 +96,13 @@ const helpers = (() => { * Generate a UUID */ generateUUID = function () { //egnerate a randmom UUID + const RANDNUMBER = 16; let d = new Date().getTime(); let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - let r = (d + Math.random() * 16) % 16 | 0; - d = Math.floor(d / 16); - return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16); + let r = (d + Math.random() * RANDNUMBER) % RANDNUMBER | 0; + d = Math.floor(d / RANDNUMBER); + return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(RANDNUMBER); }); return uuid; }, @@ -209,6 +209,16 @@ const helpers = (() => { return text; } }, + isURL = function (str) { + var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol + '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|' + // domain name + '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address + '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path + '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string + '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator + + return pattern.test(str); + }, translate = function (message, value) { return ext.i18n.getMessage(message, value); }, @@ -248,6 +258,7 @@ const helpers = (() => { pageHeight, isPrommise, shortText, + isURL, translate, scrollTo }; diff --git a/src/scripts/utils/message.js b/src/scripts/utils/message.js index 944bda6..47f8ebe 100644 --- a/src/scripts/utils/message.js +++ b/src/scripts/utils/message.js @@ -1,4 +1,5 @@ -'use strict' +'use strict'; + import ext from '../utils/ext'; const message = (() => { diff --git a/src/scripts/utils/validate.js b/src/scripts/utils/validate.js index dfd3d14..2c40ca7 100644 --- a/src/scripts/utils/validate.js +++ b/src/scripts/utils/validate.js @@ -15,7 +15,7 @@ const validate = (() => { return re.test(color); }; - var text = function (text) { //validate string for a text + var text = function () { //validate string for a text return true; }; var password = function (password) { //validate string for a password @@ -37,9 +37,9 @@ const validate = (() => { }; return { - text, email, color, + text, password, number, date, diff --git a/src/styles/components/form.scss b/src/styles/components/form.scss index e09a7f5..5d13aa1 100644 --- a/src/styles/components/form.scss +++ b/src/styles/components/form.scss @@ -72,6 +72,9 @@ } select { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; padding: $padding-small 2.4em $padding-small $padding-small; } @@ -237,7 +240,6 @@ font-weight: 900; //fix font wight for some sites } } - //chekcbox label .ln-checkbox { & + label { @@ -279,7 +281,6 @@ } .ln-checkbox+ label::after { - display: none; left: 50%; position: absolute; diff --git a/src/styles/modules/setup.scss b/src/styles/modules/setup.scss index 8bd4e75..22fba78 100644 --- a/src/styles/modules/setup.scss +++ b/src/styles/modules/setup.scss @@ -32,8 +32,7 @@ justify-content: flex-start; max-height: 100vh; max-width: 500px; - overflow-x: hidden; - overflow-y: scroll; + overflow: hidden; pointer-events: all; position: fixed; width: 60vw; diff --git a/src/styles/modules/ticketsOnPage.scss b/src/styles/modules/ticketsOnPage.scss index 19dbcbd..c89e340 100644 --- a/src/styles/modules/ticketsOnPage.scss +++ b/src/styles/modules/ticketsOnPage.scss @@ -63,6 +63,10 @@ transform: translate(-50%, -50%); //position in the center; width: 75px; + span { + pointer-events: none; + } + &.active, &:hover { transform: translate(-50%, -50%) scale(1.2); //the ticket icon scale biggger