Skip to content

Commit

Permalink
ja: Format /mozilla/add-ons using Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
queengooborg committed Jul 27, 2023
1 parent 1b3474f commit e72c4cf
Show file tree
Hide file tree
Showing 80 changed files with 773 additions and 780 deletions.
3 changes: 0 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ build/
/files/ja/learn/css/**/*.md
/files/ja/learn/javascript/**/*.md
/files/ja/learn/server-side/**/*.md
/files/ja/mozilla/**/*.md
/files/ja/mdn/**/*.md
/files/ja/mozilla/add-ons/**/*.md
/files/ja/mozilla/add-ons/webextensions/api/**/*.md
/files/ja/web/api/**/*.md
/files/ja/web/css/**/*.md
/files/ja/web/html/**/*.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ WebExtension API では、こうしたボタンの種類は "ブラウザーア

```json
{

"description": "Demonstrating toolbar buttons",
"manifest_version": 2,
"name": "button-demo",
Expand All @@ -39,7 +38,6 @@ WebExtension API では、こうしたボタンの種類は "ブラウザーア
"32": "icons/page-32.png"
}
}

}
```

Expand All @@ -59,7 +57,7 @@ These icons are from the [bitsies!](https://www.iconfinder.com/iconsets/bitsies)
```js
function openPage() {
browser.tabs.create({
url: "https://developer.mozilla.org"
url: "https://developer.mozilla.org",
});
}

Expand All @@ -70,7 +68,7 @@ browser.browserAction.onClicked.addListener(openPage);

ここで完全な拡張機能は次のようです:

```html
```plain
button/
icons/
page-16.png
Expand All @@ -89,7 +87,6 @@ button/

```json
{

"description": "Demonstrating toolbar buttons",
"manifest_version": 2,
"name": "button-demo",
Expand All @@ -103,7 +100,6 @@ button/
"32": "icons/page-32.png"
}
}

}
```

Expand All @@ -116,21 +112,20 @@ button/
さてポップアップを作らねばなりません。"popup" というディレクトリーを作成してその中に "choose_page.html" というファイルを作ります。中身は次の通り:

```html
<!DOCTYPE html>
<!doctype html>

<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="choose_page.css"/>
<meta charset="utf-8" />
<link rel="stylesheet" href="choose_page.css" />
</head>

<body>
<div class="page-choice">developer.mozilla.org</div>
<div class="page-choice">support.mozilla.org</div>
<div class="page-choice">addons.mozilla.org</div>
<script src="choose_page.js"></script>
</body>

<body>
<div class="page-choice">developer.mozilla.org</div>
<div class="page-choice">support.mozilla.org</div>
<div class="page-choice">addons.mozilla.org</div>
<script src="choose_page.js"></script>
</body>
</html>
```

Expand All @@ -139,7 +134,8 @@ button/
"popup" ディレクトリーに"choose_page.css" というファイルを作って、次の中身を入れます:

```css
html, body {
html,
body {
width: 300px;
}

Expand All @@ -152,7 +148,7 @@ html, body {
}

.page-choice:hover {
background-color: #CFF2F2;
background-color: #cff2f2;
}
```

Expand All @@ -161,16 +157,15 @@ html, body {
次に、"popup" ディレクトリーに"choose_page.js" ファイルを作成し、次の中身を入れます:

```js
document.addEventListener("click", function(e) {
document.addEventListener("click", function (e) {
if (!e.target.classList.contains("page-choice")) {
return;
}

var chosenPage = "https://" + e.target.textContent;
browser.tabs.create({
url: chosenPage
url: chosenPage,
});

});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ slug: Mozilla/Add-ons/WebExtensions/API/alarms/create

```js
browser.alarms.create(
name, // 文字列
alarmInfo // オブジェクト
)
name, // 文字列
alarmInfo, // オブジェクト
);
```

### 引数
Expand Down Expand Up @@ -49,7 +49,7 @@ browser.alarms.create(
const delayInMinutes = 5;

chrome.alarms.create({
delayInMinutes
delayInMinutes,
});
```

Expand All @@ -61,7 +61,7 @@ const periodInMinutes = 2;

chrome.alarms.create("my-periodic-alarm", {
delayInMinutes,
periodInMinutes
periodInMinutes,
});
```

Expand All @@ -73,7 +73,7 @@ const periodInMinutes = 2;

chrome.alarms.create("my-periodic-alarm", {
when,
periodInMinutes
periodInMinutes,
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/create
```js
browser.bookmarks.create(
bookmark, // CreateDetails
callback // 関数(省略可)
)
callback, // 関数(省略可)
);
```

### 引数
Expand All @@ -40,10 +40,13 @@ function onBookmarkAdded(bookmarkItem) {
console.log("Bookmark added with ID: " + bookmarkItem.id);
}

chrome.bookmarks.create({
title: "bookmarks.create() on MDN",
url: "https://developer.mozilla.org/Add-ons/WebExtensions/API/bookmarks/create"
}, onBookmarkAdded);
chrome.bookmarks.create(
{
title: "bookmarks.create() on MDN",
url: "https://developer.mozilla.org/Add-ons/WebExtensions/API/bookmarks/create",
},
onBookmarkAdded,
);
```

{{WebExtExamples}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/get
```js
browser.bookmarks.get(
idOrIdList, // 文字列または文字列の配列
callback // 関数
)
callback, // 関数
);
```

### 引数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/getChildren

```js
browser.bookmarks.getChildren(
id, // 文字列
callback // 関数
)
id, // 文字列
callback, // 関数
);
```

### Parameters
Expand Down Expand Up @@ -49,8 +49,8 @@ chrome.bookmarks.getChildren(bookmarkItemId, gotChildren);

```js
function toggleBookmark(folderNode, title, url) {
chrome.bookmarks.getChildren(folderNode.id, function(results) {
let node = results.find(function(el) {
chrome.bookmarks.getChildren(folderNode.id, function (results) {
let node = results.find(function (el) {
return el.title === title;
});

Expand All @@ -63,7 +63,7 @@ function toggleBookmark(folderNode, title, url) {
chrome.bookmarks.create({
parentId: folderNode.id,
title: title,
url: url
url: url,
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/getRecent
```js
browser.bookmarks.getRecent(
numberOfItems, // 整数
callback // 関数
)
callback, // 関数
);
```

### 引数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/getSubTree

```js
browser.bookmarks.getSubTree(
id, // 文字列
callback // 関数
)
id, // 文字列
callback, // 関数
);
```

### 引数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/getTree

```js
browser.bookmarks.getTree(
callback // 関数
)
callback, // 関数
);
```

### 引数
Expand Down
17 changes: 10 additions & 7 deletions files/ja/mozilla/add-ons/webextensions/api/bookmarks/move/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/move

```js
browser.bookmarks.move(
id, // 文字列
id, // 文字列
destination, // オブジェクト
callback // 関数(省略可)
)
callback, // 関数(省略可)
);
```

### 引数
Expand Down Expand Up @@ -57,10 +57,13 @@ browser.bookmarks.move(bookmarkID, { index: 0 });

```js
function moveToFolder(bookmarkId, destinationId) {
browser.bookmarks.move(bookmarkId, { parentId: destinationId },
function(updatedNode) {
/* ブックマークの移動後に行う処理 */
});
browser.bookmarks.move(
bookmarkId,
{ parentId: destinationId },
function (updatedNode) {
/* ブックマークの移動後に行う処理 */
},
);
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/remove

```js
browser.bookmarks.remove(
id, // 文字列
callback // 関数(省略可)
)
id, // 文字列
callback, // 関数(省略可)
);
```

### 引数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/removeTree

```js
browser.bookmarks.removeTree(
id, // 文字列
callback // 関数(省略可)
)
id, // 文字列
callback, // 関数(省略可)
);
```

### 引数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/search

```js
browser.bookmarks.search(
query, // 文字列またはオブジェクト
callback // 関数
)
query, // 文字列またはオブジェクト
callback, // 関数
);
```

### 引数
Expand Down Expand Up @@ -76,7 +76,7 @@ function onGot(bookmarkItems) {
}

function checkActiveTab(tab) {
chrome.bookmarks.search({url: tab.url}, onGot);
chrome.bookmarks.search({ url: tab.url }, onGot);
}

chrome.browserAction.onClicked.addListener(checkActiveTab);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ slug: Mozilla/Add-ons/WebExtensions/API/bookmarks/update

```js
browser.bookmarks.update(
id, // 文字列
id, // 文字列
changes, // オブジェクト
callback // 関数(省略可)
)
callback, // 関数(省略可)
);
```

### 引数
Expand Down Expand Up @@ -55,7 +55,7 @@ function updateFolders(items) {
// only folders, so skip items with a `url`
if (!item.url) {
chrome.bookmarks.update(item.id, {
title: "Mozilla Developer Network (MDN)"
title: "Mozilla Developer Network (MDN)",
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ slug: Mozilla/Add-ons/WebExtensions/API/browserAction/disable

```js
browser.browserAction.disable(
tabId // optional integer
)
tabId, // optional integer
);
```

### パラメータ
Expand Down
Loading

0 comments on commit e72c4cf

Please sign in to comment.