| @@ -1,87 +0,0 @@ |
| 1 | | −module Docs |
| 2 | | − class DomEvents |
| 3 | | − class EntriesFilter < Docs::EntriesFilter |
| 4 | | − TYPE_BY_INFO = { |
| 5 | | − 'applicationCache' => 'Application Cache', |
| 6 | | − 'Battery' => 'Battery', |
| 7 | | − 'Call' => 'Telephony', |
| 8 | | − 'Clipboard' => 'Clipboard', |
| 9 | | − 'CSS' => 'CSS', |
| 10 | | − 'Drag' => 'Drag & Drop', |
| 11 | | − 'Fetch' => 'Fetch', |
| 12 | | − 'Fullscreen' => 'Fullscreen', |
| 13 | | − 'Gamepad' => 'Gamepad', |
| 14 | | − 'HashChange' => 'History', |
| 15 | | − 'IDB' => 'IndexedDB', |
| 16 | | − 'IndexedDB' => 'IndexedDB', |
| 17 | | − 'Keyboard' => 'Keyboard', |
| 18 | | − 'edia' => 'Media', |
| 19 | | − 'Mouse' => 'Mouse', |
| 20 | | − 'Notification' => 'Notification', |
| 21 | | − 'Offline' => 'Offline', |
| 22 | | − 'Orientation' => 'Device', |
| 23 | | − 'Sensor' => 'Device', |
| 24 | | − 'SVG' => 'SVG', |
| 25 | | − 'Page Visibility' => 'Page Visibility', |
| 26 | | − 'Pointer' => 'Mouse', |
| 27 | | − 'PopState' => 'History', |
| 28 | | − 'Push' => 'Push', |
| 29 | | − 'Progress' => 'Progress', |
| 30 | | − 'Proximity' => 'Device', |
| 31 | | − 'Selection' => 'Selection', |
| 32 | | − 'Server Sent' => 'Server Sent Events', |
| 33 | | − 'Speech' => 'Web Speech', |
| 34 | | − 'Storage' => 'Web Storage', |
| 35 | | − 'Touch' => 'Touch', |
| 36 | | − 'Transition' => 'CSS', |
| 37 | | − 'PageTransition' => 'History', |
| 38 | | − 'WebSocket' => 'WebSocket', |
| 39 | | − 'Web App Manifest' => 'Web App Manifest', |
| 40 | | − 'Web Audio' => 'Web Audio', |
| 41 | | − 'Web Messaging' => 'Web Messaging', |
| 42 | | − 'WebGL' => 'WebGL', |
| 43 | | − 'WebRTC' => 'WebRTC', |
| 44 | | − 'WebVR' => 'WebVR', |
| 45 | | − 'Wheel' => 'Mouse', |
| 46 | | − 'Worker' => 'Web Workers', |
| 47 | | − 'Focus' => 'Focus' } |
| 48 | | − |
| 49 | | − FORM_SLUGS = %w(change compositionend compositionstart compositionupdate |
| 50 | | − input invalid reset select submit) |
| 51 | | − LOAD_SLUGS = %w(abort beforeunload DOMContentLoaded error load |
| 52 | | − readystatechange unload) |
| 53 | | − |
| 54 | | − APPEND_TYPE = %w(Application\ Cache IndexedDB Progress Telephony |
| 55 | | − Server\ Sent\ Events WebSocket Web\ Messaging Web\ Workers) |
| 56 | | − |
| 57 | | − def get_name |
| 58 | | − name = super |
| 59 | | − name = "#{name.split.first} (#{type})" if APPEND_TYPE.include?(type) |
| 60 | | − name |
| 61 | | − end |
| 62 | | − |
| 63 | | − def get_type |
| 64 | | − if FORM_SLUGS.include?(slug) |
| 65 | | − 'Form' |
| 66 | | − elsif LOAD_SLUGS.include?(slug) |
| 67 | | − 'Load' |
| 68 | | − else |
| 69 | | − info = css('.eventinfo, .properties, .standard-table').map(&:content).join |
| 70 | | − TYPE_BY_INFO.each_pair do |key, value| |
| 71 | | − return value if info.include?(key) |
| 72 | | − end |
| 73 | | − |
| 74 | | − 'Miscellaneous' |
| 75 | | − end |
| 76 | | − end |
| 77 | | − |
| 78 | | − def include_default_entry? |
| 79 | | − content = doc.content |
| 80 | | − !content.include?('Firefox OS specific') && |
| 81 | | − !content.include?('Addons specific') && |
| 82 | | − !content.include?('Mozilla specific') && |
| 83 | | − content !~ /Specification\s+XUL/ |
| 84 | | − end |
| 85 | | − end |
| 86 | | − end |
| 87 | | −end |