Last active
December 30, 2015 14:19
-
-
Save karmiphuc/7841535 to your computer and use it in GitHub Desktop.
Strip an article post and send to Blogger http://g.karmiphuc.com/Updated sources:1. Blogspot Blogs2. Tinhte.vn3. Hongkiat.com4. Alltop.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function () { | |
function importJquery(look_for, onload) { | |
var src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js'; | |
var s = document.createElement('script'); | |
s.setAttribute('type', 'text/javascript'); | |
s.setAttribute('src', src); | |
if (onload) wait_for_script_load(look_for, onload); | |
var head = document.getElementsByTagName('head')[0]; | |
if (head) { | |
head.appendChild(s); | |
} else { | |
document.body.appendChild(s); | |
} | |
} | |
function wait_for_script_load(look_for, callback) { | |
var interval = setInterval(function () { | |
if (eval("typeof " + look_for) != 'undefined') { | |
clearInterval(interval); | |
callback(); | |
} | |
}, 50); | |
} | |
importJquery('jQuery', function () { | |
if (location.href.indexOf('tinhte.vn/') > -1) { | |
var _title = $('.titleBar h1')[0].innerHTML; | |
var _body = $('.primaryContent .messageContent article blockquote')[0].innerHTML; | |
} else if (location.href.indexOf('www.hongkiat.com/') > -1) { | |
var _title = $('.post.clearfix h1')[0].innerHTML; | |
var _body = $('div.sContent')[0].innerHTML; | |
} else if (location.href.indexOf('alltop.com/') > -1) { | |
var _title = $('div.entry h3 a')[0].innerHTML; | |
var _body = $('div.post-body')[0].innerHTML | |
} else { | |
var _bodyDom = $('[class*=content][itemprop="description articleBody"],[itemprop="articleBody"]')[0]; | |
if (typeof _bodyDom == 'undefined') { | |
_bodyDom = $('.post-content, .post-body, .article-content, .entry-content, [class*=content-article]'); | |
if (_bodyDom.length) _bodyDom = _bodyDom[0]; | |
} | |
var _body = _bodyDom.innerHTML.trim(); | |
var _titleDom = $('.post-title, .entry-title, .title-content, article h1, [class=entry-title], .story-header, #post-wrapper h3')[0]; | |
if (typeof _titleDom == 'undefined') { | |
_titleDom = $('[class*=title][itemprop=name]'); | |
if (_titleDom.length) _titleDom = _titleDom[0]; | |
} | |
if (_titleDom.children.length) { | |
var _title = _titleDom.children[0].innerHTML.trim(); | |
} else var _title = _titleDom.innerHTML.trim(); | |
} | |
var f = document.createElement("form"); | |
f.setAttribute('id', "frm"); | |
f.setAttribute('method', "post"); | |
f.setAttribute('action', "http://karmiphuc.com/php/mailBlogger.php"); | |
var i = document.createElement("input"); | |
i.setAttribute('type', "hidden"); | |
i.setAttribute('name', "subject"); | |
var s = document.createElement("input"); | |
s.setAttribute('type', "hidden"); | |
s.setAttribute('name', "body"); | |
var u = document.createElement("input"); | |
u.setAttribute('type', "hidden"); | |
u.setAttribute('name', "lnk"); | |
var r = document.createElement("input"); | |
r.setAttribute('type', "hidden"); | |
r.setAttribute('name', "ref"); | |
var mode = document.createElement("input"); | |
mode.setAttribute('type', "hidden"); | |
mode.setAttribute('name', "ripImage"); | |
f.appendChild(i); | |
f.appendChild(s); | |
f.appendChild(u); | |
f.appendChild(r); | |
f.appendChild(mode); | |
document.getElementsByTagName('body')[0].appendChild(f); | |
var frm = document.getElementById('frm'); | |
frm.children.subject.value = _title; | |
frm.children.body.value = _body; | |
frm.children.lnk.value = location.href; | |
frm.children.ref.value = location.host; | |
frm.children.ripImage.value = confirm('Should I rip all images and upload them to Imgur?!'); | |
frm.submit(); | |
}); | |
})(); | |
void(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment