Skip to content

Commit

Permalink
Cleanup, sanitize, reorganize.
Browse files Browse the repository at this point in the history
  • Loading branch information
jklaiho committed Mar 3, 2012
1 parent 68e5601 commit f3eb581
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 120 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -4,7 +4,6 @@ chrome/build/UnFuckGoogle.crx
chrome/build/UnFuckGoogle.pem
# Ignore build products and copies of the CSS...
UnFuckGoogle.css
start.js
end.js
UnFuckGoogle.js
# ...but don't ignore the master CSS file at repo root
!/UnFuckGoogle.css
38 changes: 12 additions & 26 deletions Cakefile
Expand Up @@ -17,23 +17,15 @@ distDirs = {

coffeeSources = {
'safari': {
'start': [
'UnFuckGoogleStart.coffee'
"safari/start.coffee"
]
'end': [
'UnFuckGoogleEnd.coffee'
"safari/end.coffee"
'UnFuckGoogle': [
"safari/preflight.coffee"
'UnFuckGoogle.coffee'
]
}
'chrome': {
'start': [
'UnFuckGoogleStart.coffee'
"chrome/start.coffee"
]
'end': [
'UnFuckGoogleEnd.coffee'
"chrome/end.coffee"
'UnFuckGoogle': [
"chrome/preflight.coffee"
'UnFuckGoogle.coffee'
]
}
}
Expand Down Expand Up @@ -99,20 +91,14 @@ task('clean', "Remove the products of any previous build runs (successful or fai
chrBd = buildDirs['chrome']
[
"#{safBd}/UnFuckGoogle.css"
"#{safBd}/start.js"
"#{safBd}/end.js"
"#{safBd}/_safari_start_temp.coffee"
"#{safBd}/_safari_end_temp.coffee"
"#{safBd}/_safari_start_temp.js"
"#{safBd}/_safari_end_temp.js"
"#{safBd}/UnFuckGoogle.js"
"#{safBd}/_safari_UnFuckGoogle_temp.coffee"
"#{safBd}/_safari_UnFuckGoogle_temp.js"

"#{chrBd}/UnFuckGoogle.css"
"#{chrBd}/start.js"
"#{chrBd}/end.js"
"#{chrBd}/_chrome_start_temp.coffee"
"#{chrBd}/_chrome_start_temp.js"
"#{chrBd}/_chrome_end_temp.coffee"
"#{chrBd}/_chrome_end_temp.js"
"#{chrBd}/UnFuckGoogle.js"
"#{chrBd}/_chrome_UnFuckGoogle_temp.coffee"
"#{chrBd}/_chrome_UnFuckGoogle_temp.js"
].map(rm)
)

Expand Down
1 change: 1 addition & 0 deletions README.markdown
Expand Up @@ -12,6 +12,7 @@ The current features are as follows:
* remove the prompts to add your Twitter account to your Google profile
* remove history-breaking onmousedown handlers from result links that
transform the original link into a google.com redirect
* restore Cached and Similar links to their original position
* Global:
* restore the top navigation bar to its original white background

Expand Down
44 changes: 44 additions & 0 deletions UnFuckGoogle.coffee
@@ -0,0 +1,44 @@
UnFuckGoogle = ->
PREVIEW_CLASSDEF = 'vspib'
REDIRECT_CLASSDEFS = ['r', 'fc']
PLUSONE_CLASSDEF = 'esw eswd'

#
# Preview functionality removal
#
removePreviewActivators = ->
elems = document.getElementsByClassName(PREVIEW_CLASSDEF)
if elems.length > 0
for i in [elems.length-1..0]
elems[i].parentNode.removeChild(elems[i])
removePreviewActivators()
document.addEventListener('DOMNodeInsertedIntoDocument', removePreviewActivators, true)

#
# Result link to onmousedown-toggled google.com redirect removal
#
removeRedirectOnmousedowns = (containers) ->
for cls in REDIRECT_CLASSDEFS
elems = document.getElementsByClassName(cls)
for elem in elems
for link in elem.getElementsByTagName('a')
link.removeAttribute('onmousedown')
removeRedirectOnmousedowns()
document.addEventListener('DOMNodeInsertedIntoDocument', removeRedirectOnmousedowns, true)

document.getElementsByClassName('gbzt gbz0l')[0].className = 'gbzt'

#
# +1 Button removal
#
removePlusOnes = ->
buttons = document.getElementsByClassName(PLUSONE_CLASSDEF)
undoDivs = []
if buttons.length > 0
for i in [buttons.length-1..0]
undoDivs.push(document.getElementById(buttons[i].getAttribute('g:undo')))
buttons[i].parentNode.removeChild(buttons[i])
for i in [undoDivs.length-1..0]
undoDivs[i].parentNode.removeChild(undoDivs[i])
removePlusOnes()
document.addEventListener('DOMNodeInsertedIntoDocument', removePlusOnes, true)
30 changes: 19 additions & 11 deletions UnFuckGoogle.css
@@ -1,9 +1,9 @@
/* UnFuckGoogle Safari/Chrome Extension v1.1 by JK Laiho (jklaiho@iki.fi) */
div#gb > div {
background-color: transparent !important;
/* UnFuckGoogle Safari/Chrome Extension by JK Laiho (jklaiho@iki.fi) */
div#gbx3 {
background-color: white !important;
}

#gbz .gbzt, #gbz .gbgt, #gbg .gbgt {
#gbz .gbzt, #gbz .gbgt {
color: black !important;
}

Expand All @@ -15,15 +15,23 @@ div#gb > div {
background-color: #E5E5E5 !important;
}

.gbts #gbi5 {
background-position-x: -6px !important;
background-position-y: -22px !important;
.vspib {
display: none !important;
}

.so.soi {
display: none !important;
.vshid {
display:inline !important;
}

.vspib {
display: none !important;
.vshid:before {
content: " - ";
}

.vshid a {
color: #12C !important;
text-decoration: none !important;
}

#cnt #center_col, #cnt #foot, #cnt .ab_center_col {
width: auto;
}
34 changes: 0 additions & 34 deletions UnFuckGoogleEnd.coffee

This file was deleted.

19 changes: 0 additions & 19 deletions UnFuckGoogleStart.coffee

This file was deleted.

5 changes: 2 additions & 3 deletions chrome/build/UnFuckGoogle/manifest.json
@@ -1,20 +1,19 @@
{
"name": "UnFuckGoogle",
"version": "1.2",
"version": "1.2.2",
"description": "Removes various annoyances from Google",
"update_url": "http://files.jklaiho.net/UnFuckGoogle/chrome/updates.xml",
"content_scripts": [
{
"matches": ["<all_urls>"],
"include_globs": ["http*://*.google.*/*"],
"js": ["start.js"],
"css": ["UnFuckGoogle.css"],
"run_at": "document_end"
},
{
"matches": ["<all_urls>"],
"include_globs": ["http*://*.google.*/*"],
"js": ["end.js"],
"js": ["UnFuckGoogle.js"],
"run_at": "document_idle"
}
]
Expand Down
2 changes: 1 addition & 1 deletion chrome/build/updates.xml
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='mkaikjcglnbjbkhmnggbpanalpkpbgaf'>
<updatecheck codebase='http://files.jklaiho.net/UnFuckGoogle/chrome/UnFuckGoogle.crx' version='1.2' />
<updatecheck codebase='http://files.jklaiho.net/UnFuckGoogle/chrome/UnFuckGoogle.crx' version='1.2.2' />
</app>
</gupdate>
2 changes: 1 addition & 1 deletion chrome/end.coffee → chrome/preflight.coffee
@@ -1,3 +1,3 @@
if window.top == window
window.onload = ->
UnFuckGoogleEnd()
UnFuckGoogle()
4 changes: 0 additions & 4 deletions chrome/start.coffee

This file was deleted.

10 changes: 3 additions & 7 deletions safari/UnFuckGoogle.safariextension/Info.plist
Expand Up @@ -13,9 +13,9 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleVersion</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>Chrome</key>
<dict/>
<key>Content</key>
Expand All @@ -24,11 +24,7 @@
<dict>
<key>End</key>
<array>
<string>end.js</string>
</array>
<key>Start</key>
<array>
<string>start.js</string>
<string>UnFuckGoogle.js</string>
</array>
</dict>
<key>Stylesheets</key>
Expand Down
4 changes: 2 additions & 2 deletions safari/dist/UnFuckGoogle.plist
Expand Up @@ -10,9 +10,9 @@
<key>Developer Identifier</key>
<string>B9695YS625</string>
<key>CFBundleVersion</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>URL</key>
<string>http://files.jklaiho.net/UnFuckGoogle/safari/UnFuckGoogle.safariextz</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion safari/end.coffee → safari/preflight.coffee
Expand Up @@ -5,4 +5,4 @@ if window.top == window
subdomain = document.domain.split('.')[0]
if tehGoogles.test(document.domain)
window.onload = ->
UnFuckGoogleEnd()
UnFuckGoogle()
9 changes: 0 additions & 9 deletions safari/start.coffee

This file was deleted.

0 comments on commit f3eb581

Please sign in to comment.