[webinterface.default] cleanup - removed over 200k from the project #1580

Merged
merged 1 commit into from Oct 10, 2012

Conversation

Projects
None yet
3 participants
Contributor

asylumfunk commented Oct 9, 2012

  • cleanup - moved ajax commonalities to dedicated library
  • cleanup - removed unneeded jQuery.proxy calls
  • cleanup - removed obvious comments
  • performance - much faster replace
  • cleanup - upgraded jquery to 1.8.2, removed unreferenced js files
  • performance - lossless image size reduction with smushit
Contributor

asylumfunk commented Oct 9, 2012

@Montellese
This will be it from me for this release window; the major rewrite will have to wait until the next go-around.

- dataType: 'json'});
- return;
- }
+ // TODO: Get active player
@Montellese

Montellese Oct 9, 2012

Owner

intentional?

Owner

Montellese commented Oct 9, 2012

Looks great. Apart from that TODO comment I commented on would it be possible to "beautify" all the JSON-RPC parameters again i.e. put a space between { and a properties name and between [ and whatever value comes afterwords (same for } and ]? IMO it makes it a bit easier to read.
On that subject would it actually be possible to define the parameters in JSON (so not a string containing data in JSON format) and then stringify it in xbmc.rpc.request to a string containing data in JSON format? Might make it easier to spot typos because the interpreter will directly parse and interpret the JSON object/data instead of a string.

@ghost ghost assigned Montellese Oct 9, 2012

addons/webinterface.default/js/MediaLibrary.js
-
- return result;
+ replaceAll: function(haystack, needle, thread) {
+ return (haystack || '').split(needle|| '').join(thread|| '');
@da-anda

da-anda Oct 9, 2012

Member

please add whitespaes before the || for better reading

Contributor

asylumfunk commented Oct 9, 2012

The TODO comment was actually already in there...I was just moving that block further down in the function (that way we don't do a DOM lookup until/unless we need it).

Yeah, I had done the stringify thing in a different branch before; I'll pull that in tomorrow after work.

It definitely makes the code look a lot cleaner.

Member

da-anda commented Oct 9, 2012

thanks a lot for AJAX the cleanup. Wanted to do this for a long time. And as @Montellese said, I planned to do a complete rewrite of the webinterface this winter and make it a) more usable, b) look much better, c) localized and d) add support for mobile devices. My plan was to make it some sort of basic web-based remote "app" and probably also make use of all the nice HTML5 features like websocket, local storage/cache, db etc. And if it works nicely even use it as basis for a phonegap app in order to get a basic official remote out for currently unsupported mobile platforms like windows phones, blackberry etc.
So if you like we could teamup.

cleanup - removed over 200k from the project
- cleanup - moved ajax commonalities to dedicated library
- cleanup - removed unneeded jQuery.proxy calls
- cleanup - removed comments
- performance - much faster replace
- cleanup - upgraded jquery to 1.8.2, removed unreferenced js files
- performance - lossless image size reduction with smushit
Contributor

asylumfunk commented Oct 10, 2012

Requests incorporated:

  • params specified as json, not strings
  • spacing

Rebased and ready to go..

Montellese added a commit that referenced this pull request Oct 10, 2012

Merge pull request #1580 from asylumfunk/js-house-cleaning
[webinterface.default] cleanup JSON-RPC requests

@Montellese Montellese merged commit d5ab22a into xbmc:master Oct 10, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment