Advertisement
KiberInfinity

get wiki code

May 9th, 2013
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function vkGetWikiCode(pid,gid){
  2.    var params={gid:gid}
  3.    if ((pid+"").match(/^\d+$/)){
  4.       params['pid']=pid;
  5.    } else {
  6.       params['title']=pid;
  7.    }
  8.     dApi.call('pages.get',params,function(r){
  9.       var data=r.response;
  10.       if (!data.source) {
  11.          alert('Nothing...');
  12.          return;
  13.       }
  14.       var code=(data.source || "").replace(/<br>/gi,'\r\n');
  15.       var box=vkAlertBox('Wiki-code','<h2>'+data.title+'</h2><textarea id="vk_wikicode_area" style="width:460px; height:300px;">'+code+'</textarea>');
  16.       box.setOptions({width:'500px'});
  17.    });
  18.    return false;
  19. }
  20.  
  21. vkGetWikiCode('id_страницы','id_группы');
Advertisement
RAW Paste Data Copied
Advertisement