Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dance2die committed Feb 10, 2019
0 parents commit 718a6db
Show file tree
Hide file tree
Showing 15 changed files with 325 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
66 changes: 66 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"l10nTabName": {
"message":"Localization"
,"description":"name of the localization tab"
}
,"l10nHeader": {
"message":"It does localization too! (this whole tab is, actually)"
,"description":"Header text for the localization section"
}
,"l10nIntro": {
"message":"'L10n' refers to 'Localization' - 'L' an 'n' are obvious, and 10 comes from the number of letters between those two. It is the process/whatever of displaying something in the language of choice. It uses 'I18n', 'Internationalization', which refers to the tools / framework supporting L10n. I.e., something is internationalized if it has I18n support, and can be localized. Something is localized for you if it is in your language / dialect."
,"description":"introduce the basic idea."
}
,"l10nProd": {
"message":"You <strong>are</strong> planning to allow localization, right? You have <em>no idea</em> who will be using your extension! You have no idea who will be translating it! At least support the basics, it's not hard, and having the framework in place will let you transition much more easily later on."
,"description":"drive the point home. It's good for you."
}
,"l10nFirstParagraph": {
"message":"When the options page loads, elements decorated with <strong>data-l10n</strong> will automatically be localized!"
,"description":"inform that <el data-l10n='' /> elements will be localized on load"
}
,"l10nSecondParagraph": {
"message":"If you need more complex localization, you can also define <strong>data-l10n-args</strong>. This should contain <span class='code'>$containerType$</span> filled with <span class='code'>$dataType$</span>, which will be passed into Chrome's i18n API as <span class='code'>$functionArgs$</span>. In fact, this paragraph does just that, and wraps the args in mono-space font. Easy!"
,"description":"introduce the data-l10n-args attribute. End on a lame note."
,"placeholders": {
"containerType": {
"content":"$1"
,"example":"'array', 'list', or something similar"
,"description":"type of the args container"
}
,"dataType": {
"content":"$2"
,"example":"string"
,"description":"type of data in each array index"
}
,"functionArgs": {
"content":"$3"
,"example":"arguments"
,"description":"whatever you call what you pass into a function/method. args, params, etc."
}
}
}
,"l10nThirdParagraph": {
"message":"Message contents are passed right into innerHTML without processing - include any tags (or even scripts) that you feel like. If you have an input field, the placeholder will be set instead, and buttons will have the value attribute set."
,"description":"inform that we handle placeholders, buttons, and direct HTML input"
}
,"l10nButtonsBefore": {
"message":"Different types of buttons are handled as well. &lt;button&gt; elements have their html set:"
}
,"l10nButton": {
"message":"in a <strong>button</strong>"
}
,"l10nButtonsBetween": {
"message":"while &lt;input type='submit'&gt; and &lt;input type='button'&gt; get their 'value' set (note: no HTML):"
}
,"l10nSubmit": {
"message":"a <strong>submit</strong> value"
}
,"l10nButtonsAfter": {
"message":"Awesome, no?"
}
,"l10nExtras": {
"message":"You can even set <span class='code'>data-l10n</span> on things like the &lt;title&gt; tag, which lets you have translatable page titles, or fieldset &lt;legend&gt; tags, or anywhere else - the default <span class='code'>Boil.localize()</span> behavior will check every tag in the document, not just the body."
,"description":"inform about places which may not be obvious, like <title>, etc"
}
}
Binary file added icons/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "Easy GitHub",
"version": "0.0.1",
"manifest_version": 2,
"description": "Working with GitHub easy",
"homepage_url": "https://sungkim.co",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"default_locale": "en",
"background": {
"page": "src/bg/background.html",
"persistent": false
},
"options_page": "src/options/options.html",
"page_action": {
"default_icon": "icons/icon19.png",
"default_title": "Easy GitHub Title",
"default_popup": "src/page_action/page_action.html"
},
"permissions": [
"https://github.com/*",
"storage",
"declarativeContent",
"activeTab",
"tabs",
"clipboardWrite"
]
}
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "easy-github",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Binary file added src/.DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions src/bg/background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="background.js"></script>
</head>
</html>
42 changes: 42 additions & 0 deletions src/bg/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// if you checked "fancy-settings" in extensionizr.com, uncomment this lines

// var settings = new Store("settings", {
// "sample_setting": "This is how you use Store.js to remember values"
// });

// //example of using a message handler from the inject scripts
// chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
// console.log(`request, sender, sendResponse`);
// chrome.pageAction.show(sender.tab.id);
// sendResponse();
// });

// https://developer.chrome.com/extensions/getstarted
chrome.runtime.onInstalled.addListener(function() {
// chrome.tabs.query({ active: true, lastFocusedWindow: true }, function(tabs) {
// var url = tabs[0].url;
// console.log(`tabs`, tabs);
// });
// chrome.tabs.query(
// { active: true, windowId: chrome.windows.WINDOW_ID_CURRENT },
// function(tabs) {
// console.log(`tabs`, tabs);
// }
// );
// chrome.storage.sync.set({ color: "#3aa757" }, function() {
// console.log("The color is green.");
// });

chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([
{
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: { hostEquals: "github.com" }
})
],
actions: [new chrome.declarativeContent.ShowPageAction()]
}
]);
});
});
20 changes: 20 additions & 0 deletions src/options/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<style>
button {
height: 30px;
width: 30px;
outline: none;
margin: 10px;
}
</style>
</head>
<body>
<div id="buttonDiv"></div>
<div>
<p>Choose a different background color!</p>
</div>
</body>
<script src="options.js"></script>
</html>
19 changes: 19 additions & 0 deletions src/options/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let page = document.getElementById("buttonDiv");
const kButtonColors = ["#3aa757", "#e8453c", "#f9bb2d", "#4688f1"];

function constructOptions(buttonColors) {
for (let item of buttonColors) {
let button = document.createElement("button");
button.style.backgroundColor = item;

button.addEventListener("click", function() {
chrome.storage.sync.set({ color: item }, function() {
console.log("color is " + item);
});
});

page.appendChild(button);
}
}

constructOptions(kButtonColors);
29 changes: 29 additions & 0 deletions src/page_action/page_action.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<style>
button {
height: 30px;
width: 30px;
outline: none;
}

pre {
margin: 1rem;
padding: 1rem 2rem 1rem 0;
border: 1px solid rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<pre>
<code>
git remote add upstream <span id="url" />
git fetch upstream
git branch --set-upstream-to=upstream/master master
</code>
</pre>

<script src="popup.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions src/page_action/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// let changeColor = document.getElementById("changeColor");

// chrome.storage.sync.get("color", function(data) {
// changeColor.style.backgroundColor = data.color;
// changeColor.setAttribute("value", data.color);
// });

// changeColor.onclick = function(element) {
// let color = element.target.value;
// chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
// chrome.tabs.executeScript(tabs[0].id, {
// code: `document.body.style.backgroundColor = "${color}";`
// });
// });
// };

// chrome.tabs.query({ active: true, lastFocusedWindow: true }, function(tabs) {
// var url = tabs[0].url;
// console.log(`url`, url);
// });

0 comments on commit 718a6db

Please sign in to comment.