PageSourceSearch

http://gmm-shop.ru/bitrix/templates/restruct_two/js/openapi.js

js gmm-shop.ru collected 2026-10-08 15:18:28 UTC 64,616 bytes, 1,829 lines download raw bytes

1(function(w) {
2if (w.fastXDM) return;
3
4var handlers = {};
5var onEnvLoad = [];
6var env = {};
7
8// Key generation
9function genKey() {
10  var key = '';
11  for (i=0;i<5;i++) key += Math.ceil(Math.random()*15).toString(16);
12  return key;
13}
14function waitFor(obj, prop, func, self,  count) {
15  if (obj[prop]) {
16     func.apply(self);
17  } else {
18    count = count || 0;
19    if (count < 1000) setTimeout(function() {
20      waitFor(obj, prop, func, self, count + 1)
21    }, 0);
22  }
23}
24function attachScript(url) {
25  setTimeout(function() {
26    var newScript = document.createElement('script');
27    newScript.type = 'text/javascript';
28    newScript.src = url || w.fastXDM.helperUrl;
29    waitFor(document, 'body', function() {
30      document.getElementsByTagName('HEAD')[0].appendChild(newScript);
31    });
32  }, 0);
33}
34
35function walkVar(value, clean) {
36  switch (typeof value) {
37    case 'string':
38      if (clean) {
39        return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
40      }
41      return value.replace(/&#039;/g, '\'').replace(/&quot;/g, '"').replace(/&gt;/g, '>').replace(/&lt;/g, '<').replace(/&amp;/g, '&');
42
43    case 'object':
44      if (Object.prototype.toString.apply(value) === '[object Array]') {
45        newValue = [];
46        for (var i = 0; i < value.length; i++) {
47          newValue[i] = walkVar(value[i], clean);
48        }
49      } else {
50        for (var k in value) {
51          newValue = {};
52          if (Object.hasOwnProperty.call(value, k)) {
53            newValue[k] = walkVar(value[k], clean);
54          }
55        }
56      }
57    default:
58      newValue = value;
59  }
60
61  return newValue;
62}
63
64// Env functions
65function getEnv(callback, self) {
66  if (env.loaded) {
67    callback.apply(self, [env]);
68  } else {
69    onEnvLoad.push([self, callback]);
70  }
71}
72
73function envLoaded() {
74  env.loaded = true;
75  var i = onEnvLoad.length;
76  while (i--) {
77    onEnvLoad[i][1].apply(onEnvLoad[i][0], [env]);
78  }
79}
80
81function applyMethod(strData, self) {
82  getEnv(function(env) {
83    var data = env.json.parse(strData);
84    if (data[0]) {
85      if (!data[1]) data[1] = [];
86      var i = data[1].length;
87      while (i--) {
88        if (data[1][i]._func) {
89          var funcNum = data[1][i]._func;
90          data[1][i] = function() {
91            var args = Array.prototype.slice.call(arguments);
92            args.unshift('_func'+funcNum);
93            self.callMethod.apply(self, args);
94          }
95        } else if (self.options.safe) {
96          data[1][i] = walkVar(data[1][i], true);
97        }
98      }
99      setTimeout(function() {
100        if (!self.methods[data[0]]) {
101          throw Error('fastXDM: Method ' + data[0] + ' is undefined');
102        }
103        self.methods[data[0]].apply(self, data[1]);
104      }, 0);
105    }
106  });
107}
108
109// XDM object
110w.fastXDM = {
111  _id: 0,
112  helperUrl: ((location.protocol === 'https:') ? 'https:' : 'http:') + '//vk.com/js/api/xdmHelper.js',
113
114  Server: function(methods, filter, options) {
115    this.methods = methods || {};
116    this.id = w.fastXDM._id++;
117    this.options = options || {};
118    this.filter = filter;
119    this.key = genKey();
120    this.methods['%init%'] = this.methods.__fxdm_i = function() {
121      w.fastXDM.run(this.id);
122      if (this.methods.onInit) this.methods.onInit();
123    };
124    this.frameName = 'fXD'+this.key;
125    this.server = true;
126    handlers[this.key] = [applyMethod, this];
127  },
128
129  Client: function(methods, options) {
130    this.methods = methods || {};
131    this.id = w.fastXDM._id++;
132    this.options = options || {};
133    w.fastXDM.run(this.id);
134    if (window.name.indexOf('fXD') === 0) {
135      this.key = window.name.substr(3);
136    } else {
137      throw Error('Wrong window.name property.');
138    }
139    this.caller = window.parent;
140    handlers[this.key] = [applyMethod, this];
141    this.client = true;
142
143    w.fastXDM.on('helper', function() {
144      w.fastXDM.onClientStart(this);
145    }, this);
146
147    getEnv(function(env) {
148      env.send(this, env.json.stringify(['%init%']));
149      var methods = this.methods;
150      setTimeout(function() {
151        if (methods.onInit) methods.onInit();
152      }, 0);
153    }, this);
154  },
155
156  onMessage: function(e) {
157    if (!e.data) return false;
158    var key = e.data.substr(0, 5);
159    if (handlers[key]) {
160      var self = handlers[key][1];
161      if (self && (!self.filter || self.filter(e.origin))) {
162        handlers[key][0](e.data.substr(6), self);
163      }
164    }
165  },
166
167  setJSON: function(json) {
168    env.json = json;
169  },
170
171  getJSON: function(callback) {
172    if (!callback) return env.json;
173    getEnv(function(env) {
174      callback(env.json);
175    });
176  },
177
178  setEnv: function(exEnv) {
179    var i;
180    for (i in exEnv) {
181      env[i] = exEnv[i];
182    }
183    envLoaded();
184  },
185
186  _q: {},
187
188  on: function(key, act, self) {
189    if (!this._q[key]) this._q[key] = [];
190    if (this._q[key] == -1) {
191      act.apply(self);
192    } else {
193      this._q[key].push([act, self]);
194    }
195  },
196
197  run: function(key) {
198    var len = (this._q[key] || []).length;
199    if (this._q[key] && len > 0) {
200      for (var i = 0; i < len; i++) this._q[key][i][0].apply(this._q[key][i][1]);
201    }
202    this._q[key] = -1;
203  },
204
205  waitFor: waitFor
206}
207
208w.fastXDM.Server.prototype.start = function(obj, count) {
209  if (obj.contentWindow) {
210    this.caller = obj.contentWindow;
211    this.frame = obj;
212
213    w.fastXDM.on('helper', function() {
214      w.fastXDM.onServerStart(this);
215    }, this);
216
217  } else { // Opera old versions
218    var self = this;
219    count = count || 0;
220    if (count < 50) setTimeout(function() {
221      self.start.apply(self, [obj, count+1]);
222    }, 100);
223  }
224}
225
226w.fastXDM.Server.prototype.destroy = function() {
227  handlers.splice(handlers.indexOf(this.key), 1);
228}
229
230function extend(obj1, obj2){
231  for (var i in obj2) {
232    if (obj1[i] && typeof(obj1[i]) == 'object') {
233      extend(obj1[i], obj2[i])
234    } else {
235      obj1[i] = obj2[i];
236    }
237  }
238}
239
240w.fastXDM.Server.prototype.append = function(obj, options) {
241  var div = document.createElement('DIV');
242  div.innerHTML = '<iframe name="'+this.frameName+'" ></iframe>';
243  var frame = div.firstChild;
244  var self = this;
245  setTimeout(function() {
246    frame.frameBorder = '0';
247    if (options) extend(frame, options);
248    obj.insertBefore(frame, obj.firstChild);
249    self.start(frame);
250  }, 0);
251  return frame;
252}
253
254w.fastXDM.Client.prototype.callMethod = w.fastXDM.Server.prototype.callMethod = function() {
255  var args = Array.prototype.slice.call(arguments);
256  var method = args.shift();
257  var i = args.length;
258  while (i--) {
259    if (typeof(args[i]) == 'function') {
260      this.funcsCount = (this.funcsCount || 0) + 1;
261      var func = args[i];
262      var funcName = '_func' + this.funcsCount;
263      this.methods[funcName] = function() {
264        func.apply(this, arguments);
265        delete this.methods[funcName];
266      }
267      args[i] = {_func: this.funcsCount};
268    } else if (this.options.safe) {
269      args[i] = walkVar(args[i], false);
270    }
271  }
272  waitFor(this, 'caller', function() {
273    w.fastXDM.on(this.id, function() {
274      getEnv(function(env) {
275        env.send(this, env.json.stringify([method, args]));
276      }, this);
277    }, this);
278  }, this);
279}
280
281if (w.JSON && typeof(w.JSON) == 'object' && w.JSON.parse && w.JSON.stringify && w.JSON.stringify({a:[1,2,3]}).replace(/ /g, '') == '{"a":[1,2,3]}') {
282  env.json = {parse: w.JSON.parse, stringify: w.JSON.stringify};
283} else {
284  w.fastXDM._needJSON = true;
285}
286
287// PostMessage cover
288if (w.postMessage) {
289  env.protocol = 'p';
290  env.send = function(xdm, strData) {
291    var win = (xdm.frame ? xdm.frame.contentWindow : xdm.caller);
292    win.postMessage(xdm.key+':'+strData, "*");
293  }
294  if (w.addEventListener) {
295    w.addEventListener("message", w.fastXDM.onMessage, false);
296  } else {
297    w.attachEvent("onmessage", w.fastXDM.onMessage);
298  }
299
300  if (w.fastXDM._needJSON) {
301    w.fastXDM._onlyJSON = true;
302    attachScript();
303  } else {
304    envLoaded();
305  }
306} else {
307  attachScript();
308}
309})(window);
310
311
312if (!window.VK) window.VK = {};
313
314
315/*
316 * Based on JavaScript implementation of the RSA Data Security, Inc. MD5 Message
317 * Copyright (C) Paul Johnston 1999 - 2009
318 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
319 * Distributed under the BSD License
320 */
321if(!VK.MD5){VK.MD5=function(n){var j=function(o,r){var q=(o&65535)+(r&65535),p=(o>>16)+(r>>16)+(q>>16);return(p<<16)|(q&65535)},g=function(o,p){return(o<<p)|(o>>>(32-p))},k=function(w,r,p,o,v,u){return j(g(j(j(r,w),j(o,u)),v),p)},a=function(q,p,w,v,o,u,r){return k((p&w)|((~p)&v),q,p,o,u,r)},h=function(q,p,w,v,o,u,r){return k((p&v)|(w&(~v)),q,p,o,u,r)},c=function(q,p,w,v,o,u,r){return k(p^w^v,q,p,o,u,r)},m=function(q,p,w,v,o,u,r){return k(w^(p|(~v)),q,p,o,u,r)},b=function(A,u){var z=1732584193,y=-271733879,w=-1732584194,v=271733878,r,q,p,o;A[u>>5]|=128<<((u)%32);A[(((u+64)>>>9)<<4)+14]=u;for(var t=0,s=A.length;t<s;t+=16){r=z;q=y;p=w;o=v;z=a(z,y,w,v,A[t+0],7,-680876936);
321v=a(v,z,y,w,A[t+1],12,-389564586);w=a(w,v,z,y,A[t+2],17,606105819);y=a(y,w,v,z,A[t+3],22,-1044525330);z=a(z,y,w,v,A[t+4],7,-176418897);v=a(v,z,y,w,A[t+5],12,1200080426);w=a(w,v,z,y,A[t+6],17,-1473231341);y=a(y,w,v,z,A[t+7],22,-45705983);z=a(z,y,w,v,A[t+8],7,1770035416);v=a(v,z,y,w,A[t+9],12,-1958414417);w=a(w,v,z,y,A[t+10],17,-42063);y=a(y,w,v,z,A[t+11],22,-1990404162);z=a(z,y,w,v,A[t+12],7,1804603682);v=a(v,z,y,w,A[t+13],12,-40341101);w=a(w,v,z,y,A[t+14],17,-1502002290);y=a(y,w,v,z,A[t+15],22,1236535329);z=h(z,y,w,v,A[t+1],5,-165796510);v=h(v,z,y,w,A[t+6],9,-1069501632);w=h(w,v,z,y,A[t+11],14,643717713);y=h(y,w,v,z,A[t+0],20,-373897302);z=h(z,y,w,v,A[t+5],5,-701558691);v=h(v,z,y,w,A[t+10],9,38016083);w=h(w,v,z,y,A[t+15],14,-660478335);y=h(y,w,v,z,A[t+4],20,-405537848);z=h(z,y,w,v,A[t+9],5,568446438);v=h(v,z,y,w,A[t+14],9,-1019803690);w=h(w,v,z,y,A[t+3],14,-187363961);y=h(y,w,v,z,A[t+8],20,1163531501);z=h(z,y,w,v,A[t+13],5,-1444681467);v=h(v,z,y,w,A[t+2],9,-51403784);w=h(w,v,z,y,A[t+7],14,1735328473);y=h(y,w,v,z,A[t+12],20,-1926607734);z=c(z,y,w,v,A[t+5],4,-378558);v=c(v,z,y,w,A[t+8],11,-2022574463);w=c(w,v,z,y,A[t+11],16,1839030562);y=c(y,w,v,z,A[t+14],23,-35309556);z=c(z,y,w,v,A[t+1],4,-1530992060);v=c(v,z,y,w,A[t+4],11,1272893353);w=c(w,v,z,y,A[t+7],16,-155497632);y=c(y,w,v,z,A[t+10],23,-1094730640);z=c(z,y,w,v,A[t+13],4,681279174);v=c(v,z,y,w,A[t+0],11,-358537222);w=c(w,v,z,y,A[t+3],16,-722521979);y=c(y,w,v,z,A[t+6],23,76029189);z=c(z,y,w,v,A[t+9],4,-640364487);v=c(v,z,y,w,A[t+12],11,-421815835);w=c(w,v,z,y,A[t+15],16,530742520);y=c(y,w,v,z,A[t+2],23,-995338651);z=m(z,y,w,v,A[t+0],6,-198630844);v=m(v,z,y,w,A[t+7],10,1126891415);w=m(w,v,z,y,A[t+14],15,-1416354905);y=m(y,w,v,z,A[t+5],21,-57434055);z=m(z,y,w,v,A[t+12],6,1700485571);v=m(v,z,y,w,A[t+3],10,-1894986606);w=m(w,v,z,y,A[t+10],15,-1051523);y=m(y,w,v,z,A[t+1],21,-2054922799);z=m(z,y,w,v,A[t+8],6,1873313359);v=m(v,z,y,w,A[t+15],10,-30611744);w=m(w,v,z,y,A[t+6],15,-1560198380);y=m(y,w,v,z,A[t+13],21,1309151649);z=m(z,y,w,v,A[t+4],6,-145523070);v=m(v,z,y,w,A[t+11],10,-1120210379);w=m(w,v,z,y,A[t+2],15,718787259);y=m(y,w,v,z,A[t+9],21,-343485551);z=j(z,r);y=j(y,q);w=j(w,p);v=j(v,o)}return[z,y,w,v]},f=function(r){var q="",s=-1,p=r.length,o,t;while(++s<p){o=r.charCodeAt(s);t=s+1<p?r.charCodeAt(s+1):0;if(55296<=o&&o<=56319&&56320<=t&&t<=57343){o=65536+((o&1023)<<10)+(t&1023);s++}if(o<=127){q+=String.fromCharCode(o)}else{if(o<=2047){q+=String.fromCharCode(192|((o>>>6)&31),128|(o&63))}else{if(o<=65535){q+=String.fromCharCode(224|((o>>>12)&15),128|((o>>>6)&63),128|(o&63))}else{if(o<=2097151){q+=String.fromCharCode(240|((o>>>18)&7),128|((o>>>12)&63),128|((o>>>6)&63),128|(o&63))}}}}}return q},e=function(p){var o=Array(p.length>>2),r,q;for(r=0,q=o.length;r<q;r++){o[r]=0}for(r=0,q=p.length*8;r<q;r+=8){o[r>>5]|=(p.charCodeAt(r/8)&255)<<(r%32)}return o},l=function(p){var o="";for(var r=0,q=p.length*32;r<q;r+=8){o+=String.fromCharCode((p[r>>5]>>>(r%32))&255)}return o},d=function(o){return l(b(e(o),o.length*8))},i=function(q){var t="0123456789abcdef",p="",o;for(var s=0,r=q.length;s<r;s++){o=q.charCodeAt(s);p+=t.charAt((o>>>4)&15)+t.charAt(o&15)}return p};return i(d(f(n)))}}
322
323/*
324 * VKontakte Open API JavaScript library
325 * http://vk.com/
326 */
327
328VK.extend = function(target, source, overwrite) {
329  for (var key in source) {
330    if (overwrite || typeof target[key] === 'undefined') {
331      target[key] = source[key];
332    }
333  }
334  return target;
335};
336
337if (VK._protocol !== 'https:') {
338  VK._protocol = ((location.protocol === 'https:') ? 'https:' : 'http:');
339}
340
341if (!VK.xdConnectionCallbacks) {
342
343VK.extend(VK, {
344  version: 1,
345  _apiId: null,
346  _session: null,
347  _userStatus: 'unknown',
348  _domain: {
349    main: 'https://oauth.vk.com/',
350    api: 'https://api.vk.com/'
351  },
352  _path: {
353    login: 'authorize',
354    proxy: 'fxdm_oauth_proxy.html'
355  },
356  _rootId: 'vk_api_transport',
357  _nameTransportPath: '',
358  xdReady: false,
359  access: {
360    FRIENDS:   0x2,
361    PHOTOS:    0x4,
362    AUDIO:     0x8,
363    VIDEO:     0x10,
364    MATCHES:   0x20,
365    QUESTIONS: 0x40,
366    WIKI:      0x80
367  }
368});
369
370VK.init = function(options) {
371  var body, root;
372
373  VK._apiId = null;
374  if (!options.apiId) {
375    throw Error('VK.init() called without an apiId');
376  }
377  VK._apiId = options.apiId;
378
379  if (options.onlyWidgets) return true;
380
381  if (options.nameTransportPath && options.nameTransportPath !== '') {
382    VK._nameTransportPath = options.nameTransportPath;
383  }
384
385  root = document.getElementById(VK._rootId);
386  if (!root) {
387    root = document.createElement('div');
388    root.id = VK._rootId;
389    body = document.getElementsByTagName('body')[0];
390    body.insertBefore(root, body.childNodes[0]);
391  }
392  root.style.position = 'absolute';
393  root.style.top = '-10000px';
394
395  var session = VK.Cookie.load();
396  if (session) {
397    VK.Auth._loadState = 'loaded';
398    VK.Auth.setSession(session, session ? 'connected' : 'unknown');
399  }
400};
401
402if (!VK.Cookie) {
403VK.Cookie = {
404  _domain: null,
405  load: function() {
406    var
407      cookie = document.cookie.match('\\bvk_app_' + VK._apiId + '=([^;]*)\\b'),
408      session;
409
410    if (cookie) {
411      session = this.decode(cookie[1]);
412      if (session.secret != 'oauth') {
413        return false;
414      }
415      session.expire = parseInt(session.expire, 10);
416      VK.Cookie._domain = '.' + window.location.hostname;//session.base_domain;
417    }
418
419    return session;
420  },
421  setRaw: function(val, ts, domain, time) {
422    var rawCookie;
423    rawCookie = 'vk_app_' + VK._apiId + '=' + val + '';
424    var exp = time ? (new Date().getTime() + time * 1000) : ts * 1000;
425    rawCookie += (val && ts === 0 ? '' : '; expires=' + new Date(exp).toGMTString());
426    rawCookie += '; path=/';
427    rawCookie += (domain ? '; domain=.' + domain : '');
428    document.cookie = rawCookie;
429
430    this._domain = domain;
431  },
432  set: function(session, resp) {
433    if (session) {
434      this.setRaw(this.encode(session), session.expire, window.location.hostname, (resp || {}).time);
435    } else {
436      this.clear();
437    }
438  },
439  clear: function() {
440    this.setRaw('', 0, this._domain, 0);
441  },
442  encode: function(params) {
443    var
444      pairs = [],
445      key;
446
447    for (key in params) {
448      if (key != 'user') pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
449    }
450    pairs.sort();
451
452    return pairs.join('&');
453  },
454  decode: function(str) {
455    var
456      params = {},
457      parts = str.split('&'),
458      i,
459      pair;
460
461    for (i=0; i < parts.length; i++) {
462      pair = parts[i].split('=', 2);
463      if (pair && pair[0]) {
464        params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
465      }
466    }
467
468    return params;
469  }
470};
471}
472
473if (!VK.Api) {
474VK.Api = {
475  _headId: null,
476  _callbacks: {},
477  ie6_7: function() {
478    if (!VK.Api.ieTested) {
479      VK.Api.isIE6_7 = navigator.userAgent.match(/MSIE [6|7]/i);
480      VK.Api.ieTested = true;
481    }
482    return VK.Api.isIE6_7;
483  },
484  attachScript: function(url) {
485    if (!VK.Api._headId) VK.Api._headId = document.getElementsByTagName("head")[0];
486    var newScript = document.createElement('script');
487    newScript.type = 'text/javascript';
488    newScript.setAttribute('encoding', 'UTF-8');
489    newScript.src = url;
490    VK.Api._headId.appendChild(newScript);
491  },
492  checkMethod: function(method, params, cb, queryTry) {
493    var m = method.toLowerCase();
494    if (m == 'wall.post' || m == 'activity.set') {
495      var text = (m == 'activity.set') ? params.text : params.message;
496      var query =  VK._protocol + '//vk.com/al_apps.php?act=wall_post_box&widget=1&method='+m+'&aid=' + parseInt(VK._apiId, 10) + '&text=' + encodeURIComponent(text);
497      if (m == 'wall.post') {
498        query += '&owner_id=' + parseInt(params.owner_id || 0, 10) + '&attachments=' + (params.attachments || params.attachment || '');
499      }
500      var method_access = '_'+(Math.random()).toString(16).substr(2);
501      query += '&method_access='+method_access;
502      var popup = VK.UI.popup({
503        url: query,
504        width: 460,
505        height: 249
506      });
507      var timer = setInterval(function() {
508        if (VK.UI.active.closed) {
509          clearInterval(timer);
510          params.method_access = method_access;
511          VK.Api.call(method, params, cb, queryTry);
512        }
513      }, 500);
514      return false;
515    }
516    return true;
517  },
518  call: function(method, params, cb, queryTry) {
519    var
520      query = params || {},
521      qs,
522      responseCb;
523
524    if (typeof query != 'object' || typeof cb != 'function') {
525      return false;
526    }
527    if (!params.method_access && !params.method_force && !VK.Api.checkMethod(method, params, cb, queryTry)) {
528      return;
529    }
530
531    if (!queryTry) queryTry = 0;
532
533    if (VK.Auth._loadState != 'loaded') {
534      var authFunc = function(result) {
535        if (result && result.session) {
536          VK.Observer.unsubscribe('auth.loginStatus', authFunc);
537          VK.Api.call(method, params, cb);
538        }
539      };
540      VK.Observer.subscribe('auth.loginStatus', authFunc);
541      VK.Auth.getLoginStatus();
542      return;
543    }
544
545    if (VK.Api.queryLength(query) < 1500 && !VK.Api.ie6_7()) {
546      var useXDM = false;
547      var rnd = parseInt(Math.random() * 10000000, 10);
548      while (VK.Api._callbacks[rnd]) {
549        rnd = parseInt(Math.random() * 10000000, 10)
550      }
551      query.callback = 'VK.Api._callbacks['+rnd+']';
552    } else {
553      var useXDM = true;
554    }
555
556    if (VK._session && VK._session.sid) {
557      query.access_token = VK._session.sid;
558    }
559
560    qs = VK.Cookie.encode(query);
561
562    responseCb = function(response) {
563      if (response.error && (response.error.error_code == 3 || response.error.error_code == 4 || response.error.error_code == 5)) {
564        if (queryTry > 3) return false;
565        var repeatCall = function(resp) {
566          VK.Observer.unsubscribe('auth.sessionChange', repeatCall);
567          delete params.access_token;
568          if (resp.session) VK.Api.call(method, params, cb, queryTry + 1);
569        }
570        VK.Observer.subscribe('auth.sessionChange', repeatCall);
571        VK.Auth.getLoginStatus();
572      } else {
573        cb(response);
574      }
575      if (!useXDM) delete VK.Api._callbacks[rnd];
576    };
577
578    if (useXDM) {
579      if (VK.xdReady) {
580        VK.XDM.remote.callMethod('apiCall', method, qs, responseCb);
581      } else {
582        VK.Observer.subscribe('xdm.init', function() {
583          VK.XDM.remote.callMethod('apiCall', method, qs, responseCb);
584        });
585        VK.XDM.init();
586      }
587    } else {
588      VK.Api._callbacks[rnd] = responseCb;
589      VK.Api.attachScript(VK._domain.api + 'method/' + method +'?' + qs);
590    }
591  },
592  queryLength: function(query) {
593    var len = 100, i; // sid + sig
594    for (i in query) {
595      len += i.length + encodeURIComponent(query.i).length + 1;
596    }
597    return len;
598  }
599};
600
601// Alias
602VK.api = function(method, params, cb) {VK.Api.call(method, params, cb);}
603};
604
605if (!VK.Auth) {
606VK.Auth = {
607  popup: null,
608  lsCb: {},
609  setSession: function(session, status, settings, resp) {
610    var
611      login = !VK._session && session,
612      logout = VK._session && !session,
613      both = VK._session && session && VK._session.mid != session.mid,
614      sessionChange = login || logout || (VK._session && session && VK._session.sid != session.sid),
615      statusChange = status != VK._userStatus,
616      response = {
617        'session': session,
618        'status': status,
619        'settings': settings
620      };
621
622    VK._session = session;
623
624    VK._userStatus = status;
625
626    VK.Cookie.set(session, resp);
627
628    if (sessionChange || statusChange || both) {
629      setTimeout(function() {
630        if (statusChange) {
631          VK.Observer.publish('auth.statusChange', response);
632        }
633
634        if (logout || both) {
635          VK.Observer.publish('auth.logout', response);
636        }
637
638        if (login || both) {
639          VK.Observer.publish('auth.login', response);
640        }
641
642        if (sessionChange) {
643          VK.Observer.publish('auth.sessionChange', response);
644        }
645      }, 0);
646    }
647
648    return response;
649  },
650  // Public VK.Auth methods
651  login: function(cb, settings) {
652    var channel, url;
653    if (!VK._apiId) {
654      return false;
655    }
656    channel = window.location.protocol + '//' + window.location.hostname;
657    url = VK._domain.main + VK._path.login + '?client_id='+VK._apiId+'&display=popup&redirect_uri=close.html&response_type=token';
658    if (settings && parseInt(settings, 10) > 0) {
659      url += '&scope=' + settings;
660    }
661    VK.Observer.unsubscribe('auth.onLogin');
662    VK.Observer.subscribe('auth.onLogin', cb);
663    VK.UI.popup({
664      width: 620,
665      height: 370,
666      url: url
667    });
668    var authCallback = function() {
669      VK.Auth.getLoginStatus(function(resp) {
670        VK.Observer.publish('auth.onLogin', resp);
671        VK.Observer.unsubscribe('auth.onLogin');
672      }, true);
673    }
674
675    VK.UI.popupOpened = true;
676    var popupCheck = function() {
677      if (!VK.UI.popupOpened) return false;
678      try {
679        if (!VK.UI.active.top || VK.UI.active.closed) {
680          VK.UI.popupOpened = false;
681          authCallback();
682          return true;
683        }
684      } catch(e) {
685        VK.UI.popupOpened = false;
686        authCallback();
687        return true;
688      }
689      setTimeout(popupCheck, 100);
690    };
691
692    setTimeout(popupCheck, 100);
693  },
694  // Logout user from app, vk.com & login.vk.com
695  logout: function(cb) {
696    VK.Auth.revokeGrants(cb);
697  },
698  revokeGrants: function(cb) {
699    var onLogout = function(resp) {
700      VK.Observer.unsubscribe('auth.statusChange', onLogout);
701      if (cb) cb(resp);
702    }
703    VK.Observer.subscribe('auth.statusChange', onLogout);
704    if (VK._session && VK._session.sid) VK.Api.attachScript('https://login.vk.com/?act=openapi&oauth=1&aid=' + parseInt(VK._apiId, 10) + '&location=' + encodeURIComponent(window.location.hostname)+'&do_logout=1&token='+VK._session.sid);
705    VK.Cookie.clear();
706  },
707  // Get current login status from session (sync) (not use on load time)
708  getSession: function() {
709    return VK._session;
710  },
711  // Get current login status from vk.com (async)
712  getLoginStatus: function(cb, force) {
713    if (!VK._apiId) {
714      return;
715    }
716
717    if (cb) {
718      if (!force && VK.Auth._loadState == 'loaded') {
719        cb({status: VK._userStatus, session: VK._session});
720        return;
721      } else {
722        VK.Observer.subscribe('auth.loginStatus', cb);
723      }
724    }
725
726    if (!force && VK.Auth._loadState == 'loading') {
727      return;
728    }
729
730    VK.Auth._loadState = 'loading';
731    var rnd = parseInt(Math.random() * 10000000, 10);
732    while (VK.Auth.lsCb[rnd]) {
733      rnd = parseInt(Math.random() * 10000000, 10)
734    }
735    VK.Auth.lsCb[rnd] = function(response) {
736      delete VK.Auth.lsCb[rnd];
737      VK.Auth._loadState = 'loaded';
738      if (response && response.auth) {
739        var session = {
740          mid: response.user.id,
741          sid: response.access_token,
742          sig: response.sig,
743          secret: response.secret,
744          expire: response.expire
745        };
746        if (force) session.user = response.user;
747        var status = 'connected';
748      } else {
749        var session = null;
750        var status = response.user ? 'logined' : 'unknown';
751        VK.Cookie.clear();
752      }
753      VK.Auth.setSession(session, status, false, response);
754      VK.Observer.publish('auth.loginStatus', {session: session, status: status});
755      VK.Observer.unsubscribe('auth.loginStatus');
756    };
757    // AttachScript here
758    VK.Api.attachScript('https://login.vk.com/?act=openapi&oauth=1&aid=' + parseInt(VK._apiId, 10) + '&location=' + encodeURIComponent(window.location.hostname)+'&rnd='+rnd);
759  }
760};
761}
762
763} else { // if VK.xdConnectionCallbacks
764  setTimeout(function() {
765    var callback;
766    while (callback = VK.xdConnectionCallbacks.pop()) {
767      callback();
768    }
769  }, 0);
770  if (VK.Widgets && !VK.Widgets._constructor) {
771    VK.Widgets = false;
772  }
773}
774
775if (!VK.UI) {
776VK.UI = {
777  active: null,
778  _buttons: [],
779  popup: function(options) {
780    var
781      screenX = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,
782      screenY = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,
783      outerWidth = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.body.clientWidth,
784      outerHeight = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.body.clientHeight - 22),
785      width = options.width,
786      height = options.height,
787      left = parseInt(screenX + ((outerWidth - width) / 2), 10),
788      top = parseInt(screenY + ((outerHeight - height) / 2.5), 10),
789      features = (
790        'width=' + width +
791        ',height=' + height +
792        ',left=' + left +
793        ',top=' + top
794      );
795      this.active = window.open(options.url, 'vk_openapi', features);
796  },
797  button: function(el, handler) {
798    var html = '';
799
800    if (typeof el == 'string') {
801      el = document.getElementById(el);
802    }
803
804
805    this._buttons.push(el);
806    index = this._buttons.length - 1;
807
808    html = (
809      '<table cellspacing="0" cellpadding="0" id="openapi_UI_' + index + '" onmouseover="VK.UI._change(1, ' + index + ');" onmouseout="VK.UI._change(0, ' + index + ');" onmousedown="VK.UI._change(2, ' + index + ');" onmouseup="VK.UI._change(1, ' + index + ');" style="cursor: pointer; border: 0px; font-family: tahoma, arial, verdana, sans-serif, Lucida Sans; font-size: 10px;"><tr style="vertical-align: middle">' +
810      '<td><div style="border: 1px solid #3b6798;border-radius: 2px 0px 0px 2px;-moz-border-radius: 2px 0px 0px 2px;-webkit-border-radius: 2px 0px 0px 2px;"><div style="border: 1px solid #5c82ab; border-top-color: #7e9cbc; background-color: #6D8DB1; color: #fff; text-shadow: 0px 1px #45688E; height: 15px; padding: 2px 4px 0px 6px;line-height: 13px;">&#1042;&#1086;&#1081;&#1090;&#1080;</div></div></td>' +
811      '<td><div style="background: url(' + VK._protocol + '//vk.com/images/btns.png) 0px -42px no-repeat; width: 21px; height: 21px"></div></td>' +
812      '<td><div style="border: 1px solid #3b6798;border-radius: 0px 2px 2px 0px;-moz-border-radius: 0px 2px 2px 0px;-webkit-border-radius: 0px 2px 2px 0px;"><div style="border: 1px solid #5c82ab; border-top-color: #7e9cbc; background-color: #6D8DB1; color: #fff; text-shadow: 0px 1px #45688E; height: 15px; padding: 2px 6px 0px 4px;line-height: 13px;">&#1050;&#1086;&#1085;&#1090;&#1072;&#1082;&#1090;&#1077;</div></div></td>' +
813      '</tr></table>'
814    );
815    el.innerHTML = html;
816    el.style.width = el.childNodes[0].offsetWidth + 'px';
817  },
818  _change: function(state, index) {
819    var row = document.getElementById('openapi_UI_' + index).rows[0];
820    var elems = [row.cells[0].firstChild.firstChild, row.cells[2].firstChild.firstChild];
821    for (var i = 0; i < 2; ++i) {
822       var elem = elems[i];
823      if (state === 0) {
824        elem.style.backgroundColor = '#6D8DB1';
825        elem.style.borderTopColor = '#7E9CBC';
826        elem.style.borderLeftColor = elem.style.borderRightColor = elem.style.borderBottomColor = '#5C82AB';
827      } else if (state == 1) {
828        elem.style.backgroundColor = '#7693B6';
829        elem.style.borderTopColor = '#88A4C4';
830        elem.style.borderLeftColor = elem.style.borderRightColor = elem.style.borderBottomColor = '#6088B4';
831      } else if (state == 2) {
832        elem.style.backgroundColor = '#6688AD';
833        elem.style.borderBottomColor = '#7495B8';
834        elem.style.borderLeftColor = elem.style.borderRightColor = elem.style.borderTopColor = '#51779F';
835      }
836    }
837    if (state === 0 || state == 2) {
838      row.cells[2].firstChild.style.backgroundPosition = '0px -42px';
839    } else if (state == 1) {
840      row.cells[2].firstChild.style.backgroundPosition = '0px -63px';
841    }
842  }
843};
844}
845
846if (!VK.XDM) {
847VK.XDM = {
848  remote: null,
849  init: function() {
850    if (this.remote) return false;
851    var url = VK._domain.api + VK._path.proxy;
852    this.remote = new fastXDM.Server({
853      onInit: function() {
854        VK.xdReady = true;
855        VK.Observer.publish('xdm.init');
856      }
857    });
858
859    this.remote.append(document.getElementById(VK._rootId), {
860      src: url
861    });
862  },
863  xdHandler: function(code) {
864    try {
865      eval('VK.' + code);
866    } catch(e) {}
867  }
868};
869}
870
871if (!VK.Observer) {
872VK.Observer = {
873  _subscribers: function() {
874    if (!this._subscribersMap) {
875      this._subscribersMap = {};
876    }
877    return this._subscribersMap;
878  },
879  publish: function(eventName) {
880    var
881      args = Array.prototype.slice.call(arguments),
882      eventName = args.shift(),
883      subscribers = this._subscribers()[eventName],
884      i, j;
885
886    if (!subscribers) return;
887
888    for (i = 0, j = subscribers.length; i < j; i++) {
889      if (subscribers[i] != null) {
890        subscribers[i].apply(this, args);
891      }
892    }
893  },
894  subscribe: function(eventName, handler) {
895    var
896      subscribers = this._subscribers();
897
898    if (typeof handler != 'function') return false;
899
900    if (!subscribers[eventName]) {
901      subscribers[eventName] = [handler];
902    } else {
903      subscribers[eventName].push(handler);
904    }
905  },
906  unsubscribe: function(eventName, handler) {
907    var
908      subscribers = this._subscribers()[eventName],
909      i, j;
910
911    if (!subscribers) return false;
912    if (typeof handler == 'function') {
913      for (i = 0, j = subscribers.length; i < j; i++) {
914        if (subscribers[i] == handler) {
915          subscribers[i] = null;
916        }
917      }
918    } else {
919      delete this._subscribers()[eventName];
920    }
921  }
922};
923}
924
925if (!VK.Widgets) {
926  VK.Widgets = {};
927
928  VK.Widgets.count = 0;
929  VK.Widgets.RPC = {};
930
931  VK.Widgets.loading = function(obj, enabled) {
932    obj.style.background = enabled ? 'url("' + VK._protocol + '//vk.com/images/upload.gif") center center no-repeat transparent' : 'none';
933  };
934
935  VK.Widgets.Comments = function(objId, options, page) {
936    var pData = VK.Util.getPageData();
937    if (!VK._apiId) throw Error('VK not initialized. Please use VK.init');
938    options = options || {};
939    var params = {
940      limit: options.limit || 10,
941      height: options.height || 0,
942      mini: options.mini === undefined ? 'auto' : options.mini,
943      norealtime: options.norealtime ? 1 : 0
944    }, mouseup = function() {
945      rpc.callMethod('mouseUp');
946      return false;
947    }, move = function(event) {
948      rpc.callMethod('mouseMove', {screenY: event.screenY});
949    }, iframe, rpc;
950
951    if (options.browse) { // browse all comments
952      params.browse = 1;
953      params.replies = options.replies || 0;
954    } else { // page
955      var url = options.pageUrl || pData.url;
956      if (url.substr(0, 1) == '/') {
957        url = (location.protocol + '//' + location.host) + url;
958      }
959      VK.extend(params, {
960        page: page || 0,
961        status_publish: options.autoPublish === undefined ? 1 : options.autoPublish,
962        attach: options.attach === undefined ? '*' : (options.attach ? options.attach : ''),
963        url: url,
964        title: options.pageTitle || pData.title,
965        description: options.pageDescription || pData.description,
966        image: options.pageImage || pData.image
967      });
968    }
969    if (options.onChange) { // DEPRECATED
970      VK.Observer.subscribe('widgets.comments.new_comment', options.onChange);
971      VK.Observer.subscribe('widgets.comments.delete_comment', options.onChange);
972    }
973
974    return VK.Widgets._constructor('widget_comments.php', objId, options, params, {
975      showBox: function(url, props) {
976        var box = VK.Util.Box((options.base_domain || VK._protocol + '//vk.com') + '/' + url, [], {
977          proxy: function() {
978            rpc.callMethod.apply(rpc, arguments);
979          }
980        });
981        box.show();
982      },
983      startDrag: function() {
984        cursorBack = window.document.body.style.cursor;
985        window.document.body.style.cursor = 'pointer';
986        VK.Util.addEvent('mousemove', move);
987        VK.Util.addEvent('mouseup', mouseup);
988      },
989      stopDrag: function() {
990        window.document.body.style.cursor = cursorBack;
991        VK.Util.removeEvent('mousemove', move);
992        VK.Util.removeEvent('mouseup', mouseup);
993      }
994    }, {
995      startHeight: 133,
996      minWidth: 300,
997      width: '100%'
998    }, function(o, i, r) {iframe = i; rpc = r;});
999  };
1000
1001  VK.Widgets.CommentsBrowse = function(objId, options) {
1002    options = options || {};
1003    options.browse = 1;
1004    return VK.Widgets.Comments(objId, options);
1005  };
1006
1007  VK.Widgets.Recommended = function(objId, options) {
1008    var pData = VK.Util.getPageData();
1009    if (!VK._apiId) throw Error('VK not initialized. Please use VK.init');
1010    options = options || {};
1011    var params = {
1012      limit: options.limit || 5,
1013      max: options.max || 0,
1014      sort: options.sort || 'friend_likes',
1015      verb: options.verb || 0,
1016      period: options.period || 'week',
1017      target: options.target || 'parent'
1018    };
1019    return VK.Widgets._constructor('widget_recommended.php', objId, options, params, {}, {
1020      startHeight: (90 + params.limit * 30),
1021      minWidth: 150,
1022      width: '100%'
1023    });
1024  };
1025
1026  VK.Widgets.Like = function(objId, options, page) {
1027    var pData = VK.Util.getPageData();
1028    if (!VK._apiId) throw Error('VK not initialized. Please use VK.init');
1029    options = VK.extend(options || {}, {allowTransparency: true});
1030    if (options.type == 'button' || options.type == 'vertical' || options.type == 'mini') delete options.width;
1031    var
1032      type = (options.type == 'full' || options.type == 'button' || options.type == 'vertical' || options.type == 'mini') ? options.type : 'full',
1033      width = type == 'full' ? Math.max(200, options.width || 350) : (type == 'button' ? 180 : (type == 'mini' ? 100 : 41)),
1034      btnHeight = parseInt(options.height, 10) || 22,
1035      height = type == 'vertical' ? (2 * btnHeight + 7) : (type == 'full' ? btnHeight + 1 : btnHeight),
1036      params = {
1037        page: page || 0,
1038        url: options.pageUrl || pData.url,
1039        type: type,
1040        verb: options.verb == 1 ? 1 : 0,
1041        title: options.pageTitle || pData.title,
1042        description: options.pageDescription || pData.description,
1043        image: options.pageImage || pData.image,
1044        text: (options.text || '').substr(0, 140),
1045        h: btnHeight
1046      },
1047      ttHere = options.ttHere || false,
1048      isOver = false,
1049      obj, buttonIfr, buttonRpc, tooltipIfr, tooltipRpc, checkTO, statsBox;
1050
1051    function showTooltip(force) {
1052      if ((!isOver && !force) || !tooltipRpc) return;
1053      if (!tooltipIfr || !tooltipRpc || tooltipIfr.style.display != 'none' && tooltipIfr.getAttribute('vkhidden') != 'yes') return;
1054      var scrollTop = options.getScrollTop ? options.getScrollTop() : (document.body.scrollTop || document.documentElement.scrollTop || 0);
1055      var objPos = VK.Util.getXY(obj, options.fixed);
1056      var startY = ttHere ? 0 : objPos[1];
1057      if (scrollTop > objPos[1] - 120 && options.tooltipPos != 'top' || type == 'vertical' || options.tooltipPos == 'bottom') {
1058        tooltipIfr.style.top = (startY + height + 2) + 'px';
1059        tooltipRpc.callMethod('show', false);
1060      } else {
1061        tooltipIfr.style.top = (startY - 125) + 'px';
1062        tooltipRpc.callMethod('show', true);
1063      }
1064      VK.Util.ss(tooltipIfr, {left: ((ttHere ? 0 : objPos[0]) - (type == 'vertical' || type == 'mini' ? 36 : 2)) + 'px', display: 'block', opacity: 1, filter: 'none'});
1065      tooltipIfr.setAttribute('vkhidden', 'no');
1066      isOver = true;
1067    }
1068
1069    function hideTooltip(force) {
1070      if ((isOver && !force) || !tooltipRpc) return;
1071      tooltipRpc.callMethod('hide');
1072      buttonRpc.callMethod('hide');
1073      setTimeout(function() {
1074        tooltipIfr.style.display = 'none'
1075      }, 400);
1076    }
1077
1078    return VK.Widgets._constructor('widget_like.php', objId, options, params, {
1079      initTooltip: function(counter) {
1080        tooltipRpc = new fastXDM.Server({
1081          onInit: counter ? function() {showTooltip(true)} : function() {},
1082          proxy: function() {
1083             buttonRpc.callMethod.apply(buttonRpc, arguments);
1084          },
1085          showBox: function(url, props) {
1086            var box = VK.Util.Box((options.base_domain || VK._protocol + '//vk.com/') + url, [props.width, props.height], {
1087              proxy: function() {
1088                tooltipRpc.callMethod.apply(tooltipRpc, arguments);
1089              }
1090            });
1091            box.show();
1092          },
1093          statsBox: function(act) {
1094            hideTooltip(true);
1095            statsBox = VK.Util.Box(buttonIfr.src + '&act=a_stats_box&widget_width=620');
1096            statsBox.show();
1097          }
1098        }, false, {safe: true});
1099        tooltipIfr = tooltipRpc.append(ttHere ? obj : document.body, {
1100          src: buttonIfr.src + '&act=a_like_tooltip',
1101          scrolling: 'no',
1102          allowTransparency: true,
1103          id: buttonIfr.id + '_tt',
1104          style: {position: 'absolute', padding: 0, display: 'block', opacity: 0.01, filter: 'alpha(opacity=1)', border: '0', width: '238px', height: '124px', zIndex: 5000, overflow: 'hidden'}
1105        });
1106        tooltipIfr.setAttribute('vkhidden', 'yes');
1107
1108        obj.onmouseover = tooltipIfr.onmouseover = function() {
1109          clearTimeout(checkTO);
1110          isOver = true;
1111        };
1112        obj.onmouseout = tooltipIfr.onmouseout = function() {
1113          clearTimeout(checkTO);
1114          isOver = false;
1115          checkTO = setTimeout(function() {hideTooltip(); }, 200);
1116        };
1117      },
1118      showTooltip: showTooltip,
1119      hideTooltip: hideTooltip,
1120      showBox: function(url, props) {
1121        var box = VK.Util.Box((options.base_domain || VK._protocol + '//vk.com/') + url, [], {
1122          proxy: function() {
1123            buttonRpc.callMethod.apply(buttonRpc, arguments);
1124          }
1125        });
1126        box.show();
1127      },
1128      proxy: function() {if (tooltipRpc) tooltipRpc.callMethod.apply(tooltipRpc, arguments);}
1129    }, {
1130      startHeight: height,
1131      minWidth: width
1132    }, function(o, i, r) {
1133      buttonRpc = r;
1134      VK.Util.ss(obj = o, {height: height + 'px', width: width + 'px', position: 'relative', clear: 'both'});
1135      VK.Util.ss(buttonIfr = i, {height: height + 'px', width: width + 'px', overflow: 'hidden', zIndex: 150});
1136    });
1137  };
1138
1139  VK.Widgets.Poll = function(objId, options, pollId) {
1140    var pData = VK.Util.getPageData();
1141    // if (!VK._apiId) throw Error('VK not initialized. Please use VK.init');
1142    if (!pollId) throw Error('No poll id passed');
1143    options = options || {};
1144    var params = {
1145      poll_id: pollId,
1146      url: options.pageUrl || pData.url || location.href,
1147      title: options.pageTitle || pData.title,
1148      description: options.pageDescription || pData.description
1149    };
1150    return VK.Widgets._constructor('widget_poll.php', objId, options, params, {}, {
1151      startHeight: 133,
1152      minWidth: 300,
1153      width: '100%'
1154    });
1155  };
1156
1157  VK.Widgets.PagePoll = function(objId, options, page) {
1158    var pData = VK.Util.getPageData();
1159    // if (!VK._apiId) throw Error('VK not initialized. Please use VK.init');
1160    options = options || {};
1161    var params = {
1162      page: page || 0,
1163      norealtime: options.norealtime ? 1 : 0,
1164      poll_id: options.pollId || '',
1165      url: options.pageUrl || pData.url || location.href,
1166      title: options.pageTitle || pData.title,
1167      description: options.pageDescription || pData.description
1168    };
1169    return VK.Widgets._constructor('al_widget_poll.php', objId, options, params, {}, {
1170      startHeight: 133,
1171      minWidth: 300,
1172      width: '100%'
1173    });
1174  };
1175
1176  VK.Widgets.Community = VK.Widgets.Group = function(objId, options, gid) {
1177    gid = parseInt(gid, 10);
1178    var RPC;
1179    if (!gid) {
1180      throw Error('No group_id passed');
1181    }
1182    options.mode = parseInt(options.mode, 10).toString();
1183    var params = {
1184      gid: gid,
1185      mode: (options.mode) ? options.mode : '0'
1186    };
1187    if (!options.width) options.width = 200;
1188    if (options.wall) params.wall = options.wall;
1189    params.color1 = options.color1 || '';
1190    params.color2 = options.color2 || '';
1191    params.color3 = options.color3 || '';
1192    if (options.no_head) params.no_head = 1;
1193    if (!options.height) options.height = 290;
1194    if (options.wide) {
1195      params.wide = 1;
1196      if (options.width < 300) {
1197        options.width = 300;
1198      }
1199    }
1200
1201    var cursorBack;
1202
1203    function mouseup() {
1204      RPC.callMethod('mouseUp');
1205      return false;
1206    }
1207
1208    function move(event) {
1209      RPC.callMethod('mouseMove', {screenY: event.screenY});
1210      return false;
1211    }
1212
1213    return VK.Widgets._constructor('widget_community.php', objId, options, params, {
1214      showBox: function(url, props) {
1215        var box = VK.Util.Box((options.base_domain || VK._protocol + '//vk.com/') + url, [], {
1216          proxy: function() {
1217            rpc.callMethod.apply(rpc, arguments);
1218          }
1219        });
1220        box.show();
1221      },
1222      startDrag: function() {
1223        cursorBack = window.document.body.style.cursor;
1224        window.document.body.style.cursor = 'pointer';
1225        VK.Util.addEvent('mousemove', move);
1226        VK.Util.addEvent('mouseup', mouseup);
1227      },
1228      stopDrag: function() {
1229        window.document.body.style.cursor = cursorBack;
1230        VK.Util.removeEvent('mousemove', move);
1231        VK.Util.removeEvent('mouseup', mouseup);
1232      },
1233      auth: function() {
1234        VK.Auth.login(null, 1);
1235      }
1236    }, {
1237      minWidth: 120,
1238      width: '200',
1239      height: '290',
1240      startHeight: 200
1241    }, function(o, i, r) {
1242      RPC = r;
1243    });
1244  };
1245
1246  VK.Widgets.Auth = function(objId, options) {
1247    var pData = VK.Util.getPageData();
1248    if (!VK._apiId) throw Error('VK not initialized. Please use VK.init');
1249    if (!options.width) {
1250      options.width = 200;
1251    }
1252    if (options.type) {
1253      type = 1;
1254    } else {
1255      type = 0;
1256    }
1257    return VK.Widgets._constructor('widget_auth.php', objId, options, {}, {makeAuth: function(data) {
1258      if (data.session) {
1259        VK.Auth._loadState = 'loaded';
1260        VK.Auth.setSession(data.session, 'connected');
1261        VK.Observer.publish('auth.loginStatus', {session: data.session, status: 'connected'});
1262        VK.Observer.unsubscribe('auth.loginStatus');
1263      }
1264      if (options.onAuth) {
1265        options.onAuth(data);
1266      } else {
1267        if (options.authUrl) {
1268          var href = options.authUrl;
1269        } else {
1270          var href = window.location.href;
1271        }
1272        if (href.indexOf('?') == -1) {
1273          href+='?';
1274        } else {
1275          href+='&';
1276        }
1277        var vars = [];
1278
1279        for (var i in data) {
1280          if (i != 'session') vars.push(i+'='+decodeURIComponent(data[i]).replace(/&/g, '%26').replace(/\?/, '%3F'));
1281        }
1282        window.location.href = href + vars.join('&');
1283      }
1284    }}, {startHeight: 80});
1285  };
1286
1287  VK.Widgets.Subscribe = function(objId, options, oid) {
1288    oid = parseInt(oid, 10);
1289    var RPC;
1290    if (!oid) {
1291      throw Error('No owner_id passed');
1292    }
1293    var params = {
1294      oid: oid
1295    };
1296    if (options.mode) {
1297      params.mode = options.mode;
1298    }
1299    if (options.soft) {
1300      params.soft = options.soft;
1301    }
1302
1303    return VK.Widgets._constructor('widget_subscribe.php', objId, options, params, {
1304      showBox: function(url, props) {
1305        var box = VK.Util.Box((options.base_domain || VK._protocol + '//vk.com/') + url, [], {
1306          proxy: function() {
1307            rpc.callMethod.apply(rpc, arguments);
1308          }
1309        });
1310        box.show();
1311      },
1312      auth: function() {
1313        VK.Auth.login(null, 1);
1314      }
1315    }, {
1316      minWidth: 220,
1317      startHeight: 22,
1318      height: options.height || 22
1319    }, function(o, i, r) {
1320      RPC = r;
1321    });
1322  };
1323
1324  VK.Widgets.Ads = function(objId, options, paramsExtra) {
1325    options = options || {};
1326    paramsExtra = paramsExtra || {};
1327    var params = {};
1328    var defaults = {};
1329    var funcs = {};
1330    var obj = document.getElementById(objId);
1331    var iframe;
1332    var rpc;
1333
1334    var adsParams = {};
1335    var adsParamsLocal = {};
1336    var adsParamsDefault = {};
1337    for (var key in paramsExtra) {
1338      var keyFix = (inArray(key, ['hash']) ? key : 'ads_' + key);
1339      adsParams[keyFix] = paramsExtra[key];
1340    }
1341
1342    if (obj && obj.getBoundingClientRect) {
1343      obj.style.width  = '100%';
1344      obj.style.height = '100%';
1345      var rect = obj.getBoundingClientRect();
1346      obj.style.width  = '';
1347      obj.style.height = '';
1348      adsParams.ads_ad_unit_width_auto  = Math.floor(rect.right - rect.left);
1349      adsParams.ads_ad_unit_height_auto = Math.floor(rect.bottom - rect.top);
1350    }
1351
1352    adsParamsDefault.ads_ad_unit_width  = 100;
1353    adsParamsDefault.ads_ad_unit_height = 100;
1354
1355    adsParamsLocal.ads_ad_unit_width  = (parseInt(adsParams.ads_ad_unit_width)  || adsParams.ads_ad_unit_width === 'auto'  && adsParams.ads_ad_unit_width_auto  || adsParamsDefault.ads_ad_unit_width);
1356    adsParamsLocal.ads_ad_unit_height = (parseInt(adsParams.ads_ad_unit_height) || adsParams.ads_ad_unit_height === 'auto' && adsParams.ads_ad_unit_height_auto || adsParamsDefault.ads_ad_unit_height);
1357    if (adsParams.ads_handler) {
1358      adsParamsLocal.ads_handler = adsParams.ads_handler;
1359    }
1360    if (adsParams.ads_handler_empty_html) {
1361      adsParamsLocal.ads_handler_empty_html = adsParams.ads_handler_empty_html;
1362    }
1363
1364    delete adsParams.ads_handler;
1365    delete adsParams.ads_handler_empty_html;
1366
1367    params.act = 'ads_web';
1368    params.url = location.href;
1369    VK.extend(params, adsParams);
1370
1371    options.noDefaultParams   = true;
1372    options.width             = adsParamsLocal.ads_ad_unit_width;
1373    options.allowTransparency = true;
1374    defaults.startHeight = adsParamsLocal.ads_ad_unit_height;
1375    defaults.minWidth    = adsParamsLocal.ads_ad_unit_width;
1376    funcs.adsOnInitLoader = adsOnInitLoader;
1377    funcs.adsOnInit       = adsOnInit;
1378
1379    return VK.Widgets._constructor('ads_rotate.php', objId, options, params, funcs, defaults, onDone);
1380
1381    function adsOnInitLoader(adsScriptVersion) {
1382      VK.Widgets.loading(obj, true);
1383      adsAttachScript(adsScriptVersion);
1384    }
1385    function adsOnInit(errorCode, adsParamsExport) {
1386      VK.Widgets.loading(obj, false);
1387      adsProcessParams(adsParamsExport);
1388      if (options.onAdsReady) options.onAdsReady.apply(options.onAdsReady, Array.prototype.slice.call(arguments));
1389      adsProcessHandler(errorCode);
1390    }
1391    function adsAttachScript(adsScriptVersion) {
1392      if (!('vk__adsLight' in window)) {
1393        window.vk__adsLight = false;
1394        adsScriptVersion = parseInt(adsScriptVersion);
1395        var attachScriptFunc = (VK.Api && VK.Api.attachScript || VK.addScript);
1396        var base_domain = (options.base_domain || VK._protocol + '//vk.com');
1397        attachScriptFunc(base_domain + '/js/al/aes_light.js?' + adsScriptVersion);
1398      } else if (window.vk__adsLight && vk__adsLight.userHandlers && vk__adsLight.userHandlers.onInit) {
1399        vk__adsLight.userHandlers.onInit(false); // false - do not publish initial onInit
1400      }
1401    }
1402    function adsProcessParams(adsParamsExport) {
1403      if (!adsParamsExport) {
1404        return;
1405      }
1406      for (var paramName in adsParamsExport) {
1407        var paramValue = adsParamsExport[paramName];
1408        if (paramName === 'ads_ad_unit_width' || paramName === 'ads_ad_unit_height') {
1409          if (!(paramName in adsParams)) {
1410            adsParamsLocal[paramName] = (parseInt(paramValue) || paramValue === 'auto' && adsParams[paramName + '_auto'] || adsParamsDefault[paramName]);
1411          }
1412        } else {
1413          if (!(paramName in adsParamsLocal)) {
1414            adsParamsLocal[paramName] = paramValue;
1415          }
1416        }
1417      }
1418    }
1419    function adsProcessHandler(errorCode) {
1420      var handlerResult = adsEvalHandler(adsParamsLocal.ads_handler, errorCode);
1421      if (errorCode <= 0 && handlerResult !== true) {
1422        try { console.log('VK: ad_unit_id = ' + adsParams.ads_ad_unit_id, ', errorCode = ', errorCode); } catch (e) {}
1423        adsInsertHtmlHandler(adsParamsLocal.ads_handler_empty_html, adsParamsLocal.ads_ad_unit_width, adsParamsLocal.ads_ad_unit_height);
1424      }
1425    }
1426    function adsEvalHandler(handler) {
1427      var result = false;
1428      try {
1429        if (!handler) {
1430          return false;
1431        }
1432        var func = false;
1433        if (isFunction(handler)) {
1434          func = handler;
1435        } else if (isString(handler)) {
1436          var handlerFuncs = handler.split('.');
1437          func = window;
1438          for (var i = 0, len = handlerFuncs.length; i < len; i++) {
1439            func = func[handlerFuncs[i]];
1440            if (!func) {
1441              break;
1442            }
1443          }
1444          if (!func) {
1445            if (handler.substr(0, 8) === 'function') {
1446              handler = 'return ' + handler + ';';
1447            }
1448            var handlerResult = (new Function(handler))();
1449            if (isFunction(handlerResult)) {
1450              func = handlerResult;
1451            } else {
1452              result = handlerResult;
1453            }
1454          }
1455        }
1456        if (func) {
1457          var args = Array.prototype.slice.call(arguments, 1);
1458          result = func.apply(func, args);
1459        }
1460      } catch (e) {
1461        try {
1462          console.error(e);
1463        } catch (e2) {}
1464      }
1465
1466      return result;
1467
1468      function isFunction(obj) {
1469        return Object.prototype.toString.call(obj) === '[object Function]';
1470      }
1471      function isString(obj) {
1472        return Object.prototype.toString.call(obj) === '[object String]';
1473      }
1474    }
1475    function adsInsertHtmlHandler(handlerHtml, width, height) {
1476      if (!handlerHtml) {
1477        return;
1478      }
1479      if (!obj) {
1480        return;
1481      }
1482
1483      width  = (width  ? width  + 'px' : '');
1484      height = (height ? height + 'px' : '');
1485
1486      var iframeHandlerHtml = '<html><head></head><body style="padding: 0; margin: 0;"><div>' + handlerHtml + '</div></body></html>';
1487
1488      var iframeHandler = document.createElement('iframe');
1489      iframeHandler.onload            = fixIframeHeight;
1490      iframeHandler.id                = (iframe ? iframe.id : ('vkwidget-' + Math.round(Math.random() * 1000000))) + '_ads_html_handler';
1491      iframeHandler.src               = 'about:blank';
1492      iframeHandler.width             = '100%';
1493      iframeHandler.height            = '100%';
1494      iframeHandler.scrolling         = 'no';
1495      iframeHandler.frameBorder       = '0';
1496      iframeHandler.allowTransparency = true;
1497      iframeHandler.style.overflow    = 'hidden';
1498      iframeHandler.style.width       = width;
1499      iframeHandler.style.height      = height;
1500
1501      obj.style.width                 = width;
1502      obj.style.height                = height;
1503
1504      obj.appendChild(iframeHandler);
1505
1506      iframeHandler.contentWindow.vk_ads_html_handler = iframeHandlerHtml;
1507      iframeHandler.src = 'javascript:window["vk_ads_html_handler"]';
1508
1509      function fixIframeHeight() {
1510        if (height) {
1511          return;
1512        }
1513        try {
1514          var rect = iframeHandler.contentWindow.document.body.firstChild.getBoundingClientRect();
1515          var heightFix = Math.ceil(rect.bottom - rect.top);
1516          if (heightFix) {
1517            iframeHandler.style.height = heightFix;
1518            obj.style.height           = heightFix;
1519          }
1520        } catch (e) {}
1521      }
1522    }
1523    function indexOf(arr, value, from) {
1524      for (var i = from || 0, l = (arr || []).length; i < l; i++) {
1525        if (arr[i] == value) return i;
1526      }
1527      return -1;
1528    }
1529    function inArray(value, arr) {
1530      return indexOf(arr, value) != -1;
1531    }
1532    function onDone(o, i, r) {
1533      obj = o;
1534      iframe = i;
1535      rpc = r;
1536    }
1537  };
1538
1539  VK.Widgets._constructor = function(widgetUrl, objId, options, params, funcs, defaults, onDone, widgetId, iter) {
1540    var obj = document.getElementById(objId);
1541    widgetId = widgetId || (++VK.Widgets.count);
1542
1543    if (!obj) {
1544      iter = iter || 0;
1545      if (iter > 10) {
1546        throw Error('VK.Widgets: object #' + objId + ' not found.');
1547      }
1548      setTimeout(function() {
1549        VK.Widgets._constructor(widgetUrl, objId, options, params, funcs, defaults, onDone, widgetId, iter + 1);
1550      }, 500);
1551      return widgetId;
1552    }
1553
1554    var ifr, base_domain, width, url, urlQueryString, encodedParam, rpc, iframe, i;
1555    options = options || {};
1556    defaults = defaults || {};
1557    funcs = funcs || {};
1558
1559    base_domain = options.base_domain || VK._protocol + '//vk.com';
1560    width = (options.width == 'auto') ? obj.clientWidth || '100%' : parseInt(options.width, 10);
1561
1562    if (options.height) {
1563      params.height = options.height;
1564      obj.style.height = options.height + 'px';
1565    } else {
1566      obj.style.height = (defaults.startHeight || 200) + 'px';
1567    }
1568
1569    width = width ? (Math.max(defaults.minWidth || 200, Math.min(10000, width)) + 'px') : '100%';
1570
1571    if (!params.url) {
1572      params.url = options.pageUrl || location.href.replace(/#.*$/, '');
1573    }
1574    url = base_domain + '/' + widgetUrl;
1575    urlQueryString = '';
1576    if (!options.noDefaultParams) {
1577      urlQueryString += '&app=' + (VK._apiId || '0') + '&width=' + width
1578    }
1579    urlQueryString += '&_ver=' + VK.version
1580    if (VK._iframeAppWidget) {
1581      params.iframe_app = 1;
1582    }
1583    for (i in params) {
1584      if (i == 'title' && params[i].length > 80) params[i] = params[i].substr(0, 80)+'...';
1585      if (i == 'description' && params[i].length > 160) params[i] = params[i].substr(0, 160)+'...';
1586      if (typeof(params[i]) == 'number') {
1587        encodedParam = params[i];
1588      } else {
1589        try {
1590          encodedParam = encodeURIComponent(params[i]);
1591        } catch (e) {
1592          encodedParam = '';
1593        }
1594      }
1595      urlQueryString += '&' + i + '=' + encodedParam;
1596    }
1597    urlQueryString += '&' + (+new Date()).toString(16);
1598    url += '?' + urlQueryString.substr(1);
1599
1600    obj.style.width = width;
1601    VK.Widgets.loading(obj, true);
1602
1603    funcs.publish = function() {
1604      var args = Array.prototype.slice.call(arguments);
1605      args.push(widgetId);
1606      VK.Observer.publish.apply(VK.Observer, args);
1607    };
1608    funcs.onInit = function() {
1609      VK.Widgets.loading(obj, false);
1610      if (funcs.onReady) funcs.onReady();
1611      if (options.onReady) options.onReady();
1612    }
1613    funcs.resize = function(e, cb) {
1614      obj.style.height = e + 'px';
1615      var el = document.getElementById('vkwidget' + widgetId);
1616      if (el) {
1617        el.style.height = e + 'px';
1618      }
1619    }
1620    funcs.resizeWidget = function(newWidth, newHeight) {
1621      newWidth  = parseInt(newWidth);
1622      newHeight = parseInt(newHeight);
1623      var widgetElem = document.getElementById('vkwidget' + widgetId);
1624      if (isFinite(newWidth)) {
1625        obj.style.width = newWidth + 'px';
1626        if (widgetElem) {
1627          widgetElem.style.width = newWidth + 'px';
1628        }
1629      }
1630      if (isFinite(newHeight)) {
1631        obj.style.height = newHeight + 'px';
1632        if (widgetElem) {
1633          widgetElem.style.height = newHeight + 'px';
1634        }
1635      }
1636      if (options.onResizeWidget) options.onResizeWidget();
1637    }
1638    funcs.updateVersion = function(ver) {
1639      if (ver > 1) {
1640        VK.Api.attachScript('//vk.com/js/api/openapi_update.js?'+parseInt(ver));
1641      }
1642    }
1643    rpc = VK.Widgets.RPC[widgetId] = new fastXDM.Server(funcs, function(origin) {
1644      if (!origin) return true;
1645      origin = origin.toLowerCase();
1646      return (origin.indexOf('.vk.com') != -1 || origin.indexOf('/vk.com') != -1);
1647    }, {safe: true});
1648    iframe = VK.Widgets.RPC[widgetId].append(obj, {
1649      src: url,
1650      width: (width.indexOf('%') != -1) ? width : (parseInt(width) || width),
1651      height: defaults.startHeight || '100%',
1652      scrolling: 'no',
1653      id: 'vkwidget' + widgetId,
1654      allowTransparency: options.allowTransparency || false,
1655      style: {
1656        overflow: 'hidden'
1657      }
1658    });
1659    onDone && setTimeout(function() {onDone(obj, iframe || obj.firstChild, rpc);}, 10);
1660    return widgetId;
1661  };
1662}
1663
1664if (!VK.Util) {
1665VK.Util = {
1666  getPageData: function() {
1667    if (!VK._pData) {
1668      var metas = document.getElementsByTagName('meta'), pData = {}, keys = ['description', 'title', 'url', 'image', 'app_id'], metaName;
1669      for (var i in metas) {
1670        if (!metas[i].getAttribute) continue;
1671        if (metas[i].getAttribute && ((metaName = metas[i].getAttribute('name')) || (metaName = metas[i].getAttribute('property')))) {
1672          for (var j in keys) {
1673            if (metaName == keys[j] || metaName == 'og:'+keys[j] || metaName == 'vk:'+keys[j]) {
1674              pData[keys[j]] = metas[i].content;
1675            }
1676          }
1677        }
1678      }
1679      if (pData.app_id && !VK._apiId) {
1680        VK._apiId = pData.app_id;
1681      }
1682      pData.title = pData.title || document.title || '';
1683      pData.description = pData.description || '';
1684      pData.image = pData.image || '';
1685      if (!pData.url && VK._iframeAppWidget && VK._apiId) {
1686        pData.url = '/app' + VK._apiId;
1687        if (VK._browserHash) {
1688          pData.url += VK._browserHash
1689        }
1690      }
1691      var loc = location.href.replace(/#.*$/, '');
1692      if (!pData.url || !pData.url.indexOf(loc)) {
1693        pData.url = loc;
1694      }
1695      VK._pData = pData;
1696    }
1697    return VK._pData;
1698  },
1699  getStyle: function(elem, name) {
1700    var ret, defaultView = document.defaultView || window;
1701    if (defaultView.getComputedStyle) {
1702      name = name.replace(/([A-Z])/g, '-$1').toLowerCase();
1703      var computedStyle = defaultView.getComputedStyle(elem, null);
1704      if (computedStyle) {
1705        ret = computedStyle.getPropertyValue(name);
1706      }
1707    } else if (elem.currentStyle) {
1708      var camelCase = name.replace(/\-(\w)/g, function(all, letter){
1709        return letter.toUpperCase();
1710      });
1711      ret = elem.currentStyle[name] || elem.currentStyle[camelCase];
1712    }
1713
1714    return ret;
1715  },
1716  getXY: function(obj, fixed) {
1717    if (!obj || obj === undefined) return;
1718
1719    var left = 0, top = 0;
1720    if (obj.getBoundingClientRect !== undefined) {
1721      var rect = obj.getBoundingClientRect();
1722      left = rect.left;
1723      top = rect.top;
1724      fixed = true;
1725    } else if (obj.offsetParent) {
1726      do {
1727        left += obj.offsetLeft;
1728        top += obj.offsetTop;
1729        if (fixed) {
1730          left -= obj.scrollLeft;
1731          top -= obj.scrollTop;
1732        }
1733      } while (obj = obj.offsetParent);
1734    }
1735    if (fixed) {
1736      top += window.pageYOffset || window.scrollNode && scrollNode.scrollTop || document.documentElement.scrollTop;
1737      left += window.pageXOffset || window.scrollNode && scrollNode.scrollLeft || document.documentElement.scrollLeft;
1738    }
1739
1740    return [left, top];
1741  },
1742  Box: function(src, sizes, fnc, options) {
1743    fnc = fnc || {};
1744    var overflowB = document.body.style.overflow;
1745    var loader = document.createElement('DIV');
1746    var rpc = new fastXDM.Server(VK.extend(fnc, {
1747      onInit: function() {
1748        iframe.style.background = 'transparent';
1749        iframe.style.visibility = 'visible';
1750        document.body.style.overflow = 'hidden';
1751        document.body.removeChild(loader);
1752      },
1753      hide: function() {
1754        iframe.style.display = 'none';
1755      },
1756      tempHide: function() {
1757        iframe.style.left = '-10000px';
1758        iframe.style.top = '-10000px';
1759        iframe.style.width = '10px';
1760        iframe.style.height = '10px';
1761        document.body.style.overflow = overflowB;
1762      },
1763      destroy: function() {
1764        try {
1765          iframe.src = 'about: blank;';
1766        } catch (e) {}
1767        iframe.parentNode.removeChild(iframe);
1768        document.body.style.overflow = overflowB;
1769      },
1770      resize: function(w, h) {
1771      }
1772    }, true), false, {safe: true}),
1773    iframe = rpc.append(document.body, {
1774      src: src.replace(/&amp;/g, '&'),
1775      scrolling: 'no',
1776      allowTransparency: true,
1777      style: {position: 'fixed', left: 0, top: 0, zIndex: 1002, background: VK._protocol + '//vk.com/images/upload.gif center center no-repeat transparent', padding: '0', border: '0', width: '100%', height: '100%', overflow: 'hidden', visibility: 'hidden'}
1778    });
1779    loader.innerHTML = '<div style="position: fixed;left: 50%;top: 50%;margin: 0px auto 0px -60px;z-index: 1002;width: 100px;"><div style="background: url(//vk.com/images/upload_inv_mono'+(window.devicePixelRatio >= 2 ? '_2x' : '')+'.gif) no-repeat 50% 50%;background-size: 64px 16px;height: 50px;position: absolute;width: 100%;z-index: 100;"></div><div style="background-color: #000;opacity: 0.7;filter: alpha(opacity=70);height: 50px;-webkit-border-radius: 5px;-khtml-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;-webkit-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.35);-moz-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.35);box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.35);"></div></div>';
1780    document.body.insertBefore(loader, document.body.firstChild);
1781    return {
1782      show: function(scrollTop, height) {
1783        iframe.style.display = 'block';
1784        document.body.style.overflow = 'hidden';
1785      },
1786      hide: function() {
1787        iframe.style.display = 'none';
1788        document.body.style.overflow = overflowB;
1789      },
1790      iframe: iframe,
1791      rpc: rpc
1792    }
1793  },
1794  addEvent: function(type, func) {
1795    if (window.document.addEventListener) {
1796      window.document.addEventListener(type, func, false);
1797    } else if (window.document.attachEvent) {
1798      window.document.attachEvent('on'+type, func);
1799    }
1800  },
1801  removeEvent: function(type, func) {
1802    if (window.document.removeEventListener) {
1803      window.document.removeEventListener(type, func, false);
1804    } else if (window.document.detachEvent) {
1805      window.document.detachEvent('on'+type, func);
1806    }
1807  },
1808  ss: function(el, styles) {VK.extend(el.style, styles, true);}
1809};
1810}
1811
1812// Init asynchronous library loading
1813window.vkAsyncInit && setTimeout(vkAsyncInit, 0);
1814
1815if (window.vkAsyncInitCallbacks && vkAsyncInitCallbacks.length) {
1816  setTimeout(function() {
1817    var callback;
1818    while (callback = vkAsyncInitCallbacks.pop()) {
1819      try {
1820        callback();
1821      } catch(e) {
1822        try {
1823          console.error(e);
1824        } catch (e2) {}
1825      }
1826    }
1827  }, 0);
1828}
1829try{if (window.stManager) stManager.done('api/openapi.js');}catch(e){}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.