[MediaWiki-CodeReview] [MediaWiki r113644]: New comment added
Krinkle posted a comment on MediaWiki.r113644. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113644#c32131 Commit summary for MediaWiki.r113644: add locale global for handling languages and message function for the benefit of the phonegap app Krinkle's comment: See also [[bugzilla:31675]]. Afaik the decision was already made to port MobileFrontend to ResourceLoader, and move the bar of get javascript to browser supports modern javascript (instead of browser supports basic javascript). ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113644]: New comment added
Krinkle posted a comment on MediaWiki.r113644. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113644#c32088 Commit summary for MediaWiki.r113644: add locale global for handling languages and message function for the benefit of the phonegap app Krinkle's comment: pre var title = {$this-data['htmlTitle']}; var scriptPath = {$this-data['wgScriptPath']}; - var showText = {$buttonShowText}; - var hideText = {$buttonHideText}; + var locale = { + expand-section: {$buttonShowText}, + collapse-section: {$buttonHideText} + }; /script /pre These generic (global!) variables are becoming an issue. More then just a maintainability problem but a practical one as well. The browser has many default variables in the global 'window' object by default. One of the things many browsers put as alias into the window object are unique DOM element IDs. So if any wiki or skin content would have codenowikispan id=locale .. /span/nowiki/code or codenowikispan id=title .. /span/nowiki/code, then this code is broken (some browsers allow overriding of those properties, some don't). Code like this is asking to get broken. My advice would be to either drop all front-end development temporarily and port to ResourceLoader asap, or spend more time on this. ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113644]: New comment added
MaxSem posted a comment on MediaWiki.r113644. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113644#c32089 Commit summary for MediaWiki.r113644: add locale global for handling languages and message function for the benefit of the phonegap app MaxSem's comment: Mobile RL looks problematic for compatibility (many mobile browsers support JS, but choke on its amount in jQuery) and traffic reasons. Any ideas? ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113644]: New comment added
Jdlrobson posted a comment on MediaWiki.r113644. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113644#c32091 Commit summary for MediaWiki.r113644: add locale global for handling languages and message function for the benefit of the phonegap app Jdlrobson's comment: What are people's thoughts on this - http://jonrobson.me.uk/tmp/r113644.diff - as a possible solution using data attributes [1] Note some mobiles do not support JSON which would be the other way to pass data from the php code to the javascript. [1] http://www.w3.org/TR/html5/elements.html#embedding-custom-non-visible-data-with-the-data-attributes ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113644]: New comment added
Krinkle posted a comment on MediaWiki.r113644. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113644#c32093 Commit summary for MediaWiki.r113644: add locale global for handling languages and message function for the benefit of the phonegap app Krinkle's comment: JSON parsing from a string is indeed a modern API that isn't reliably available in a cross-browser environment. However it doesn't make sense to pass a JSON string to a browser. Browsers have javascript engines and JSON (JavaScript Object Notation) as a literal rather than a string is (naturally) supported in all javascript engines (even old ones (IE6..) and/or handicapped mobile javascript engines, its in the fundamentals of the language, it's even used in the return value visible in the diff above). Outputting code'var mwMobileFrontendData = ' . FormatJSON::encode( $frontendData ) . ';'/code will be fine. Where code$frontendData/code would be something like: pre $frotendData = array( 'messages' = array( 'expand-section' = .., ), 'config' = array( 'pageTitle' = .. , 'scriptPath' = .., ), ); /pre Then from a javascript file you'd have something like: pre ( function ( mfData ) { var mf = { msg: function (key) { return mfData.messages[key]; } }; window.mwMobileFrontend = mf; }( mwMobileFrontendData ) ); /pre Just a short example :) ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113644]: New comment added
Krinkle posted a comment on MediaWiki.r113644. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113644#c32095 Commit summary for MediaWiki.r113644: add locale global for handling languages and message function for the benefit of the phonegap app Krinkle's comment: There's no need for work-around via DOM attributes. JavaScript objects work just fine and much easier and faster to manipulate. ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
[MediaWiki-CodeReview] [MediaWiki r113644]: New comment added
Jdlrobson posted a comment on MediaWiki.r113644. URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/113644#c32099 Commit summary for MediaWiki.r113644: add locale global for handling languages and message function for the benefit of the phonegap app Jdlrobson's comment: See follow up in r113695 ___ MediaWiki-CodeReview mailing list mediawiki-coderev...@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview