Skip to content
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

Closed
utubo opened this issue Dec 28, 2017 · 28 comments
Closed

Self code review #24

utubo opened this issue Dec 28, 2017 · 28 comments

Comments

@utubo
Copy link
Owner

utubo commented Dec 28, 2017

No description provided.

utubo added a commit that referenced this issue Jan 10, 2018
utubo added a commit that referenced this issue Jan 11, 2018
utubo added a commit that referenced this issue Jan 12, 2018
@utubo
Copy link
Owner Author

utubo commented Jan 13, 2018

いったんクローズ

@utubo utubo closed this as completed Jan 13, 2018
@utubo
Copy link
Owner Author

utubo commented Jan 19, 2018

  • options.js L404-L407
const setupSettingItems = res => {
		if (res && res.simple_gesture) {
			SimpleGesture.ini = res.simple_gesture;
		}

const setupSettingItems = () => {

@utubo utubo reopened this Jan 19, 2018
@utubo utubo changed the title ソース整理をする Self code review Jan 19, 2018
utubo added a commit that referenced this issue Jan 19, 2018
@utubo
Copy link
Owner Author

utubo commented Jan 19, 2018

  • options.js L175
    delete this line.
b.classList.remove('hide');

@utubo
Copy link
Owner Author

utubo commented Jan 19, 2018

  • options.css L18
    Title's padding is may be .8em 1em.
.title {
	background: #f2f2f2;
	border-bottom: 2px solid #0099ff;
	font-weight: bold;
	padding: 1em; ←HERE
}

@utubo
Copy link
Owner Author

utubo commented Jan 19, 2018

  • options.js L35-L37
    1行にしちゃおうかな
let exData = {
	customGestureList: []
};

@utubo
Copy link
Owner Author

utubo commented Jan 19, 2018

  • background.js L94
    typo. linNumber -> lineNumber
const code = `alert('${msg}');`; // TODO: Always e.lieNumber is 0.

utubo added a commit that referenced this issue Jan 19, 2018
utubo added a commit that referenced this issue Jan 19, 2018
@utubo
Copy link
Owner Author

utubo commented Jan 20, 2018

  • background.jsのこれベッタベタなのでなんとかしたい…
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に持ち越し

@utubo utubo closed this as completed Jan 20, 2018
@utubo utubo reopened this Jan 22, 2018
@utubo
Copy link
Owner Author

utubo commented Jan 22, 2018

options.*

  • adjustDlg, adjustBox → adjustmentDlg

@utubo utubo closed this as completed Jan 22, 2018
utubo added a commit that referenced this issue Jan 22, 2018
utubo added a commit that referenced this issue Jan 22, 2018
@utubo utubo reopened this Jan 22, 2018
@utubo
Copy link
Owner Author

utubo commented Jan 22, 2018

  • options.js この行document.getElementsByClassName使えば消せる
const TEXT_FORMS = ['newTabUrl', 'userAgent', 'timeout', 'strokeSize'];

@utubo
Copy link
Owner Author

utubo commented Jan 23, 2018

  • やっぱりActionじゃなくてGestureかなぁ

utubo added a commit that referenced this issue Jan 23, 2018
@utubo
Copy link
Owner Author

utubo commented Jan 23, 2018

  • options.js TEXT_FORMS 名前が変だから直したいなぁ何がいいかな
    →適当に直した

@utubo
Copy link
Owner Author

utubo commented Jan 23, 2018

parentByClass getParentByClass かなぁと思ったけどjQueryとかだとparent()なんだよな…

@utubo
Copy link
Owner Author

utubo commented Jan 23, 2018

  • containeritemかなぁ?
  • ページのリンクはAタグでやったほうがいいしそうすればタッチ中の色付けも簡単そう
  • ダイアログがでるitemやボタンはBUTTONタグの方がいいかな?
    →BUTTON使えやってかいあるわ… https://developer.mozilla.org/ja/docs/Web/HTML/Element/a
    →BUTTONにするとCSSの定義が長くなるのでDIVでいいや
    :activeは反応が遅くてダメだった

utubo added a commit that referenced this issue Jan 23, 2018
@utubo
Copy link
Owner Author

utubo commented Jan 25, 2018

  • options.css
    emよりもremの方が良さそう

utubo added a commit that referenced this issue Feb 1, 2018
@utubo
Copy link
Owner Author

utubo commented Feb 17, 2018

トーストつくったらまたソースがヤバイことになってしまった

  • options.js
  • options.css
  • content.js

@utubo
Copy link
Owner Author

utubo commented Feb 17, 2018

  • options.js L.506-514
byId('index').addEventListener...
byId('index').addEventListener...
byId('index').addEventListener...

const index = byId('index);
index.addEventListener...
index.addEventListener...
index.addEventListener...

@utubo
Copy link
Owner Author

utubo commented Feb 17, 2018

  • options.js
    saveTextValuessaveBindingValues
    saveTextValuesDleaysaveBindingValuesDelay

utubo added a commit that referenced this issue Feb 17, 2018
utubo added a commit that referenced this issue Feb 17, 2018
@utubo
Copy link
Owner Author

utubo commented Feb 21, 2018

touchstartとtouchmoveはasyncにしたほうがいいかも?
touchendはpreventDefaultするのでasyncはダメ

結論:このままでOKいいや。
ためしてみた。
https://utb.sakura.ne.jp/samples/touchmove_interval.html
アドオンを無効にしても対して変わらない。
asyncにしたらむしろ重くなったまである

この件別issueにしとこうかな
#39

@utubo
Copy link
Owner Author

utubo commented Mar 26, 2018

  • content.js
    lastInnerWidth が一生「0」!

utubo added a commit that referenced this issue Mar 27, 2018
@utubo
Copy link
Owner Author

utubo commented Mar 31, 2018

バージョンの上げ方間違ったわ…
2.5.5→2.6の間違いだわ…

@utubo
Copy link
Owner Author

utubo commented Apr 17, 2018

  • options.js 2か所くらいあるっぽい
a.parentNode.removeChild(a);

a.remove();

utubo added a commit that referenced this issue Apr 17, 2018
@utubo
Copy link
Owner Author

utubo commented Apr 19, 2018

  • options.js
    letconst
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; 

utubo added a commit that referenced this issue Apr 21, 2018
@utubo
Copy link
Owner Author

utubo commented Apr 21, 2018

  • options.js
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}\; 
}

utubo added a commit that referenced this issue Apr 22, 2018
@utubo
Copy link
Owner Author

utubo commented Apr 26, 2018

  • options.js
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');

@utubo
Copy link
Owner Author

utubo commented Jun 9, 2018

  • トーストのフォントサイズは5vminでよいのでは🤔
    →拡大表示してるとトーストも拡大されちゃうのでNG

utubo added a commit that referenced this issue Jun 10, 2018
@utubo
Copy link
Owner Author

utubo commented Aug 2, 2018

  • background.js の最後
arg.tab = tab || (await browser.tabs.query({ active: true, currentWindow: true })[0];
  • background.jsの コメント
// Ignore invalid value

// Ignore the invalid return value.
  • content.js
SimpleGesture.doCommand = (g, o) => ...

SimpleGesture.doCommand = (g, options) => ...

utubo added a commit that referenced this issue Aug 2, 2018
utubo added a commit that referenced this issue Aug 2, 2018
@utubo
Copy link
Owner Author

utubo commented Dec 3, 2018

  • 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.
}
  • 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 });
});

utubo added a commit that referenced this issue Dec 3, 2018
utubo added a commit that referenced this issue Dec 3, 2018
@utubo
Copy link
Owner Author

utubo commented Mar 11, 2020

このIssueはクローズして、残りはSeason 2へ持ち越し

@utubo utubo closed this as completed Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant