diff --git a/zanglenotify/_locales/en/messages.json b/zanglenotify/_locales/en/messages.json new file mode 100644 index 0000000..a1b9cd0 --- /dev/null +++ b/zanglenotify/_locales/en/messages.json @@ -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 are planning to allow localization, right? You have no idea 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 data-l10n will automatically be localized!" + ,"description":"inform that elements will be localized on load" + } + ,"l10nSecondParagraph": { + "message":"If you need more complex localization, you can also define data-l10n-args. This should contain $containerType$ filled with $dataType$, which will be passed into Chrome's i18n API as $functionArgs$. 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. <button> elements have their html set:" + } + ,"l10nButton": { + "message":"in a button" + } + ,"l10nButtonsBetween": { + "message":"while <input type='submit'> and <input type='button'> get their 'value' set (note: no HTML):" + } + ,"l10nSubmit": { + "message":"a submit value" + } + ,"l10nButtonsAfter": { + "message":"Awesome, no?" + } + ,"l10nExtras": { + "message":"You can even set data-l10n on things like the <title> tag, which lets you have translatable page titles, or fieldset <legend> tags, or anywhere else - the default Boil.localize() behavior will check every tag in the document, not just the body." + ,"description":"inform about places which may not be obvious, like , etc" + } +} diff --git a/zanglenotify/css/index.css b/zanglenotify/css/index.css new file mode 100644 index 0000000..ec3d853 --- /dev/null +++ b/zanglenotify/css/index.css @@ -0,0 +1,4 @@ +#container { + width: 100%; + margin: 0; +} \ No newline at end of file diff --git a/zanglenotify/icons/icon128.png b/zanglenotify/icons/icon128.png new file mode 100644 index 0000000..79b452b Binary files /dev/null and b/zanglenotify/icons/icon128.png differ diff --git a/zanglenotify/icons/icon16.png b/zanglenotify/icons/icon16.png new file mode 100644 index 0000000..6664ee4 Binary files /dev/null and b/zanglenotify/icons/icon16.png differ diff --git a/zanglenotify/icons/icon19.png b/zanglenotify/icons/icon19.png new file mode 100644 index 0000000..68aa4be Binary files /dev/null and b/zanglenotify/icons/icon19.png differ diff --git a/zanglenotify/icons/icon48.png b/zanglenotify/icons/icon48.png new file mode 100644 index 0000000..4a016d7 Binary files /dev/null and b/zanglenotify/icons/icon48.png differ diff --git a/zanglenotify/js/index.js b/zanglenotify/js/index.js new file mode 100644 index 0000000..ebf4d47 --- /dev/null +++ b/zanglenotify/js/index.js @@ -0,0 +1,71 @@ +var assignments; + +document.getElementById("button").onclick = function() { + var container = document.getElementById("container"); + assignments = getData(); + assignments = processData(assignments); +} + +function processData(data) { + var el = document.createElement("html"); + el.innerHTML = data.replace(/(src|href)="[^"]*"/gmi, "");; + var organized = []; + var classes = el.getElementsByClassName("displaytbl"); + for(var i = 0; i < classes.length; i++) { + var eachClass = {}; + var teacher = classes[i].children[0].children[0].children[1].childNodes[2].nodeValue.replace(/\s/g,"").split(","); + var grade = classes[i].children[0].children[1].children[0].childNodes[2].nodeValue.replace(/\s/g,""); + + eachClass["name"] = classes[i].children[0].children[0].children[0].children[1].innerText.match(/[a-z].*(?= \()/gi)[0]; + eachClass["teacher"] = [teacher[1], teacher[0]]; + eachClass["grade"] = grade.replace(/\(.+\)/g, ""); + eachClass["percent"] = parseFloat(grade.match(/[0-9][^%\)]*/g)) || "Unknown"; + + var works = classes[i].children[1].children; + var orgWork = []; + for(var j = 0; j < works.length; j++) { + var eachWork = {}; + var tabLen = works[j].children.length; + + eachWork["date"] = new Date(works[j].children[1].innerText); + eachWork["workName"] = works[j].children[3].innerText; + eachWork["totalPoints"] = parseFloat(works[j].children[4].innerText); + eachWork["earnedPoints"] = parseFloat(works[j].children[5].innerText); + if(works[j].children.length === 10) { + eachWork["percent"] = Math.round(1000*eachWork["earnedPoints"]/eachWork["totalPoints"])/10; + } else { + eachWork["percent"] = parseFloat(works[j].children[6].innerText.replace("%","")); + } + eachWork["scoreComments"] = works[j].children[tabLen-4].innerText; + eachWork["extraCredit"] = works[j].children[tabLen-3].innerText; + eachWork["notGraded"] = works[j].children[tabLen-2].innerText; + eachWork["comments"] = works[j].children[tabLen-1].innerText; + orgWork.push(eachWork); + } + eachClass["work"] = orgWork; + organized.push(eachClass); + } + return organized; +} + +function getData() { + var username = document.getElementById("username").value; + var password = document.getElementById("password").value; + if(username === "" || password === "") { + alert("Please fill out all forms!"); + return; + } + + var xhr = new XMLHttpRequest(); + var data; + var send = "Pin=" + username + "&Password=" + password; + xhr.open("POST", "http://68.41.125.11:5000/ZangleAccess/index.php", false); + xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xhr.onreadystatechange = function() { + if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { + data = xhr.responseText; + } + } + xhr.send(send); + return data; +} \ No newline at end of file diff --git a/zanglenotify/manifest.json b/zanglenotify/manifest.json new file mode 100644 index 0000000..a6254ab --- /dev/null +++ b/zanglenotify/manifest.json @@ -0,0 +1,27 @@ +{ + "name": "CHANGE THIS : Extension boilerplate", + "version": "0.0.1", + "manifest_version": 2, + "description": "This extension was created with the awesome extensionizr.com", + "homepage_url": "http://extensionizr.com", + "icons": { + "16": "icons/icon16.png", + "48": "icons/icon48.png", + "128": "icons/icon128.png" + }, + "default_locale": "en", + "background": { + "page": "src/bg/background.html", + "persistent": true + }, + "browser_action": { + "default_icon": "icons/icon19.png", + "default_title": "browser action demo", + "default_popup": "src/browser_action/browser_action.html" + }, + "permissions": [ + "clipboardWrite", + "notifications", + "*" + ] +} \ No newline at end of file diff --git a/zanglenotify/src/.DS_Store b/zanglenotify/src/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/zanglenotify/src/.DS_Store differ diff --git a/zanglenotify/src/bg/background.html b/zanglenotify/src/bg/background.html new file mode 100644 index 0000000..1ce1e93 --- /dev/null +++ b/zanglenotify/src/bg/background.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> +<head> + <script type="text/javascript" src="background.js"></script> +</head> +</html> \ No newline at end of file diff --git a/zanglenotify/src/bg/background.js b/zanglenotify/src/bg/background.js new file mode 100644 index 0000000..ce91965 --- /dev/null +++ b/zanglenotify/src/bg/background.js @@ -0,0 +1,6 @@ +//example of using a message handler from the inject scripts +chrome.extension.onMessage.addListener( + function(request, sender, sendResponse) { + chrome.pageAction.show(sender.tab.id); + sendResponse(); + }); \ No newline at end of file diff --git a/zanglenotify/src/browser_action/browser_action.html b/zanglenotify/src/browser_action/browser_action.html new file mode 100644 index 0000000..32612cc --- /dev/null +++ b/zanglenotify/src/browser_action/browser_action.html @@ -0,0 +1,11 @@ +<html> + <head> + <link rel="stylesheet" href="./index.css"> + </head> + <input id="username"> + <input id="password"> + <button id="button">Submit</button> + <div id="container"> + </div> + <script src="js/index.js"></script> +</html> \ No newline at end of file