-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbookmarklet.js
More file actions
58 lines (50 loc) · 1.46 KB
/
Copy pathbookmarklet.js
File metadata and controls
58 lines (50 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
if (!($ = window.jQuery)) { // typeof jQuery=='undefined' works too
script = document.createElement( 'script' );
script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
script.onload=Readify;
document.body.appendChild(script);
}
else {
Readify();
}
function Readify() {
alert('lets make this page beautifull!');
//remove unnecessary elements
//jQuery('img,link,style,a,form,header,#header,footer,#footer').remove();
/*$('body *')
.filter(function() {
return $.trim($(this).text()) === ''
})
.remove()
.css({
'font-size':'1.3em',
'line-height':'0.5em'
});*/
var highest =0;
var mainContainer;
$("body *").each(function () {
$current = $(this);
if ( $current.outerHeight() > highest ) {
mainContainer = this;
highest = $current.outerHeight();
}
});
var $newContainer = $(mainContainer).html();
$($newContainer + 'img, '
+ $newContainer + ' script, '
+ $newContainer + ' style,'
+ $newContainer + ' a,'
+ $newContainer + ' form,'
+ $newContainer + ' header,'
+ $newContainer + ' #header,'
+ $newContainer + 'footer,'
+ $newContainer + ' #footer').remove();
function replaceEmptyHTML(html){
console.log(html.replace("/<[^\/>][^>]*><\/[^>]+>/",""));
// replaceEmptyHTML(html)
}
replaceEmptyHTML($newContainer);
console.log($newContainer);
// $('html').remove('body');
// $('html').html($newContainer);
}