Permalink
Browse files

support image maps for f-mode

  • Loading branch information...
1 parent 1411da9 commit a7c3aa352d9642743292280a404a2079ff0d7bd8 @k2nr committed Dec 6, 2012
Showing with 74 additions and 9 deletions.
  1. +15 −0 coffee/mode.coffee
  2. +9 −0 coffee/storage.coffee
  3. +4 −5 coffee/utils.coffee
  4. +20 −0 mode.js
  5. +18 −0 storage.js
  6. +8 −4 utils.js
View
@@ -475,6 +475,21 @@ class g.FMode extends g.Mode
@hideFunc = $.fn.hide
links = $('a:_visible,*:input:_visible,.button:_visible')
+ $('img[usemap^="#"]:_visible').each(->
+ offset = this._offset_
+ mapName = $(this).attr('usemap').slice(1)
+ areas = $('map[name="' + mapName + '"] area')
+ console.log areas
+ areas.each(->
+ if $(this).attr('shape') != 'default'
+ coords = $(this).attr('coords').split(',')
+ this._offset_ = {top: offset.top + ~~coords[1], left: offset.left + ~~coords[0]}
+ else
+ this._offset_ = offset
+
+ links.push(this);
+ );
+ )
if links.length == 0
g.view.setStatusLineText( "No visible links found", 2000 )
View
@@ -0,0 +1,9 @@
+this.vichrome ?= {}
+g = this.vichrome
+
+g.storage = {
+ set : (items, callback) ->
+ storage.set
+
+ remove : (keys, callback) ->
+}
View
@@ -124,9 +124,7 @@ g.util.dispatchKeyEvent = (target, identifier, primary, shift, alt) ->
target.dispatchEvent e
g.util.dispatchMouseClickEvent = (target, primary, shift, alt) ->
- e = document.createEvent("MouseEvents")
secondary = false
-
unless target?.dispatchEvent?
g.logger.e "target is invalid"
return false
@@ -142,9 +140,10 @@ g.util.dispatchMouseClickEvent = (target, primary, shift, alt) ->
meta = secondary
ctrl = primary
- e.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, ctrl, alt, shift, meta, 0, null)
-
- target.dispatchEvent e
+ for event in ['mousedown', 'mouseup', 'click']
+ e = document.createEvent("MouseEvents")
+ e.initMouseEvent(event, true, true, window, 1, 0, 0, 0, 0, ctrl, alt, shift, meta, 0, null)
+ target.dispatchEvent e
return true
View
20 mode.js

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit a7c3aa3

Please sign in to comment.