summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-10-04Remove extra whitespace in variable declarationsJuuso Lapinlampi
This is something I would disagree with, because this commit in my opinion reduces readability. I am not going to reinvent the wheel and write for humans, because I enjoy being a slave to ESLint. Any complaints about this commit should be directed at Airbnb to fix their style guide. Alternatively, a documented standard style guide should be created for pantsu.cat, extending the Airbnb config. This fixes ESLint no-multi-spaces errors using airbnb/legacy config.
2015-10-04Clarify Gyazo deprecation warning to use text responseJuuso Lapinlampi
It is a little unclear what the deprecation warning wants the developer to do. The fallthrough comment to text response may not be immediately obvious to the reader. This commit helps to understand the intention and to avoid bugs such as commit daac77a.
2015-10-04Fix empty Gyazo response with more fallthroughsJuuso Lapinlampi
Gyazo didn't fallthrough correctly to text, because the type would be set to Gyazo while the Gyazo case didn't exist. PHP is so ambiguous sometimes. This adds the missing fallthroughs that were removed in commit e39a920. It should now correctly fallthrough ("fallback") to text response.
2015-10-04Wrap CSV response values in double quotes (")Juuso Lapinlampi
While double quotes are mostly optional in implementations, some CSV linters want double quotes for whatever the reason. Assumably, it reduces the amount of bugs and avoids possible parsing errors. This also has very little relevance for not trusting the user input, but better be safe than sorry. This commit is not very pretty. In a future commit, this issue will be addressed with arrays and fputcsv().
2015-10-04Use CRLF linebreaks for CSV responsesJuuso Lapinlampi
RFC 4180 specifies that CSV files should use CRLF (a carriage-return and line-feed pair, e.g. \r\n).
2015-10-04Merge branch 'follow-airbnb-jquery' into fix-eslint-warnings-2Juuso Lapinlampi
Prefix jQuery object variables with a $
2015-10-04Merge branch 'eslint-undef' into fix-eslint-warnings-2Juuso Lapinlampi
2015-10-04Fix Gyazo response falling through back to text againJuuso Lapinlampi
This fixes a silly mistake where Gyazo would accidentally use the HTML response instead of text as intended. This bug was introduced in commit 2ca5b6b.
2015-09-30Sort Response default case options alphabeticallyJuuso Lapinlampi
This commit improves readability and compliments commit 6d8b204.
2015-09-30Sort Response code lines alphabetically againJuuso Lapinlampi
This commit improves readability.
2015-09-29Remove default undefined behavior from Response classJuuso Lapinlampi
Let's say some user decides to use output "xml". Unexpectedly, the user would instead receive JSON output. This is undefined behavior in its own way and violates the principle of least surprise. Problems could arise if we added "xml" later with actual application/xml or text/xml content. Right now upload.php overrides an empty output argument to json instead, so this seems safe to do. Any non-existent output will now return a 400 Bad Request error.
2015-09-29Sort upload responses alphabeticallyJuuso Lapinlampi
This commit improves readability by swapping text and html response source line order for alphabetical sorting.
2015-09-29Improve consistency by resorting Response.send()Juuso Lapinlampi
This restores the typical sorting order: - csv - (gyazo) - text - html - default (json)
2015-09-29Deprecate Gyazo response, fallthrough to text/plainJuuso Lapinlampi
A majority of the Gyazo code is just copy-pasted text/plain protocol. This will put an end to that insanity. OK ewhal@
2015-09-29Return Content-Type: text/csv with csv upload outputJuuso Lapinlampi
Previously, CSV would return the wrong filetype text/plain and fallthrough. RFC 4180 registers text/csv MIME type. RFC 7111 is closely related and says to use text/csv to launch the correct application.
2015-09-28Add missing var declaration to EventEmitterJuuso Lapinlampi
Previous commit 11e9d2d forgot to add the var declaration here. Fixes ESLint no-undef warnings using Airbnb ES5 config.
2015-09-28Add missing var declarations to undefined variablesJuuso Lapinlampi
Fixes ESLint no-undef warnings using Airbnb ES5 config.
2015-09-28Fix unexpected use of undefined with Boolean()Juuso Lapinlampi
Airbnb style guide recommends checking booleans this way or using (!!window.FormData). The latter is more confusing for many. While !! is indeed 0.2% faster than Boolean(), it's called micro-optimization. There is no noticeable difference to the user in our use scenario and I prefer more readable code any day. Fixes ESLint no-undefined warning using Airbnb ES5 config. Reference: https://jsperf.com/boolean-conversion-speed
2015-09-28Remove dead uploadstart emitter startUpload()Juuso Lapinlampi
The loadstart even is only triggered once to indicate the progress has begun (initialize the progress bar). Essentially, this is dead code for two reasons: 1. It never gets emitted because initProgressBar() gets emitted first. 2. No JavaScript file in pomf core uses the non-standard uploadstart event.
2015-09-28Name and comment addEventListener functionsJuuso Lapinlampi
Using anonymous functions with event handlers is painfully slow according to benchmarks. Anonymous functions are up to 99% slower. It is also illegal to use anonymous functions in this way according to Airbnb ES5 style guide. Fixes some ESLint func-names errors using Airbnb ES5 config. Reference: https://jsperf.com/event-handler-vs-anonymous-function/3
2015-09-28Fix assignments to function parameters in JavaScriptJuuso Lapinlampi
Fixes ESLint no-param-reassing warning.
2015-09-28Prefix cheesesteak.js jQuery object variables with a $Juuso Lapinlampi
This fixes Airbnb ES5 style guide violations.
2015-09-28Merge branch 'fix-eslint-warnings' of wubthecaptain/pomfJuuso Lapinlampi
Before this merge, ESLint reported about 114 problems (76 errors, 38 warnings). This merge reduces that to about 67 problems (29 errors, 38 warnings) using Airbnb ES5 config. OK ewhal@
2015-09-28Remove previously added missing brace/bracket commasJuuso Lapinlampi
Until the code has been converted to ES6 in it's entirety, let's stick to Airbnb's ES5 style guide so that ESLint won't complain. This reverts commit e6f354a.
2015-09-28Remove extra newline padding from pomf.jsJuuso Lapinlampi
This newline was accidentally introduced in commit a17c446. Fixes ESLint warning padded-blocks using Airbnb ES5 config.
2015-09-28Add pomf.js parseInt() radix 10Juuso Lapinlampi
Fixes ESLint radix warning using Airbnb ES5 config.
2015-09-27Prefix jQuery object variables with a $Juuso Lapinlampi
While JSCS and ESLint do not detect this yet as of today, my eyes do. The Airbnb style guide wants to do this. This commit doesn't prefix cabinet.js, but the next commit will while addressing another issue.
2015-09-27Fix JS switch ... case indentationJuuso Lapinlampi
This is a surprising one. JSHint and JSCS do not seem to mind the previous indentation, but ESLint throws an error when using the Airbnb style guide. The style guide itself doesn't seem to mention anything about this directly. What ever it is, this one pleases all three linters. Fixes ESLint indent warnings using Airbnb ES5 config.
2015-09-27cheesesteak.js: Use _this to save reference to thisJuuso Lapinlampi
Fixes JSCS safeContextKeyword warnings using Airbnb preset.
2015-09-27Remove extra quotes to follow Airbnb JavaScript styleJuuso Lapinlampi
Fixes JSCS disallowQuotedKeysInObjects warnings using Airbnb preset.
2015-09-27Add missing commas before closing bracket/curly braceJuuso Lapinlampi
This adds commas to cheesesteak.js. Something to note, the Airbnb ES5 style guide opposes a trailing comma. The latest ES6 edition endorses adding a trailing comma, explaining it leads to cleaner Git diffs. Endorse the ES6 standard, that's also the Airbnb preset in JSCS. Fixes JSCS requireTrailingComma warnings using Airbnb preset.
2015-09-27Fix cheesesteak.js comments to follow Airbnb styleJuuso Lapinlampi
Airbnb says to use /** ... */ for multiline comments and // for single line comments. Fixes JSCS requirePaddingNewLinesBeforeLineComments and validateIndentation warnings using Airbnb preset.
2015-09-27Use individual Javascript var declarationsJuuso Lapinlampi
Thanks to ASI (Automatic Semicolon Insertion) in JavaScript, not using individual var declarations can actually cause subtle bugs. Fixes JSCS disallowMultipleVarDecl warnings using Airbnb preset. Reference: http://benalman.com/news/2012/05/multiple-var-statements-javascript/
2015-09-27Change double quotes to single quotes in cheesesteak.jsJuuso Lapinlampi
Fixes JSCS validateQuoteMarks warnings using Airbnb preset.
2015-09-27Fix illegal trailing whitespace in JavaScriptJuuso Lapinlampi
Fixes JSCS disallowTrailingWhitespace warnings using Airbnb preset.
2015-09-27Add missing newlines after blocksJuuso Lapinlampi
Fixes JSCS requirePaddingNewLinesAfterBlocks warnings using Airbnb preset.
2015-09-27Fix redeclaration of "res" variable in pomf.jsJuuso Lapinlampi
Fixes ESLint warning no-redeclare.
2015-09-27Fix irregular whitespace in cheesesteak.jsJuuso Lapinlampi
Fixes ESLint warnings about no-irregular-whitespace.
2015-09-27Remove Gruntfile cssmin task banner optionJuuso Lapinlampi
The banner option was removed in grunt-contrib-cssmin v0.11.0. This removes the dead config option.
2015-09-27Remove unused expression (hits[file.name] = 0)Juuso Lapinlampi
Fixes ESLint no-unused-expressions warning.
2015-09-27Use strict node === node.parentNode comparisonJuuso Lapinlampi
Fixes ESLint no-cond-assign warning. -- Sat, 26 Sep 2015 -- 10:38:42 +bursey | while (node = node.parentNode) is invalid 10:38:54 +bursey | should be while (node == node.parentNode) 10:40:38 +bursey | weird actually 10:40:55 +bursey | Elements tend to be "true" in js 10:41:16 +bursey | but if the parentNode is undefined, then it's | false 10:41:50 +bursey | thus it doesn't loop infinitely 10:43:00 +bursey | actually, use === instead of ==
2015-09-27Fix JavaScript units[] array coding styleJuuso Lapinlampi
Reduces confusion and improves readability, despite not having yet agreed on which JavaScript style guide to use.
2015-09-27Replace copy-pasted pomf.js errors with constantsJuuso Lapinlampi
Introduces client-side UPLOAD_ERR_MAX_SIZE and UPLOAD_ERR_FAILED constants. This reduces code duplication, which means less code smell.
2015-09-27Add Cupkle to package.json contributorsJuuso Lapinlampi
Cupkle has contributed a Catalan translation, merged to master in commit e233523.
2015-09-27Simplify contributors array in package.jsonJuuso Lapinlampi
npm allows to shorten contributors into a single string, the following format: "Author Name <me@authorname.example> (http://authorname.example)" This commit changes the array to the shortened strings.
2015-09-27Remove misleading comment and simplify pomf.js case 413Juuso Lapinlampi
There appears to be no such thing as a terrible scary bug that needs a workaround in my Chromium 45.0.2454.85 browser to encode &hellip;. The unobvious self-closing <div/> is also very questionable. For what it's worth, &hellip; will encode correctly as long as you use jQuery's .html() method – which it already did anyway. OK ewhal@
2015-09-27Merge branch 'remove-moe-code-in-core' of WubTheCaptain/pomfJuuso Lapinlampi
OK ewhal@
2015-09-27Remove session_start(); from upload.phpJuuso Lapinlampi
Moe panel uses PHP sessions to keep the user logged in. We don't need it anymore, it's not required for core functionality.
2015-09-27Merge branch 'grabbing-urls-hellip' of WubTheCaptain/pomfJuuso Lapinlampi
OK ewhal@
2015-09-27Merge branch 'php-strict-comparison'Juuso Lapinlampi
OK ewhal@