mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
rules: fix regex for yt, add rx for wikimedia
This commit is contained in:
parent
8b5a6be956
commit
c47d3ca925
@ -65,7 +65,17 @@ rules:
|
|||||||
fuzzy_lookup: '()'
|
fuzzy_lookup: '()'
|
||||||
|
|
||||||
|
|
||||||
# flickr rules
|
# wikimedia rules
|
||||||
|
#=================================================================
|
||||||
|
- url_prefix: 'org,wikimedia,meta)/'
|
||||||
|
|
||||||
|
rewrite:
|
||||||
|
js_regexs:
|
||||||
|
- match: '\burl\((\\?/\\?/[^)]+)\)'
|
||||||
|
rewrite: true
|
||||||
|
group: 1
|
||||||
|
|
||||||
|
# flickr rules
|
||||||
#=================================================================
|
#=================================================================
|
||||||
- url_prefix: ['com,yimg,l)/g/combo', 'com,yimg,s)/pw/combo', 'com,yahooapis,yui)/combo']
|
- url_prefix: ['com,yimg,l)/g/combo', 'com,yimg,s)/pw/combo', 'com,yahooapis,yui)/combo']
|
||||||
fuzzy_lookup: '([^/]+(?:\.css|\.js))'
|
fuzzy_lookup: '([^/]+(?:\.css|\.js))'
|
||||||
@ -134,7 +144,7 @@ rules:
|
|||||||
js_regexs:
|
js_regexs:
|
||||||
- match: 'window.location'
|
- match: 'window.location'
|
||||||
replace: 'WB_wombat_location'
|
replace: 'WB_wombat_location'
|
||||||
|
|
||||||
# youtube rules
|
# youtube rules
|
||||||
#=================================================================
|
#=================================================================
|
||||||
|
|
||||||
@ -203,7 +213,7 @@ rules:
|
|||||||
- match: 'ytplayer.load\(\);'
|
- match: 'ytplayer.load\(\);'
|
||||||
replace: 'ytplayer.config.args.dash = "0"; ytplayer.config.args.dashmpd = ""; {0}'
|
replace: 'ytplayer.config.args.dash = "0"; ytplayer.config.args.dashmpd = ""; {0}'
|
||||||
|
|
||||||
- match: 'yt\.setConfig.*PLAYER_CONFIG.*args": {'
|
- match: 'yt\.setConfig.*PLAYER_CONFIG.*args":\s*{'
|
||||||
replace: '{0} "dash": "0", dashmpd: "", '
|
replace: '{0} "dash": "0", dashmpd: "", '
|
||||||
|
|
||||||
req_cookie_rewrite:
|
req_cookie_rewrite:
|
||||||
|
@ -616,6 +616,36 @@ _WBWombat = (function() {
|
|||||||
window.Worker = undefined;
|
window.Worker = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================
|
||||||
|
function init_mutation_obs() {
|
||||||
|
if (!window.MutationObserver) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var m = new MutationObserver(function(records, observer)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < records.length; i++) {
|
||||||
|
var r = records[i];
|
||||||
|
if (r.type == "attributes" && r.attributeName == "style") {
|
||||||
|
var style = r.target.style.cssText;
|
||||||
|
if (style.indexOf("url(") > 0) {
|
||||||
|
var new_style = rewrite_style(style);
|
||||||
|
if (new_style != style) {
|
||||||
|
r.target.style.cssText = new_style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
m.observe(document.documentElement, {childList: false,
|
||||||
|
attributes: true,
|
||||||
|
subtree: true,
|
||||||
|
//attributeOldValue: true,
|
||||||
|
attributeFilter: ["style"]});
|
||||||
|
}
|
||||||
|
|
||||||
//============================================
|
//============================================
|
||||||
function rewrite_attr(elem, name, func) {
|
function rewrite_attr(elem, name, func) {
|
||||||
if (!elem || !elem.getAttribute) {
|
if (!elem || !elem.getAttribute) {
|
||||||
@ -959,6 +989,9 @@ _WBWombat = (function() {
|
|||||||
init_ajax_rewrite();
|
init_ajax_rewrite();
|
||||||
init_worker_override();
|
init_worker_override();
|
||||||
|
|
||||||
|
// Init mutation observer (for style only)
|
||||||
|
init_mutation_obs();
|
||||||
|
|
||||||
// setAttribute
|
// setAttribute
|
||||||
init_setAttribute_override();
|
init_setAttribute_override();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user