Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2f1ccfc

Browse files
🎉 Initial commit
0 parents commit 2f1ccfc

File tree

91 files changed

+1896
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1896
-0
lines changed

‎README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# ![extension icon](./extension/icon48.png) Snippet Library
2+
3+
A chrome extension with useful JavaScript snippets to aid software development and testing.
4+
5+
## Installation
6+
7+
- Download and extract this repository somewhere
8+
- Navigate to `chrome://extensions` within chrome
9+
- Ensure to switch 'Developer mode' on (a toggle at the top right of the page)
10+
- Select 'Load unpacked' and then navigate to the `/extension` folder
11+
- Navigate to a website and then right click it to access the `Snippet Library` context menu
12+
- After executing a snippet you can the code as a bookmarklet by viewing the DevTools console
13+
14+
## Current Snippets
15+
Below is a list of snippets currently available with this extension.
16+
17+
### Help
18+
19+
* About
20+
21+
### Events
22+
23+
* Log Segment Events
24+
25+
### Exploits
26+
27+
* SQL Injection
28+
* XSS Injection
29+
30+
### TBC
31+
32+
* TBC

‎extension/icon128.png

14.4 KB
Loading[フレーム]

‎extension/icon16.png

718 Bytes
Loading[フレーム]

‎extension/icon48.png

15 KB
Loading[フレーム]

‎extension/js/background.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
const contextMenus = {}
3+
4+
function findMenuRefItem(theMenuArray, theMenuRef) {
5+
for (let menuindex = 0; menuindex < theMenuArray.length; menuindex++) {
6+
if (theMenuArray[menuindex].menuref === theMenuRef) {
7+
return theMenuArray[menuindex].id
8+
}
9+
}
10+
}
11+
12+
for (let actionindex = 0; actionindex < menuActions.length; actionindex++) {
13+
if (menuActions[actionindex].menu === "") {
14+
menuActions[actionindex].id = chrome.contextMenus.create({ "title": menuActions[actionindex].title, "type": "normal", contexts: ["all"] })
15+
} else {
16+
const parentId = findMenuRefItem(menuActions, menuActions[actionindex].menu)
17+
menuActions[actionindex].id = chrome.contextMenus.create({ "title": menuActions[actionindex].title, "type": "normal", contexts: ["all"], "parentId": parentId })
18+
}
19+
}
20+
21+
chrome.contextMenus.onClicked.addListener(contextMenuClickHandler)
22+
23+
function contextMenuClickHandler(info, tab) {
24+
25+
let actionToDo
26+
27+
for (let actionindex = 0; actionindex < menuActions.length; actionindex++) {
28+
if (menuActions[actionindex].id === info.menuItemId) {
29+
actionToDo = menuActions[actionindex]
30+
break
31+
}
32+
}
33+
34+
if (!actionToDo) {
35+
return
36+
}
37+
38+
if (actionToDo.file === "") {
39+
return
40+
}
41+
42+
const errorHandler = function () {
43+
if (chrome.runtime.lastError) {
44+
console.error(chrome.runtime.lastError.message)
45+
}
46+
}
47+
48+
function sendFileContentsAsMessage(filecontents) {
49+
chrome.tabs.sendMessage(tab.id, { type: "display", messageContents: "Script to Run:\n" })
50+
chrome.tabs.sendMessage(tab.id, { type: "display", messageContents: filecontents })
51+
}
52+
53+
function sendFileContentsAsBookmarklet(filecontents) {
54+
const bookmarklet = "javascript:(function(){" + encodeURI(filecontents) + "})()"
55+
chrome.tabs.sendMessage(tab.id, { type: "display", messageContents: "As Bookmarklet:\n" })
56+
chrome.tabs.sendMessage(tab.id, { type: "display", messageContents: bookmarklet })
57+
}
58+
59+
if (actionToDo.instant) {
60+
chrome.tabs.executeScript(null, { file: actionToDo.file }, errorHandler)
61+
} else {
62+
chrome.tabs.executeScript(tab.id, { file: 'js/contentscript.js' }, function () {
63+
chrome.tabs.sendMessage(tab.id, { type: "execfile", filename: actionToDo.file })
64+
})
65+
}
66+
67+
getFileContents(actionToDo.file, errorHandler, sendFileContentsAsMessage)
68+
getFileContents(actionToDo.file, errorHandler, sendFileContentsAsBookmarklet)
69+
70+
function getFileContents(filename, errorHandler, callback) {
71+
chrome.runtime.getPackageDirectoryEntry(function (root) {
72+
root.getFile(filename, {}, function (fileEntry) {
73+
fileEntry.file(function (file) {
74+
const reader = new FileReader()
75+
reader.onloadend = function (e) {
76+
callback(this.result)
77+
}
78+
reader.readAsText(file)
79+
}, errorHandler)
80+
}, errorHandler)
81+
})
82+
}
83+
}

‎extension/js/contentscript.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
if (window.haveInstalledBotListener !== true) {
2+
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
3+
if (message.type === "execfile") {
4+
const script = document.createElement('script');
5+
script.type = 'text/javascript';
6+
script.src = chrome.extension.getURL(message.filename);
7+
document.getElementsByTagName('head')[0].appendChild(script);
8+
}
9+
if (message.type === "display") {
10+
console.log(message.messageContents)
11+
}
12+
});
13+
window.haveInstalledBotListener = true;
14+
}

‎extension/js/menu.js

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
const menuActions = [
2+
{ menu: "", "title": "Snippet Library", menuref: "W", file: "" },
3+
4+
5+
{ menu: "W", "title": "Help", menuref: "W>H", file: "" },
6+
{ menu: "W>H", "title": "About", file: "js/web/help/about.js", instant: false },
7+
8+
9+
{ menu: "W", "title": "Exploits", menuref: "W>E", file: "" },
10+
{ menu: "W>E", "title": "XSS Injection", file: "js/web/exploits/xss.js", instant: false },
11+
{ menu: "W>E", "title": "SQL Injection", file: "js/web/exploits/sql.js", instant: false },
12+
13+
14+
{ menu: "W", "title": "Accessibility", menuref: "W>A", file: "" },
15+
{ menu: "W>A", "title": "Enable right click", file: "js/web/accessibility/enableRightClick.js", instant: false },
16+
{ menu: "W>A", "title": "Enable text selection", file: "js/web/accessibility/enableTextSelection.js", instant: false },
17+
{ menu: "W>A", "title": "Highlight elements with the same id", file: "js/web/accessibility/highlightElementsWithTheSameId.js", instant: false },
18+
{ menu: "W>A", "title": "Highlight images with alt tags", file: "js/web/accessibility/highlightImagesWithAltTags.js", instant: false },
19+
{ menu: "W>A", "title": "Highlight images without alt tags", file: "js/web/accessibility/highlightImagesWithoutAltTags.js", instant: false },
20+
{ menu: "W>A", "title": "Highlight inputs without labels", file: "js/web/accessibility/highlightImagesWithoutLabels.js", instant: false },
21+
{ menu: "W>A", "title": "Increase all elements text", file: "js/web/accessibility/increaseAllElementsText.js", instant: false },
22+
{ menu: "W>A", "title": "Increase all buttons text", file: "js/web/accessibility/increaseButtonsText.js", instant: false },
23+
{ menu: "W>A", "title": "Increase all labels text", file: "js/web/accessibility/increaseLabelsText.js", instant: false },
24+
{ menu: "W>A", "title": "Increase all links text", file: "js/web/accessibility/increaseLinksText.js", instant: false },
25+
{ menu: "W>A", "title": "Increase page text", file: "js/web/accessibility/increasePagesText.js", instant: false },
26+
{ menu: "W>A", "title": "List images and alt tags", file: "js/web/accessibility/listImagesAndAltTags.js", instant: false },
27+
{ menu: "W>A", "title": "Make text CAPS", file: "js/web/accessibility/makeTextCapitlise.js", instant: false },
28+
{ menu: "W>A", "title": "Make text lowercase", file: "js/web/accessibility/makeTextLowercase.js", instant: false },
29+
{ menu: "W>A", "title": "Make text uppercase", file: "js/web/accessibility/makeTextUppercase.js", instant: false },
30+
{ menu: "W>A", "title": "Print form controls", file: "js/web/accessibility/printFormControls.js", instant: false },
31+
{ menu: "W>A", "title": "Remove elements with the same id", file: "js/web/accessibility/removeElementWithTheSameId.js", instant: false },
32+
{ menu: "W>A", "title": "Remove images without alt tags", file: "js/web/accessibility/removeImagesWithoutAltTags.js", instant: false },
33+
{ menu: "W>A", "title": "Remove inputs without labels", file: "js/web/accessibility/removeInputsWithoutLabel.js", instant: false },
34+
{ menu: "W>A", "title": "Remove max length", file: "js/web/accessibility/removeMaxLength.js", instant: false },
35+
{ menu: "W>A", "title": "Remove paste restrictions", file: "js/web/accessibility/removePasteRestrictions.js", instant: false },
36+
{ menu: "W>A", "title": "Remove required", file: "js/web/accessibility/removeRequired.js", instant: false },
37+
{ menu: "W>A", "title": "Visualise tab flow", file: "js/web/accessibility/visualiseTabFlow.js", instant: false },
38+
39+
40+
{ menu: "W", "title": "Convert", menuref: "W>C", file: "" },
41+
{ menu: "W>C", "title": "Decode base64 to console", file: "js/web/convert/decodeBase64ToConsole.js", instant: false },
42+
{ menu: "W>C", "title": "Encode base64 to console", file: "js/web/convert/encodeBase64ToConsole.js", instant: false },
43+
{ menu: "W>C", "title": "Pretty print JSON to console", file: "js/web/convert/prettryPrintJsonToConsole.js", instant: false },
44+
{ menu: "W>C", "title": "ROT13", file: "js/web/convert/ROT13.js", instant: false },
45+
46+
47+
{ menu: "W", "title": "DOM", menuref: "W>D", file: "" },
48+
{ menu: "W>D", "title": "Add number column to table", file: "js/web/dom/addNumberColumnToTable.js", instant: false },
49+
{ menu: "W>D", "title": "Console save", file: "js/web/dom/consoleSave.js", instant: false },
50+
{ menu: "W>D", "title": "Convert images to data url", file: "js/web/dom/convertAllImagesToDataUrl.js", instant: false },
51+
{ menu: "W>D", "title": "Convert input types to text", file: "js/web/dom/convertAllInputTypesToText.js", instant: false },
52+
{ menu: "W>D", "title": "Convert bullet points to numbers", file: "js/web/dom/convertBulletpointsToNumbers.js", instant: false },
53+
{ menu: "W>D", "title": "Document design mode off", file: "js/web/dom/documentDesignModeOff.js", instant: false },
54+
{ menu: "W>D", "title": "Document design mode on", file: "js/web/dom/documentDesignModeOn.js", instant: false },
55+
{ menu: "W>D", "title": "Find all colours", file: "js/web/dom/findAllColours.js", instant: false },
56+
{ menu: "W>D", "title": "For every element do this", file: "js/web/dom/forEveryElementDoThis.js", instant: false },
57+
{ menu: "W>D", "title": "Highligh internal and external links", file: "js/web/dom/internalExternalLinks.js", instant: false },
58+
{ menu: "W>D", "title": "Overlay images", file: "js/web/dom/overlayImages.js", instant: false },
59+
{ menu: "W>D", "title": "Preview images", file: "js/web/dom/previewImages.js", instant: false },
60+
{ menu: "W>D", "title": "Remove all images", file: "js/web/dom/removeAllImages.js", instant: false },
61+
{ menu: "W>D", "title": "Show url link text", file: "js/web/dom/showUrlLinkText.js", instant: false },
62+
{ menu: "W>D", "title": "Sort tables", file: "js/web/dom/sortTable.js", instant: false },
63+
{ menu: "W>D", "title": "Transpose tables", file: "js/web/dom/transposeTables.js", instant: false },
64+
{ menu: "W>D", "title": "Wrap element", file: "js/web/dom/wrapElement.js", instant: false },
65+
66+
67+
{ menu: "W", "title": "GitHub", menuref: "W>G", file: "" },
68+
{ menu: "W>G", "title": "Mark files as viewed", file: "js/web/github/markFilesAsViewed.js", instant: false },
69+
{ menu: "W>G", "title": "Mark files as not viewed", file: "js/web/github/markFilesAsNotViewed.js", instant: false },
70+
71+
72+
{ menu: "W", "title": "Libraries", menuref: "W>L", file: "" },
73+
{ menu: "W>L", "title": "Enable JQuery", file: "js/web/libraries/enableJquery.js", instant: false },
74+
75+
76+
{ menu: "W", "title": "Miscellaneous", menuref: "W>M", file: "" },
77+
{ menu: "W>M", "title": "Find public logins", file: "js/web/miscellaneous/findPublicLogins.js", instant: false },
78+
{ menu: "W>M", "title": "Log globals", file: "js/web/miscellaneous/logGlobals.js", instant: false },
79+
{ menu: "W>M", "title": "Remove all cookies", file: "js/web/miscellaneous/removeAllCookies.js", instant: false },
80+
{ menu: "W>M", "title": "Remove bloat", file: "js/web/miscellaneous/removeBloat.js", instant: false },
81+
{ menu: "W>M", "title": "Restore console", file: "js/web/miscellaneous/restoreConsole.js", instant: false },
82+
{ menu: "W>M", "title": "Log website stack", file: "js/web/miscellaneous/stack.js", instant: false },
83+
{ menu: "W>M", "title": "View all scripts", file: "js/web/miscellaneous/viewAllScripts.js", instant: false },
84+
{ menu: "W>M", "title": "View cookies", file: "js/web/miscellaneous/viewCookies.js", instant: false },
85+
{ menu: "W>M", "title": "View partial source", file: "js/web/miscellaneous/viewPartialSource.js", instant: false },
86+
{ menu: "W>M", "title": "View passwords", file: "js/web/miscellaneous/viewPasswords.js", instant: false },
87+
{ menu: "W>M", "title": "Website to qr code", file: "js/web/miscellaneous/websitesToQrCode.js", instant: false },
88+
{ menu: "W>M", "title": "Log word frequency", file: "js/web/miscellaneous/wordFrequency.js", instant: false },
89+
90+
91+
{ menu: "W", "title": "Network", menuref: "W>N", file: "" },
92+
{ menu: "W>N", "title": "Cache buster", file: "js/web/network/cacheBuster.js", instant: false },
93+
{ menu: "W>N", "title": "Generate hash link", file: "js/web/network/generateHashLink.js", instant: false },
94+
{ menu: "W>N", "title": "Network heatmap", file: "js/web/network/heatmap.js", instant: false },
95+
{ menu: "W>N", "title": "Is this website down", file: "js/web/network/isThisWebsiteDown.js", instant: false },
96+
{ menu: "W>N", "title": "Link checker", file: "js/web/network/linkChecker.js", instant: false },
97+
{ menu: "W>N", "title": "Log query strings", file: "js/web/network/logQueryStrings.js", instant: false },
98+
{ menu: "W>N", "title": "Performance", file: "js/web/network/performance.js", instant: false },
99+
{ menu: "W>N", "title": "Performance again", file: "js/web/network/performanceAgain.js", instant: false },
100+
{ menu: "W>N", "title": "Performance stats", file: "js/web/network/performanceStats.js", instant: false },
101+
{ menu: "W>N", "title": "Show headers", file: "js/web/network/showHeaders.js", instant: false },
102+
103+
104+
{ menu: "W", "title": "Convert", menuref: "W>CO", file: "" },
105+
{ menu: "W>CO", "title": "CSS prettifer", file: "js/web/convert/cssPrettifier.js", instant: false },
106+
{ menu: "W>CO", "title": "Insert CSS", file: "js/web/convert/insertCss.js", instant: false },
107+
{ menu: "W>CO", "title": "Plain CSS", file: "js/web/convert/plainCss.js", instant: false },
108+
{ menu: "W>CO", "title": "Plain forms", file: "js/web/convert/plainForms.js", instant: false },
109+
{ menu: "W>CO", "title": "Reload CSS", file: "js/web/convert/reloadCss.js", instant: false },
110+
{ menu: "W>CO", "title": "Remove colours", file: "js/web/convert/removeColours.js", instant: false },
111+
{ menu: "W>CO", "title": "Remove CSS", file: "js/web/convert/removeCss.js", instant: false },
112+
{ menu: "W>CO", "title": "Remove style sheets", file: "js/web/convert/removeStyleSheets.js", instant: false },
113+
{ menu: "W>CO", "title": "View all CSS", file: "js/web/convert/viewAllCss.js", instant: false },
114+
{ menu: "W>CO", "title": "What font is this", file: "js/web/convert/whatFontIsThis.js", instant: false },
115+
116+
117+
{ menu: "W", "title": "Events", menuref: "W>EV", file: "" },
118+
{ menu: "W>EV", "title": "Log Segment Events", file: "js/web/events/logSegmentEvents.js", instant: false },
119+
120+
121+
{ menu: "W", "title": "Validation", menuref: "W>V", file: "" },
122+
{ menu: "W>V", "title": "Remove paste restrictions", file: "js/web/validation/removePasteRestrictions.js", instant: false },
123+
124+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
void(document.oncontextmenu = null)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(function () {
2+
function R(a) {
3+
ona = "on" + a;
4+
if (window.addEventListener) window.addEventListener(a, function (e) {
5+
for (var n = e.originalTarget; n; n = n.parentNode) n[ona] = null;
6+
}, true);
7+
window[ona] = null;
8+
document[ona] = null;
9+
if (document.body) document.body[ona] = null;
10+
}
11+
R("click");
12+
R("mousedown");
13+
R("mouseup");
14+
R("selectstart");
15+
})()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var ids = {};
2+
var all = document.all || document.getElementsByTagName("*");
3+
for (var i = 0, l = all.length; i < l; i++) {
4+
var id = all[i].id;
5+
if (id) {
6+
if (ids[id]) {
7+
all[i].style = all[i].style+"; border:10px dashed red;"
8+
document.getElementById(id).style = document.getElementById(id).style+"; border:10px dashed red;"
9+
} else {
10+
ids[id] = 1;
11+
}
12+
}
13+
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /