自定义TextMate刷新浏览器脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自定义TextMate刷新浏览器脚本相关的知识,希望对你有一定的参考价值。

refreshes Chrome + Safari without bringing them into focus. If Chrome is hidden, then no refresh occurs.
  1. osascript >/dev/null <<EOL
  2. tell application "Safari"
  3. do javascript "if(window.location.hostname.indexOf('.local') != -1 || window.location.hostname.indexOf('.dev') || window.location.href.indexOf('file://') != -1) { window.location.reload(); }" in first document
  4. end tell
  5. EOL
  6.  
  7. osascript > /dev/null <<'APPLESCRIPT'
  8. tell application "System Events"
  9. set isVisible to visible of process "Google Chrome"
  10. end tell
  11.  
  12. tell application "Google Chrome"
  13. if isVisible then
  14. tell active tab of first window
  15. execute javascript "window.location.reload()"
  16. end tell
  17. end if
  18. end tell
  19. APPLESCRIPT
  20.  
  21. exit 0

以上是关于自定义TextMate刷新浏览器脚本的主要内容,如果未能解决你的问题,请参考以下文章