{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/11671","repository_url":"https://api.github.com/repos/joomla/joomla-cms","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/11671/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/11671/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/11671/events","html_url":"https://github.com/joomla/joomla-cms/pull/11671","id":172163496,"number":11671,"title":"[RFC] Script options without inline JavaScript","user":{"login":"Fedik","id":1568198,"avatar_url":"https://avatars.githubusercontent.com/u/1568198?v=3","gravatar_id":"","url":"https://api.github.com/users/Fedik","html_url":"https://github.com/Fedik","followers_url":"https://api.github.com/users/Fedik/followers","following_url":"https://api.github.com/users/Fedik/following{/other_user}","gists_url":"https://api.github.com/users/Fedik/gists{/gist_id}","starred_url":"https://api.github.com/users/Fedik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fedik/subscriptions","organizations_url":"https://api.github.com/users/Fedik/orgs","repos_url":"https://api.github.com/users/Fedik/repos","events_url":"https://api.github.com/users/Fedik/events{/privacy}","received_events_url":"https://api.github.com/users/Fedik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-19T15:55:54Z","updated_at":"2016-08-19T16:07:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/11671","html_url":"https://github.com/joomla/joomla-cms/pull/11671","diff_url":"https://github.com/joomla/joomla-cms/pull/11671.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/11671.patch"},"body":"Here is idea of 'lazy' loading for `Joomla.optionsStorage`. \r\nThe idea is very simple. Use custom `<script type=\"text/joomla-script-options\"></script>` and load it only when it requested by `Joomla.getOptions()`.\r\n\r\n*You see the script but it is not JavaScript* :neckbeard: \r\n\r\nIt should be part of #3072, but unfortunately I did not had this idea on that time 😃 \r\n\r\n### Testing Instructions\r\n\r\nPlace in index.php of Isis template the test options:\r\n```php\r\n$this->addScriptOptions('com_foobar', array(\r\n\tarray('selector' => 'body', 'color' => 'orange'),\r\n\tarray('selector' => 'table tr:nth-child(2n)>td', 'color' => 'green'),\r\n));\r\n```\r\nPlace in template.js of Isis template the test JavaScript:\r\n```javascript\r\njQuery(document).ready(function($){\r\n\tvar myOptions = Joomla.getOptions('com_foobar');\r\n\tif(myOptions){\r\n\t\tfor(var i = 0, l = myOptions.length; i < l; i++){\r\n\t\t\t$(myOptions[i].selector).css('color', myOptions[i].color);\r\n\t\t}\r\n\t}\r\n});\r\n```\r\nOpen some page with table view (example Plugins). You should see all text yellow, and each even row is green.\r\n\r\nSimilar can be done for `Joomla.JText`. I can do it, if this idea will be accepted.\r\n\r\n@dgt41 It is what I told you some time ago 😉 \r\n"},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/241060600","html_url":"https://github.com/joomla/joomla-cms/pull/11671#issuecomment-241060600","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/11671","id":241060600,"user":{"login":"andrepereiradasilva","id":9630530,"avatar_url":"https://avatars.githubusercontent.com/u/9630530?v=3","gravatar_id":"","url":"https://api.github.com/users/andrepereiradasilva","html_url":"https://github.com/andrepereiradasilva","followers_url":"https://api.github.com/users/andrepereiradasilva/followers","following_url":"https://api.github.com/users/andrepereiradasilva/following{/other_user}","gists_url":"https://api.github.com/users/andrepereiradasilva/gists{/gist_id}","starred_url":"https://api.github.com/users/andrepereiradasilva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrepereiradasilva/subscriptions","organizations_url":"https://api.github.com/users/andrepereiradasilva/orgs","repos_url":"https://api.github.com/users/andrepereiradasilva/repos","events_url":"https://api.github.com/users/andrepereiradasilva/events{/privacy}","received_events_url":"https://api.github.com/users/andrepereiradasilva/received_events","type":"User","site_admin":false},"created_at":"2016-08-19T16:07:12Z","updated_at":"2016-08-19T16:07:12Z","body":"is \"text/joomla-script-options\" a w3c valid html script tag type attribute mime type?\r\n\r\n> The type attribute gives the language of the script or format of the data. If the attribute is present, its value must be a valid MIME type. The charset parameter must not be specified. The default, which is used if the attribute is absent, is \"text/javascript\".\r\n\r\nhttps://www.w3.org/TR/html5/scripting-1.html#attr-script-type"}}
{"actor":{"display_login":"andrepereiradasilva"}}