1!window.uCoz && (window.uCoz = {}); 2uCoz.socialComments = (function() { 3 4 function setEternalCookie(name, value) { 5 document.cookie = (name || 'oops') + '=' + encodeURIComponent(value || '') + '; path=/; expires=' + (new Date((new Date).getTime() + 1000*60*60*24*365)).toGMTString(); 6 }; 7 8 function getCookieEmail() { 9 return decodeURIComponent( ( /socComEmail=\s*(.+?)\s*(?:;|$)/.exec(document.cookie) || {} )[1] || '' ); 10 }; 11 12 function timeWait(tryCount, interval, testFunction, onSuccess, onFailure) { 13 window.console && console && console.info('timeWait: ' + tryCount); 14 if (!tryCount ) { 15 return onFailure && onFailure('timeout'); 16 }; 17 var done = testFunction ? testFunction() : 'nocb'; 18 if (done === 'abort' || done === 'nocb' ) { 19 window.console && console.warn && console.warn('timeWait: ' + done); 20 return; 21 }; 22 if (done ) { 23 window.console && console && console.info('timeWait: done'); 24 return onSuccess && onSuccess(); 25 }; 26 return setTimeout(function() { 27 return timeWait(tryCount - 1, interval, testFunction, onSuccess, onFailure); 28 }, interval); 29 }; 30 31 var dontHandleLocationHash = false; 32 33 var hashCommandHandlers = { 34 reloadPage: function(command) { 35 location.reload(); 36 dontHandleLocationHash = true; 37 }, 38 gotoAddCommentForm: function(command) { 39 var handled = false; 40 var selector = '#postFormContent'; 41 var handler = function() { 42 if (handled ) { 43 window.console && console.warn && console.warn('gotoAddCommentForm: already handled.'); 44 return 'once'; 45 }; 46 var target = $(selector); 47 if (!target.length ) { 48 window.console && console.warn && console.warn('gotoAddCommentForm: target not found.'); 49 return; 50 }; 51 setTimeout(function() { 52 $('html, body').animate({ 53 scrollTop: ( target.eq(0).offset() || { top: 0 } ).top 54 }, 'fast'); 55 }, 750); 56 handled = true; 57 return 'once'; 58 }; 59 if (typeof window.___uwbbCallbacks === 'array' ) { 60 window.___uwbbCallbacks.push(handler); 61 } else { 62 window.___uwbbCallbacks = [handler]; 63 }; 64 $(document).ready(function() { 65 timeWait(10, 500, function() { return handled ? 'abort' : $(selector).length ? true : false; }, handler); 66 }); 67 } 68 }; 69 70 function handleLocationHash() { 71 if (dontHandleLocationHash || !location.hash ) return; 72 var command = ( /^#([0-9a-zA-Z_-]+)(?:,|$)/.exec(location.hash) || {} )[1] || ''; 73 var handler = hashCommandHandlers[command]; 74 if (!handler ) return; 75 try { 76 var regexp = new RegExp('^#' + command + ',?'); 77 location.hash = location.hash.replace(regexp, '#'); 78 handler(command); 79 window.console && console.info && console.info('handleLocationHash', command, 'ok'); 80 } catch(exception) { 81 window.console && console.error && console.error('handleLocationHash', command, exception); 82 } 83 }; 84 85 var obj = { 86 87 init: function() { 88 handleLocationHash(); 89 $(window).on('hashchange', handleLocationHash); 90 if (/subscrOn=false/.test(document.cookie) ) { 91 $(function() { 92 var checkbox = $('input[name="subscribe"]'); 93 checkbox.prop('checked', false).removeAttr('checked').parents('.ucf-option-label').eq(0).removeClass('ucf-option-checked'); 94 }); 95 }; 96 var email = getCookieEmail(); 97 var emailInput = $('#acform input[name=email]').filter(':visible'); 98 if (email && emailInput.length ) { 99 emailInput.val(email); 100 }; 101 obj.addEventListeners(); 102 }, 103 104 getCookieEmail: getCookieEmail, 105 106 addEventListeners: function() { 107 $(function() { 108 var form = $('#acform'); 109 obj.placeholderLegacy(form); 110 form.find('.js-ucf-option').change(function(event) { 111 if ($(this).attr('name') == 'subscribe' ) { 112 setEternalCookie( 'subscrOn', ( $(this).prop('checked') ? 'true' : 'false' ) ); 113 }; 114 if ($(this).is('[name=share]') && $('input[name=anonymous]').prop('checked')) { 115 $("input[name='share']").prop('checked',false); 116 return; 117 } 118 if ($(this).is('[name=anonymous]') && $('input[name=share]').prop('checked')) { 119 $("input[name='share']").prop('checked',false); 120 $("input[name='share']").parent('label').removeClass('ucf-option-checked'); 121 } 122 if ($(this).prop('checked')) { 123 $(this).parent('label').addClass('ucf-option-checked'); 124 } else { 125 $(this).parent('label').removeClass('ucf-option-checked'); 126 } 127 }).trigger('change'); 128 129 $('#acform input[name=email]').change(function(event) { 130 var email = $(this).val(); 131 if (email && !/^\s*$/.test(email) ) { 132 setEternalCookie('socComEmail', email); 133 }; 134 }); 135 136 var startTxt = form.find('.js-start-txt'); 137 startTxt.on('change keydown keyup', function() { 138 if ($(this).scrollTop() > 0 ) { 139 $(this).css('height',$(this).scrollTop() + $(this).outerHeight()); 140 } 141 }); 142 143 if (window.socialCommentsOnSubmit ) { 144 var submitButton = $('#acform button.uf-btn'); 145 if (submitButton.length === 1 ) { 146 submitButton.removeAttr('onclick').click(function(event) { 147 event && event.preventDefault && event.preventDefault(); 148 window.preSaveMessage && preSaveMessage(); 149 window.socialCommentsOnSubmit && socialCommentsOnSubmit(); 150 return false;
151 }); 152 }; 153 }; 154 }); 155 }, 156 157 placeholderLegacy: function(form) { 158 $.support.placeholder = false; 159 var test = document.createElement('input'); 160 if('placeholder' in test) $.support.placeholder = true; 161 if (window.navigator && window.navigator.userAgent && (window.navigator.userAgent.indexOf('Presto') !== -1)) {$.support.placeholder = false;} 162 163 if(!$.support.placeholder) { 164 var phEls = form.find('[placeholder]'); 165 phEls.focus(function() { 166 if ($(this).val() === $(this).attr('placeholder')) { 167 $(this).val(''); 168 } 169 }).blur(function() { 170 if (($(this).val() !== $(this).attr('placeholder')) && !$(this).val()) { 171 $(this).val($(this).attr('placeholder')); 172 } 173 }).blur(); 174 175 function formOnSubmit() { 176 phEls.each(function() { 177 if ($(this).val() === $(this).attr('placeholder')) {$(this).val('');} 178 }); 179 setTimeout(function () { 180 phEls.blur(); 181 }, 3000); 182 } 183 form.submit(function() {formOnSubmit();}); 184 $('#addcBut').click(function () {formOnSubmit();}); 185 } 186 } 187 }; 188 189 return { 190 init: obj.init, 191 getCookieEmail: obj.getCookieEmail 192 }; 193 194}()); 195uCoz.socialComments.init();
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.