Closed utubo closed 4 years ago
const setupSettingItems = res => {
if (res && res.simple_gesture) {
SimpleGesture.ini = res.simple_gesture;
}
↓
const setupSettingItems = () => {
b.classList.remove('hide');
.8em 1em
.
.title {
background: #f2f2f2;
border-bottom: 2px solid #0099ff;
font-weight: bold;
padding: 1em; ←HERE
}
let exData = {
customGestureList: []
};
linNumber
-> lineNumber
const code = `alert('${msg}');`; // TODO: Always e.lieNumber is 0.
e.message.indexOf('result is non-structured-clonable data') === -1 // Ignore invalid value.
e.fileName: resource://gre/modules/ExtensionContent.jsm →alertしたい例外(syntax errorもこっち)
e.fileName: <anonymous code> →問題の例外(他にもこっちになるのがあるかも?)
もっとしっかりした切り分けはないのか
→ Season 2に持ち越し
options.*
adjustDlg
, adjustBox
→ adjustmentDlg
const TEXT_FORMS = ['newTabUrl', 'userAgent', 'timeout', 'strokeSize'];
TEXT_FORMS
名前が変だから直したいなぁ何がいいかな
→適当に直したparentByClass
→ getParentByClass
かなぁと思ったけどjQueryとかだとparent()
なんだよな…
container
→item
かなぁ?:active
は反応が遅くてダメだったem
よりもrem
の方が良さそうトーストつくったらまたソースがヤバイことになってしまった
byId('index').addEventListener...
byId('index').addEventListener...
byId('index').addEventListener...
↓
const index = byId('index);
index.addEventListener...
index.addEventListener...
index.addEventListener...
saveTextValues
→ saveBindingValues
saveTextValuesDleay
→ saveBindingValuesDelay
touchstartとtouchmoveはasyncにしたほうがいいかも? touchendはpreventDefaultするのでasyncはダメ ↓ 結論:このままでOKいいや。 ためしてみた。 https://utb.sakura.ne.jp/samples/touchmove_interval.html アドオンを無効にしても対して変わらない。 asyncにしたらむしろ重くなったまである
この件別issueにしとこうかな → #39
lastInnerWidth
が一生「0」!バージョンの上げ方間違ったわ… 2.5.5→2.6の間違いだわ…
a.parentNode.removeChild(a);
↓
a.remove();
let
→const
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'); };
↓
```javascript
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');
[x] background.js の最後
arg.tab = tab || (await browser.tabs.query({ active: true, currentWindow: true })[0];
[x] background.jsの コメント
// Ignore invalid value
↓
// Ignore the invalid return value.
[x] content.js
SimpleGesture.doCommand = (g, o) => ...
↓
SimpleGesture.doCommand = (g, options) => ...
[x] exec.open
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.
}
[x] exec.executeScript
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へ持ち越し
いったんクローズ