Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Mynij
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alexandra Rogova
Mynij
Commits
7576610c
Commit
7576610c
authored
May 28, 2019
by
Alexandra Rogova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saving works, now working on queries
parent
a404e13f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
62 deletions
+49
-62
gadget_model.js
gadget_model.js
+6
-19
gadget_parser.js
gadget_parser.js
+32
-37
search.html
search.html
+1
-0
search.js
search.js
+10
-6
No files found.
gadget_model.js
View file @
7576610c
...
...
@@ -17,17 +17,6 @@
this
.
sub_storages
=
[];
/*this.search_storage = jIO.createJIO({
type : "query",
sub_storage:{
type : "uuid",
sub_storage : {
type: "indexeddb",
database: "mynij-v1"
}
}
});*/
this
.
info
=
jIO
.
createJIO
({
type
:
"
indexeddb
"
,
database
:
"
mynij-v1-info
"
...
...
@@ -37,9 +26,10 @@
})
.
declareMethod
(
"
add_attachment
"
,
function
(
title
,
rss
){
var
gadget
=
this
;
return
this
.
feeds
.
putAttachment
(
"
feeds_doc
"
,
title
,
new
Blob
([
rss
],
{
type
:
"
text/xml
"
}))
.
push
(
function
(){
this
.
sub_storages
.
push
(
{
var
new_sub_storage
=
{
type
:
"
my_parser
"
,
document_id
:
"
feeds_doc
"
,
attachment_id
:
title
,
...
...
@@ -48,18 +38,15 @@
type
:
"
indexeddb
"
,
database
:
"
mynij-v1.2
"
}
});
this
.
search_storage
=
jIO
.
createJIO
({
}
gadget
.
sub_storages
.
push
(
new_sub_storage
);
gadget
.
search_storage
=
jIO
.
createJIO
({
type
:
"
union
"
,
storage_list
:
this
.
sub_storages
storage_list
:
gadget
.
sub_storages
});
});
})
.
declareMethod
(
"
put
"
,
function
()
{
// deprecated
return
this
.
search_storage
.
post
.
apply
(
this
.
search_storage
,
arguments
);
})
.
declareMethod
(
"
get
"
,
function
()
{
return
this
.
search_storage
.
get
.
apply
(
this
.
search_storage
,
arguments
);
})
...
...
gadget_parser.js
View file @
7576610c
...
...
@@ -6,43 +6,35 @@
.
declareAcquiredMethod
(
"
get_model
"
,
"
get_model
"
)
.
setState
({
storage
:
null
})
.
ready
(
function
(){
var
gadget
=
this
;
.
declareMethod
(
"
read_file_new
"
,
function
(
link
){
var
gadget
=
this
,
storage
;
return
gadget
.
get_model
()
.
push
(
function
(
result
){
return
gadget
.
changeState
({
storage
:
result
});
});
})
.
declareMethod
(
"
read_file_new
"
,
function
(
link
){
var
gadget
=
this
,
xmlhttp
=
new
XMLHttpRequest
();
xmlhttp
.
onreadystatechange
=
function
()
{
if
(
xmlhttp
.
status
==
200
&&
xmlhttp
.
readyState
==
4
){
var
rss
,
title
;
rss
=
xmlhttp
.
responseText
;
title
=
rss
.
slice
(
rss
.
indexOf
(
"
<title>
"
)
+
7
,
rss
.
indexOf
(
"
</title>
"
));
return
gadget
.
is_already_parsed
(
title
)
.
push
(
function
(
is_parsed
){
if
(
!
is_parsed
){
return
gadget
.
remove_css
(
rss
)
.
push
(
function
(
rss_without_css
){
return
gadget
.
state
.
storage
.
add_attachment
(
title
,
rss_without_css
);
});
}
});
}
}
xmlhttp
.
open
(
"
GET
"
,
link
,
true
);
xmlhttp
.
send
();
storage
=
result
;
})
.
push
(
function
(){
var
xmlhttp
=
new
XMLHttpRequest
();
xmlhttp
.
onreadystatechange
=
function
()
{
if
(
xmlhttp
.
status
==
200
&&
xmlhttp
.
readyState
==
4
){
var
rss
,
title
;
rss
=
xmlhttp
.
responseText
;
title
=
rss
.
slice
(
rss
.
indexOf
(
"
<title>
"
)
+
7
,
rss
.
indexOf
(
"
</title>
"
));
return
gadget
.
is_already_loaded
(
title
)
.
push
(
function
(
is_loaded
){
if
(
!
is_loaded
){
return
gadget
.
remove_css
(
rss
)
.
push
(
function
(
rss_without_css
){
return
storage
.
add_attachment
(
title
,
rss_without_css
);
});
}
});
}
};
xmlhttp
.
open
(
"
GET
"
,
link
,
true
);
xmlhttp
.
send
();
});
})
.
declareMethod
(
"
remove_css
"
,
function
(
body
){
...
...
@@ -50,8 +42,11 @@
return
body
.
replace
(
regEx
,
""
);
})
.
declareMethod
(
"
is_already_parsed
"
,
function
(
title
){
return
this
.
state
.
storage
.
all_loaded_docs
()
.
declareMethod
(
"
is_already_loaded
"
,
function
(
title
){
return
this
.
get_model
()
.
push
(
function
(
storage
){
return
storage
.
all_loaded_docs
();
})
.
push
(
function
(
result
){
var
i
;
for
(
i
=
0
;
i
<
result
.
data
.
rows
.
length
;
i
+=
1
){
...
...
search.html
View file @
7576610c
...
...
@@ -4,6 +4,7 @@
<title>
Mynij
</title>
<script
src=
"../jio/external/rsvp-2.0.4.js"
></script>
<script
src=
"../jio/dist/jio-latest.js"
></script>
<script
src=
"jio.my_parser_storage.js"
></script>
<script
src=
"../renderjs/dist/renderjs-latest.js"
></script>
<script
src=
"search.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"mynij.css"
>
...
...
search.js
View file @
7576610c
...
...
@@ -23,10 +23,6 @@
]
})
.
allowPublicAcquisition
(
"
get_model
"
,
function
(){
return
this
.
getDeclaredGadget
(
"
model
"
);
})
.
ready
(
function
(){
var
model_gadget
,
result_gadget
;
...
...
@@ -64,9 +60,17 @@
}
RSVP
.
all
(
promise_list
);
})
.
allowPublicAcquisition
(
"
get_model
"
,
function
(){
return
this
.
getDeclaredGadget
(
"
model
"
);
})
.
declareMethod
(
"
search
"
,
function
(
key
){
var
gadget
=
this
,
return
this
.
state
.
model_gadget
.
search
()
.
push
(
function
(
result
){
console
.
log
(
result
);
})
/*var gadget = this,
options;
options = {
...
...
@@ -102,7 +106,7 @@
promise_list.push(gadget.state.result_gadget.addItem(result_list[j], key));
}
return RSVP.all(promise_list);
});
});
*/
})
.
onEvent
(
"
submit
"
,
function
(
event
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment