Skip to content

Commit ae438be

Browse files
authored
Establish script UI view of antifeature (#2071)
* Adopted a while back... make visually prominent on script page to improve consideration during moderation request/handling. * Linkable FAQ entry Post #1869 #657 Auto-merge
1 parent 471b95b commit ae438be

3 files changed

Lines changed: 88 additions & 0 deletions

File tree

controllers/script.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ var getScriptPageTasks = function (aOptions) {
8181
var copyright = null;
8282
var license = null;
8383
var licenseConflict = false;
84+
var antifeature = null;
85+
var types = [];
8486
var author = null;
8587
var collaborator = null;
8688

@@ -175,6 +177,24 @@ var getScriptPageTasks = function (aOptions) {
175177
aOptions.script.licenseConflict = true;
176178
}
177179

180+
// Show antifeatures of the script
181+
antifeature = scriptStorage.findMeta(script.meta, 'UserScript.antifeature');
182+
if (antifeature) {
183+
aOptions.hasAntiFeature = true;
184+
185+
antifeature.forEach(function (aElement, aIndex, aArray) {
186+
var type = types[aElement.value1];
187+
var comment = type ? (type.comment || '') : '';
188+
189+
types[aElement.value1] = { name: aElement.value1, comment:
190+
(aElement.value2 ? aElement.value2 : '')
191+
+ (comment ? (aElement.value2 ? '\n' : '') + comment: '')
192+
};
193+
});
194+
195+
aOptions.script.antifeatures = Object.values(types);
196+
}
197+
178198
// Show collaborators of the script
179199
author = scriptStorage.findMeta(script.meta, 'OpenUserJS.author.0.value');
180200
collaborator = scriptStorage.findMeta(script.meta, 'OpenUserJS.collaborator');

views/includes/documents/Frequently-Asked-Questions.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,71 @@ A: Yes, use the raw source route like this in the UserScript metadata block:
247247

248248
The `@downloadURL` UserScript metadata block key is not currently required but highly encouraged especially due to potential faulty .user.js engine updaters.
249249

250+
### Q: What is antifeature?
251+
252+
A: Adopted and vetted from another site, this UserScript metadata block key indicates what types of Author beneficial Code has been included with the script. This allows any visitor to make a more informed decision before installation.
253+
254+
Non-localized usage:
255+
``` js
256+
// @antifeature type comment
257+
```
258+
259+
Localized usage:
260+
``` js
261+
// @antifeature:cs type komentář.
262+
// @antifeature:es-MX type comentario.
263+
// @antifeature:ru type комментарий
264+
265+
```
266+
267+
* There can be any number of @antifeature keys in a script.
268+
* `comment` is optional but recommended. Comments will show up as a tooltip for all unlocalized and localized values.
269+
270+
271+
The following key type(s) are currently supported:
272+
273+
#### antifeature ads
274+
275+
``` js
276+
// @antifeature ads This script contains too many ads.
277+
```
278+
279+
#### antifeature membership
280+
281+
``` js
282+
// @antifeature membership This script requires an account for full functionality.
283+
```
284+
285+
#### antifeature miner
286+
287+
``` js
288+
// @antifeature miner This script uses a lot of electricity on your behalf.
289+
```
290+
291+
#### antifeature referral-link
292+
293+
``` js
294+
// @antifeature referral-link This script makes money for the Author.
295+
```
296+
297+
298+
#### antifeature tracking
299+
300+
``` js
301+
// @antifeature tracking This script contains a tracking of your activity.
302+
```
303+
304+
The following key type(s) are currently __not__ supported:
305+
306+
#### antifeature payment
307+
308+
``` js
309+
// @antifeature payment This script utilizes additional proprietary upstream software and access.
310+
```
311+
312+
If any of these keys are present then additional consideration should be utilized for moderation requests. If any key is absent and a script is found to contain Code relevant to these types please flag the script for moderation inspection.
313+
314+
250315
### Q: Does OpenUserJS.org have script synchronization from a version control site?
251316

252317
This site is currently a presentational userscript repository and is intended to distribute the final published product in a familiar community setting.

views/pages/scriptPage.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
{{#script.copyrights}}<p><i class="fa fa-fw fa-copyright"></i> <b>Copyright:</b> {{name}}</p>{{/script.copyrights}}
4646
{{#script.licenseConflict}}<p><i class="fa fa-fw fa-legal"></i> <b>License:</b> {{#script.licenseParadox}}<s>{{/script.licenseParadox}}<a rel="external noreferrer noopener nofollow ugc license" referrerpolicy="same-origin" href="https://spdx.org/licenses/MIT.html">MIT</a>; <a rel="external noreferrer noopener nofollow ugc license" referrerpolicy="same-origin" href="https://opensource.org/licenses/MIT">https://opensource.org/licenses/MIT</a>{{#script.licenseParadox}}</s>{{/script.licenseParadox}}</p>{{/script.licenseConflict}}
4747
{{#script.licenses}}<p><i class="fa fa-fw fa-balance-scale"></i> <b>License:</b> {{#name}}{{name}}{{/name}}{{^name}}<a rel="external noreferrer noopener nofollow ugc license" referrerpolicy="same-origin" href="https://spdx.org/licenses/{{spdx}}.html">{{spdx}}</a>{{#url}}; <a rel="external noreferrer noopener nofollow ugc license" referrerpolicy="same-origin" href="{{url}}">{{url}}</a>{{/url}}{{/name}}</p>{{/script.licenses}}
48+
{{#hasAntiFeature}}
49+
<p><i class="fa fa-fw fa-exclamation-triangle"></i> <b>Antifeatures:</b> <span>{{#script.antifeatures}}<a href="/about/Frequently-Asked-Questions#antifeature-{{name}}" title="{{comment}}"> {{name}}</a>{{/script.antifeatures}}</span></p>
50+
{{/hasAntiFeature}}
4851
{{#hasCollab}}
4952
<p><i class="fa fa-fw fa-user"></i> <b>Collaborator:</b> {{#script.collaborators}} <span class="label label-info"><a href="/users/{{{url}}}">{{text}}</a></span> {{/script.collaborators}}</p>
5053
{{/hasCollab}}

0 commit comments

Comments
 (0)