Skip to content

Instantly share code, notes, and snippets.

@MrSwed
Last active March 22, 2019 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrSwed/2ad486a083688af89d863f5be7a2b0f8 to your computer and use it in GitHub Desktop.
Save MrSwed/2ad486a083688af89d863f5be7a2b0f8 to your computer and use it in GitHub Desktop.
Отзывы с гиперкомента в Jot MODX
// use in debug console browser
//
var $d=[];
$(".comments__block").each(function(){
var t = this,
dt = $(".comments__table__items__date",t).text().match(/(\d+)[-;:.,]?(\d+)[-;:.,]?(\d+) (\d+):(\d+):(\d+)?/);
var r = {
'title' : $(".comments__table__items__name",t).clone().children().remove().end().text(),
'tagid' :'',
'flags' :'',
'sechash': '',
'published': 1,
'uparent':11, // ID of MODX page source
'parent':0,
'mode': 0,
'secip': $(".comments__table__items__name__ip",t).text(),
'content':$(".comments__table__items__text",t).text(),
'createdby': 0,
'createdon' : new Date( dt[3]>2000?dt[2]:2000+(1*dt[2]) , parseInt(dt[2], 10) - 1 ,dt[1], dt[4], dt[5], dt[6] ).getTime() / 1000,
};
$d.push("INSERT INTO `modx_jot_content` (`"
+ Object.keys(r).join("`, `")
+ "`) VALUES ( '",
Object.values(r).join("', '"),
"'")
});
$d.join(";\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment