History

Remove obsoklete lib/docs/filters/dom_events

Simon Legner committed 5 years ago

Commit c32c4df1 parent 72ba9db2 files · +0 −115Browse files

Unified · Split

2 files
  1. lib/docs/filters/dom_events/clean_html.rb +0 −28
  2. lib/docs/filters/dom_events/entries.rb +0 −87
lib/docs/filters/dom_events/clean_html.rb+0−28
@@ -1,28 +0,0 @@
1module Docs
2 class DomEvents
3 class CleanHtmlFilter < Filter
4 def call
5 root_page? ? root : other
6 doc
7 end
8
9 def root
10 # Remove everything after "Standard events"
11 css('#Non-standard_events', '#Non-standard_events ~ *').remove
12
13 # Remove events we don't want
14 css('tr').each do |tr|
15 if td = tr.at_css('td:nth-child(3)')
16 tr.remove if td.content =~ /SVG|Battery|Gamepad|Sensor/i
17 end
18 end
19 end
20
21 def other
22 css('#General_info + dl').each do |node|
23 node['class'] = 'eventinfo'
24 end
25 end
26 end
27 end
28end
lib/docs/filters/dom_events/entries.rb+0−87
@@ -1,87 +0,0 @@
1module 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
87end