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
677c64a2
Commit
677c64a2
authored
May 27, 2019
by
Alexandra Rogova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test : remove styling in HTML while parsing
parent
a86a462d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
17 deletions
+26
-17
gadget_parser.js
gadget_parser.js
+26
-17
No files found.
gadget_parser.js
View file @
677c64a2
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
link_end
=
local_cur_text
.
indexOf
(
"
</link>
"
),
link_end
=
local_cur_text
.
indexOf
(
"
</link>
"
),
body_start
=
local_cur_text
.
indexOf
(
"
<description>
"
),
body_start
=
local_cur_text
.
indexOf
(
"
<description>
"
),
body_end
=
local_cur_text
.
indexOf
(
"
</description>
"
)
+
14
;
body_end
=
local_cur_text
.
indexOf
(
"
</description>
"
)
+
14
;
return
this
.
parse_body
(
local_cur_text
.
slice
(
body_start
,
body_end
))
return
this
.
remove_css
(
local_cur_text
.
slice
(
body_start
,
body_end
))
.
push
(
function
(
result
){
.
push
(
function
(
result
){
return
storage
.
put
({
return
storage
.
put
({
"
title
"
:
local_cur_text
.
slice
(
title_start
,
title_end
),
"
title
"
:
local_cur_text
.
slice
(
title_start
,
title_end
),
...
@@ -57,16 +57,25 @@
...
@@ -57,16 +57,25 @@
});
});
})
})
.
declareMethod
(
"
parse_body
"
,
function
(
body
){
.
declareMethod
(
"
remove_css
"
,
function
(
body
){
/*var before,
var
regEx
,
after;
result
;
while (body.indexOf("<span style") > -1){
regEx
=
new
RegExp
(
'
<style.*/>
'
);
before = body.slice(0, body.indexOf("<span style"));
after = body.slice(body.indexOf("">"), body.length -1);
do
{
body = before + after;
result
=
regEx
.
exec
(
body
);
}
body_before
=
body
.
slice
(
0
,
result
.
index
);
console.log(body);*/
body_after
=
body
.
slice
(
result
.
index
+
result
[
0
].
length
+
1
);
return
body
;
body
=
body_before
+
body_after
;
}
while
(
result
!==
null
);
regEx
=
new
RegExp
(
'
(<span style=.*>|<span style.*">)
'
);
do
{
result
=
regEx
.
exec
(
body
);
body_before
=
body
.
slice
(
0
,
result
.
index
);
body_after
=
body
.
slice
(
result
.
index
+
result
[
0
].
length
+
1
);
body
=
body_before
+
'
<span>
'
+
body_after
;
}
while
(
result
!==
null
);
})
})
.
declareMethod
(
"
is_already_parsed
"
,
function
(
storage
,
title
){
.
declareMethod
(
"
is_already_parsed
"
,
function
(
storage
,
title
){
...
...
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