// <![CDATA[ window.month_array = ['nihil','January','February','March','April','May','June','July','August','September','October','November','December']; var d = new Date(); window.last_oi = d.getMonth() + 1; window.last_b = d.getDate(); window.last_y = d.getFullYear(); window.parse_weekday_context = function(rday){ var day_array = ['Sun', 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat']; var d = new Date(); var oi = 1; //mo var di = d.getDay(); var y = window.last_y; var b = window.last_b; //day of mo if(rday.match(/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/) != null){ while(oi < window.month_array.length){ if(rday.match((window.month_array[oi] + '').substring(0, 3)) == null){ //month oi++; }else{ break; } } }else{ oi = window.last_oi; } if(rday.match(/\d{4},/) != null){ //not this year y = parseInt((rday + '').match(/(\d{4}),/)[1]); } var diy = new Date(window.last_y, window.last_oi - 1, window.last_b).getDay(); if(rday.match(/(Sun|Mon|Tue|Wed|Thu|Fri|Sat)/) != null){ //day of week var ds = rday.match(/(Sun|Mon|Tue|Wed|Thu|Fri|Sat)/)[0]; di = (ds == "Sun")? 0 : (ds == "Mon")? 1 : (ds == "Tue")? 2 : (ds == "Wed")? 3 : (ds == "Thu")? 4 : (ds == "Fri")? 5 : (ds == "Sat")? 6 : diy; if(di!=diy){ b = b - (diy - ((di>diy)? di - 7: di)); if(b < 1){ oi--; if(oi < 1){ oi = 12; y--; } b = new Date(y, oi, 0).getDate(); } di=diy; } } if(rday.match(/\d{1,2}[thndrs]{2},?/i) != null) b = parseInt(rday.match(/(\d{1,2})[thndrs]{2},?/i)[1]); window.last_b = b; window.last_y = y; window.last_oi = oi; di = new Date(y, oi - 1, b, 0, 0, 0, 0).getDay(); return window.month_array[oi] + " " + b + ", " + y + " (" + day_array[di] + " " + rday.match(/\d{1,2}:\d{2}[ap]m/) + ")"; } window.visible_permalinks = function(t){ if((document.location + '').split('/')[5] != 'queue'){ jQuery('.post_permalink').each(function(){ if(!jQuery(this).hasClass('visible_pl')){ jQuery(this).addClass('visible_pl'); var t = jQuery(this).attr('title'); var d = (t.match(/(Sun|Mon|Tue|Wed|Thu|Fri|Sat|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/) == null)? ' - Today ' : ' - '; var tt = window.parse_weekday_context(t); jQuery(this).parent().find('.post_info a:eq(0)').after('' + d + tt); } }); }else{ var d = new Date(); var day = d.getDay(); var oi = d.getMonth() + 1; var y = d.getFullYear(); var b = d.getDate(); jQuery('div.post_avatar').each(function(i){ if(jQuery(this).find('div.publish_on_day:eq(0)').html() != null){ var ds = jQuery(this).find('div.publish_on_day:eq(0)').html(); var di = (ds == "Sun")? 0 : (ds == "Mon")? 1 : (ds == "Tue")? 2 : (ds == "Wed")? 3 : (ds == "Thu")? 4 : (ds == "Fri")? 5 : (ds == "Sat")? 6 : -1; if(di > day || di == 0 && day == 6){ b++; day = (day < 6)? day + 1 : 0; } if(b > new Date(y, oi, 0).getDate()){ oi++; b = 1; if(oi > 12){ oi = 1; y++; } } if(!jQuery(this).hasClass('visible_pl') || t){ var tt = (di != -1)? window.parse_weekday_context("View post - " + window.month_array[oi] + " " + b + "rd, " + y + ", " + jQuery(this).find('div.publish_on_time:eq(0)').html()) : window.parse_weekday_context("View post - " + ds.replace(/\s{2,}/g, '') + "rd, " + y + ", " + jQuery(this).find('div.publish_on_time:eq(0)').html()); if(!t || typeof jQuery(this).parent().parent().find('span.date_custom:eq(0)') == undefined){ jQuery(this).parent().parent().find('.post_info a:eq(0)').after( ' - ' + '<span class="date_custom">'+tt+''); }else{ if(jQuery(this).parent().parent().find('span.date_custom:eq(0)').html()!=tt) jQuery(this).parent().parent().find('span.date_custom:eq(0)').html(tt); } jQuery(this).addClass('visible_pl'); } } }); } } var addCSS = jQuery('<style>'); jQuery(addCSS).attr('type',"text/css"); jQuery(addCSS).html('.post_full .post_info_fence.has_follow_button {max-width: 500px !important;}'+ '.post_source {margin-top: 20px !important;'); jQuery('head:eq(0)').append(addCSS); if((document.location+'').match(/\/queue$/)==null){ window.visible_permalinks(false); }else{ jQuery(window).load(function(){ window.visible_permalinks(false); }); } window.AutoPaginator.trigger = (function(){ var cached_function = window.AutoPaginator.trigger; return function(){ cached_function.apply(this, arguments); window.visible_permalinks(false); }; }()); if(typeof Tumblr.PostQueue!="undefined"){ Tumblr.PostQueue.prototype.updatePublishOnTimes = (function(){ var cached_function = Tumblr.PostQueue.prototype.updatePublishOnTimes; return function(){ cached_function.apply(this, arguments); window.visible_permalinks(true); }; }()); } // ]]>