Bitcoin Forum
May 24, 2024, 10:53:16 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [28] 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ... 258 »
541  Economy / Digital goods / MOVED: Spotify Premium - Auodelievery- 6 months guarantee - Personal Account on: April 28, 2015, 03:32:06 AM
This topic has been moved to Trashcan.

Reason: not bitcoin related
542  Economy / Digital goods / MOVED: [WTS] GTA 5 and other Licensed keys for origin, steam with 20-30% discount. on: April 28, 2015, 03:12:55 AM
This topic has been moved to Trashcan.

Reason: not bitcoin related
543  Other / Off-topic / Re: Please Help - Ransomware has stolen my files and I need to pay in BitCoins on: April 28, 2015, 12:22:49 AM
http://blogs.cisco.com/security/talos/teslacrypt
544  Other / Meta / MOVED: Has your Butterfly been GOXXXED? on: April 27, 2015, 04:47:40 AM
This topic has been moved to Trashcan.

Reason: pointless topic
545  Bitcoin / Bitcoin Technical Support / Re: Plz help a noob on: April 23, 2015, 05:14:11 PM
off topic split: https://bitcointalk.org/index.php?topic=1036161.0
546  Other / Meta / MOVED: Forum theme on: April 23, 2015, 05:05:10 PM
This topic has been moved to Trashcan.

Reason: duplicate topic https://bitcointalk.org/index.php?topic=1034535.0
547  Economy / Service Discussion / Re: Hey Canadians - Bitcoin / $CDN trading has resumed on CAVIRTEX on: April 20, 2015, 04:18:59 AM
too little too late. I already switched to another exchange that has lower trading fees and no withdraw fees.

Which one? PM if you do not want it public.
quadrigacx
548  Economy / Investor-based games / MOVED: investment game : free 0.5 btc on: April 16, 2015, 06:03:13 PM
This topic has been moved to Trashcan.

Reason: duplicate topic
549  Economy / Service Discussion / MOVED: Solidtrustpay service exchanger for paypal! on: April 16, 2015, 06:02:48 PM
This topic has been moved to Trashcan.

Reason: not bitcoin related
550  Economy / Service Discussion / Re: Hey Canadians - Bitcoin / $CDN trading has resumed on CAVIRTEX on: April 16, 2015, 06:01:30 PM
too little too late. I already switched to another exchange that has lower trading fees and no withdraw fees.
551  Economy / Digital goods / MOVED: VPS hosting - $0.01 on: April 11, 2015, 02:02:19 AM
This topic has been moved to Trashcan.

Reason: referral/not bitcoin related
552  Bitcoin / Press / MOVED: Interview With Olivier Janssens After 'The Truth About BTC Foundation' Pos on: April 09, 2015, 04:38:30 AM
This topic has been moved to Trashcan.

Reason: wrong format
553  Economy / Digital goods / MOVED: Selling Digital Ocean $100 coupon code on: April 09, 2015, 04:37:22 AM
This topic has been moved to Trashcan.

Reason: not bitcoin related
554  Bitcoin / Press / MOVED: Bitcoins not a threat to Australia: RBA on: April 09, 2015, 04:37:02 AM
This topic has been moved to Trashcan.

Reason: wrong format
555  Bitcoin / Press / MOVED: Telstra May Start Accepting Bitcoin on: April 09, 2015, 04:15:28 AM
This topic has been moved to Trashcan.

Reason: wrong format
556  Economy / Services / MOVED: [BIT-X] Get a Free Bitcoin Debit MasterCard! on: April 09, 2015, 04:13:06 AM
This topic has been moved to Trashcan.

Reason: duplicate topic
557  Other / Meta / Re: Signature Adblock Script [0.3.0] on: April 08, 2015, 04:44:28 AM
If you cannot read this, original source code wont change anything!
That's a wee bit unfair - Just because somebody doesn't know what to make of...
Code:
$(e).find("a").length && (r *= 2)
...doesn't mean they won't know what this does:
Code:
if ($(element).find("a").length > 0) { score = score * 2 }
And the minified code - though possibly even the input - makes use of quite a few such tricks and programmer shorthands.
refactored+annotated (making no claim that it still works, or even that I got it right - I certainly wouldn't use it): http://pastebin.com/CTXaCnkp

But for most people with concerns, this is the only bit of code that does anything they should care about:
Code:
$(i[a]).attr("style", "opacity: 0; pointer-events: none")
All it does is make the entire signature fully transparent and unresponsive to clicks/taps, and that bit of code is only called if the signature scores badly.  There's certainly no communication with a mothership or secret background bitcoin mining on your CPU etc. going on. (as of this post)

Your annotated code is actually pretty close to the original source! The main reason I use mimify the script with uglifyjs is because it removes my debug statements, which there are a lot of. In the interest of openness, here is a version that has minimal uglification applied to it: bct_adblock.no_debug.js. The creation and upload of the not-so-minified version is built into my upload scripts so it should be up to date with any future updates.

For reference, below is the original source, with debugging removed. If you want to understand how the script works, TheRealSteve is the way to go because it has annotations.
Code:
function isAnnoyingCharacter(char)
{
  var code = char.charCodeAt();
  var ranges = [[0x2500, 0x256F],
                [0x2580, 0x259F],
                [0x25A0, 0x25FF],
               ];
  for(var i = 0; i < ranges.length; i++)
    if(code > ranges[i][0] && code <= ranges[i][1])
      return true;
  return false;
}

function calculateAnnoyingCharacter(element)
{
  var childNodes = Array.prototype.slice.call(element.childNodes);
  var result = childNodes.reduce(
    function(prev, current, index)
    {
      if(current.nodeType == 1)
        return prev + calculateAnnoyingCharacter(current);
      if(current.nodeType == 3)
      {
        var count = 0;
        for (c of current.nodeValue)
          if(isAnnoyingCharacter(c))
            count++;

        var size = Number(getComputedStyle(current.parentNode).fontSize.match(/(\d*(\.\d*)?)px/)[1]);
        return prev + size*size*count;
      }
      return prev;
    }, 0);
  return result;
}

function getFormattingRate(context)
{
  var result = 0;
  if(context.backgroundColor)
    return 1;
  if(context.fontSize >= 14)
    result += 0.05 + Math.max(0, (context.fontsize - 14)*0.03);
  if(context.color)
    result += 0.2;
  if(context.font)
    result += 0.03;
  if(context.underline)
    result += 0.02;
  if(context.bold)
    result += 0.04;
  if(context.table)
    result += 0.2;
  return Math.min(result, 1);
}


function calculateFormattingScore(element, context)
{
  var previousContext = context;
  if(typeof(context) === 'undefined')
    previousContext = context = {};
  else
    context = $.extend({}, context);

  if(element.style.fontSize && element.style.fontSize != "inherit")
    context.fontsize = Number(element.style.fontSize.match(/(\d+)pt/)[1]);

  if(element.style.color && element.style.color != "inherit")
    context.color = true;
  
  if(element.style.backgroundColor && element.style.backgroundColor != "inherit")
    context.backgroundColor = true;
  
  if(element.style.fontFamily && element.style.fontFamily != "inherit")
    context.font = true;
  
  if(element.style.textDecoration.indexOf("underline") != -1)
    context.underline = true;
  
  if(element.tagName == "B")
    context.bold = true;
  
  if(element.tagName == "TABLE")
    context.table = true;
  
  var score = $(element).width() * $(element).height() * getFormattingRate(context)
              - $(element).width() * $(element).height() * getFormattingRate(previousContext);

  var childNodes = Array.prototype.slice.call(element.childNodes);
  score += childNodes.reduce(
    function(prev, current, index)
    {
      if(current.nodeType == 1)
        return prev + calculateFormattingScore(current, context);
      return prev;
    }, 0);
  return score;
}

function isAd(div)
{
  var score = 0;
  score += calculateAnnoyingCharacter(div);
  score += calculateFormattingScore(div);
  score = Math.sqrt(score);
  if($(div).find("a").length)
    score *= 2;
  
  return score > 100;
};

try
{
  var signatures = $("div .signature");
  for(var i = 0; i < signatures.length; i++)
  {
    if(isAd(signatures[i]))
    {
        $(signatures[i]).attr("style", "opacity: 0; pointer-events: none");
    }
  }
}
catch(e)
{
  console.log(e);
}
558  Other / Meta / Re: Signature Adblock Script [0.3.0] on: April 07, 2015, 04:37:34 PM
Can I ask if there will be the possibility to integrate that script here in this forum (without using an external extension)? Thanks for the attention.
One way would be to create a forum theme that contains my script. That way it's available to every user and can be enabled/disabled from the user control panel. You'll have to petition theymos to do that though.

Another way (which I mentioned before), would be to use a proxy that injects the script.
559  Economy / Currency exchange / MOVED: WTS STP to PM on: April 07, 2015, 05:11:05 AM
This topic has been moved to Trashcan.

Reason: not bitcoin related
560  Other / Meta / Re: Disappearing OPs on: April 06, 2015, 05:19:56 AM
First, if you see your topic getting deleted, don't repost the same topic! Yes, it was moved to trashcan, but I don't know who moved it. Most likely it was by the local moderator. Contact him and ask why it was moved. If it wasn't him, contact badbear/theymos.

Considering that you only made 3 posts in the turkish section during your 1 year stay here, I'm guessing that you made a poor translation and that was the reason for removal.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [28] 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ... 258 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!