Hupotronic / ExLinks

A userscript to make E-Hentai & ExHentai links on 4chan & Foolz archive more useful. Includes ExSauce.
http://hupotronic.github.com/ExLinks/
46 stars 6 forks source link

copyright #5

Closed aeosynth closed 12 years ago

aeosynth commented 12 years ago

https://github.com/Hupotronic/ExLinks/blob/master/exlinks.js#L91

A whole bunch of code lifted pretty much straight from 4chan X.

https://github.com/MayhemYDG/4chan-x/blob/master/4chan_x.user.js

/* LICENSE
 *
 * Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
 * Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com>
 * http://mayhemydg.github.com/4chan-x/
 * 4chan X 2.34.8
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.

please either remove / rewrite the code lifted from 4chan x, or include the MIT license

also there are more build systems out there than just Cakefiles; you should take a look at grunt

@mayhemYDG

Hupotronic commented 12 years ago

Most of it was already at least somewhat rewritten / refactored, but I went and did it for what was left as well. Though seeing as there's not really that many (efficient) ways to write the shortcut functions ExLinks has in $ (8 of its 14 functions are simple one-liners and the rest aren't exactly that complex either), the code is still rather similar (especially since I was already familiar with the way it worked in the first place). We good?

On the whole, 4chan X was quite the inspiration for ExLinks' current form - between 1.7.4 and 2.0.0, ExLinks was actually rewritten from scratch twice. I had a perfectly working version that was pretty much only lacking the on-page configuration from the current set of functionality. I then decided to take a look at how other relevant userscripts (4chan X and OneeChan) did their option menus and started going through 4chan X's (compiled JS) code. Reading through I realized how much cleaner and more organized my code could be, and I set on rewriting it from scratch again. In the beginning of this second rewrite, I copied most of the $ block from 4chan X (and added the comment about it), but after quickly realizing that most of it would be unnecessary for ExLinks, I trimmed out everything that I didn't need (and added some of my own code).

Anyway, I still haven't decided what license to use for ExLinks itself. I'm contemplating between some very permissive license or just straight-up unlicensing it.

As for building, I was initially going to use Jake but ended up using CoffeeScript and Cake because of multi-line strings. Since requiring CS solely for the sake of building is pretty excessive, though, I'll definitely take a look at grunt.

aeosynth commented 12 years ago

changing variable names / whitespace != rewrite / refactor

We good?

no

Hupotronic commented 12 years ago

Well that's too bad, then. Look, I have no issue mentioning 4chan X as a source of inspiration, because it most certainly was - but I am not going to include its whole license for providing the idea of having jQuery-like shortcut functions for stuff that I was already doing in my code in the first place, because basically all the functionality that the codebases "share" is trivial (I can elaborate on this, but I honestly think it should be pretty obvious).

Like just for example, how the hell is one supposed to "rewrite" something like $.id = function(id) { d.getElementById(id); } without you going "hurr durr you're just renaming variables" and still fulfill the intended goal of having a shortcut function for document.getElementById?

aeosynth commented 12 years ago

Like just for example, how the hell is one supposed to "rewrite" something like $.id = function(id) { d.getElementById(id); }

one way:

$.id = document.getElementById.bind(document);

also you copied more than just shortcut functions - https://github.com/Hupotronic/ExLinks/blob/master/exlinks.js#L1010

Config.engine = navigator.userAgent.match(/WebKit|Presto|Gecko/)[0].toLowerCase();

https://github.com/MayhemYDG/4chan-x/blob/master/script.coffee#L260

engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase()
Hupotronic commented 12 years ago

Okay, so you could use bind, but I would say the current way is the more obvious (and completely trivial) solution.

And UserAgent sniffing for browser detection isn't the obvious solution? I'd like to disagree. Will you stop bitching if I change it to only detect Opera? Because that's what I was planning on using it for (the upcoming Sauce feature will rely on GM_xmlhttpRequest and thus not work on Opera).

aeosynth commented 12 years ago

Bro, either rewrite / remove the 4chan x code, or add the 4chan x license. If you don't, I'll send github a dmca takedown request

VitP commented 12 years ago

the upcoming Sauce feature will rely on GM_xmlhttpRequest and thus not work on Opera

Wouldn't checking for the existance of GM_xmlhttpRequest be more sensible as by looking at this comparison table greasekit and native google chrome don't support it as well.

Hupotronic commented 12 years ago

Google Chrome does support GM_xmlhttpRequest natively - but only in userscripts. And since I target Firefox and Chrome primarily and Opera secondarily, I'll just need to check for Opera to disable GM_xmlhttpRequest (which the latest commit does).

And aeosynth, if you wish to go there, then do so. As per the latest commit, your DMCA takedown request will be based pretty much solely on the obvious and trivial oneliners imitating jQuery API functionality, and I really doubt that is going to get you very far. And you can count on me to file a counter-claim, so unless you are willing to take this to the courtroom, I would recommend dropping this subject (by the way, are you familiar with what happened in the recent Google/Oracle lawsuit?) and to be satisfied with me mention 4chan X as a source of inspiration (I can add this to readme.md and to the eventual proper site I'm going to make for this).

aeosynth commented 12 years ago

Bro, yes, most of the stuff consists of trivial one liners, but the 4chan x team wrote those one liners, not you. You are using the library that we built. I don't understand your unwillingness to recognize this simple truth.

Additionally, $$ and prep are non trivial. $$ is only one step removed from the trivial solution, but you cannot argue that prep is a trivial and obvious one liner.

Hupotronic commented 12 years ago

And if you asked anyone reasonably proficient in JS to write shortcut functions for jQuery-like functionality like ".after()", I would wager that the function would consist of root.parentNode.insertBefore(node, root.nextSibling). Hell, I had a function for that in ExLinks before 2.0.0 as well.

The only "non-trivial" part of $$ is Array.prototype.slice.call and I damn well bet you got that one straight from Sizzle anyway. And I don't see you including the Sizzle license in 4chan X, do I now?

As for prep, I was already doing the same thing in my previous code (in the linkification part of it) - which isn't exactly surpising as the idea of "appending elements from an array to a documentFragment" (which are supported even by IE6) is hardly special or non-trivial - hell, the MDN example for createDocumentFragment does it! Doing it in $ and having it in the add/prepend/etc was certainly an idea from 4chan X, but if it makes you stop whining I can change it to be used only in the places where it's actually necessary (in fact, I think I'll do that anyway - not having to do the array checking will probably be slightly faster anyway.) (Oh, and free protip for 4chan X - Array.isArray is generally faster than instanceof - I'd suggest adding a check for the support of the former before using the latter.)

EDIT: And done. Also changed the name of "prep" to "elem" to better reflect what it does (turning an array of elements into a single element).

aeosynth commented 12 years ago

And if you asked anyone reasonably proficient in JS to write shortcut functions for jQuery-like functionality like ".after()", I would wager that the function would consist of root.parentNode.insertBefore(node, root.nextSibling).

since it's so easy, why don't you do just that? remove the 4chan x code and write the shortcut functions yourself, from scratch. that's one of the solutions i stated at the very beginning.

you are using the 4chan x library. if you remove the 4chan x library and re-implement it yourself, you won't have to include the license. i still don't see why including a license is such a big deal for you, especially the MIT license, which i chose in part for its brevity.

Hupotronic commented 12 years ago

why don't you do just that?

But I already did! Then you went "hurr durr you just changed variable names" because I did it the most obvious way - which is incidentally also how 4chan X did it.

aeosynth commented 12 years ago

you don't have to be afraid of using open source software, there's nothing bad or wrong about including my code in your works - i explicitly give you permission to do so, as long as you follow the rules in the license, which include adding the license to your code.

you don't take uglify or jshint, strip their license and pass it off as your own, there's no reason to do so with 4chan x either.

Hupotronic commented 12 years ago

I am not afraid of using open source software, I just cannot in any conscience consider you as the "inventor" of "shortcut functions for trivial javascript functionality" and include your license in my project because of that.

aeosynth commented 12 years ago

i'm not claiming to be the inventor of shortcut functions, i'm claiming to be the creator of the library of shortcut functions you copied. open source software is open source in part to prevent people from having to go through the contortions that you're going through.

Hupotronic commented 12 years ago

Yeah, sure, I originally did copy the library of shortcut functions you wrote. Keyword being originally, as I have already rewritten all of it. Any similarity between the two at this point only comes down to functions inspired by the jQuery API, obvious things and something from Sizzle.

nstepien commented 12 years ago

Oh, and free protip for 4chan X - Array.isArray is generally faster than instanceof - I'd suggest adding a check for the support of the former before using the latter.

Oh, and free protip for Hupotronic - Array.isArray is generally slower than instanceof - I'd suggest you run your own tests instead of believing anything you see on the internet: http://jsperf.com/array-isarray-vs-instanceof-array/4

Hupotronic commented 12 years ago

Well, I consider myself corrected. Time to do some optimizations...

aeosynth commented 12 years ago

ok, looks good

it didn't have to end like this

Hupotronic commented 12 years ago

Well, I'm quite satisfied with the outcome myself, since otherwise it would have probably taken longer for me to realize how many of the functions can be changed to better fit ExLinks' needs. I guess now that I'm back home I ought to finally take a proper look at grunt too...