1/*! 2 AutoResize v1.18.4 - 2014-01-11 3 Automatically adjust textarea height based on user input. 4 (c) 2014 Jack Moore - http://www.jacklmoore.com/autosize 5 Originally altered by mdawaffe. 6 Current version altered by pento. 7 license: http://www.opensource.org/licenses/mit-license.php 8*/ 9(function ($) { 10 var 11 defaults = { 12 className: 'autosizejs', 13 append: '', 14 callback: false, 15 resizeDelay: 10, 16 placeholder: true, 17 animate: true, 18 animateDuration: 150, 19 animateCallback: function(){}, 20 extraSpace: 20 21 }, 22 23 // border:0 is unnecessary, but avoids a bug in Firefox on OSX 24 copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>', 25 26 // line-height is conditionally included because IE7/IE8/old Opera do not return the correct value. 27 typographyStyles = [ 28 'fontFamily', 29 'fontSize', 30 'fontWeight', 31 'fontStyle', 32 'letterSpacing', 33 'textTransform', 34 'textDecoration', 35 'wordSpacing', 36 'textIndent' 37 ], 38 39 // to keep track which textarea is being mirrored when adjust() is called. 40 mirrored, 41 42 // the mirror element, which is used to calculate what size the mirrored element should be. 43 mirror = $(copy).data('autosize', true)[0]; 44 45 // test that line-height can be accurately copied. 46 mirror.style.lineHeight = '99px'; 47 if ($(mirror).css('lineHeight') === '99px') { 48 typographyStyles.push('lineHeight'); 49 } 50 mirror.style.lineHeight = ''; 51 52 $.fn.autoResize = function (options) { 53 if (!this.length) { 54 return this; 55 } 56 57 options = $.extend({}, defaults, options || {}); 58 59 if (mirror.parentNode !== this.parentNode) { 60 $(mirror).insertBefore(this); 61 } 62 63 return this.each(function () { 64 var 65 ta = this, 66 $ta = $(ta), 67 maxHeight, 68 minHeight, 69 boxOffset = 0, 70 callback = $.isFunction(options.callback), 71 originalStyles = { 72 height: ta.style.height, 73 overflow: ta.style.overflow, 74 overflowY: ta.style.overflowY, 75 wordWrap: ta.style.wordWrap, 76 resize: ta.style.resize 77 }, 78 timeout, 79 width = $ta.width(); 80 81 if ($ta.data('autosize')) { 82 // exit if autosize has already been applied, or if the textarea is the mirror element. 83 return; 84 } 85 $ta.data('autosize', true); 86 87 if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){ 88 boxOffset = $ta.outerHeight() - $ta.height(); 89 } 90 91 // IE8 and lower return 'auto', which parses to NaN, if no min-height is set. 92 minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height()); 93 94 $ta.css({ 95 overflow: 'hidden', 96 overflowY: 'hidden', 97 wordWrap: 'break-word', // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width 98 resize: ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal' 99 }); 100 101 // The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value. 102 // window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower. 103 function setWidth() { 104 var width; 105 var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false; 106 107 if (style) { 108 109 width = ta.getBoundingClientRect().width; 110 111 if (width === 0) { 112 width = parseInt(style.width,10); 113 } 114 115 $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){ 116 width -= parseInt(style[val],10); 117 }); 118 } else { 119 width = Math.max($ta.width(), 0); 120 } 121 122 mirror.style.width = width + 'px'; 123 } 124 125 function initMirror() { 126 var styles = {}; 127 128 mirrored = ta; 129 mirror.className = options.className + " " + ta.className; 130 maxHeight = parseInt($ta.css('maxHeight'), 10); 131 132 // mirror is a duplicate textarea located off-screen that 133 // is automatically updated to contain the same text as the 134 // original textarea. mirror always has a height of 0. 135 // This gives a cross-browser supported way getting the actual 136 // height of the text, through the scrollTop property. 137 $.each(typographyStyles, function(i,val){ 138 styles[val] = $ta.css(val); 139 }); 140 $(mirror).css(styles); 141 142 setWidth(); 143 144 // Chrome-specific fix: 145 // When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space 146 // made available by removing the scrollbar. This workaround triggers the reflow for Chrome. 147 if (window.chrome) { 148 var width = ta.style.width; 149 ta.style.width = '0px'; 150 var ignore = ta.offsetWidth; 151 ta.style.width = width; 152 } 153 } 154 155 // Using mainly bare JS in this function because it is going 156 // to fire very often while typing, and needs to very efficie
156nt. 157 function adjust() { 158 var height, original; 159 160 if (mirrored !== ta) { 161 initMirror(); 162 } else { 163 setWidth(); 164 } 165 166 if (!ta.value && options.placeholder) { 167 // If the textarea is empty, copy the placeholder text into 168 // the mirror control and use that for sizing so that we 169 // don't end up with placeholder getting trimmed. 170 mirror.value = ($ta.attr("placeholder") || '') + options.append; 171 } else { 172 mirror.value = ta.value + options.append; 173 } 174 175 mirror.style.overflowY = ta.style.overflowY; 176 original = parseInt(ta.style.height,10); 177 178 // Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied 179 mirror.scrollTop = 0; 180 181 mirror.scrollTop = 9e4; 182 183 // Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding. 184 height = mirror.scrollTop + options.extraSpace; 185 186 if (maxHeight && height > maxHeight) { 187 ta.style.overflowY = 'scroll'; 188 height = maxHeight; 189 } else { 190 ta.style.overflowY = 'hidden'; 191 if (height < minHeight) { 192 height = minHeight; 193 } 194 } 195 196 height += boxOffset; 197 height = Math.floor( height ); 198 199 if (original !== height) { 200 if ( options.animate && $ta.css( 'display' ) === 'block' ) { 201 $ta.stop().animate( {height: height}, options.animateDuration, options.animateCallback ); 202 } else { 203 ta.style.height = height + 'px'; 204 options.animateCallback.call( this ); 205 } 206 if (callback) { 207 options.callback.call(ta,ta); 208 } 209 } 210 } 211 212 function resize () { 213 clearTimeout(timeout); 214 timeout = setTimeout(function(){ 215 var newWidth = $ta.width(); 216 217 if (newWidth !== width) { 218 width = newWidth; 219 adjust(); 220 } 221 }, parseInt(options.resizeDelay,10)); 222 } 223 224 if ('onpropertychange' in ta) { 225 if ('oninput' in ta) { 226 // Detects IE9. IE9 does not fire onpropertychange or oninput for deletions, 227 // so binding to onkeyup to catch most of those occasions. There is no way that I 228 // know of to detect something like 'cut' in IE9. 229 $ta.on('input.autosize keyup.autosize', adjust); 230 } else { 231 // IE7 / IE8 232 $ta.on('propertychange.autosize', function(){ 233 if(event.propertyName === 'value'){ 234 adjust(); 235 } 236 }); 237 } 238 } else { 239 // Modern Browsers 240 $ta.on('input.autosize', adjust); 241 } 242 243 // Set options.resizeDelay to false if using fixed-width textarea elements. 244 // Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize. 245 246 if (options.resizeDelay !== false) { 247 $(window).on('resize.autosize', resize); 248 } 249 250 // Event for manual triggering if needed. 251 // Should only be needed when the value of the textarea is changed through JavaScript rather than user input. 252 $ta.on('autosize.resize', adjust); 253 254 // Event for manual triggering that also forces the styles to update as well. 255 // Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method. 256 $ta.on('autosize.resizeIncludeStyle', function() { 257 mirrored = null; 258 adjust(); 259 }); 260 261 $ta.on('autosize.destroy', function(){ 262 mirrored = null; 263 clearTimeout(timeout); 264 $(window).off('resize', resize); 265 $ta 266 .off('autosize') 267 .off('.autosize') 268 .css(originalStyles) 269 .removeData('autosize'); 270 }); 271 272 // Call adjust in case the textarea already contains text. 273 adjust(); 274 }); 275 }; 276}(window.jQuery || window.$)); // jQuery or jQuery-like library, such as Zepto 277; 278var HighlanderComments = jQuery.extend( HighlanderComments, { 279 autosaveInterval: false, 280 commentList: null, 281 282 initialHeight: 70, 283 284 cookies: { facebook: 'wpc_fbc', twitter: 'wpc_tc', wordpress: 'wpc_wpc', googleplus: 'wpc_gpc' }, 285 popups: { facebook: ',height=400,width=600', twitter: ',height=515,width=600', wordpress: ',height=500,width=500' }, 286 temp_cookie_data: '', 287 currentParent: false, 288 currentParentId: false, 289 currentParentMargins: {}, 290 keyCodeReturn: 13, 291 292 resizeCallback: function() {}, 293 294 init : function() { 295 jQuery( '#respond' ).addClass( 'js' ); 296 297 HighlanderComments.commentList = jQuery( '#thecomments, .thecomments, #commentlist, #comment-list, #comments-list, .commentlist, .comment-list, .comments-list, .com-list, #comments' ).last(); 298 299 jQuery( '#comment-form-nascar a' ).click( HighlanderComments.clickService ); 300 jQuery( '#postas-wordpress' ).click( HighlanderComments.clickExternalTab ); 301 jQuery( '#postas-facebook, #labelto-facebook' ).click( HighlanderComments.clickExternalTab ); 302 jQuery( '#postas-twitter, #labelto-twitter' ).click( HighlanderComments.clickExternalTab ); 303 304 pm.bind( 'googlePlusButtonClick', HighlanderComments.onGooglePlusButtonClick, 'https://public-api.wordpress.com' ); 305 pm.bind( 'googlePlusSignIn', HighlanderComments.onGooglePlusSignIn, 'https://public-api.wordpress.com' ); 306 307 jQuery( '#labelto-wordpress' ).click( HighlanderComments.checkPostToWordPress ); 308 jQuery( '#comment-form-post-to-edit a' ).click( HighlanderComments.editShareText ); 309 jQuery( window ).resize( HighlanderComments.toggleShareLabels ); 310 311 HighlanderComments.toggleShareLabels(); 312 HighlanderComments.restoreComment(); 313// HighlanderComments.autosaveInterval = setInterval( HighlanderComments.autosaveComment, 10000 ); 314 315 jQuery.each( jQuery( '.comment-form-field input, textarea#comment' ), function() { 316 if ( jQuery(this).val() !== '' ) { 317 HighlanderComments.hideLabels( jQuery(this) ); 318 } 319 } ); 320 321 jQuery( 'div.comment-form-fields input' ).change( function() { HighlanderComments.toggleLabel( jQuery(this) ); } ).focus( function() { HighlanderComments.hideLabels( jQuery(this) ); } ).blur( function() { HighlanderComments.showLabels( jQuery(this) ); } ); 322 jQuery( 'div.comment-form-fields label' ).click( function() { HighlanderComments.hideLabels( jQuery(this).parent().children( '.comment-form-input input' ) ); } ); 323 324 // Identity auto-fill from Gravatar Profiles 325 jQuery( '#email' ).blur( function() { 326 HighlanderComments.updateAvatarWithGravatar( '#email' ); 327 328 if ( !jQuery( '#author' ).val() ) { 329 Gravatar.autofill( jQuery( this ).val(), { 330 'displayName':'author', 331 'url':'url' // Their first available link, or profile URL if none 332 } ); 333 334 var afd = Gravatar.autofill_data; 335 Gravatar.autofill_data = function( hash ) { 336 afd.call( Gravatar, hash ); 337 jQuery( 'input#url' ).change(); 338 jQuery( 'input#author' ).change().click(); 339 }; 340 } 341 } ); 342 343 // Comment area auto-sizing and tab handling 344 jQuery( 'textarea#comment' ) 345 .autoResize({ 346 animate: false, 347 animateCallback: HighlanderComments.resizeCallback 348 }) 349 .css( 'resize', 'none' ) 350 .trigger('change.dynSiz') 351 .focus( function() { HighlanderComments.hideLabels( jQuery(this) ); } ) 352 .blur( function() { HighlanderComments.showLabels( jQuery(this) ); } ) 353 .keydown( function( e ) { 354 if ( 'undefined' != typeof e.keyCode && 9 == e.keyCode ) { // TAB key 355 e.preventDefault(); 356 if ( 'guest' == jQuery( '#hc_post_as' ).val() ) { 357 if ( 1 == HighlanderComments.comment_registration ) { 358 jQuery( '#postas-wordpress' ).focus(); 359 } else { 360 jQuery( '#email' ).focus(); 361 } 362 } else { 363 jQuery( '#comment-submit' ).focus(); 364 } 365 } 366 if ( 367 HighlanderComments.isCommandOrControlKeyDown( e ) && 368 HighlanderComments.keyCodeReturn === e.which 369 ) { 370 jQuery( "#comment-submit" ).click(); 371 } 372 } ) 373 .keyup( function() { HighlanderComments.fillShareText( jQuery(this) ); } ) 374 .one( 'focus', function() { 375 var googlePlusSignIn = jQuery( '#googleplus-sign-in' ); 376 if ( googlePlusSignIn.length < 1 ) { 377 return; 378 } 379 380 pm( { 381 target: googlePlusSignIn[0].contentWindow, 382 type: 'googlePlusLoadJS', 383 data: 0, 384 url: 'https://public-api.wordpress.com' 385 } ); 386 }); 387 388 // Client-side form validation 389 jQuery( '#commentform' ).submit( function() { 390 var verified = true, email, author; 391 // Comment text required 392 if ( '' === jQuery( 'textarea#comment' ).val() ) { 393 jQuery( 'label[for="comment"]' ).fadeOut( 'fast', function() { 394 jQuery(this).text( HighlanderComments.enterACommentError ).fadeIn( 'fast').addClass('error'); 395 } ); 396 jQuery( '#comment-form-comment' ).addClass('error'); 397 jQuery( 'textarea#comment' ).focus( function() { jQuery(this).parent( '#comment-form-comment' ).removeClass('error'); } ); 398 verified = false;
399 } 400 401 // Only exists if email/name are required 402 if ( 'guest' == jQuery( '#hc_post_as' ).val() && ( jQuery( '#comment-form-guest label span[class="required"]' ).size() || jQuery( '#comment-form-guest label[class="error"]' ).size() ) ) { 403 email = jQuery( '#email' ).val(); 404 if ( '' === email || !email.match( /^.*@.*\..*$/ ) ) { 405 jQuery( 'label[for="email"]' ).fadeOut( 'fast', function() { 406 var error; 407 if ( '' == email ) { 408 error = HighlanderComments.enterEmailError; 409 } else { 410 error = '<span class="nopublish">' + HighlanderComments.invalidEmailError + '</span>'; 411 } 412 jQuery(this).html( error ).css( 'opacity', 1 ).fadeIn( 'fast' ).addClass( 'error' ); 413 }); 414 jQuery( 'div.comment-form-email .comment-form-input' ).addClass('error'); 415 jQuery( 'input#email' ).focus( function() { jQuery(this).parent().removeClass( 'error' ); } ); 416 417 verified = false; 418 } 419 420 author = jQuery( '#author' ).val(); 421 if ( '' === author ) { 422 jQuery( 'label[for="author"]' ).fadeOut( 'fast', function() { 423 jQuery(this).text( HighlanderComments.enterAuthorError ).fadeIn('fast').addClass( 'error' ); 424 } ); 425 jQuery( 'div.comment-form-author .comment-form-input' ).addClass('error'); 426 jQuery( 'input#author' ).focus( function() { jQuery(this).parent().removeClass( 'error' ); } ); 427 verified = false; 428 } 429 } 430 431 // Don't allow "guest" comments if auth is required 432 if ( '1' == HighlanderComments.comment_registration && 'guest' == jQuery( '#hc_post_as' ).val() ) { 433 jQuery( '#comment-form-nascar > p' ).addClass( 'error' ).fadeOut( 'fast', function() { 434 jQuery( this ).fadeIn( 'fast' ); 435 } ); 436 verified = false; 437 } 438 439 // Set a cookie to remember which was the last used tab 440 HighlanderComments.writeCookie( 'hc_post_as', jQuery( '#hc_post_as' ).val(), 7, '.wordpress.com' ); 441 442 if ( !verified ) { 443 return false; 444 } 445 446 HighlanderComments.clickSubmit(); 447 return true; 448 } ); 449 450 // Set up the identity block based on WP options, logged in state, etc 451 if ( '1' == HighlanderComments.comment_registration ) { 452 // Must be logged in to comment (guest commenting not allowed) 453 jQuery('#comment-form-guest').hide(); 454 if ( !HighlanderComments.isJetpack && !HighlanderComments.userIsLoggedIn ) { 455 // Force to guest posting if they're not logged in, which should actually not allow itself 456 HighlanderComments.clickGuestTab(); 457 jQuery( '#comment-form-wordpress' ).removeClass( 'selected' ); 458 jQuery( '#hc_post_as' ).val( 'guest' ); 459 } 460 } else { 461 // Guest commenting is allowed 462 if ( HighlanderComments.userIsLoggedIn && jQuery( '#comment-form-wordpress.selected' ).length ) { 463 // User is logged in and we're looking at the WP UI already, get rid of guest commenting 464 jQuery( '#comment-form-guest' ).slideUp( 'fast' ); 465 } 466 } 467 if ( jQuery( '.comment-form-service.selected' ).not( '#comment-form-guest.selected' ).length ) { 468 // Something other than Guest is selected, hide the auth strip 469 jQuery( '#comment-form-nascar' ).hide(); 470 } 471 472 if ( 'undefined' !== typeof addComment ) { 473 HighlanderComments._moveForm = addComment.moveForm; 474 addComment.moveForm = HighlanderComments.moveForm; 475 } 476 477 // Hover Tooltips 478 jQuery( '#comment-form-guest .comment-form-avatar' ).hover( function() { 479 pos = jQuery( this ).offset(); 480 if ( 'rtl' === HighlanderComments.text_direction ) { 481 style = 'top:' + ( pos.top - 10 ) + 'px;left:' + ( pos.left - 130 ) + 'px;'; 482 } else { 483 style = 'top:' + ( pos.top - 10 ) + 'px;left:' + ( pos.left + 35 ) + 'px;'; 484 } 485 486 jQuery( 'body' ).append( '<div id="hltt-grav" class="highlander-tooltip" style="' + style + '">' + HighlanderComments.gravatarFromEmail + '</div>' ); 487 }, function() { 488 jQuery( '#hltt-grav' ).fadeOut( 'fast', function() { 489 jQuery( this ).remove(); 490 jQuery( '.highlander-tooltip' ).remove(); 491 } ); 492 } ); 493 jQuery( '#comment-form-nascar ul' ).hover( function() { 494 pos = jQuery( this ).offset(); 495 if ( 'rtl' === HighlanderComments.text_direction ) { 496 style = 'top:' + ( pos.top - 12 ) + 'px;left:' + ( pos.left + 125 ) + 'px;'; 497 } else { 498 style = 'top:' + ( pos.top - 12 ) + 'px;left:' + ( pos.left - 125 ) + 'px;'; 499 } 500 jQuery( 'body' ).append( '<div id="hltt-auth" class="highlander-tooltip" style="' + style + '">' + HighlanderComments.logInToExternalAccount + '</div>' ); 501 }, function() { 502 jQuery( '#hltt-auth' ).fadeOut( 'fast', function() { 503 jQuery( this ).remove(); 504 jQuery( '.highlander-tooltip' ).remove(); 505 } ); 506 } ); 507 }, 508 509 isCommandOrControlKeyDown: function( event ) { 510 // event.metaKey will be true if Command key (â) or Windows key is down. 511 return ( event.ctrlKey || event.metaKey ); 512 }, 513 514 _moveForm: null, 515 moveForm: function( commId, parentId, respondId, postId ) { 516 if ( null === HighlanderComments._moveForm ) { 517 return; 518 } 519 520 var t = this, 521 r = false, 522 respond = jQuery( '#' + respondId ).css( { marginLeft: 0, marginRight: 0 } ), 523 w, wTop, commElement, rHeight, cTop, rTop; 524 525 if ( HighlanderComments.currentParent ) { 526 if ( parentId === HighlanderComments.currentParentId ) { 527 return false;
528 } 529 530 w = jQuery(window); 531 wTop = w.scrollTop(); 532 commElement = jQuery( '#' + commId ); 533 cTop = commElement.offset().top; 534 rTop = respond.offset().top; 535 536 if ( rTop <= cTop ) { 537 rHeight = respond.outerHeight( true ); 538 respond.before( jQuery( '<div id="highlander-placeholder" />' ).css( { margin: 0, padding: 0, border: 0, height: rHeight, visibility: 'hidden', position: respond.css( 'position' ) } ) ); 539 } 540 541 r = HighlanderComments._moveForm.call( t, commId, parentId, respondId, postId ); 542 if ( false !== r ) { 543 return r; 544 } 545 546 HighlanderComments.currentParent.stop( true, true ).css( HighlanderComments.currentParentMargins ); 547 548 jQuery( '#highlander-placeholder' ).remove(); 549 550 if ( rTop <= cTop ) { 551 jQuery( window ).scrollTop( wTop - rHeight ); 552 } 553 554 HighlanderComments.moveFormNow.call( t, commId, parentId, respondId ); 555 } else { 556 r = HighlanderComments._moveForm.call( t, commId, parentId, respondId, postId ); 557 if ( false === r ) { 558 HighlanderComments.moveFormNow.call( t, commId, parentId, respondId ); 559 } 560 } 561 562 return r; 563 }, 564 565 moveFormNow: function( commId, parentId, respondId ) { 566 HighlanderComments.currentParent = jQuery( '#comment-' + parentId ).parents( '.highlander-comment' ).andSelf().filter( '.highlander-comment' ).last(); 567 if ( !HighlanderComments.currentParent.size() ) { 568 HighlanderComments.currentParent = jQuery( '#comment-' + parentId ).parents( '.comment' ).andSelf().filter( '.comment' ).last(); 569 } 570 HighlanderComments.currentParentId = parentId; 571 572 var respond = jQuery( '#' + respondId ); 573 574 if ( !HighlanderComments.currentParent.find( respond ).size() ) { 575 var betterParent = HighlanderComments.currentParent.parents( '.children:first' ); 576 if ( !betterParent.size() ) { 577 betterParent = HighlanderComments.currentParent.parents( '.highlander-comment:first' ); 578 if ( !betterParent.size() ) { 579 betterParent = HighlanderComments.currentParent.parents( '.comment:first' ); 580 } 581 } 582 583 if ( betterParent.size() ) { 584 HighlanderComments.currentParent = betterParent; 585 } 586 } 587 588 HighlanderComments.currentParentMargins = { 589 backgroundColor: HighlanderComments.currentParent.css( 'backgroundColor' ), 590 marginLeft: HighlanderComments.currentParent.css( 'marginLeft' ), 591 marginRight: HighlanderComments.currentParent.css( 'marginRight' ) 592 }; 593 594 var oldOff, newOff, offOrder, autoWidth = false; 595 if ( 'rtl' === HighlanderComments.text_direction ) { 596 offOrder = [ 'Left', 'Right' ]; 597 } else { 598 offOrder = [ 'Right', 'Left' ]; 599 } 600 601 jQuery.each( offOrder, function( i, v ) { 602 if ( '0px' === HighlanderComments.currentParentMargins['margin' + v] ) { 603 oldOff = HighlanderComments.currentParent.offset().left; 604 if ( 'Right' === v ) { 605 oldOff += HighlanderComments.currentParent.outerWidth(); 606 } 607 HighlanderComments.currentParent.css( 'margin' + v, 0 ); 608 newOff = HighlanderComments.currentParent.offset().left; 609 if ( 'Right' === v ) { 610 newOff += HighlanderComments.currentParent.outerWidth(); 611 } 612 if ( oldOff !== newOff ) { 613 newOff = 'Right' === v ? newOff - oldOff : oldOff - newOff; 614 HighlanderComments.currentParent.css( 'margin' + v, newOff ); 615 HighlanderComments.currentParentMargins['margin' + v] = newOff; 616 autoWidth = true; 617 } 618 } 619 } ); 620 621 if ( autoWidth ) { 622 HighlanderComments.currentParent.css( 'width', 'auto' ); 623 HighlanderComments.currentParentMargins.width = 'auto'; 624 } 625 626 var rgbaTransparent = /rgba.*,\s*0\s*\)/, cp, bg, bgi; 627 if ( 'transparent' === HighlanderComments.currentParentMargins.backgroundColor || HighlanderComments.currentParentMargins.backgroundColor.match( rgbaTransparent ) ) { 628 cp = HighlanderComments.currentParent.get( 0 ); 629 bg = 'transparent'; 630 bgi = HighlanderComments.currentParent.css( 'backgroundImage' ); 631 632 while ( 'none' === bgi && cp.parentNode && cp.parentNode != document && ( 'transparent' === bg || bg.match( rgbaTransparent ) ) ) { 633 cp = cp.parentNode; 634 bg = jQuery( cp ); 635 bgi = bg.css( 'backgroundImage' ); 636 bg = bg.css( 'backgroundColor' ); 637 } 638 639 HighlanderComments.currentParent.css( 'backgroundColor', bg ); 640 } 641 642 var cancel = document.getElementById( 'cancel-comment-reply-link' ), 643 listOffsetSource = HighlanderComments.commentList, 644 listOffset, 645 parentOffset = HighlanderComments.currentParent.offset(), 646 currentParentMargins = HighlanderComments.currentParentMargins, 647 redoMargins = false, 648 grandWidth; 649 650 cp = HighlanderComments.currentParent; 651 652 while ( !cp.is( HighlanderComments.commentList ) && !cp.is( document ) ) { 653 if ( 'hidden' === cp.css( 'overflow' ) || 'hidden' === cp.css( 'overflow-x' ) ) { 654 listOffsetSource = cp; 655 break; 656 } 657 658 cp = cp.parent(); 659 } 660 661 listOffset = listOffsetSource.offset(); 662 663 HighlanderComments._unmoveForm = cancel.onclick; 664 cancel.onclick = function() { return HighlanderComments.unmoveForm.call( this ); }; 665 666 if ( -1 < currentParentMargins.marginLeft.toString().indexOf( '%' ) ) { 667 grandWidth = HighlanderComments.currentParent.parent().width(); 668 currentParentMargins.marginLeft = parseFloat( currentParentMargins.marginLeft ) / 100 * grandWidth; 669 redoMargins = true; 670 } 671 672 if ( -1 < currentParentMargins.marginRight.toString().indexOf( '%' ) ) { 673 grandWidth = HighlanderComments.currentParent.parent().width(); 674 currentParentMargins.marginRight = parseFloat( currentParentMargins.marginRight ) / 100 * grandWidth; 675 redoMargins = true; 676 } 677 678 if ( redoMargins ) { 679 HighlanderComments.currentParent.css( currentParentMargins ); 680 } 681 682 listOffset.right = listOffset.left + listOffsetSource.outerWidth(); 683 parentOffset.left -= parseInt( HighlanderComments.currentParent.css( 'margin-left' ), 10 ); 684 parentOffset.right = parentOffset.left + HighlanderComments.currentParent.outerWidth( true ); 685 686 respond.hide(); 687 HighlanderComments.currentParent.animate( { 688 marginLeft: '-=' + ( parentOffset.left - listOffset.left ).toString(), 689 marginRight: '-=' + ( listOffset.right - parentOffset.right ).toString() 690 }, 350, function() { 691 respond.slideDown( 350, function() { 692 jQuery( '#' + commId + ' .comment-reply-link:first' ).focus(); 693 jQuery( '#comment' ).focus(); 694 HighlanderComments.resizeCallback(); 695 } ); 696 697 respond.children('form').after('<div class="clear" id="threaded-clear"></div>'); 698 } ); 699 }, 700 701 _unmoveForm: null, 702 unmoveForm: function() { 703 var r = HighlanderComments._unmoveForm.call( this ); 704 if ( false !== r ) { 705 return r; 706 } 707 708 HighlanderComments.currentParent.stop( true, true ).animate( HighlanderComments.currentParentMargins, 350, function() { 709 HighlanderComments.currentParent.css( HighlanderComments.currentParentMargins ); 710 HighlanderComments.currentParent = HighlanderComments.currentParentId = false;
711 } ); 712 jQuery( '#respond' ).stop( true, true ).show(); 713 jQuery( '#respond div#threaded-clear' ).remove(); 714 HighlanderComments.resizeCallback(); 715 716 return r; 717 }, 718 719 HTMLToText : function( string ) { 720 return jQuery( '<span />' ).text( string ).html(); 721 }, 722 723 autosaveComment : function() { 724 var oneDay = new Date(); 725 oneDay.setTime( oneDay.getTime() + 86400000 ); 726 document.cookie = 'comment-' + HighlanderComments.postID + '=' + encodeURIComponent( jQuery( '#comment' ).val() ) + '; expires=' + oneDay.toGMTString() + '; path=/'; 727 }, 728 729 unsaveComment : function() { 730 var oneDay = new Date(); 731 oneDay.setTime( oneDay.getTime() - 86400000 ); 732 document.cookie = 'comment-' + HighlanderComments.postID + '= ; expires=' + oneDay.toGMTString() + '; path=/'; 733 }, 734 735 restoreComment : function() { 736 var parts = document.cookie.split( ';' ), part; 737 jQuery.each( parts, function(i) { 738 part = parts[i].split( '=' ); 739 if ( 'comment-' + HighlanderComments.postID === jQuery.trim( part[0] ) ) { 740 if ( 'undefined' !== typeof part[1] && 'undefined' !== part[1] && '' !== decodeURIComponent( part[1] ) ) { 741 jQuery( '#comment' ).val( decodeURIComponent( part[1] ) ); 742 } 743 return; 744 } 745 } ); 746 }, 747 748 switchAccount : function() { 749 jQuery( '.comment-form-service' ).removeClass( 'selected' ).hide(); 750 jQuery( '#hc_post_as' ).val( 'guest' ); 751 jQuery( '#comment-form-nascar > p' ).removeClass( 'error' ); 752 if ( '1' == HighlanderComments.comment_registration ) { 753 jQuery( '#comment-form-nascar' ).show(); 754 jQuery( '#comment-form-guest' ).hide(); // Guest commenting not allowed 755 HighlanderComments.resizeCallback(); 756 } else { 757 jQuery( '#comment-form-nascar' ).show(); 758 jQuery( '#comment-form-guest' ).slideDown( 'fast', HighlanderComments.resizeCallback ); 759 HighlanderComments.clickGuestTab(); 760 } 761 }, 762 763 setConnectingToText : function( serviceFriendlyName ) { 764 jQuery( '#comment-form-load-service p' ).text( HighlanderComments.connectingToText.replace( '%s', serviceFriendlyName ) ); 765 }, 766 767 updateLoadServiceVisibility : function( tab ) { 768 jQuery( '.comment-form-service' ) 769 .css( 'visibility', 'hidden' ) 770 .show() 771 .removeClass( 'selected' ) 772 .filter( tab ) 773 .css( 'visibility', 'visible' ) 774 .fadeIn( 'fast' ) 775 .end() 776 .not( tab ) 777 .hide() 778 .css( 'visibility', 'visible' ); 779 }, 780 781 clickService : function(e) { 782 e.preventDefault(); 783 784// HighlanderComments.autosaveComment(); 785 786 var tab = this.href.replace( /^.*#/, '#' ).split( ':' ); 787 788 if ( '#comment-form-load-service' === tab[0] && tab[1] ) { 789 HighlanderComments.setConnectingToText( tab[1] ); 790 } else { 791 jQuery( '#hc_post_as' ).val( tab[0].split( '-' ).pop() ); 792 } 793 794 HighlanderComments.updateLoadServiceVisibility( '#comment-form-load-service' ); 795 796 jQuery( '#comment-form-nascar li.selected' ).removeClass( 'selected' ); 797 jQuery( this ).parent().addClass( 'selected' ); 798 HighlanderComments.resizeCallback(); 799 }, 800 801 clickGuestTab : function(e) { 802 if ( '1' == HighlanderComments.comment_registration ) { 803 jQuery( '#comment-form-guest' ).hide(); 804 } 805 806 if ( jQuery( '#email' ).length && -1 < jQuery( '#email' ).val().indexOf( '@twitter.example.com' ) ) { 807 jQuery( '#email' ).val( '' ).blur(); 808 } 809 810 HighlanderComments.updateAvatarWithGravatar( '#email' ); 811 812 // Reenable subscription options 813 jQuery( '#comment-form-subscribe' ).css( 'opacity', '1' ).find( 'input' ).removeAttr( 'disabled' ); 814 HighlanderComments.resizeCallback(); 815 }, 816 817 checkPostToWordPress: function(e) { 818 HighlanderComments.clickExternalTab( 'wordpress' ); 819 jQuery( '#wordpress-login-first' ).show(); 820 }, 821 822 updateAvatarWithGravatar: function(e) { 823 var grav_base = ( 'https:' === location.protocol ? 'https://secure' : 'http://www' ) + '.gravatar.com/avatar/'; 824 // When Avatars are disabled, Gravatar can be undefined, so we check against that first 825 // and fall back to an unknown gravatar if it isn't 826 var gravSource = grav_base + 'ad516503a11cd5ca435acc9bb6523536?s=25&forcedefault=1'; 827 828 if ( 'undefined' !== typeof Gravatar && jQuery( e ).length ) { 829 gravSource = grav_base + Gravatar.md5( jQuery.trim( jQuery( e ).val().toLowerCase() ) ) + '?s=25'; 830 } 831 832 if ( 'gravatar_default' !== HighlanderComments.gravDefault ) { 833 gravSource += '&d=' + encodeURIComponent( HighlanderComments.gravDefault ); 834 } 835 836 jQuery( '#comment-form-guest .comment-form-avatar img' ).attr( 'src', gravSource ); 837 }, 838 839 getServiceData : function( service ) { 840 var data = HighlanderComments.readCookie( HighlanderComments.cookies[service] ); 841 842 if ( null === data || 'undefined' === typeof data.access_token || !data.access_token ) { 843 return false;
844 } 845 return data; 846 }, 847 848 ext_win : false, 849 ext_win_check : false, 850 pollExternalWindow : function( service, from_tab ) { 851 if ( !HighlanderComments.ext_win || HighlanderComments.ext_win.closed ) { 852 // If the cookie is available, then we must have auth'd successfully 853 if ( HighlanderComments.getServiceData( service ) ) { 854 HighlanderComments.doExternalLoggedIn( service ); 855 return; 856 } 857 HighlanderComments.doExternalCanceled( service, from_tab ); 858 HighlanderComments.ext_win = false; 859 clearInterval( HighlanderComments.ext_win_check ); 860 } 861 }, 862 863 cancelExternalWindow : function() { 864 if ( HighlanderComments.ext_win ) { 865 HighlanderComments.ext_win.close(); 866 } 867 HighlanderComments.doExternalCanceled( jQuery( '#hc_post_as' ).val(), true ); 868 }, 869 870 clickExternalTab : function( e ) { 871 if ( 'undefined' == typeof e ) { 872 return; 873 } 874 875 jQuery( '#comment-form-guest' ).slideUp( 'fast', function() { 876 jQuery( '#comment-form-nascar' ).hide(); 877 878 HighlanderComments.resizeCallback(); 879 880 clearInterval( HighlanderComments.ext_win_check ); 881 jQuery( '.highlander-tooltip' ).remove(); 882 883 var from_tab = 1; 884 if ( 'string' == typeof e ) { 885 var service = e; 886 } else { 887 var service = e.currentTarget.id.split( '-' )[1]; 888 if ( e.currentTarget.nodeName != 'A' ) { 889 from_tab = 0; 890 } 891 } 892 893 if ( 894 // Found commenting cookies 895 null != HighlanderComments.readCookie( HighlanderComments.cookies[service] ) 896 && 897 ( 898 // WordPress tab, and we're logged in 899 'wordpress' == service && HighlanderComments.userIsLoggedIn 900 || 901 // Not WordPress tab 902 'wordpress' != service 903 ) 904 ) { 905 if ( from_tab ) { 906 HighlanderComments.doExternalLoggedIn( service ); 907 } 908 } else if ( 'googleplus' == service ) { 909 // Nothing to do - we're already logged in at this point 910 } else { 911 HighlanderComments.ext_win = window.open( HighlanderComments.connectURL + '&service=' + service, 'highconn', 'status=0,toolbar=0,location=1,menubar=0,directories=0,resizable=1,scrollbars=0' + HighlanderComments.popups[service] ); 912 HighlanderComments.ext_win_check = setInterval( "HighlanderComments.pollExternalWindow( '" + service + "', " + from_tab + " )", 100 ); 913 } 914 } ); 915 }, 916 917 doExternalLoggedIn : function( service ) { 918 clearInterval( HighlanderComments.ext_win_check ); 919 920 var data = HighlanderComments.getServiceData( service ); 921 922 if ( 'object' !== typeof data ) { 923 return; 924 } 925 926 if ( 'wordpress' == service ) { 927 // Allow subscription options 928 jQuery( '#comment-form-subscribe' ).css( 'opacity', '1' ).find( 'input' ).removeAttr( 'disabled' ); 929 930 // Set up Gravatar and flag as logged in. Load a page to trigger cookies etc 931 jQuery( '#comment-form-' + service + ' .comment-form-avatar img' ).attr( 'src', data.avatar ); 932 HighlanderComments.userIsLoggedIn = true; 933 if ( !HighlanderComments.isJetpack ) { 934 jQuery( 'body' ).append( '<iframe class="highlander-auth-init" height="1" width="1" style="display:none;" src="' + HighlanderComments.homeURL + 'highlander.login/" />' ); 935 } 936 } else { 937 if ( 'twitter' == service ) { 938 // Disable subscription options for Twitter since we don't have an email 939 jQuery( '#comment-form-subscribe' ).css( 'opacity', '0.5' ).find( 'input' ).attr( 'disabled', 'disabled' ).removeAttr( 'checked' ); 940 } 941 942 // Run all external avatars through ImgPress to resize them 943 jQuery( '#comment-form-' + service + ' .comment-form-avatar img' ) 944 .attr( 'src', function() { 945 var split, host, path, query, url; 946 947 try { 948 if ( data.avatar.match( /^(https?:)?\/\/i[012]\.wp\.com\// ) ) { 949 return data.avatar.replace( /^https?:/, location.protocol ); 950 } 951 952 if ( data.avatar.match( /^(https?:)?\/\/(.*?\.)gravatar\.com\// ) ) { 953 return data.avatar.replace( /^https?:/, location.protocol ); 954 } 955 956 split = data.avatar.split( '#' ); // Ignore fragment 957 split = split[0].split( '?' ); 958 query = split[1]; 959 split = split[0].split( '//' ); // Ignore scheme 960 split = split[1].split( '/' ); 961 host = split[0]; 962 path = split.slice( 1 ).join( '/' ); 963
964 url = location.protocol + 'https://i0.wp.com/' + host + '/' + path + '?'; 965 966 if ( 'graph.facebook.com' === host && query.length ) { 967 url += 'q=' + encodeURIComponent( query ) + '&'; 968 } 969 970 return url + 'resize=25%2C25'; 971 } catch ( error ) { 972 return data.avatar; 973 } 974 } ); 975 } 976 977 jQuery( '#email' ).val( data.email ).change(); 978 jQuery( '#author' ).val( data.name ).change(); 979 jQuery( '#url' ).val( data.link ).change().click(); 980 jQuery( '#' + service + '-avatar' ).val( data.avatar ); 981 jQuery( '#' + service + '-user_id' ).val( data.uid ); 982 jQuery( '#' + service + '-access_token' ).val( data.access_token ); 983 984 jQuery( '#hc_post_as' ).val( service ); 985 986 // The child of the li.selected can be a <A> (WP, FB, Twitter) or an <IFRAME> (Google+) 987 988 var selectedLink = jQuery( '#comment-form-nascar li.selected a' ); 989 if ( selectedLink.length && service == selectedLink.attr( 'id' ).replace( 'postas-', '' ) ) { 990 jQuery( '#comment-form-load-service' ).hide(); 991 jQuery( '#comment-form-' + service ).show(); 992 jQuery( '#comment-form-' + service + ' .comment-form-posting-as strong' ).text( data.name + ':' ); 993 HighlanderComments.resizeCallback(); 994 } 995 996 var selectedIFrame = jQuery( '#comment-form-nascar li.selected iframe' ); 997 if ( selectedIFrame.length && service == "googleplus" ) { 998 jQuery( '#comment-form-load-service' ).hide(); 999 jQuery( '#comment-form-' + service ).show(); 1000 jQuery( '#comment-form-' + service + ' .comment-form-posting-as strong' ).text( data.name + ':' ); 1001 HighlanderComments.resizeCallback(); 1002 } 1003 }, 1004 1005 doExternalCanceled : function( service, from_tab ) { 1006 if ( from_tab ) { 1007 var gravSource = ( 'https:' === location.protocol ? 'https://secure' : 'http://www' ) + '.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=25'; 1008 if ( 'gravatar_default' !== HighlanderComments.gravDefault ) { 1009 gravSource += '&d=' + encodeURIComponent( HighlanderComments.gravDefault ); 1010 } 1011 jQuery( '#comment-form-' + service + ' .comment-form-avatar img' ).attr( 'src', gravSource ); 1012 jQuery( '.comment-meta-' + service ).val( '' ); 1013 jQuery( '#postas-' + service + ' span' ).html( ' ' ); 1014 jQuery( '#comment-form-' + service ).hide(); 1015 HighlanderComments.switchAccount(); 1016 } 1017 1018 jQuery( '#postto-' + service ).prop( 'checked', false ); 1019 }, 1020 1021 doExternalLogout : function( service ) { 1022 var hostname; 1023 if ( -1 !== document.location.hostname.indexOf( '.wordpress.com' ) ) { 1024 hostname = 'wordpress.com'; 1025 } else { 1026 hostname = document.location.hostname; 1027 } 1028 1029 HighlanderComments.writeCookie( HighlanderComments.cookies[service], '', -10, hostname ); 1030 HighlanderComments.doExternalCanceled( service, true ); 1031 1032 if ( 'wordpress' == service ) { 1033 HighlanderComments.userIsLoggedIn = false; 1034 jQuery( 'body' ).append( '<iframe height="1" width="1" style="display:none;" src="' + HighlanderComments.logoutURL + '" />' ); 1035 } 1036 1037 if ( 'googleplus' == service ) { 1038 jQuery( 'body' ).append( '<iframe height="1" width="1" style="display:none;" src="https://accounts.google.com/logout" />' ); 1039 } 1040 }, 1041 1042 clickSubmit : function(e) { 1043 HighlanderComments.unsaveComment(); 1044 jQuery( '#respond input#comment-submit' ).val( HighlanderComments.HTMLToText( HighlanderComments.submittingText ) ).addClass( 'disabled' ).attr( 'disabled', 'disabled' ).wrap( '<p id="comment-form-submitting" />' ); 1045 }, 1046 1047 toggleLabel : function( input ) { 1048 if ( jQuery( window ).width() && jQuery( window ).width() <= 450 ) { 1049 return; 1050 } 1051 1052 if ( !input.val().length ) { 1053 input.parents('div.comment-form-field').children('label').css( { opacity: 1 } ); 1054 } else { 1055 input.parents('div.comment-form-field').children('label').css( { opacity: 0.05 } ); 1056 } 1057 }, 1058 1059 hideLabels: function( input ) { 1060 if ( jQuery( window ).width() == 0 || jQuery( window ).width() > 450 && !input.attr( 'placeholder' ) ) { 1061 input.parents('div.comment-form-field').children('label').animate( { opacity: 0 }, 150, function() { 1062 jQuery(this).hide(); 1063 } ); 1064 } 1065 1066 input.parent().addClass('active'); 1067 }, 1068 1069 showLabels: function( input ) { 1070 if ( jQuery( window ).width() == 0 || jQuery( window ).width() > 450 && !input.attr( 'placeholder' ) ) { 1071 if ( !input.val().length ) { 1072 input.parents('div.comment-form-field').children('label').show().animate( { opacity: 1 }, 150 ); 1073 } 1074 } 1075 1076 input.parent().removeClass('active'); 1077 }, 1078 1079 editShareText: function(e) { 1080 e.preventDefault(); 1081 1082 if ( jQuery( '#comment-form-edit-share-text' ).is( ':hidden' ) ) { 1083 jQuery( '#comment-form-edit-share-text' ).slideDown( 'fast', HighlanderComments.resizeCallback ); 1084 } else {
1085 jQuery( '#comment-form-edit-share-text' ).slideUp( 'fast', HighlanderComments.resizeCallback ); 1086 } 1087 }, 1088 1089 toggleShareLabels: function() { 1090 if ( jQuery( '#respond' ).outerWidth() > 450 ) { 1091 jQuery( '#comment-form-post-to label span' ).show().parent().css( { 'padding-right': 0 } ); 1092 } else { 1093 jQuery( '#comment-form-post-to label span' ).hide().parent().css( { 'padding-right': '20px' } ); 1094 } 1095 HighlanderComments.resizeCallback(); 1096 }, 1097 1098 fillShareText: function( textarea ) { 1099 if ( !jQuery( '#comment-form-share-text-textarea' ).length ) { return; } 1100 1101 var current = jQuery( '#comment-form-share-text-textarea' ).val().split( '": ' ); 1102 var shareComment = current[0] + '": ' + jQuery(textarea).val(); 1103 1104 if ( shareComment.length > 280 ) { 1105 shareComment = shareComment.substr( 0, 276 ) + '...'; 1106 } 1107 1108 jQuery( '#comment-form-share-text-textarea' ).val( shareComment ); 1109 }, 1110 1111 // Google+ Sign-in is a little different than the other services 1112 // It uses its own JavaScript API loaded in its own iframe 1113 // (public.api/connect/?googleplus-sign-in=1) 1114 // We listen for messages from that iframe here 1115 onGooglePlusSignIn: function( message ) { 1116 var hostname; 1117 if ( -1 !== document.location.hostname.indexOf( '.wordpress.com' ) ) { 1118 hostname = 'wordpress.com'; 1119 } else { 1120 hostname = document.location.hostname; 1121 } 1122 1123 if ( 'undefined' == typeof message.error) { 1124 var value = jQuery.param( message ).replace( /\+/g, '%20' ); 1125 value.name = encodeURIComponent( value.name ); 1126 HighlanderComments.writeCookie( 'wpc_gpc', value, 1, hostname ); 1127 1128 jQuery( '#comment-form-nascar li.selected' ).removeClass( 'selected' ); 1129 jQuery( "#googleplus-sign-in" ).parent().addClass( 'selected' ); 1130 1131 HighlanderComments.doExternalLoggedIn( 'googleplus' ); 1132 } else { 1133 HighlanderComments.doExternalLogout( 'googleplus' ); 1134 } 1135 }, 1136 1137 onGooglePlusButtonClick: function( message ) { 1138 HighlanderComments.setConnectingToText( 'Google+' ); 1139 HighlanderComments.updateLoadServiceVisibility( '#comment-form-load-service' ); 1140 HighlanderComments.clickExternalTab( 'googleplus' ); 1141 }, 1142 1143 /* Read the contents of a named cookie, assuming they are query-string-style 1144 delimited, and return them as a JS hash. */ 1145 readCookie : function(c) { 1146 var nameEQ = c + "=", 1147 cookieStrings = document.cookie.split( ';' ), 1148 i, cookieString, num, chunk, pairs, pair, cookie_data; 1149 1150 if( 'wpc_gpc' == c && !document.cookie ) { // Needed for IE because it doesnât allow setting cookies in iframes from another domain, unless we send P3P headers 1151 cookieStrings = HighlanderComments.temp_cookie_data.split( ';' ); 1152 } 1153 for ( i = 0; i < cookieStrings.length; i++ ) { 1154 cookieString = cookieStrings[ i ]; 1155 while ( cookieString.charAt( 0 ) === ' ' ) { 1156 cookieString = cookieString.substring( 1, cookieString.length ); 1157 } 1158 if ( cookieString.indexOf( nameEQ ) === 0 ) { 1159 chunk = cookieString.substring( nameEQ.length, cookieString.length ); 1160 pairs = chunk.split( '&' ); 1161 cookie_data = {}; 1162 for ( num = pairs.length - 1; num >= 0; num-- ) { 1163 pair = pairs[ num ].split( '=' ); 1164 cookie_data[ pair[0] ] = decodeURIComponent( pair[1] ); 1165 } 1166 return cookie_data; 1167 } 1168 } 1169 return null; 1170 }, 1171 1172 writeCookie : function( name, value, days, domain ) { 1173 var expires; 1174 if ( days ) { 1175 var date = new Date(); 1176 date.setTime( date.getTime() + ( days * 24 * 60 * 60 * 1000 ) ); 1177 expires = "; expires=" + date.toGMTString(); 1178 } else { 1179 expires = ""; 1180 } 1181 1182 if ( domain ) { 1183 domain = "; domain=" + domain; 1184 } else { 1185 domain = ''; 1186 } 1187 1188 HighlanderComments.temp_cookie_data = document.cookie = name + "=" + value + expires + "; path=/" + domain; 1189 1190 } 1191} ); 1192 1193jQuery( HighlanderComments.init ); 1194;
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.