Monday, July 23, 2018

#1 2015-01-16 11:35:57 am

Registered: 2012-11-21
Posts: 3046

Make Wikipedia Articles look better!

I read articles at Wikipedia occasionally.

By accident, I disovered that the pages really looks best  by inserting 'm.' after 'en.' in the page url.

This is probably because the 'm.' makes the page to be styled for mobile devices.

It is bother some to have to edit the urls all the time, so this script, fixes the url!



tell application "Safari"
   # 2 lines below just for demo purposes!
   open location "[url][/url]"
   delay 10
   # comment out the lines above when you have tried it!
   tell current tab of front window
       set {_oldURL, langdomain} to {URL, "//en."}
       if _oldURL contains langdomain and _oldURL does not contain (langdomain & "m.") then
           set {astid, my text item delimiters} to {my text item delimiters, langdomain}
           set urlparts to text items of _oldURL
           set my text item delimiters to (langdomain & "m.")
               set URL to urlparts as text
           end try
           set my text item delimiters to astid
       end if
   end tell
end tell

Last edited by McUsrII (2015-01-16 11:36:20 am)

Filed under: safari, wikipedia



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)