locatine 0.01546 → 0.01659
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/locatine/app/content.js +51 -43
- data/lib/locatine/app/manifest.json +1 -1
- data/lib/locatine/data_generate.rb +1 -1
- data/lib/locatine/dialog_logic.rb +15 -7
- data/lib/locatine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9be6c3fbe4cec2f39899f6874683c8653b12d756
|
4
|
+
data.tar.gz: 1c00862aa6032251a4f7a14f4a80a02e68d1be3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc1289f818358b5a05789676cff4384f24ca3494cfafbbed95a64e04cf0a172b841490f267f93d7ba6db8e9ea72e4081c96d4b1bda184d6da02ce067d55b46fd
|
7
|
+
data.tar.gz: 12d72cb6cb38cac62e74c9c7ee38eaec0586cf93ab1997e70e8d0cf4608fe95aa05baf53a32c694f0d367aafd3925a1fc43a9635d3df24b87dd19bfc3c4d615f
|
data/lib/locatine/app/content.js
CHANGED
@@ -9,50 +9,60 @@ async function get_value(name) {
|
|
9
9
|
return x[name];
|
10
10
|
};
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
async function creatingDiv(){
|
13
|
+
const options = {
|
14
|
+
"id":"locatine_magic_div",
|
15
|
+
"locatinestyle": await get_value('magic_div') || "false",
|
16
|
+
"locatinetitle": "ok",
|
17
|
+
"locatinehint": "ok"
|
18
|
+
};
|
19
|
+
locatine_create_element(document.body, "div", options, "");
|
20
|
+
const magic_cover = document.getElementById('locatine_magic_div');
|
21
|
+
magic_cover.onclick = function(e) {locatine_magic_click(e)};
|
22
|
+
}
|
23
|
+
|
24
|
+
async function setStyle(style, magicDiv){
|
25
|
+
if (style === "set_true") {
|
26
|
+
await set_value('magic_div', true);
|
27
|
+
magicDiv.setAttribute("locatinestyle", "true");
|
28
|
+
};
|
29
|
+
if (style === "set_false") {
|
30
|
+
await set_value('magic_div', false);
|
31
|
+
magicDiv.setAttribute("locatinestyle", "false");
|
32
|
+
};
|
33
|
+
let status = await get_value('magic_div');
|
34
|
+
magicDiv.setAttribute("locatinestyle", status);
|
35
|
+
}
|
36
|
+
|
37
|
+
async function setTitleHint(magicDiv){
|
38
|
+
if (magicDiv.getAttribute("locatinetitle") != "ok") {
|
39
|
+
await set_value('locatine_title', magicDiv.getAttribute("locatinetitle"));
|
40
|
+
await set_value('locatine_hint', magicDiv.getAttribute("locatinehint"));
|
41
|
+
magicDiv.setAttribute("locatinetitle", "ok");
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
async function setConfirm(magicDiv) {
|
46
|
+
if (magicDiv.getAttribute("locatineconfirmed") === "ok") {
|
47
|
+
magicDiv.removeAttribute("tag");
|
48
|
+
magicDiv.removeAttribute("index");
|
49
|
+
await set_value("locatine_confirm", false);
|
50
|
+
}
|
51
|
+
|
52
|
+
const confirmed = await get_value('locatine_confirm');
|
53
|
+
magicDiv.setAttribute("locatineconfirmed", confirmed);
|
54
|
+
}
|
15
55
|
|
16
56
|
async function refreshData(){
|
57
|
+
const magicDiv = document.getElementById("locatine_magic_div");
|
17
58
|
if (!document.getElementById("locatine_magic_div")){
|
18
|
-
|
19
|
-
"locatineclass": "locatine_smthing",
|
20
|
-
"id":"locatine_magic_div",
|
21
|
-
"locatinestyle": await get_value('magic_div') || "false",
|
22
|
-
"locatinetitle": "ok",
|
23
|
-
"locatinehint": "ok"
|
24
|
-
};
|
25
|
-
locatine_create_element(document.body, "div", options, "");
|
59
|
+
creatingDiv();
|
26
60
|
} else {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
};
|
32
|
-
if (magicDiv.getAttribute("locatinestyle") === "set_false") {
|
33
|
-
await set_value('magic_div', false);
|
34
|
-
magicDiv.setAttribute("locatinestyle", "false");
|
35
|
-
};
|
36
|
-
if (magicDiv.getAttribute("locatinetitle") != "ok") {
|
37
|
-
await set_value('locatine_title', magicDiv.getAttribute("locatinetitle"));
|
38
|
-
await set_value('locatine_hint', magicDiv.getAttribute("locatinehint"));
|
39
|
-
magicDiv.setAttribute("locatinetitle", "ok");
|
40
|
-
}
|
41
|
-
let status = await get_value('magic_div');
|
42
|
-
if (magicDiv.getAttribute("locatinestyle") != "set_true"){
|
43
|
-
magicDiv.setAttribute("locatinestyle", status);
|
44
|
-
}
|
45
|
-
magicDiv.setAttribute("locatinecollection", await get_value("locatine_collection"))
|
46
|
-
if (magicDiv.getAttribute("locatineconfirmed") === "ok") {
|
47
|
-
magicDiv.removeAttribute("tag");
|
48
|
-
magicDiv.removeAttribute("index");
|
49
|
-
await set_value("locatine_confirm", false);
|
50
|
-
}
|
51
|
-
const confirmed = await get_value('locatine_confirm');
|
52
|
-
magicDiv.setAttribute("locatineconfirmed", confirmed);
|
61
|
+
setStyle(magicDiv.getAttribute("locatinestyle"), magicDiv);
|
62
|
+
setTitleHint(magicDiv);
|
63
|
+
magicDiv.setAttribute("locatinecollection", await get_value("locatine_collection"));
|
64
|
+
setConfirm(magicDiv);
|
53
65
|
};
|
54
|
-
const magic_cover = document.getElementById('locatine_magic_div');
|
55
|
-
magic_cover.onclick = function(e) {locatine_magic_click(e)};
|
56
66
|
};
|
57
67
|
|
58
68
|
async function getSelected(value){
|
@@ -78,8 +88,8 @@ async function locatine_magic_click(e) {
|
|
78
88
|
const array = Array.prototype.slice.call( document.getElementsByTagName(tagName) );
|
79
89
|
const index = array.indexOf(value);
|
80
90
|
await set_value("locatine_confirm", "selected");
|
81
|
-
document.getElementById("locatine_magic_div").setAttribute("
|
82
|
-
document.getElementById("locatine_magic_div").setAttribute("
|
91
|
+
document.getElementById("locatine_magic_div").setAttribute("tag", tagName);
|
92
|
+
document.getElementById("locatine_magic_div").setAttribute("index", index);
|
83
93
|
};
|
84
94
|
|
85
95
|
function locatine_create_element(dom, tag, attrs, inner) {
|
@@ -92,8 +102,6 @@ function locatine_create_element(dom, tag, attrs, inner) {
|
|
92
102
|
return element;
|
93
103
|
};
|
94
104
|
|
95
|
-
//set_value('magic_div','off');
|
96
|
-
|
97
105
|
setInterval(async function(){
|
98
106
|
if (document.getElementById("locatine_magic_div")) {
|
99
107
|
if (document.getElementById("locatine_magic_div").getAttribute("locatinestyle") != "blocked") {
|
@@ -85,7 +85,7 @@ module Locatine
|
|
85
85
|
attributes = element.attributes
|
86
86
|
array = []
|
87
87
|
attributes.each_pair do |name, value|
|
88
|
-
next if name.to_s == 'locatineclass'
|
88
|
+
next if name.to_s == 'locatineclass' # Should never happen
|
89
89
|
|
90
90
|
value.split(/['" ]/).reject(&:empty?).uniq.each do |part|
|
91
91
|
array.push('name' => name.to_s, 'type' => 'attribute',
|
@@ -82,17 +82,25 @@ module Locatine
|
|
82
82
|
return nil, {}
|
83
83
|
end
|
84
84
|
|
85
|
+
def user_selection(els, attrs, vars, name, scope)
|
86
|
+
case get_from_app('locatineconfirmed')
|
87
|
+
when 'selected'
|
88
|
+
els, attrs = what_was_selected(els, attrs, vars, name, scope)
|
89
|
+
when 'declined'
|
90
|
+
els, attrs = decline(els, name, scope)
|
91
|
+
end
|
92
|
+
return els, attrs
|
93
|
+
end
|
94
|
+
|
85
95
|
def listening(els, attrs, vars, name, scope)
|
86
96
|
until get_from_app('locatineconfirmed') == 'true'
|
87
97
|
sleep(0.1)
|
88
|
-
|
89
|
-
when 'selected'
|
90
|
-
els, attrs = what_was_selected(els, attrs, vars, name, scope)
|
91
|
-
when 'declined'
|
92
|
-
els, attrs = decline(els, name, scope)
|
93
|
-
end
|
98
|
+
els, attrs = user_selection(els, attrs, vars, name, scope)
|
94
99
|
end
|
95
|
-
return els, attrs
|
100
|
+
return els, attrs if els
|
101
|
+
|
102
|
+
decline(els, name, scope)
|
103
|
+
listening(els, attrs, vars, name, scope)
|
96
104
|
end
|
97
105
|
|
98
106
|
##
|
data/lib/locatine/version.rb
CHANGED
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.
|
4
|
+
version: '0.01659'
|
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-
|
11
|
+
date: 2019-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|