Facebook
From CerberuS, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 263
  1. function STwriteCookie (key, value, hours) {
  2.     var date = new Date();
  3.  
  4.     // Get milliseconds at current time plus number of hours*60 minutes*60 seconds* 1000 milliseconds
  5.     date.setTime(+ date + (hours * 3600000)); //60 * 60 * 1000
  6.  
  7.     window.document.cookie = key + "=" + value + "; expires=" + date.toGMTString() + "; path=/";
  8.  
  9.     return value;
  10. };
  11.  
  12. function STgetCookie(cname) {
  13.     var name = cname + "=";
  14.     var decodedCookie = decodeURIComponent(document.cookie);
  15.     var ca = decodedCookie.split(';');
  16.     for(var i = 0; i <ca.length; i++) {
  17.         var c = ca[i];
  18.         while (c.charAt(0) == ' ') {
  19.             c = c.substring(1);
  20.         }
  21.         if (c.indexOf(name) == 0) {
  22.             return c.substring(name.length, c.length);
  23.         }
  24.     }
  25.     return "";
  26. }
  27.  
  28. // The purpose of this code is to fix the height of overflow: auto blocks, because some browsers can't figure it out for themselves.
  29. function smf_codeBoxFix()
  30. {
  31.         var codeFix = document.getElementsByTagName('code');
  32.         for (var i = codeFix.length - 1; i >= 0; i--)
  33.         {
  34.                 if (is_webkit && codeFix[i].offsetHeight < 20)
  35.                         codeFix[i].style.height = (codeFix[i].offsetHeight + 20) + 'px';
  36.  
  37.                 else if (is_ff && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0))
  38.                         codeFix[i].style.overflow = 'scroll';
  39.  
  40.                 else if ('currentStyle' in codeFix[i] && codeFix[i].currentStyle.overflow == 'auto' && (codeFix[i].currentStyle.height == '' || codeFix[i].currentStyle.height == 'auto') && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0) && (codeFix[i].offsetHeight != 0))
  41.                         codeFix[i].style.height = (codeFix[i].offsetHeight + 24) + 'px';
  42.         }
  43. }
  44.  
  45. // Add a fix for code stuff?
  46. if ((is_ie && !is_ie4) || is_webkit || is_ff)
  47.         addLoadEvent(smf_codeBoxFix);
  48.  
  49. function selectText(node) {
  50.     var to = node;
  51.     node = document.getElementById(node);
  52.  
  53.     if (document.body.createTextRange) {
  54.         const range = document.body.createTextRange();
  55.         range.moveToElementText(node);
  56.         range.select();
  57.         $('#'+to).animatedScroll({easing: "easeOutExpo"});
  58.     } else if (window.getSelection) {
  59.         const selection = window.getSelection();
  60.         const range = document.createRange();
  61.         range.selectNodeContents(node);
  62.         selection.removeAllRanges();
  63.         selection.addRange(range);
  64.         $('#'+to).animatedScroll({easing: "easeOutExpo"});
  65.     } else {
  66.         console.warn("Could not select text in node: Unsupported browser.");
  67.     }
  68. }
  69.  
  70.  
  71. // Toggles the element height and width styles of an image.
  72. function smc_toggleImageDimensions()
  73. {
  74.         var oImages = document.getElementsByTagName('IMG');
  75.         for (oImage in oImages)
  76.         {
  77.                 // Not a resized image? Skip it.
  78.                 if (oImages[oImage].className == undefined || oImages[oImage].className.indexOf('bbc_img resized') == -1)
  79.                         continue;
  80.  
  81.                 oImages[oImage].style.cursor = 'pointer';
  82.                 oImages[oImage].onclick = function() {
  83.                         this.style.width = this.style.height = this.style.width == 'auto' ? null : 'auto';
  84.                 };
  85.         }
  86. }
  87.  
  88. // Add a load event for the function above.
  89. addLoadEvent(smc_toggleImageDimensions);
  90.  
  91. // Adds a button to a certain button strip.
  92. function smf_addButton(sButtonStripId, bUseImage, oOptions)
  93. {
  94.         var oButtonStrip = document.getElementById(sButtonStripId);
  95.         var aItems = oButtonStrip.getElementsByTagName('span');
  96.  
  97.         // Remove the 'last' class from the last item.
  98.         if (aItems.length > 0)
  99.         {
  100.                 var oLastSpan = aItems[aItems.length - 1];
  101.                 oLastSpan.className = oLastSpan.className.replace(/\s*last/, 'position_holder');
  102.         }
  103.  
  104.         // Add the button.
  105.         var oButtonStripList = oButtonStrip.getElementsByTagName('ul')[0];
  106.         var oNewButton = document.createElement('li');
  107.         setInnerHTML(oNewButton, '<a href="' + oOptions.sUrl + '" ' + ('sCustom' in oOptions ? oOptions.sCustom : '') + '><span class="last"' + ('sId' in oOptions ? ' id="' + oOptions.sId + '"': '') + '>' + oOptions.sText + '</span></a>');
  108.  
  109.         oButtonStripList.appendChild(oNewButton);
  110. }
  111.  
  112. // Adds hover events to list items. Used for a versions of IE that don't support this by default.
  113. var smf_addListItemHoverEvents = function()
  114. {
  115.         var cssRule, newSelector;
  116.  
  117.         // Add a rule for the list item hover event to every stylesheet.
  118.         for (var iStyleSheet = 0; iStyleSheet < document.styleSheets.length; iStyleSheet ++)
  119.                 for (var iRule = 0; iRule < document.styleSheets[iStyleSheet].rules.length; iRule ++)
  120.                 {
  121.                         oCssRule = document.styleSheets[iStyleSheet].rules[iRule];
  122.                         if (oCssRule.selectorText.indexOf('LI:hover') != -1)
  123.                         {
  124.                                 sNewSelector = oCssRule.selectorText.replace(/LI:hover/gi, 'LI.iehover');
  125.                                 document.styleSheets[iStyleSheet].addRule(sNewSelector, oCssRule.style.cssText);
  126.                         }
  127.                 }
  128.  
  129.         // Now add handling for these hover events.
  130.         var oListItems = document.getElementsByTagName('LI');
  131.         for (oListItem in oListItems)
  132.         {
  133.                 oListItems[oListItem].onmouseover = function() {
  134.                         this.className += ' iehover';
  135.                 };
  136.  
  137.                 oListItems[oListItem].onmouseout = function() {
  138.                         this.className = this.className.replace(new RegExp(' iehover\\b'), '');
  139.                 };
  140.         }
  141. }
  142.  
  143. // Add hover events to list items if the browser requires it.
  144. if (is_ie7down && 'attachEvent' in window)
  145.         window.attachEvent('onload', smf_addListItemHoverEvents);
  146.  
  147. $(document).on('click',function(){
  148.         $('.collapse').collapse('hide');
  149. })
  150. jQuery(document).ready(function(){
  151.         jQuery(".increment_qty").click(function() {
  152.           var oldVal = jQuery(this).parent().find("input").val();
  153.           if ( parseFloat(oldVal) >= 1 ) {
  154.                 var newVal = parseFloat(oldVal) + 1;
  155.                 jQuery(this).parent().find("input").val(newVal);
  156.           }
  157.         });
  158. jQuery(".decrement_qty").click(function() {
  159.           var oldVal = jQuery(this).parent().find("input").val();
  160.           if ( parseFloat(oldVal) >= 2 ) {
  161.                 var newVal = parseFloat(oldVal) - 1;
  162.                 jQuery(this).parent().find("input").val(newVal);
  163.           }
  164.         });
  165. });
  166. jQuery(document).ready(function(){
  167.         $(".scroll-to-top").click(function()    {
  168.                 $("html, body").animate({ scrollTop: 0 }, 600);
  169.                  return false;
  170.         });
  171.         $(window).scroll(function(){
  172.                
  173.                 var position = $(window).scrollTop();
  174.                 var uzunluk=$(document).height();
  175.  
  176.                         if(position < uzunluk-705)
  177.                         {
  178.                                 $(".safari_bildirim_view_click").addClass("active")
  179.                                 $(".safari_bildirim_view").addClass("active")
  180.                         }
  181.                         else {
  182.                                 $(".safari_bildirim_view_click").removeClass("active")
  183.                                 $(".safari_bildirim_view").removeClass("active")
  184.                         }
  185.  
  186.  
  187.  
  188.                
  189.                  if(position >= 200)    {
  190.                         $(".scroll-to-top").addClass("active")
  191.                  }
  192.                  else   {
  193.                         $(".scroll-to-top").removeClass("active")
  194.                  }
  195.         });
  196. });
  197. $(document).ready(function(){
  198.         $('.popper').popover({
  199.                 trigger: 'hover',
  200.                 placement: 'left',
  201.                 container: 'body',
  202.                 html: true,
  203.                 content: function () {
  204.                         return $(this).next('.popper-content').html();
  205.                 }
  206.         });
  207.         $(function () {
  208.                 $('[data-toggle="tooltip"]').tooltip()
  209.         })
  210. });
  211.  
  212. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.timeago=e()}(this,function(){"use strict";var t="second_minute_hour_day_week_month_year".split("_"),e="?_??_??_?_?_?_?".split("_"),n=[60,60,24,7,365/7/12,12],r={en:function(e,n){if(0===n)return["just now","right now"];var r=t[parseInt(n/2)];return e>1&&(r+="s"),[e+" "+r+" ago","in "+e+" "+r]},zh_CN:function(t,n){if(0===n)return["??","???"];var r=e[parseInt(n/2)];return[t+" "+r+"?",t+" "+r+"?"]}},a=function(t){return parseInt(t)},i=function(t){return t instanceof Date?t:!isNaN(t)||/^\d+$/.test(t)?new Date(a(t)):(t=(t||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(t))},o=function(t,e,i){e=r[e]?e:r[i]?i:"en";for(var o=0,u=t<0?1:0,c=t=Math.abs(t);t>=n[o]&&o<n.length;o++)t/=n[o];return(t=a(t))>(0===(o*=2)?9:1)&&(o+=1),r[e](t,o,c)[u].replace("%s",t)},u=function(t,e){return((e=e?i(e):new Date)-i(t))/1e3},c=function(t,e){return t.getAttribute?t.getAttribute(e):t.attr?t.attr(e):void 0},f=function(t){return c(t,"data-timeago")||c(t,"datetime")},d=[],l=function(t){t&&(clearTimeout(t),delete d[t])},s=function(t){if(t)l(c(t,"data-tid"));else for(var e in d)l(e)},h=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();var p=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.nowDate=e,this.defaultLocale=n||"en"}return h(t,[{key:"setLocale",value:function(t){this.defaultLocale=t}},{key:"doRender",value:function(t,e,r){var a=this,i=u(e,this.nowDate);t.innerHTML=o(i,r,this.defaultLocale);var c=function(t,e){var n=setTimeout(function(){l(n),t()},e);return d[n]=0,n}(function(){a.doRender(t,e,r)},Math.min(1e3*function(t){for(var e=1,r=0,a=Math.abs(t);t>=n[r]&&r<n.length;r++)t/=n[r],e*=n[r];return a=(a%=e)?e-a:e,Math.ceil(a)}(i),2147483647));!function(t,e){t.setAttribute?t.setAttribute("data-tid",e):t.attr&&t.attr("data-tid",e)}(t,c)}},{key:"render",value:function(t,e){void 0===t.length&&(t=[t]);for(var n=void 0,r=0,a=t.length;r<a;r++)n=t[r],s(n),this.doRender(n,f(n),e)}},{key:"format",value:function(t,e){return o(u(t,this.nowDate),e,this.defaultLocale)}}]),t}(),v=function(t,e){return new p(t,e)};return v.register=function(t,e){r[t]=e},v.cancel=s,v});