Created
April 18, 2016 21:39
-
-
Save jenya239/6661a0fb50f2f08b6d89155867a95f2e to your computer and use it in GitHub Desktop.
vk photo move to album panel
This file contains hidden or 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
var ma = document.createElement('div'); | |
ma.setAttribute('style', 'font-size: 8px; width: 255px; right: 90px; opacity: 0.8; z-index: 700; position: absolute; background: white;'); | |
document.querySelector('div.pv_fixed').appendChild(ma); | |
ajax.post('al_photos.php', { | |
act: 'a_move_to_album_box', | |
photo_id: cur.pvCurPhoto.id | |
}, { | |
onDone: function(title, html, js, data) { | |
var el = document.createElement('div'); | |
el.innerHTML = html; | |
var albums = el.querySelector('div.pv_movebox_albums_wrap').children; | |
var mahtml = ''; | |
for (var i = 0; i < albums.length; i++) { | |
var album = albums[i]; | |
var name = album.querySelector('div.pv_movebox_album_name').innerHTML; | |
var count = album.querySelector('div.pv_movebox_album_count').innerHTML.replace(/\D/g, ''); | |
var cover = album.querySelector('img.pv_movebox_thumb').src; | |
var onclick = album.getAttribute('onclick').replace(/[\'\(\)]/g, '').split(', '); | |
var id = onclick[1]; | |
hash = onclick[2]; | |
var s = "<div style=\"display: inline-block; width: 50px; cursor: pointer; border-bottom: 1px solid grey; border-right: 1px solid grey;\" onclick=\"Photoview.moveToAlbum(cur.pvCurPhoto.id, '" + id + "', '" + hash + "'); Photoview.show(false, cur.pvIndex+1, event)\">" + name + " (" + count + ")<br/><img width=\"49\" height=\"16\" src=\"" + cover + "\"/></div>"; | |
mahtml += s; | |
}; | |
ma.innerHTML = mahtml; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment