Tải bản đầy đủ - 0 (trang)
Hack 125. Avoid the Clash of Context Menus

Hack 125. Avoid the Clash of Context Menus

Tải bản đầy đủ - 0trang



Preventingscriptsfromoverridingyourcontextmenuin

Firefox



TheFirefoxcontextmenuhidestheMapsmenu.Whatif

youdowanttheMapsmenueveryonceinawhile,

though?



Butwhatifyou'dratherhavebothcontextmenus—sometimes

one,sometimestheother,dependingonthespecific

circumstancesandyourtaskathand?TakealookatFigure1134,whichshowswhathappenswhenyouconfigureFirefoxto

disallowwebsitestohidetheFirefoxcontextmenu,andthen

right-clickGoogleMaps.Ifyoulookclosely,youwillnoticethat

theMapscontextmenuisstillthere,albeitalmostcompletely

hidden.Sohowcanyouforcethebrowsercontextmenuto

showbutstillsometimeshideittoseewhat'sbehind?The

answer:pressEscapeafterright-clickingthepage.Thiswill

makethebrowsercontextmenudisappear,butstillleavethe

webapp'scontextmenuopen.



Hack126.PlotGoogleCalendarEvents

onaGoogleMap

IfyoumaintainapubliceventslistusingGoogleCalendar,you

cancreateaversionofthecalendar'sXMLfeedthatwillplot

youreventsonaGoogleMaporinGoogleEarth.

OnewayofgettingaseriesofeventsdisplayedonaGoogle

MapistocreateaGoogleMyMap[Hack#117]containinga

separatemarkerforeachevent.Thishackshowsyoutheother

way:pullingtheeventsintothemapfromGoogleCalendar.

UsingaGoogleCalendartodeclaretheeventsthatyouwantto

maphastheadvantagethatyoucanvieweventsbydate,using

aGoogleCalendarview,embeddedasacalendarorlistviewin

yourownwebpagesusingGoogleCalendarembeddingcode,or

bylocation,usingtheGoogleMap.

GoogleCalendarprovidesalinkthroughtotheevent

locationplottedonaGooglemap



TheGoogleCalendaroptionsmenu



GeocodingaGoogleCalendarXMLFeed

WhenyouaddaneventtoaGoogleCalendar,youcan

optionallyspecifyalocationforthatevent.GoogleCalendarwill

thentrytoidentifythegeographicalpositionofthatlocationso

thatyoucanviewitonaGoogleMapbyclickingonthe

automaticallygenerated"map"linkintheeventviewfora



calendarentry,asshowninFigure11-35.Ifyoudon'tadda

location,thereisnomaplinkprovided—instead,youare

presentedwitha"Clicktoaddalocation"option.

Afeedcontainingeachcalendareventasaseparatefeeditem

isavailablefromeachcalendar.ThefeedformatisAtom,used

bytheGoogleDataAPI(GData)framework.Tofindthe

calendar'sfeed,firstopenthepop-upoptionsmenuassociated

withoneofyourcalendars—there'sadrop-downarrowbyeach

calendarname—andselect"Calendarsettings,"asshownin

Figure11-36.

Towardthebottomofthecalendarsettingsaresomelinksto

variousoutputfeedsfromthecalendar(Figure11-37).The

publicandprivatefeedsarebothread-onlyfeedsthatcanbe

accessedwithoutloggingintoGoogleCalendar.Youhavesome

controloverthecontentofthepublicfeedviatheCalendar's

sharingsettings.Theprivatefeedisafullfeed,andprivateonly

aslongasyoudon'tsharetheURLwithanyoneelse!

GoogleCalendar"CalendarSettings"page;thefeedURLs

canbefoundtowardsthebottomofthepage



AsweknowthatGoogleCalendarcangenerateamapmarker

fromthelocationofanevent,itwouldseemreasonableto

assumethatthisgeocodedinformationwouldbemadeavailable

intheXMLsyndicationfeed,essentiallydefiningitasa

"GeoRSS"XMLfile(RSS,likeAtom,isafeedformat).Ifthat



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Hack 125. Avoid the Clash of Context Menus

Tải bản đầy đủ ngay(0 tr)

×