add change_cdn script
This commit is contained in:
17
change_cdn.py
Normal file
17
change_cdn.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def iter(path):
|
||||||
|
for root, dirs, files in os.walk(path):
|
||||||
|
for fn in files:
|
||||||
|
if fn.endswith(".html"):
|
||||||
|
with open(root + '/' + fn, 'r') as f:
|
||||||
|
content = f.read()
|
||||||
|
content = content.replace('<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.3/ace.js"></script>', '<script src="http://cdn.bootcss.com/ace/1.1.3/ace.js"></script>').replace('<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.3/mode-javascript.js"></script>', '<script src="http://cdn.bootcss.com/ace/1.1.3/mode-javascript.js"></script>')
|
||||||
|
with open(root + '/' + fn, 'w') as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
iter(os.getcwd())
|
||||||
Reference in New Issue
Block a user