Bitcoin Forum
May 14, 2024, 01:36:58 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3] 4 5 6 7 »  All
  Print  
Author Topic: Signature Adblock Script [0.5.0]  (Read 37423 times)
R2D221
Hero Member
*****
Offline Offline

Activity: 658
Merit: 500



View Profile
March 28, 2015, 02:18:54 PM
 #41

This is awesome. Too bad I can't use it on my mobile Sad

I though it can work to mobile too since I'm still not try it

Thanks for a new update..everything works perfect

It can't work on Windows Phone because it doesn't have addons.

An economy based on endless growth is unsustainable.
1715650618
Hero Member
*
Offline Offline

Posts: 1715650618

View Profile Personal Message (Offline)

Ignore
1715650618
Reply with quote  #2

1715650618
Report to moderator
1715650618
Hero Member
*
Offline Offline

Posts: 1715650618

View Profile Personal Message (Offline)

Ignore
1715650618
Reply with quote  #2

1715650618
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715650618
Hero Member
*
Offline Offline

Posts: 1715650618

View Profile Personal Message (Offline)

Ignore
1715650618
Reply with quote  #2

1715650618
Report to moderator
grue (OP)
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
March 28, 2015, 04:08:31 PM
 #42

You can theoretically get it to work by using a proxy that inserts the javascript into every page that you load. I'm planning on implementing a bitcointalk proxy with 2-factor authentication and other security features, so there's that  Smiley

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
Mitchell
Copper Member
Legendary
*
Offline Offline

Activity: 3920
Merit: 2198


Verified awesomeness ✔


View Profile WWW
March 28, 2015, 04:26:27 PM
 #43

You can theoretically get it to work by using a proxy that inserts the javascript into every page that you load. I'm planning on implementing a bitcointalk proxy with 2-factor authentication and other security features, so there's that  Smiley
Sign me up! That is extremely handy.

.
Duelbits
            ▄████▄▄
          ▄█████████▄
        ▄█████████████▄
     ▄██████████████████▄
   ▄████▄▄▄█████████▄▄▄███▄
 ▄████▐▀▄▄▀▌████▐▀▄▄▀▌██

 ██████▀▀▀▀███████▀▀▀▀█████

▐████████████■▄▄▄■██████████▀
▐██████████████████████████▀
██████████████████████████▀
▀███████████████████████▀
  ▀███████████████████▀
    ▀███████████████▀
.
         ▄ ▄▄▀▀▀▀▄▄
         ▄▀▀▄      █
         █   ▀▄     █
       ▄█▄     ▀▄   █
      ▄▀ ▀▄      ▀█▀
    ▄▀     ▀█▄▄▄▀▀ ▀
  ▄▀  ▄▀  ▄▀

Live Games

   ▄▄▀▀▀▀▀▀▀▄▄
 ▄▀ ▄▄▀▀▀▀▀▄▄ ▀▄
▄▀ █ ▄  █  ▄ █ ▀▄
█ █   ▀   ▀   █ █  ▄▄▄
█ ▀▀▀▀▀▀▀▀▀▀▀▀▀ █ █   █
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█  █▄█
█ ▀▀█  ▀▀█  ▀▀█ █  █▄█

Slots
.
        ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄
        █         ▄▄  █
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄       █
█  ▄▄         █       █
█             █       █
█   ▄▀▀▄▀▀▄   █       █
█   ▀▄   ▄▀   █       █

Blackjack
|█▀▀▀▀▀█▄▄▄
       ▀████▄▄
         ██████▄
▄▄▄▄▄▄▄▄█▀    ▀▀█
████████▄        █
█████████▄        █
██████████▄     ▄██
█████████▀▀▀█▄▄████
▀▀███▀▀       ████
   █          ███
   █          █▀
▄█████▄▄▄ ▄▄▀▀
███████▀▀▀
.
                 NEW!                  
SPORTS BETTING 
|||
[ Đ ][ Ł ]
AVAILABLE NOW

Advertisements are not endorsed by me.
R2D221
Hero Member
*****
Offline Offline

Activity: 658
Merit: 500



View Profile
March 28, 2015, 04:31:22 PM
 #44

You can theoretically get it to work by using a proxy that inserts the javascript into every page that you load. I'm planning on implementing a bitcointalk proxy with 2-factor authentication and other security features, so there's that  Smiley

Yes, that would be nice, as long as it's secure.

An economy based on endless growth is unsustainable.
PolarPoint
Hero Member
*****
Offline Offline

Activity: 672
Merit: 500


View Profile
April 07, 2015, 12:34:15 AM
 #45

Please block this. This the worst sig ever.
https://bitcointalk.org/index.php?topic=1013170.0
master-P
Hero Member
*****
Offline Offline

Activity: 868
Merit: 1001


https://keybase.io/masterp FREE Escrow Service


View Profile WWW
April 07, 2015, 12:44:40 AM
 #46

Neat tool, nice to have. Personally I never really minded the sig ads that much. I am more bothered by the low quality/irrelevant/spammy posts that the sig ads/campaigns unintentionally promote to these forums.

Master-P's Free Escrow Service | 1% Fee for Multi-Party/Sig Campaigns | I Sign ALL of my addresses using PGP Key: https://keybase.io/masterp Verify
Tipping Address: 14PUWBwK854GLenxSa7MAuxXQUXK4DKKi5 | E-mail: masterp.bitcointalk {at} gmail {dot} com (for when/if the forum's offline)
Guide on How to Sign a Message
Hueristic
Legendary
*
Offline Offline

Activity: 3808
Merit: 4906


Doomed to see the future and unable to prevent it


View Profile
April 07, 2015, 03:07:32 AM
 #47

Neat tool, nice to have. Personally I never really minded the sig ads that much. I am more bothered by the low quality/irrelevant/spammy posts that the sig ads/campaigns unintentionally promote to these forums.

When I decide whether to ignore someone the Sig can be the deciding factor.

“Bad men need nothing more to compass their ends, than that good men should look on and do nothing.”
sed
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500


View Profile
April 07, 2015, 05:58:34 AM
 #48

I don't trust your js code.
It's non human readable.

Share original source code.

Uh, there's no such thing as compiled javascript (I know someone will correct me if I'm wrong), so I have to wonder what the hell you're talking about here.


I feel like we are treading on thin ice here. Our forum is so unique and we created system of direct advertising method that is unprecedented and  truly "sui generis". Yet you want to destroy that system by creating tools and methods which will disable signatures permanently? Potentially it can bring an end to all signature campaigns.

The forum isn't about advertising, its about discussion. Businesses that advertise in people's signatures have the same right to be here and the same right to be kicked out if they are disruptive. If individuals want to opt out of seeing advertisements they are more than welcome to, and if that brings down paid advertising signatures, then so be it.

But I agree, great job grue.

Indeed, I appreciate the approach here, people taking control to limit what they want to see, obviously this is a win.  If advertizers annoy, they should be punished by people ignoring them.  That will teach them to annoy less.  Ie, be less distracting.

Wil I be shot for irony if I try this script myself?
redsn0w
Legendary
*
Offline Offline

Activity: 1778
Merit: 1042


#Free market


View Profile
April 07, 2015, 08:50:41 AM
 #49

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.
grue (OP)
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 07, 2015, 04:37:34 PM
 #50

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.

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 07, 2015, 08:49:14 PM
 #51

I don't trust your js code.
It's non human readable.

Share original source code.

Uh, there's no such thing as compiled javascript (I know someone will correct me if I'm wrong), so I have to wonder what the hell you're talking about here.+

Not compiled but minified, which makes it harder to follow. He's asking for the non-minified version.
TheRealSteve
Hero Member
*****
Offline Offline

Activity: 686
Merit: 500

FUN > ROI


View Profile
April 08, 2015, 03:19:54 AM
 #52

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)

grue (OP)
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 08, 2015, 04:44:28 AM
Last edit: April 08, 2015, 05:17:09 AM by grue
 #53

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);
}

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
Amph
Legendary
*
Offline Offline

Activity: 3206
Merit: 1069



View Profile
April 08, 2015, 07:53:29 AM
 #54

too bad i don't like java, why not choosing other programming language? can this be done in php or python?
Mitchell
Copper Member
Legendary
*
Offline Offline

Activity: 3920
Merit: 2198


Verified awesomeness ✔


View Profile WWW
April 08, 2015, 08:02:14 AM
 #55

too bad i don't like java, why not choosing other programming language? can this be done in php or python?
This is not Java, this is Javascript.

.
Duelbits
            ▄████▄▄
          ▄█████████▄
        ▄█████████████▄
     ▄██████████████████▄
   ▄████▄▄▄█████████▄▄▄███▄
 ▄████▐▀▄▄▀▌████▐▀▄▄▀▌██

 ██████▀▀▀▀███████▀▀▀▀█████

▐████████████■▄▄▄■██████████▀
▐██████████████████████████▀
██████████████████████████▀
▀███████████████████████▀
  ▀███████████████████▀
    ▀███████████████▀
.
         ▄ ▄▄▀▀▀▀▄▄
         ▄▀▀▄      █
         █   ▀▄     █
       ▄█▄     ▀▄   █
      ▄▀ ▀▄      ▀█▀
    ▄▀     ▀█▄▄▄▀▀ ▀
  ▄▀  ▄▀  ▄▀

Live Games

   ▄▄▀▀▀▀▀▀▀▄▄
 ▄▀ ▄▄▀▀▀▀▀▄▄ ▀▄
▄▀ █ ▄  █  ▄ █ ▀▄
█ █   ▀   ▀   █ █  ▄▄▄
█ ▀▀▀▀▀▀▀▀▀▀▀▀▀ █ █   █
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█  █▄█
█ ▀▀█  ▀▀█  ▀▀█ █  █▄█

Slots
.
        ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄
        █         ▄▄  █
▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄       █
█  ▄▄         █       █
█             █       █
█   ▄▀▀▄▀▀▄   █       █
█   ▀▄   ▄▀   █       █

Blackjack
|█▀▀▀▀▀█▄▄▄
       ▀████▄▄
         ██████▄
▄▄▄▄▄▄▄▄█▀    ▀▀█
████████▄        █
█████████▄        █
██████████▄     ▄██
█████████▀▀▀█▄▄████
▀▀███▀▀       ████
   █          ███
   █          █▀
▄█████▄▄▄ ▄▄▀▀
███████▀▀▀
.
                 NEW!                  
SPORTS BETTING 
|||
[ Đ ][ Ł ]
AVAILABLE NOW

Advertisements are not endorsed by me.
coinpr0n
Hero Member
*****
Offline Offline

Activity: 910
Merit: 1000



View Profile
April 08, 2015, 09:09:36 AM
 #56

too bad i don't like java, why not choosing other programming language? can this be done in php or python?
This is not Java, this is Javascript.

Either way, choose the best tool for the job. I know it's not, but even if it were Java, not "liking" something shouldn't be the disqualifying feature when it comes to choosing a development technology.

redsn0w
Legendary
*
Offline Offline

Activity: 1778
Merit: 1042


#Free market


View Profile
April 08, 2015, 09:32:32 AM
 #57

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.

Thanks for the reply, so we should open a thread and ask to theymos if he can add this script here in the forum. I think someone of us will do this (when it will be necessary). The second option is more "risky" than the first, or am I wrong? Maybe it is better the first option.
TheRealSteve
Hero Member
*****
Offline Offline

Activity: 686
Merit: 500

FUN > ROI


View Profile
April 08, 2015, 10:28:49 AM
 #58

Your annotated code is actually pretty close to the original source!
sweet! Smiley

Thanks for the reply, so we should open a thread and ask to theymos if he can add this script here in the forum.
Keep in mind that if the javascript code is added to the forum, it also needs somebody to maintain it, and you can't make your own tweaks (e.g. to the scoring algorithm)

I'm also not sure that's really the way to go versus a signature ignore boolean of some variety.  There's pros and cons (dev time, upkeep, (false) positives, user control, server load, etc.) to both approaches though.

SirChiko
Legendary
*
Offline Offline

Activity: 966
Merit: 1000



View Profile
April 08, 2015, 11:13:31 AM
 #59

However, was there not a option to disable all signatures?
Even If I'm sure you already know this:
"Profile" -> "Look and Layout Preferences" -> "Don't show users' signatures."
That isn't thr thing everyone wants. Me as an example, i want to see user signatures and most of other people want too, they just don't want to see the AD ones.

The only online casino on which i won something. I made 17mBTC from 1mBTC in like 15 minutes.  This is not paid AD!

▀Check it out yourself▀
Hueristic
Legendary
*
Offline Offline

Activity: 3808
Merit: 4906


Doomed to see the future and unable to prevent it


View Profile
April 09, 2015, 04:06:57 AM
 #60


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.


If this was implemented then selective blocking could be used as well.

“Bad men need nothing more to compass their ends, than that good men should look on and do nothing.”
Pages: « 1 2 [3] 4 5 6 7 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!