1var riaShare = { 2 services: { 3 telegram: { 4 name: 'Telegram', 5 /* popupUrl: 'tg://msg_url?url=<%- data.url %>', */ 6 popupUrl: 'https://telegram.me/share/url?url=<%- data.url %>', 7 popupWidth: 820, 8 popupHeight: 500 9 }, 10 vkontakte: { 11 name: 'ÐÐонÑакÑе', 12 popupUrl: 'https://vk.ru/share.php?url=<%- data.url %>&title=<%- data.title %>', 13 popupWidth: 655, 14 popupHeight: 450 15 }, 16 odnoklassniki: { 17 name: 'ÐдноклаÑÑники', 18 popupUrl: 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&service=odnoklassniki&st.shareUrl=<%- data.url %>', 19 popupWidth: 580, 20 popupHeight: 336 21 } 22 // twitter: { 23 // name: 'Twitter', 24 // popupUrl: 'https://twitter.com/intent/tweet?url=<%- data.url %>&text=<%- data.title %>:', 25 // popupWidth: 600, 26 // popupHeight: 250 27 // }, 28 // viber: { 29 // name: 'Viber', 30 // popupUrl: 'viber://forward?text=<%- data.url %>', 31 // popupWidth: 820, 32 // popupHeight: 500, 33 // mobile: true 34 // }, 35 // whatsapp: { 36 // name: 'WhatsApp', 37 // popupUrl: 'whatsapp://send?text=<%- data.url %>', 38 // popupWidth: 820, 39 // popupHeight: 500, 40 // mobile: true 41 // } 42 /*facebook: { 43 name: 'Facebook', 44 popupUrl: 'https://www.facebook.com/sharer/sharer.php?u=<%- data.url %>', 45 popupWidth: 600, 46 popupHeight: 359 47 },*/ 48 /* fbmessenger: { 49 name: 'Messenger', 50 popupUrl: 'fb-messenger://share/?link=<%- data.url %>&app_id=130182077069283', 51 popupWidth: 820, 52 popupHeight: 500, 53 mobile: true 54 },*/ 55 // google: { 56 // name: 'Google+', 57 // popupUrl: 'https://plus.google.com/share?url=<%- data.url %>', 58 // popupWidth: 500, 59 // popupHeight: 550 60 // } 61 // ,sms: { 62 // name: 'SMS', 63 // popupUrl: 'sms:?&body=<%- data.title %>%0A%0A<%- data.url %>', 64 // popupWidth: 820, 65 // popupHeight: 500 66 // }, 67 // mailru: { 68 // name: 'Mail.ru', 69 // popupUrl: 'https://connect.mail.ru/share?share_url=<%- data.url %>&title=<%- data.title %>', 70 // popupWidth: 492, 71 // popupHeight: 500 72 // }, 73 // pinterest: { 74 // name: 'Pinterest', 75 // popupUrl: 'https://pinterest.com/pin/create/button/?url=<%- data.url %>&description=<%- data.title %>', 76 // popupWidth: 740, 77 // popupHeight: 550 78 // }, 79 // flipboard: { 80 // name: 'Flipboard', 81 // popupUrl: 'https://share.flipboard.com/bookmarklet/popout?v=2&title=<%- data.title %>&url=<%- data.url %>', 82 // popupWidth: 820, 83 // popupHeight: 500 84 // } 85 }, 86 services_sort: [], 87 options: { 88 shareFullEl: '.share-full', 89 shareEl: '.share' 90 }, 91 states: { 92 open: false, // оÑкÑÑÑо окно ÑаÑÑ 93 modal: false, // окно модалÑной ÑаÑÑ 94 type: false, // Ñип окна 95 mobile: false, // мобилÑнÑй ÐºÐ»Ð¸ÐµÐ½Ñ 96 el: undefined, // кнопка по коÑоÑой оÑкÑоÑÑ Ð¾ÐºÐ½Ð¾ ÑаÑÑ 97 cw: 0 // ÑиÑина окна клиенÑа 98 }, 99 el: undefined, 100 init: function() { 101 var _this = this; 102 _this.states.mobile = _this.mobileAndTabletcheck(); 103 _this.states.cw = _this.getClientWidth(); 104 _this.initFullList(); 105 _this.initItems( $( 'body' ) ); 106 $( window ).on('resize', function() { 107 _this.states.cw = _this.getClientWidth(); // пÑи каждом ÑеÑайзе обновлÑÑÑ ÑиÑÐ¸Ð½Ñ Ð¾ÐºÐ½Ð° клиенÑа 108 if ( _this.states.open == true ) { 109 _this.changeModal(); 110 _this.coordFullList(); 111 } 112 }); 113 $( window ).on('scroll', function() { 114 if ( _this.states.cw >= 925 && ( _this.states.type == 'article' || _this.states.type == 'header' ) ) { 115 _this.hideFullList(); 116 } 117 }); 118 }, 119 initItems: function( el ) { 120 var _this = this, 121 j = 0; 122 123 var count = el.find( _this.options.shareEl ).closest('[data-count]').attr( 'data-count' ); 124 var services_length = _this.services_sort.length; 125 if (typeof count !== 'undefined' && count > 0) { 126 for ( var i = 0; i < _this.services_sort.length; i++ ) { 127 if ( ( _this.services_sort[ i ][ 3 ].mobile && _this.states.mobile ) || !_this.services_sort[ i ][ 3 ].mobile ) { 128 var data = { 129 name: _this.services_sort[ i ][ 0 ], 130 title: _this.services_sort[ i ][ 3 ].name 131 } 132 if ( ++j <= count ) { 133 var template2 = _.template( $( '#shareBlockTemplate' ).html() ); 134 var result2 = template2( { data: data } ); 135 el.find( _this.options.shareEl ).append( result2 ); 136 } 137 services_length = j; 138 } 139 } 140 el.on('click', '.share a[data-name]', function( e ) { 141 _this.serviceClick( e, $( this ) ); 142 }); 143 } 144 if (typeof count === 'undefined' || (typeof count !== 'undefined' && count < services_length)) { 145 var template3 = _.template( $('#shareBlockMoreTemplate').html() ); 146 var result3 = template3(); 147 148 el.find( _this.options.shareEl ).append( result3 ); 149 150 el.on('click', '.share__more', function( e ) { 151 var shareurl = $( this ).closest('[data-url]').attr( 'data-url' ); 152 var sharetitle = $( this ).closest('[data-title]').attr( 'data-title' ); 153 var shareid = $( this ).closest('[data-id]').attr( 'data-id' ); 154 if ( typeof navigator.share !== 'undefined' && _this.states.mobile ) { 155 navigator.share({ 156 url: shareurl, 157 title: sharetitle 158 }); 159 if ( shareid != '' ) { 160 $.get('/services/counter/set/?obj_id=' + shareid + '&obj_type=article&action_type=share'); 161 } 162 } else { 163 if ( $( this ).hasClass( 'm-active' ) ) { 164 _this.hideFullList(); 165 } else { 166 _this.states.type = false;
167 if ( $( this ).parents( '.share:first' ).hasClass('m-article' ) ) { 168 _this.states.type = 'article'; 169 } else if ( $( this ).parents( '.share:first' ).hasClass('m-header' ) ) { 170 _this.states.type = 'header'; 171 } 172 _this.showFullList( e, $( this ), shareurl, sharetitle, shareid ); 173 } 174 } 175 }); 176 } 177 }, 178 initFullList: function( selector ) { 179 var _this = this; 180 if ( typeof selector === 'undefined' ) { 181 selector = _this.options.shareFullEl; 182 } 183 var i = 0; 184 this.services_sort = []; 185 for ( var service in _this.services ) { 186 _this.services_sort.push( [ service, parseInt( ria.lsGet('ria.share.' + service ) || 0 ), ++i, _this.services[ service ] ] ); 187 } 188 189 _this.services_sort.sort(function( a, b ) { 190 if ( a[ 1 ] < b[ 1 ] ) return 1; 191 if ( a[ 1 ] > b[ 1 ] ) return -1; 192 if ( a[ 2 ] < b[ 2 ] ) return -1; 193 return 1; 194 }); 195 196 for ( var i = 0; i < _this.services_sort.length; i++ ) { 197 if ( ( _this.services_sort[ i ][ 3 ].mobile && _this.states.mobile ) || !_this.services_sort[ i ][ 3 ].mobile ) { 198 var data = { 199 name: _this.services_sort[ i ][ 0 ], 200 title: _this.services_sort[ i ][ 3 ].name 201 } 202 var template = _.template( $( '#shareFullTemplate' ).html() ); 203 var result = template( { data: data } ); 204 $( selector ).find( ' > ul' ).append( result ); 205 } 206 } 207 208 $( selector ).on('click', 'a[data-name]', function( e ) { 209 _this.serviceClick( e, $( this ) ); 210 }); 211 }, 212 serviceClick: function( e, el ) { 213 e.stopPropagation(); 214 215 var service = el.data( 'name' ); 216 var url = el.closest( '[data-url]' ).attr( 'data-url' ); 217 var title = el.closest( '[data-title]' ).attr( 'data-title' ); 218 var id = el.closest( '[data-id]' ).attr( 'data-id' ); 219 220 if ( url.lastIndexOf( 'http', 0 ) !== 0 ) { 221 url = GLOBAL.www + url; 222 } 223 224 var data = { 225 url: encodeURIComponent( url ), 226 title: encodeURIComponent( title ) 227 } 228 var template = _.template( this.services[ service ].popupUrl ); 229 var popupUrl = template( { data: data } ); 230 231 this.openPopup( popupUrl, { 232 width: this.services[ service ].popupWidth, 233 height: this.services[ service ].popupHeight 234 }); 235 236 ria.lsSet( 'ria.share.' + service, ( parseInt( ria.lsGet('ria.share.' + service ) || 0 ) + 1 ) ); 237 if ( id != '' ) { 238 $.get( '/services/counter/set/?obj_id=' + id + '&obj_type=article&action_type=share' ); 239 } 240 }, 241 showFullList: function( e, el, url, title, id ) { 242 var _this = this; 243 e.stopPropagation(); 244 /* ÐбÑабоÑка клика влÑбое меÑÑо докÑменÑа Ð´Ð»Ñ Ð·Ð°ÐºÑÑÑÐ¸Ñ ÑаÑÑ */ 245 $( document ).on( 'click.hideshare ', function() { 246 _this.hideFullList(); 247 $( document ).off( 'click.hideshare' ); 248 }); 249 /* ÐÑли this.el еÑÑÑ Ð·Ð½Ð°Ñил Ñже еÑÑÑ Ð¾ÑкÑÑÑÑй ÑпиÑок ÑаÑÑ Ð² дÑÑгом меÑÑе, закÑÑваем*/ 250 if ( typeof _this.states.el !== 'undefined' ) { 251 _this.states.el.removeClass('m-active'); 252 } 253 _this.states.el = el; 254 _this.states.el.addClass('m-active'); 255 $( _this.options.shareFullEl ).attr({ 256 'data-url': url, 257 'data-title': title, 258 'data-id': id 259 }); 260 _this.changeModal( true ) 261 /* ÐозиÑиониÑÑем ÑпиÑок */ 262 _this.coordFullList(); 263 /* ÐавеÑиваем модиÑикаÑоÑÑ Ð¸ показÑваем ÑпиÑок*/ 264 $( _this.options.shareFullEl ) 265 .toggleClass( 'm-article', _this.states.type == 'article' ) 266 .toggleClass( 'm-header', _this.states.type == 'header' ) 267 .addClass( 'active' ); 268 269 _this.states.open = true; 270 271 }, 272 changeModal: function( state ){ 273 var _this = this; 274 if ( _this.states.modal == false && _this.states.cw < 925 && ( state === true || state === undefined ) ){ 275 _this.states.modal = true;
276 $( 'html' ).addClass( 'modal-share' ); 277 ria.disablePageScroll(true ); 278 } else if ( _this.states.modal == true && ( state === false || _this.states.cw >= 925 ) ){ 279 _this.states.modal = false; 280 $( 'html' ).removeClass( 'modal-share' ); 281 ria.disablePageScroll(false ); 282 } 283 }, 284 coordFullList: function() { 285 var _this = this, 286 el = _this.states.el; 287 if ( _this.states.cw < 400 ) { 288 $( this.options.shareFullEl ).css( {'right': '10px', 'bottom': '10px', 'left': '10px', 'top': 'auto'} ); 289 } else if ( _this.states.cw < 925 ) { 290 $( this.options.shareFullEl ).css( {'right': '10px', 'bottom': '10px', 'left': 'auto', 'top': 'auto'} ); 291 } else { 292 var btn_top = el.offset().top, 293 btn_left = el.offset().left, 294 btn_width = el.outerWidth(), 295 btn_height = el.outerHeight(), 296 window_h = document.documentElement.clientHeight, 297 window_scroll = window.pageYOffset || document.documentElement.scrollTop, 298 distance_top = ( btn_top - window_scroll ), 299 distance_bottom = ( window_scroll + window_h - btn_top ), 300 popup_w = $( _this.options.shareFullEl ).width(), 301 popup_h = $( _this.options.shareFullEl ).height(), 302 popup_top = ( distance_top > distance_bottom ) ? btn_top - popup_h - 3 : btn_top + btn_height + 1, 303 popup_left = btn_left - popup_w + btn_width/2 + 18; 304 305 if ( _this.states.type == 'article' ) { 306 popup_top = btn_top - 10; 307 popup_left = btn_left + btn_width + 10; 308 }; 309 310 $( _this.options.shareFullEl ) 311 .toggleClass( 'm-bottom', !( distance_top > distance_bottom ) ) 312 .css( { 'left': popup_left+'px', 'top': popup_top+'px', 'bottom': 'auto', 'right': 'auto' } ); 313 } 314 }, 315 openPopup: function( url, params ) { 316 var _this = this, 317 left = Math.round( screen.width/2 - params.width/2 ); 318 var top = 0; 319 if ( screen.height > params.height ) { 320 top = Math.round( screen.height/3 - params.height/2 ); 321 } 322 var win = window.open( url, 'sl_' + _this.service, 'left=' + left + ',top=' + top + ',' + 323 'width=' + params.width + ',height=' + params.height + ',personalbar=0,toolbar=0,scrollbars=1,resizable=1'); 324 if ( win ) { 325 win.focus(); 326 } else { 327 location.href = url; 328 } 329 if ( typeof _this.states.el != 'undefined' ) { 330 _this.hideFullList(); 331 } 332 }, 333 hideFullList: function() { 334 if ( this.states.open == true ){ 335 var _this = this; 336 _this.changeModal( false ) 337 _this.states.el.removeClass( 'm-active' ); // Удаление клаÑÑа Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ "..." 338 $( _this.options.shareFullEl ) 339 .css({'left': 'auto', 'top': 'auto', 'bottom': 'auto', 'right': 'auto'}) 340 .removeClass('active m-article m-header' ); 341 _this.states.type = false;
342 _this.states.el = undefined; 343 _this.states.open = false; 344 } 345 }, 346 getClientWidth: function () { 347 return Math.max( window.innerWidth || 0, ( document.getElementsByTagName( 'html' )[ 0 ] || {} ).clientWidth || 0) 348 }, 349 mobileAndTabletcheck: function() { 350 var check = false; 351 (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera); 352 return check; 353 } 354}
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.