Tweaked when the page refreshes a bit

Only refresh if we're in my ~/Sites directory (since I most likely will have a site up in the browser). Also checks to see if the domain of the site starts with "local" which would imply that the tab I have active is what I'm working on.
This commit is contained in:
Josh Sherman 2013-12-12 11:01:11 -05:00
parent 6c4ed6c65c
commit 36c2329fc8

View file

@ -1,8 +1,10 @@
#!/bin/bash
osascript -e 'tell application "Safari"' \
-e 'activate' \
-e 'do javascript "window.location.reload();" in first document' \
-e 'end tell' > /dev/null;
osascript -e 'tell application "iTerm" to activate'
if [[ $(pwd) == /Users/josh/Sites/* ]];
then
osascript -e 'tell application "Safari"' \
-e 'activate' \
-e 'do javascript "if (location.href.substring(7, 12) == \"local\") { window.location.reload(); }" in first document' \
-e 'end tell' > /dev/null;
osascript -e 'tell application "iTerm" to activate'
fi