FlashFire Start
This commit is contained in:
commit
4ab4b8d480
BIN
Action.png
Normal file
BIN
Action.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
55
Info.plist
Normal file
55
Info.plist
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Author</key>
|
||||
<string>Mr. Gecko's Media</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>FlashFire</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.MrGeckosMedia.FlashFire</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.1</string>
|
||||
<key>Chrome</key>
|
||||
<dict>
|
||||
<key>Global Page</key>
|
||||
<string>global.html</string>
|
||||
</dict>
|
||||
<key>Content</key>
|
||||
<dict>
|
||||
<key>Scripts</key>
|
||||
<dict>
|
||||
<key>Start</key>
|
||||
<array>
|
||||
<string>flashfire.js</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Stylesheets</key>
|
||||
<array>
|
||||
<string>flashfire.css</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>Description</key>
|
||||
<string>Blocks Flash</string>
|
||||
<key>ExtensionInfoDictionaryVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>Permissions</key>
|
||||
<dict>
|
||||
<key>Website Access</key>
|
||||
<dict>
|
||||
<key>Include Secure Pages</key>
|
||||
<true/>
|
||||
<key>Level</key>
|
||||
<string>All</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Update Manifest URL</key>
|
||||
<string>http://mrgeckosmedia.com/FlashFire.plist</string>
|
||||
<key>Website</key>
|
||||
<string>http://mrgeckosmedia.com/</string>
|
||||
</dict>
|
||||
</plist>
|
12
Settings.plist
Normal file
12
Settings.plist
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<string></string>
|
||||
<key>Key</key>
|
||||
<string>whitelist</string>
|
||||
</dict>
|
||||
</array>
|
||||
</plist>
|
100
flashfire.css
Normal file
100
flashfire.css
Normal file
@ -0,0 +1,100 @@
|
||||
.flashfireBlocked {
|
||||
background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255, 255, 255, 0.15)), to(rgba(0, 0, 0, 0.15))) !important;
|
||||
border:1px solid rgba(0, 0, 0, 0.5) !important;
|
||||
display: table !important;
|
||||
-webkit-user-select: none !important;
|
||||
font-family:"Lucida Grande", "Helvetica Neue", Helvetica, sans-serif !important;
|
||||
}
|
||||
|
||||
.flashfireBlocked:active {
|
||||
background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(0, 0, 0, 0.15)), to(rgba(255, 255, 255, 0.15))) !important;
|
||||
}
|
||||
|
||||
.flashfireBlocked .container {
|
||||
position: relative !important;
|
||||
width: inherit !important;
|
||||
height: inherit !important;
|
||||
margin: 0px !important;
|
||||
}
|
||||
|
||||
.flashfireBlocked .vText {
|
||||
display: table-cell !important;
|
||||
vertical-align: middle !important;
|
||||
width: inherit !important;
|
||||
height: inherit !important;
|
||||
}
|
||||
.flashfireBlocked .hText {
|
||||
float: left !important;
|
||||
position: relative !important;
|
||||
left: 50% !important;
|
||||
height: auto !important;
|
||||
width: auto;
|
||||
}
|
||||
.flashfireBlocked .textContainer {
|
||||
float: left !important;
|
||||
position: relative !important;
|
||||
left: -50% !important;
|
||||
width: auto !important;
|
||||
height: auto !important;
|
||||
}
|
||||
.flashfireBlocked .textContainer.rotate {
|
||||
left: -90% !important;
|
||||
-webkit-transform: rotate(-90deg);
|
||||
}
|
||||
.flashfireBlocked .textContainer .text {
|
||||
border-radius: 4.0px !important;
|
||||
border: 3px solid rgba(0, 0, 0, 0.3) !important;
|
||||
font-size: 20px !important;
|
||||
width: auto !important;
|
||||
color: rgba(0, 0, 0, 0.3) !important;
|
||||
font-weight: bold !important;
|
||||
padding: 14px 5px 7px 5px !important;
|
||||
-webkit-user-select: none !important;
|
||||
cursor: default !important;
|
||||
background: none !important;
|
||||
position: relative !important;
|
||||
height: auto !important;
|
||||
line-height: 0 !important;
|
||||
}
|
||||
.flashfireBlocked .textContainer.mini .text {
|
||||
border-radius: 4.0px !important;
|
||||
font-size: 8px !important;
|
||||
border: 1px solid rgba(0, 0, 0, 0.3) !important;
|
||||
padding: 6px 3px 4px 3px !important;
|
||||
}
|
||||
.flashfireBlocked .textContainer .textInset {
|
||||
border: 0px !important;
|
||||
font-size: 20px !important;
|
||||
width: auto !important;
|
||||
color: rgba(255, 255, 255, 0.45) !important;
|
||||
font-weight: bold !important;
|
||||
padding: 16px 7px 10px 8px !important;
|
||||
-webkit-user-select: none !important;
|
||||
cursor: default !important;
|
||||
background: none !important;
|
||||
height: auto !important;
|
||||
line-height: 0 !important;
|
||||
position: absolute !important;
|
||||
top: 1px !important;
|
||||
right: 1px !important;
|
||||
}
|
||||
.flashfireBlocked .textContainer.mini .textInset {
|
||||
font-size: 8px !important;
|
||||
padding: 6px 3px 10px 8px !important;
|
||||
}
|
||||
|
||||
.flashfireBlocked .action {
|
||||
position: absolute !important;
|
||||
left: 10px !important;
|
||||
top: 10px !important;
|
||||
width: 14px !important;
|
||||
height: 14px !important;
|
||||
background: url("action.png") no-repeat !important;
|
||||
opacity: 0.25 !important;
|
||||
-webkit-transition-property: opacity;
|
||||
-webkit-transition-duration: 0.5s;
|
||||
z-index: 2 !important;
|
||||
}
|
||||
.flashfireBlocked .action:hover {
|
||||
opacity: 0.5 !important;
|
||||
}
|
118
flashfire.js
Normal file
118
flashfire.js
Normal file
@ -0,0 +1,118 @@
|
||||
document.addEventListener("beforeload", handleBeforeLoadEvent, true);
|
||||
var elementsBlocked = new Array();
|
||||
|
||||
function handleBeforeLoadEvent(event) {
|
||||
const element = event.target;
|
||||
if (element instanceof HTMLEmbedElement || element instanceof HTMLObjectElement) {
|
||||
if (element.allowedToLoad)
|
||||
return;
|
||||
|
||||
if (element instanceof HTMLEmbedElement) {
|
||||
var source = element.getAttribute("src");
|
||||
if (!source.match("swf"))
|
||||
return;
|
||||
} else if (element instanceof HTMLObjectElement) {
|
||||
var foundFile;
|
||||
var elementNodes = element.childNodes;
|
||||
for (i=0; i<elementNodes.length; i++) {
|
||||
if (elementNodes[i].nodeName=="PARAM" && elementNodes[i].name.match("movie")) {
|
||||
foundFile = elementNodes[i].value.match("swf");
|
||||
if (!foundFile) {
|
||||
var type = element.getAttribute("type");
|
||||
if (type!=null && (!type.match("flash") && !type.match("shockwave") && !type.match("futuresplash")))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(safari.self.tab.canLoad(event, {name: "getSettings", data: ""}));
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
blockElement(element);
|
||||
}
|
||||
}
|
||||
|
||||
function unblockElement(event) {
|
||||
var element = event.target;
|
||||
while (element.className!="flashfireBlocked")
|
||||
element = element.parentNode;
|
||||
|
||||
var elementID = element.getAttribute("elementID");
|
||||
|
||||
var blockedElement = elementsBlocked[elementID];
|
||||
blockedElement.allowedToLoad = true;
|
||||
|
||||
element.parentNode.replaceChild(blockedElement, element);
|
||||
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function blockElement(element) {
|
||||
if (element.getAttribute("elementID")!=null)
|
||||
return;
|
||||
var elementID = elementsBlocked.length;
|
||||
element.setAttribute("elementID", elementID);
|
||||
elementsBlocked[elementID] = element;
|
||||
|
||||
var text = "Flash";
|
||||
|
||||
var flashfireBlockedDiv = document.createElement("div");
|
||||
flashfireBlockedDiv.setAttribute("elementID", elementID);
|
||||
flashfireBlockedDiv.style = element.style;
|
||||
flashfireBlockedDiv.style.width = element.offsetWidth + "px";
|
||||
flashfireBlockedDiv.style.height = element.offsetHeight + "px";
|
||||
flashfireBlockedDiv.className = "flashfireBlocked";
|
||||
flashfireBlockedDiv.onclick = unblockElement;
|
||||
|
||||
var flashfireContainerDiv = document.createElement("div");
|
||||
flashfireContainerDiv.className = "container";
|
||||
flashfireBlockedDiv.appendChild(flashfireContainerDiv);
|
||||
|
||||
var flashfireVDiv = document.createElement("div");
|
||||
flashfireVDiv.className = "vText";
|
||||
flashfireContainerDiv.appendChild(flashfireVDiv);
|
||||
var flashfireHDiv = document.createElement("div");
|
||||
flashfireHDiv.className = "hText";
|
||||
flashfireVDiv.appendChild(flashfireHDiv);
|
||||
|
||||
var flashfireTextContainerDiv = document.createElement("div");
|
||||
flashfireTextContainerDiv.className = "textContainer";
|
||||
flashfireHDiv.appendChild(flashfireTextContainerDiv);
|
||||
|
||||
var flashfireTextInsetDiv = document.createElement("div");
|
||||
flashfireTextInsetDiv.className = "textInset";
|
||||
flashfireTextInsetDiv.innerHTML = text;
|
||||
flashfireTextContainerDiv.appendChild(flashfireTextInsetDiv);
|
||||
var flashfireTextDiv = document.createElement("div");
|
||||
flashfireTextDiv.className = "text";
|
||||
flashfireTextDiv.innerHTML = text;
|
||||
flashfireTextContainerDiv.appendChild(flashfireTextDiv);
|
||||
|
||||
var flashfireActionDiv = document.createElement("div");
|
||||
flashfireActionDiv.className = "action";
|
||||
flashfireContainerDiv.appendChild(flashfireActionDiv);
|
||||
|
||||
setTimeout(function(){element.parentNode.replaceChild(flashfireBlockedDiv, element);}, 5);
|
||||
var changeSize = function() {
|
||||
if (flashfireBlockedDiv.offsetWidth>0 && flashfireTextDiv.offsetWidth>0 && flashfireBlockedDiv.offsetHeight>0 && flashfireTextDiv.offsetHeight>0) {
|
||||
if ((flashfireBlockedDiv.offsetWidth - 4) < flashfireTextDiv.offsetWidth || (flashfireBlockedDiv.offsetHeight - 4) < flashfireTextDiv.offsetHeight) {
|
||||
flashfireTextContainerDiv.className += " mini";
|
||||
}
|
||||
|
||||
if ((flashfireBlockedDiv.offsetWidth - 4) < flashfireTextDiv.offsetWidth) {
|
||||
flashfireTextContainerDiv.className += " rotate";
|
||||
flashfireHDiv.style.width = 17;
|
||||
}
|
||||
if ((flashfireBlockedDiv.offsetWidth - 2) <= flashfireHDiv.offsetWidth || (flashfireBlockedDiv.offsetHeight - 17) <= flashfireTextDiv.offsetHeight) {
|
||||
flashfireHDiv.style.width = "inherit";
|
||||
flashfireTextContainerDiv.style.display = "none";
|
||||
}
|
||||
} else {
|
||||
setTimeout(changeSize, 100);
|
||||
}
|
||||
};
|
||||
changeSize();
|
||||
}
|
17
global.html
Normal file
17
global.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE HTML>
|
||||
<script>
|
||||
safari.application.addEventListener("message", handleMessage, false);
|
||||
|
||||
function handleMessage(theEvent) {
|
||||
if (theEvent.name=="canLoad") {
|
||||
var message = theEvent.message;
|
||||
console.log(message);
|
||||
if (message.name=="getSettings") {
|
||||
console.log("Get Settings");
|
||||
var data = message.data;
|
||||
theEvent.message = safari.extension.settings.bob;
|
||||
}
|
||||
}
|
||||
}
|
||||
safari.application.addEventListener("message", handleMessage, false);
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user