Skip to content

Instantly share code, notes, and snippets.

@selfboot
Last active December 19, 2015 03:21
Show Gist options
  • Save selfboot/5283306 to your computer and use it in GitHub Desktop.
Save selfboot/5283306 to your computer and use it in GitHub Desktop.
win下修改chrome和360浏览器6.0版本的Custom.css,恶搞网页。 setup.py 为 py2exe的转换脚本。
/* HTML PRIDE! */
html {
-webkit-animation: rainbow 8s infinite;
}
/*
Spin all images
*/
img {
-webkit-animation: spin 1s linear infinite;
}
/*
Spin dev tools round and round
*/
#-webkit-web-inspector {
-webkit-animation: spin 1s linear infinite;
}
/*
Flip dev tools upside down
*/
#-webkit-web-inspector {
-webkit-transform:rotate(180deg);
}
/* Hide the close button */
#-webkit-web-inspector .toolbar-item.close-left {
display:none !important;
}
body:before {
content: "------Happy Everyday!-------";
}
/* Animations */
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@-webkit-keyframes rainbow {
100% { -webkit-filter: hue-rotate(360deg); }
}
import os
import shutil
import _winreg
# from findpath import find_path
# for chrome
usr_home = os.path.expanduser('~')
customfile = usr_home + '\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\User StyleSheets\\Custom.css'
# for 360
'''
root = ['C:', 'D:', 'E:','F:']
for rootdir in root:
install_path = find_path(rootdir,'360se');
if(install_path):
break
'''
key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,r"Software\360\360se6\Update\ClientState\{02E720BD-2B50-4404-947C-65DBE64F6970}")
value, type = _winreg.QueryValueEx(key, "UninstallString")
split = value.find('Application')
install_path = value[:split-1]
# print install_path
customfile_360 = install_path+ '\\User Data\\Default\\User StyleSheets\\Custom.css'
if __name__ == '__main__':
if os.path.isfile (customfile):
shutil.copy ("aprilFools.css", customfile)
print "Open your chrome and see what happens!"
if os.path.isfile (customfile_360):
shutil.copy ("aprilFools.css", customfile_360)
print "Open your 360 explorer and see what happens!"
print "Enter any key to continue..."
raw_input()
import os
import aprilFools
if os.path.isfile (aprilFools.customfile):
f = open(aprilFools.customfile,'w')
f.close()
if os.path.isfile (aprilFools.customfile_360):
f = open(aprilFools.customfile_360,'w')
f.close()
print "It's just a joke, everything is OK now! \nEnter any key to continue..."
raw_input()
from distutils.core import setup
import py2exe
options = {"py2exe": { "bundle_files": 1 } }
setup(console=["aprilFools.py","cancelFools.py"],
options = options,
zipfile = None,
data_files=[("css_demo",['aprilFools.css'])]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment