Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Options for searching in "city," "area," or "country," widening search.

  • Loading branch information...
commit b6bc27e47564e9a5fe5b6dd2dc733247142466d0 1 parent 261495a
@meitar authored
Showing with 32 additions and 13 deletions.
  1. +4 −4 README.markdown
  2. +28 −9 fetlife-age-sex-location-search.user.js
View
8 README.markdown
@@ -10,7 +10,7 @@ With the FetLife Age/Sex/Location Search user script installed, a few clicks wil
## System requirements
-To use the FetLife Age/Sex/Location Search user script, you must be running [Mozilla Firefox](http://getfirefox.com/) (version 12.0 or higher), with the [Greasemonkey extension](https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/) installed (at version 0.9 or higher).
+To use the FetLife Age/Sex/Location Search user script, you must be running [Mozilla Firefox](http://getfirefox.com/) (version 12.0 or higher), with the [Greasemonkey extension](https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/) installed (at version 1.0 or higher).
Sorry, FetLife Age/Sex/Location Search is currently [incompatible with other Web browsers](https://github.com/meitar/fetlife-aslsearch/issues/1). (Please help me fix that!)
@@ -32,7 +32,7 @@ You will be presented with a number of additional options that allow you to defi
![Screenshot of form fields for FetLife Age/Sex/Location Search.](http://i.imgur.com/k6YEm.png)
-The image above shows selections that will search for the profile of any person whose gender/sex is Male or FtM, who is between the ages of 21 and 28 (inclusive), and who identifies as a submissive, slave, pet, bottom, or masochist. Once you've made your selections, click the `Mine! I mean, uh, search…` button. A progress bar will replace the search button showing you how many pages have been searched for a match, as shown below:
+The image above shows selections that will search for the profile of any person whose gender/sex is Male or FtM, who is between the ages of 21 and 28 (inclusive), and who identifies as a submissive, slave, pet, bottom, or masochist. Once you've made your selections, click the `Mine! (I mean, uh, search…)` button. A progress bar will replace the search button showing you how many pages have been searched for a match, as shown below:
![Screenshot of FetLife Age/Sex/Location Search running a search.](http://i.imgur.com/zRBnN.png)
@@ -46,10 +46,10 @@ To start a new search, simply reload the page.
Before you report a new issue with FetLife Age/Sex/Location Search, please check to ensure your question is not already addressed in the list below.
-* [Can I search in a location other than "near me"?](#can-i-search-in-a-location-other-than-near-me)
+* [Can I search in a location other than my own city, state, or country?](#can-i-search-in-a-location-other-than-my-own-city-state-or-country)
* [Why can I only search for men, not women?](#why-can-i-only-search-for-men-not-women)
-### Can I search in a location other than "near me"?
+### Can I search in a location other than my own city, state, or country?
The current version of FetLife Age/Sex/Location Search doesn't provide an interface for you to choose a location directly. However, you can temporarily change the location you list on your own profile to search in different regions. In other words, if you're currently in New York City but want to search for people in Tokyo, temporarily change your FetLife profile's location to Tokyo and run your search again. Afterwards, you can change your FetLife profile's location back to New York City.
View
37 fetlife-age-sex-location-search.user.js
@@ -6,9 +6,9 @@
*/
// ==UserScript==
// @name FetLife ASL Search
-// @version 0.1
-// @namespace http://maybemaimed.com/playground/fetlife-aslsearch/
-// @updateURL https://userscripts.org/scripts/source/146293.user.js
+// @version 0.2
+// @namespace http://maybemaimed.com/playground/fetlife-age-sex-location-search/
+// @updateURL https://userscripts.org/scripts/source/????.user.js
// @description Allows you to search for FetLife profiles based on age, sex, location, and role.
// @include https://fetlife.com/administrative_areas*
// @include https://fetlife.com/cities*
@@ -28,6 +28,8 @@
// @exclude https://fetlife.com/chat/*
// @exclude https://fetlife.com/im_sessions*
// @exclude https://fetlife.com/polling/*
+// @grant GM_xmlhttpRequest
+// @grant GM_addStyle
// ==/UserScript==
FL_ASL = {};
@@ -99,7 +101,7 @@ FL_ASL.getSearchParams = function () {
'age' : {'min': null, 'max': null},
'sex' : [],
'role' : [],
- 'loc' : null
+ 'loc' : {}
};
// Collect age parameters, setting wide defaults.
@@ -123,8 +125,20 @@ FL_ASL.getSearchParams = function () {
}
// Collect location parameters.
- // TODO: Create an interface for setting locations other than closest-to-me.
- r.loc = FL_ASL.getLocationForUser(uw.FetLife.currentUser.id);
+ var search_in = [];
+ var z = FL_ASL.CONFIG.search_form.querySelectorAll('input[name="fl_asl_loc"]');
+ for (var iz = 0; iz < z.length; iz++) {
+ if (z[iz].checked) {
+ search_in.push(z[iz].value);
+ }
+ }
+ // Match location parameter with known location ID.
+ user_loc = FL_ASL.getLocationForUser(uw.FetLife.currentUser.id);
+ for (var xk in user_loc) {
+ if (null !== user_loc[xk] && (-1 !== search_in.indexOf(xk)) ) {
+ r.loc[xk] = user_loc[xk];
+ }
+ }
return r;
};
@@ -158,7 +172,7 @@ FL_ASL.getUserProfile = function (id) {
} else {
FL_ASL.users[id] = {};
GM_xmlhttpRequest({
- 'method': "GET",
+ 'method': 'GET',
'url': 'https://fetlife.com/users/' + id.toString(),
'onload': function (response) {
FL_ASL.users[id].profile_html = response.responseText;
@@ -255,6 +269,8 @@ FL_ASL.getKinkstersFromURL = function (url) {
FL_ASL.matchesSearchParams = function (el) {
var search_params = FL_ASL.getSearchParams();
+ // Location omitted because we collect results in an already-location-filtered set.
+
// Does block match age range?
age = FL_ASL.getAge(el);
// Did we supply a minimum age?
@@ -377,8 +393,11 @@ FL_ASL.main = function () {
html_string += '</p></fieldset>';
html_string += '<fieldset><legend>Search for user profiles located in:</legend><p>';
// TODO: Change "near me" to options offering "my city," "my region," and "my country."
- html_string += '&hellip;located near me.';
- html_string += '</p></fieldset>';
+ html_string += '&hellip;located in my ';
+ html_string += '<label><input type="radio" name="fl_asl_loc" value="city_id" />city</label>';
+ html_string += '<label><input type="radio" name="fl_asl_loc" value="area_id" checked="checked" />state/province</label>';
+ html_string += '<label><input type="radio" name="fl_asl_loc" value="country" />country</label>';
+ html_string += '.</p></fieldset>';
div.innerHTML = html_string;
FL_ASL.CONFIG.search_form.appendChild(label);
FL_ASL.CONFIG.search_form.appendChild(div);
Please sign in to comment.
Something went wrong with that request. Please try again.