PageSourceSearch

http://astroolymp.ru/js/share.js?9

js astroolymp.ru collected 2026-10-02 21:02:03 UTC 11,244 bytes, 208 lines download raw bytes

1if (!window.VK) window.VK = {};
2if (!VK.Share) {
3  VK.Share = {
4    _popups: [],
5    _gens: [],
6    _base_domain: '',
7    _ge: function(id) {
8      return document.getElementById(id);
9    },
10    button: function(gen, but, index) {
11      if (!gen) gen = {};
12      if (gen === gen.toString()) gen = {url: gen.toString()};
13      if (!gen.url) gen.url = VK.Share._loc;
14
15      if (!but) but = {type: 'round'};
16      if (but === but.toString()) but = {type: 'round', text: but};
17      if (!but.text) but.text = 'Ñîõðàíèòü';
18
19      var old = true, count_style = 'display: none', count_width = 22;
20      if (index === undefined) {
21        gen.count = 0;
22        gen.shared = (but.type == 'button' || but.type == 'round') ? false : true;
23        this._gens.push(gen);
24        this._popups.push(false);
25        index = this._popups.length - 1;
26        old = false;
27      } else {
28        if ((gen.count = this._gens[index].count) && (but.type == 'button' || but.type == 'round')) {
29          count_style = '';
30          count_width = 29;
31        }
32        gen.shared = this._gens[index].shared;
33        this._gens[index] = gen;
34      }
35
36      var head = document.getElementsByTagName('head')[0];
37      if (!this._base_domain) {
38        for (var elem = head.firstChild; elem; elem = elem.nextSibling) {
39          var m;
40          if (elem.tagName && elem.tagName.toLowerCase() == 'script' && (m = elem.src.match(/(http?:\/\/(?:[a-z0-9_\-\.]*\.)?(?:vk\.com|vkontakte\.ru)\/)js\/api\/share\.js(?:\?|$)/))) {
41            this._base_domain = m[1];
42          }
43        }
44      }
45      if (!this._base_domain) {
46        this._base_domain = 'http://vkontakte.ru/';
47      }
48      if (!old && (but.type == 'button' || but.type == 'round')) {
49        var elem = document.createElement('script');
50        elem.src = this._base_domain + 'share.php?act=count&index=' + index + '&url=' + encodeURIComponent(gen.url);
51        head.appendChild(elem);
52      }
53      var a = '<a href="'+this._base_domain+'share.php?url='+encodeURIComponent(gen.url)+'" onmouseup="this._btn=event.button;this.blur();" onclick="return VK.Share.click(' + index + ', this);"', a1 = a+' style="text-decoration:none;">', a2='</a>', a3 = a+' style="display:inline-block;text-decoration:none;">', td1 = '<td style="vertical-align: middle;">', td2 = '</td>';
54      if (but.type == 'button' || but.type == 'button_nocount') {
55        return '<table cellspacing="0" cellpadding="0" id="vkshare' + index + '" onmouseover="VK.Share.change(1, ' + index + ');" onmouseout="VK.Share.change(0, ' + index + ');" onmousedown="VK.Share.change(2, ' + index + ');" onmouseup="VK.Share.change(1, ' + index + ');" style="position: relative; width: auto; border: 0px;"><tr style="line-height: normal;"><td></td>' +
56               td1+a1+'<div style="border: 1px solid #3b6798; cursor:pointer;"><div style="border: 1px solid #5c82ab; border-top-color: #7e9cbc; background-color: #6d8fb3; color: #fff; text-shadow: 0px 1px #45688E; height: 15px; padding: 2px 4px 0px 6px; font-size: 10px; font-family: tahoma;">' + but.text + '</div></div>'+a2+td2 +
57               td1+a1+'<div style="background: url(https://vk.com/images/btns.png) 0px 0px no-repeat; cursor:pointer; width:' + count_width + 'px; height: 21px"></div>'+a2+td2 +
58               td1+a1+'<div style="border: 1px solid #a2b9d3; cursor:pointer; border-left: 0px; background-color: #dee6f1; color:#000; height: 15px; padding: 2px 6px 0px 4px; font-size: 10px; font-weight: bold; font-family: tahoma;' + count_style + '">' + gen.count + '</div>'+a2+td2 +
59               '</tr></table>';
60      } else if (but.type == 'round' || but.type == 'round_nocount') {
61        return '<table cellspacing="0" cellpadding="0" id="vkshare' + index + '" onmouseover="VK.Share.change(1, ' + index + ');" onmouseout="VK.Share.change(0, ' + index + ');" onmousedown="VK.Share.change(2, ' + index + ');" onmouseup="VK.Share.change(1, ' + index + ');" style="position: relative; width: auto; cursor: pointer; border: 0px;"><tr style="line-height: normal;">' +
62               td1+a1+'<div style="height: 21px; cursor:pointer; width: 2px; background: url(https://vk.com/images/btns.png) no-repeat -21px -42px;"></div>'+a2+td2 +
63               td1+a1+'<div style="border: 1px solid #3b6798; cursor:pointer; border-left: 0px;"><div style="border: 1px solid #5c82ab; border-left: 0px; border-top-color: #7e9cbc; background-color: #6d8fb3; color: #fff; text-shadow: 0px 1px #45688E; height: 15px; padding: 2px 4px 0px 6px; font-family: tahoma; font-size: 10px;">
63' + but.text + '</div></div>'+a2+td2 +
64               td1+a1+'<div style="background: url(https://vk.com/images/btns.png) 0px -21px no-repeat; cursor:pointer; width:' + count_width + 'px; height: 21px"></div>'+a2+td2 +
65               td1+a1+'<div style="border: 1px solid #a2b9d3; border-width: 1px 0px; cursor:pointer; background-color: #dee6f1; color:#000; height: 15px; padding: 2px 6px 0px 4px; font-size: 10px; font-weight: bold; font-family: tahoma;' + count_style + '">' + gen.count + '</div>'+a2+td2 +
66               td1+a1+'<div style="background: url(https://vk.com/images/btns.png) -27px -42px; cursor:pointer; width: 2px; height: 21px;' + count_style + '"></div>'+a2+td2 +
67               '</tr></table>';
68      } else if (but.type == 'link') {
69        return '<table style="position: relative; cursor:pointer; width: auto; line-height: normal;" onmouseover="this.rows[0].cells[1].firstChild.firstChild.style.textDecoration=\'underline\'" onmouseout="this.rows[0].cells[1].firstChild.firstChild.style.textDecoration=\'none\'" cellspacing="0" cellpadding="0"><tr style="line-height: normal;">' +
70               td1+a1+'<img src="https://vk.com/images/vk16.png" style="vertical-align: middle;border:0;"/>'+a2+td2 +
71               td1+a1+'<span style="padding: 0 0 0 5px; color: #2B587A; font-family: tahoma; font-size: 11px;">' + but.text + '</span>'+a2+td2 +
72               '</tr></table>';
73      } else if (but.type == 'link_noicon') {
74        return a3+'<span style="position: relative; font-family: tahoma; font-size: 11px; color: #2B587A; line-height: normal;" onmouseover="this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">' + but.text + '</span>'+a2;
75      } else {
76        return a3+'<span style="position: relative; padding:0;">' + but.text + '</span>'+a2;
77      } 
78    },
79    change: function(state, index) {
80      var row = this._ge('vkshare' + index).rows[0];
81      var elem = row.cells[1].firstChild.firstChild.firstChild;
82      if (state == 0) {
83        elem.style.backgroundColor = '#6d8fb3';
84        elem.style.borderColor = '#7e9cbc #5c82ab #5c82ab';
85      } else if (state == 1) {
86        elem.style.backgroundColor = '#84a1bf';
87        elem.style.borderColor = '#92acc7 #7293b7 #7293b7';
88      } else if (state == 2) {
89        elem.style.backgroundColor = '#6688ad';
90        elem.style.borderColor = '#51779f #51779f #7495b8';
91      }
92      var left = row.cells[0].firstChild;
93      if (left) {
94        if (state == 0) {
95          left.style.backgroundPosition = '-21px -42px';
96        } else if (state == 1) {
97          left.style.backgroundPosition = '-23px -42px';
98        } else if (state == 2) {
99          left.style.backgroundPosition = '-25px -42px';
100        }
101      }
102    },
103    click: function(index, el) {
104      var e = window.event;
105      if (e) {
106        if (!e.which && el._btn) e.which = (el._btn & 1 ? 1 : (el._btn & 2 ? 3 : (el._btn & 4 ? 2 : 0)));
107        if (e.which == 2) {
108          return true;
109        }
110      }
111      var details = this._gens[index];
112      if (!details.shared) {
113        VK.Share.count(index, details.count + 1);
114        details.shared = true;
115      }
116      var undefined;
117      if (details.noparse === undefined) {
118        details.noparse = details.title && details.description && details.image;
119      }
120      details.noparse = details.noparse ? 1 : 0;
121
122      var params = {url: details.url};
123      var fields = ['title', 'description', 'image', 'noparse'];
124      for (var i = 0; i < fields.length; ++i) {
125        if (details[fields[i]]) {
126          params[fields[i]] = details[fields[i]];
127        }
128      }
129
130      var popupName = '_blank';
131      var width = 554;
132      var height = 349;
133      var left = (screen.width - width) / 2;
134      var top = (screen.height - height) / 2;
135      var url = this._base_domain + 'share.php';
136      var popupParams = 'scrollbars=0, resizable=1, menubar=0, left=' + left + ', top=' + top + ', width=' + width + ', height=' + height + ', toolbar=0, status=0';
137      var popup = false;
138      try {
139        var doc_dom = '', loc_hos = '';
140        try {
141          doc_dom = document.domain;
142          loc_hos = location.host;
143        } catch (e) {
144        }
145        if (doc_dom != loc_hos) {
146          var ua = navigator.userAgent.toLowerCase();
147          if (!/opera/i.test(ua) && /msie/i.test(ua)) {
148            throw 'wont work';
149          }
150        }
151        popup = this._popups[index] = window.open('', popupName, popupParams);
152        var text = '<form accept-charset="UTF-8" action="' + url + '" method="POST" id="share_form">';
153        for (var i in params) {
154          text += '<input type="hidden" name="' + i + '" value="' + params[i].toString().replace(/"/g, '&myquot;').replace(/&quot/ig, '&myquot') + '" />';
155        }
156        text += '</form>';
157        text += '<script type="text/javascript">document.getElementById("share_form").submit()</script>';
158
159        text = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' +
160               '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' +
161               '<head><meta http-equiv="content-type" content="text/html; charset=windows-1251" /></head>' +
162               '<body>
162' + text + '</body></html>';
163        popup.document.write(text);
164        popup.focus();
165      } catch (e) { // ie with changed domain.
166        try {
167          if (popup) {
168            popup.close();
169          }
170          url += '?';
171          for (var i in params) {
172            url += encodeURIComponent(i) + '=' + encodeURIComponent(params[i]) + '&';
173          }
174          popup = this._popups[index] = window.open(url, popupName, popupParams);
175          popup.focus();
176        } catch (e) {
177        }
178      }
179      return false;
180    },
181    count: function(index, count) {
182      this._gens[index].count = count;
183      var elem = this._ge('vkshare' + index);
184      if (elem) {
185        var row = elem.rows[0];
186        if (count) {
187          row.cells[3].firstChild.firstChild.innerHTML = count;
188          row.cells[2].firstChild.firstChild.style.width = '29px';
189          row.cells[3].firstChild.firstChild.style.display = 'block';
190          if (row.cells.length > 4) {
191            row.cells[4].firstChild.firstChild.style.display = 'block';
192          }
193        } else {
194          row.cells[2].firstChild.firstChild.style.width = '22px';
195          row.cells[3].firstChild.firstChild.style.display = 'none';
196          if (row.cells.length > 4) {
197            row.cells[4].firstChild.firstChild.style.display = 'none';
198          }
199        }
200      }
201    }
202  }
203  try {
204    VK.Share._loc = location.toString();
205  } catch(e) {
206    VK.Share._loc = 'http://vkontakte.ru/';
207  }
208}

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.