-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Self code review #24
Comments
いったんクローズ |
const setupSettingItems = res => {
if (res && res.simple_gesture) {
SimpleGesture.ini = res.simple_gesture;
} ↓ const setupSettingItems = () => { |
b.classList.remove('hide'); |
.title {
background: #f2f2f2;
border-bottom: 2px solid #0099ff;
font-weight: bold;
padding: 1em; ←HERE
} |
let exData = {
customGestureList: []
}; |
const code = `alert('${msg}');`; // TODO: Always e.lieNumber is 0. |
e.message.indexOf('result is non-structured-clonable data') === -1 // Ignore invalid value.
もっとしっかりした切り分けはないのか → Season 2に持ち越し |
options.*
|
const TEXT_FORMS = ['newTabUrl', 'userAgent', 'timeout', 'strokeSize']; |
|
|
|
|
|
トーストつくったらまたソースがヤバイことになってしまった
|
↓
|
|
touchstartとtouchmoveはasyncにしたほうがいいかも? この件別issueにしとこうかな |
|
バージョンの上げ方間違ったわ… |
a.parentNode.removeChild(a); ↓ a.remove(); |
let s = byId('addCommandToScript'); ←
let f = document.createDocumentFragment(); ←
f.appendChild(s.firstChild.cloneNode(true));
for (let i of allByClass('gesture-item')) {
let name = i.id.replace(/_item/, ''); ←
if (name === dlgs.editDlg.targetId) continue;
if (!name) continue;
let o = document.createElement('OPTION'); ←
o.value = name;
o.textContent = byClass(i, 'gesture-caption').textContent;
f.appendChild(o);
} const addCommand = e => {
let name = e.target.value; ←
if (!name) return;
let script = `\nSimpleGesture.doCommand('${name}');\n`;
if (name[0] === CUSTOM_GESTURE_PREFIX) {
let title = findCustomGesture(name).title.replace(/\*/, ' '); ←
script = `/* ${title} */${script}\n`;
} // edit text values --
const saveBindingValues = e => {
clearTimeout(TIMERS.saveBindingValues);
for (let elm of bidingForms) {
let ini = elm.classList.contains('js-binding-exData') ? exData : SimpleGesture.ini; ← for (let elm of bidingForms) {
let ini = elm.classList.contains('js-binding-exData') ? exData : SimpleGesture.ini; ← |
const addCommand = e => {
let name = e.target.value; ←
if (!name) return;
let script = `\nSimpleGesture.doCommand('${name}');\n`;
if (name[0] === CUSTOM_GESTURE_PREFIX) {
let title = findCustomGesture(name).title.replace(/\*/, ' ');
script = `/* ${title} */${script}\n`;
} ↓ const addCommand = e => {
let name = e.target.value; ←
if (!name) return;
let script = `\nSimpleGesture.doCommand('${name}');\n`;
if (name[0] === CUSTOM_GESTURE_PREFIX) {
let title = findCustomGesture(name).title.replace(/\/\*|\*\//g, ' '); ←
script = `\n/* ${title} */${script}\; ←
} |
const findCustomGesture = id => {
return exData.customGestureList.find((e, i, a) => e.id === id);
};
const ifById = id => (typeof id === 'string') ? byId(id): id;
const fadeout = elm => { ifById(elm).classList.add('transparent'); };
const fadein = elm => { ifById(elm).classList.remove('transparent'); }; ↓ const findCustomGesture = id => exData.customGestureList.find((e, i, a) => e.id === id);
const ifById = id => (typeof id === 'string') ? byId(id): id;
const fadeout = elm => ifById(elm).classList.add('transparent');
const fadein = elm => ifById(elm).classList.remove('transparent'); |
|
arg.tab = tab || (await browser.tabs.query({ active: true, currentWindow: true })[0];
// Ignore invalid value ↓ // Ignore the invalid return value.
SimpleGesture.doCommand = (g, o) => ... ↓ SimpleGesture.doCommand = (g, options) => ... |
if (code) {
const remove = () => { browser.tabs.onUpdated.removeListener(f); };
const timer = setTimeout(remove, 5000); // when the tab doesn't complete.
const f = (tabId, changeInfo, tab) => {
if (changeInfo.status !== 'complete' || tabId !== arg.tab.id) return;
clearTimeout(timer);
remove();
exec.executeScript({ tabId: tabId, code: code});
};
browser.tabs.onUpdated.addListener(f); // Firefox for Android doesn't support extraParameter.tabId.
}
browser.tabs.executeScript(arg.tabId, { code: userScript }).then(result => {
result && result[0] && result[0].url && exec.open(result[0]);
}).catch(e => {
if (e.message === 'SimpleGestureExit') return;
if (e.message.indexOf('result is non-structured-clonable data') !== -1) return; // Ignore the invalid return value.
const msg = e.message.replace(/(['\\])/g, '\\$1');
const code = `alert('${msg}');`; // TODO: Always e.lineNumber is 0.
browser.tabs.executeScript({ code: code });
}); |
このIssueはクローズして、残りはSeason 2へ持ち越し |
No description provided.
The text was updated successfully, but these errors were encountered: