localbitcoinsfilter

localbitcoinsfilter Commit Details


Date:2015-12-19 17:16:58 (9 years 2 days ago)
Author:Natalie Adams
Branch:master
Commit:6aa6fdf2ef54e3a74e2457e7e20fb72704d7306e
Message:Initial commit

Changes:

File differences

README.md
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
# localbitcoins filter
This tampermonkey script is designed to add some filtering to localbitcoins site results.
It's a small modification but it has helped me. It does 2 things:
- Sorts results by dollar amounts (click on table header "Price / BTC")
- Hide users that are offline or seen recently
These 2 mods allowed me to easily view the highest/lowest amounts and see those who were ready to do a trade now. localbitcoins is a nice looking site but I'm surprised they didn't add some basic filtering.
# Install
This has only been tested on Chrome but should work on Firefox. To get it working on Chrome you need to install the following extension:
- [Tampermonkey](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en)
Tampermonkey is an extension which allows people to easily write code that can be ran on a given page. It also has a built in update engine which makes it easy to keep scripts up to date.
# How to use
Attempting to download the javascript file should trigger tampermonkey to detect that it is a tamper monkey script and install it.
Once installed just navigate to localbitcoins.com and view results (or if you have a window open already - you will need to refresh the page for the script to load)
This will add 2 checkboxes below the navigation bar titled "Hide Recent" and "Hide Offline". Checking either will toggle the display of recent/offline. You may also click on "Price / BTC" to sort the list.
# FAQs
Q: How Does this work?
A: It adds some Javascript onto the page and leverages jQuery for some of the scripting.
Q: Can you steal my account/my BTC in my account?
A: You have my word (check out my background) that I would NEVER introduce any code to steal accounts or BTC. However, there are bad/stupid/greedy people out there who would create a script that would do that.
Q: Can you add X feature?
A: I can look into it - post a ticket/bug on github or srchub.
Q: This doesn't work!
A: See above question.
Q: Can I take this script and modify it/redistribute it?
A: Of course - as long as you follow the license (that's the point of applying a license).
# Donations
If you feel this script was useful please feel free to send BTC to this address - 1kqfr9hYPHTwGdMev9b538sSeyLa5h4FR
# License
This script is licensed under MIT
localbitcoinsfilter.user.js
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// ==UserScript==
// @name localbitcoins filter
// @namespace https://srchub.org
// @version 0.2
// @description Adds some filters and sorting to localbitcoins
// @author Nathan Adams <adamsna@datanethost.net>
// @match https://localbitcoins.com/*
// @grant none
// ==/UserScript==
// License: MIT
//
// If you feel this script was useful please send BTC donations to this address:
// 1kqfr9hYPHTwGdMev9b538sSeyLa5h4FR
//
// Mirrors:
// https://github.com/nadams810/localbitcoinsfilter
// https://srchub.org/p/localbitcoinsfilter/
/**
* jQuery.fn.sortElements
* --------------
* @author James Padolsey (http://james.padolsey.com)
* @version 0.11
* @updated 18-MAR-2010
* --------------
* @param Function comparator:
* Exactly the same behaviour as [1,2,3].sort(comparator)
*
* @param Function getSortable
* A function that should return the element that is
* to be sorted. The comparator will run on the
* current collection, but you may want the actual
* resulting sort to occur on a parent or another
* associated element.
*
* E.g. $('td').sortElements(comparator, function(){
* return this.parentNode;
* })
*
* The <td>'s parent (<tr>) will be sorted instead
* of the <td> itself.
*/
jQuery.fn.sortElements = (function(){
var sort = [].sort;
return function(comparator, getSortable) {
getSortable = getSortable || function(){return this;};
var placements = this.map(function(){
var sortElement = getSortable.call(this),
parentNode = sortElement.parentNode,
// Since the element itself will change position, we have
// to have some way of storing it's original position in
// the DOM. The easiest way is to have a 'flag' node:
nextSibling = parentNode.insertBefore(
document.createTextNode(''),
sortElement.nextSibling
);
return function() {
if (parentNode === this) {
throw new Error(
"You can't sort elements if any one is a descendant of another."
);
}
// Insert before flag:
parentNode.insertBefore(this, nextSibling);
// Remove flag:
parentNode.removeChild(nextSibling);
};
});
return sort.call(this, comparator).each(function(i){
placements[i].call(getSortable.call(this));
});
};
})();
$(".pagination-block").first().after('Hide Recent <input type="checkbox" id="hideRecent"> | Hide Offline <input type="checkbox" id="hideOffline">');
$("#hideRecent").click(function(e) {
$(".online-status-recent").closest("tr").toggle();
});
$("#hideOffline").click(function(e) {
$(".online-status-offline").closest("tr").toggle();
});
var table = $('.table-bitcoins').first();
$('.header-price').first()
.wrapInner('<span title="sort this column"/>')
.each(function(){
var th = $(this),
thIndex = th.index(),
inverse = false;
th.click(function(){
table.find('td').filter(function(){
return $(this).index() === thIndex;
}).sortElements(function(a, b){
return Number(jQuery.trim($.text([a])).split(" ")[0]) > Number(jQuery.trim($.text([b])).split(" ")[0]) ?
inverse ? -1 : 1
: inverse ? 1 : -1;
}, function(){
// parentNode is the element we want to move
return this.parentNode;
});
inverse = !inverse;
});
});
$(".header-price").first().hover(function() {
$(this).css('cursor','pointer');
}, function() {
$(this).css('cursor','auto');
});
$('.header-price').click();
if (window.location.href.indexOf("sell") > -1) {
$('.header-price').click();
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05553s using 14 queries.