This is just a very simple script that enables javascript for all urls contained within a whitelist, and disables javascript for all others. I created this because I found that uzbl's per-site-settings was much too slow and pages would load before the file was processed.
* Although faster than using per-site-settings there are still certain sites where this script may be too slow, and the page will load up before the script finishes. It should work fine for about 90% of pages though. Until theres a way to sync page loading with scripts theres not much that can be done about it. If you have a better method please share.
1. Save the script as $XDG_DATA_HOME/uzbl/scripts/noscript.sh and give executable permissions.
2. Create the whitelist at $XDG_DATA_HOME/uzbl/ns_whitelist with at least one entry. (entries should be simple urls, one per line)
Example whitelist:
youtube.com uzbl.org google.com
3. Add the following line to your config (this will spawn the script on the LOAD_COMMIT event)
@on_event LOAD_COMMIT spawn @scripts_dir/noscript.sh
#!/bin/bash WHITELIST=$XDG_DATA_HOME/uzbl/ns_whitelist while read -r line; do if [[ "$UZBL_URI" =~ "$line" ]]; then echo 'set enable_scripts = 1' > "$UZBL_FIFO" break else echo 'set enable_scripts = 0' > "$UZBL_FIFO" fi done < "$WHITELIST"
* You could make an identical flashblock script very easily by changing enable_scripts to enable_plugins and renaming the whitelist and filename accordingly.
It is possible to add an indicator to your statusbar that tells you whether js is currently enabled or disabled.
1. In the “Behavior and appearance” section of your config, just before the “set status_format” line add the following… (change color as desired)
set script_section = scripts:<span foreground="#af5f00">\@enable_scripts</span>
2. Add @script_section somewhere in your status bar. As you can probably see ive moved things around from the defaults on my status bar, but you get the idea just put @script_section in there somewhere.
set status_format = <span font_family="Terminus" font_size="8">@mode_section @keycmd_section @uri_section @progress_section @status_section @selected_section @download_section</span> set status_format_right = <span font_family="Terminus" font_size="8">@script_section @scroll_section</span>