locatine 0.01811 → 0.01822

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 291cbcc01b2a41fb79a851461f620ab5e3089d9d
4
- data.tar.gz: e8f0125d9caafe79dabf0834cdbd4e50737e5e42
3
+ metadata.gz: c42ba5ac7959a4ab71aa728327a9c28370feb16a
4
+ data.tar.gz: a36821ec021212fbf125680d449242efba9abd2e
5
5
  SHA512:
6
- metadata.gz: a1766f658d20d1fe90fb1a854ea493a23835961847578ec246820b36dc7aea3c55d304efdc99261de6badd13514c518e9dc6e4348ee1a57c151b8a82d7618221
7
- data.tar.gz: 44ab3200dbe3290012e7ffc43f3a68d2729d44ef8b94bb5cf9e71fb13836df26b04e0b163e6e598bede348e5d6404fe2e4dbd9346a9e9b364d425e0e5e476246
6
+ metadata.gz: cfa093835faa43a741931e8d012b3800774c959d4779c2541b73803fec067b233a2bc262d84779b9b5ddd0f950ad19d1852ef46ac88759eac364e980b60fbdab
7
+ data.tar.gz: a77d487a503ee587b9ad4ad1491d0cf046a64502d680f9ebcef07f22fe1172ae7cf97f67de0d568deef4e9e2b59438ab6a3a9044b731b9a81740efbd002ac28e
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Locatine app",
3
- "version": "0.01811",
3
+ "version": "0.01822",
4
4
  "description": "Messaging from browser to main app",
5
5
  "devtools_page": "devtools.html",
6
6
  "permissions": ["activeTab", "storage", "contextMenus", "tabs"],
@@ -36,6 +36,28 @@ module Locatine
36
36
  family
37
37
  end
38
38
 
39
+ def equal_elements?(one, another)
40
+ good = true
41
+ one.each_pair do |depth, array|
42
+ trusted = get_trusted(array).map do |i|
43
+ i.reject { |k| k == 'stability' }
44
+ end
45
+ good &&= (trusted - another[depth] == [])
46
+ end
47
+ good
48
+ end
49
+
50
+ def find_in_data(attributes)
51
+ found = []
52
+ @data.each_pair do |scope, elements|
53
+ elements.each_pair do |element, hash|
54
+ good = equal_elements?(hash, attributes)
55
+ found.push(scope: scope, name: element) if good
56
+ end
57
+ end
58
+ found.empty? ? nil : found
59
+ end
60
+
39
61
  ##
40
62
  # Getting element\\parents information
41
63
  def get_family_info(element, vars)
@@ -67,13 +67,17 @@ module Locatine
67
67
  send_to_app('locatineconfirmed', 'ok')
68
68
  mass_highlight_turn(element, false) if element
69
69
  element, attributes = working_on_selected(tag, index, vars, attributes)
70
- if element
71
- mass_highlight_turn(element)
72
- send_selected(element.length, name, scope)
73
- end
70
+ show_element(element, attributes, name, scope) if element
74
71
  return element, attributes
75
72
  end
76
73
 
74
+ def show_element(element, attributes, name, scope)
75
+ found = find_in_data(attributes)
76
+ mass_highlight_turn(element)
77
+ send_selected(element.length, name, scope) unless found
78
+ send_same_entry(element.length, name, scope, found) if found
79
+ end
80
+
77
81
  def decline(element, name, scope)
78
82
  mass_highlight_turn(element, false) if element
79
83
  send_to_app('locatineconfirmed', 'ok')
@@ -85,6 +85,14 @@ module Locatine
85
85
  'Locatine is waiting for new find request')
86
86
  end
87
87
 
88
+ def send_same_entry(length, name, scope, found)
89
+ push_title "#{length} #{verb(length)} selected as #{name} in #{scope}."\
90
+ " But it was already defined #{found.length} times."
91
+ example = found.sample
92
+ send_to_app('locatinehint', "For example like #{example[:name]} in"\
93
+ " #{example[:scope]}")
94
+ end
95
+
88
96
  def warn_dropping(tag, index)
89
97
  send_warn('For some reason locatine cannot proceed with'\
90
98
  " //#{tag}[#{index}] element. You've selected. Maybe element was"\
@@ -1,6 +1,6 @@
1
1
  module Locatine
2
2
  # constants here...
3
- VERSION = '0.01811'.freeze
3
+ VERSION = '0.01822'.freeze
4
4
  NAME = 'locatine'.freeze
5
5
  HOME = if File.readable?("#{Dir.pwd}/lib/#{Locatine::NAME}")
6
6
  "#{Dir.pwd}/lib/#{Locatine::NAME}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locatine
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.01811'
4
+ version: '0.01822'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Seleznev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-26 00:00:00.000000000 Z
11
+ date: 2019-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler