I found some js that would help to split a tab using two frames, but I cannot make it work. Probably I’m getting the escaping wrong. If someone lends a hand.
-- http://www.chromeplugins.org/plugins/google-chrome-dual-view/
(*
javascript:A14nH=location.href;L3f7=prompt('Choose%20File%201',A14nH);R1Gh7=prompt('Choose%20File%202',L3f7);if(L3f7&&R1Gh7){Fr4Q='<frameset%20cols=\'*,*\'>\n<frame%20src=\''+L3f7+'\'/>';Fr4Q+='<frame%20src=\''+R1Gh7+'\'/>\n';Fr4Q+='</frameset>';with(document){write(Fr4Q);void(close())}}else{void(null)}
*)
tell application "Safari"
activate
tell front window
if (count of tabs) ≥ 2 then
set TabsURLs to URL of tabs
set CurrentTabIndex to index of current tab
set LeftTab to item (CurrentTabIndex - 1) of TabsURLs
set RightTab to item CurrentTabIndex of TabsURLs
set theScript to "" -- here js
make new tab at end
do JavaScript theScript in last tab
set current tab to last tab
end if
end tell
end tell
tell application "Safari"
activate
if front window exists then tell front window
if (count of tabs) ≥ 2 then
if (count of tabs) = 2 then set current tab to last tab
set TabsURLs to URL of tabs
set CurrTabIndex to index of current tab
set LeftTabURL to quoted form of (item (CurrTabIndex - 1) of TabsURLs)
set RightTabURL to quoted form of (item CurrTabIndex of TabsURLs)
set theJavaScript to "if(" & LeftTabURL & "&&" & RightTabURL & "){
FrameSet='<frameset cols=\\'*,*\\'>\\n<frame src=\\''+" & LeftTabURL & "+'\\'/>';
FrameSet+='<frame src=\\''+" & RightTabURL & "+'\\'/>\\n';
FrameSet+='</frameset>';
with(document){write(FrameSet);
void(close())}}else{void(null)}"
do JavaScript theJavaScript in current tab
end if
end tell
end tell
I like your script, especially with full screen (haven’t tried that yet), as it makes a lot of sense to see two web-pages at a time, (and maybe more).
Anyways, I scavenged your script and created one that resets the current tab to just display what’s in it.
Thank you very much, once again for this.
tell application "Safari"
activate
if front window exists then tell front window
if (count of tabs) ≥ 2 then
if (count of tabs) = 2 then set current tab to last tab
set TabsURLs to URL of tabs
set CurrTabIndex to index of current tab
set RightTabURL to quoted form of (item CurrTabIndex of TabsURLs)
set theJavaScript to "if(" & RightTabURL & "){
FrameSet='<frameset cols=\\'\\'>\\n<frame src=\\''+" & RightTabURL & "+'\\'/>';
FrameSet+='</frameset>';
with(document){write(FrameSet);
void(close())}}else{void(null)}"
do JavaScript theJavaScript in current tab
end if
end tell
end tell