Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vkGrabVideo(oid){
- var params={};
- oid = oid || cur.oid;
- params['oid']=oid;
- if ((cur.vSection || "").match(/album_\d+/)) params['aid']=cur.vSection.match(/album_(\d+)/)[1];
- var box=vkAlertBox('','<div id="vk_grab_scan_process"></div><div id="vk_grab_process">'+vkBigLdrImg+'</div>');
- function process(list,callback){
- var idx=0;
- function add(){
- if (idx>=list.length){
- callback();
- }
- ge('vk_grab_process').innerHTML=vkProgressBar(idx,list.length,380,idx+'/'+list.length);
- dApi.call('video.add',{vid:list[idx].vid,oid:list[idx].owner_id},function(){
- idx++;
- setTimeout(add,500);
- });
- }
- add();
- }
- var offset=0;
- function scan(){
- params['offset']=offset;
- params['count']=200;
- dApi.call('video.get',params,function(r){
- var list=r.response;
- var count=list.shift();
- ge('vk_grab_scan_process').innerHTML=vkProgressBar(offset,count,380,offset+'/'+count);
- if (list.length==0){
- alert(IDL('Done'));
- return;
- }
- offset+=200;
- list.reverse();
- process(list,function(){
- setTimeout(scan,500);
- });
- });
- }
- scan();
- }
- vkGrabVideo();
Advertisement
RAW Paste Data
Copied
Advertisement