{"action":"closed","issue":{"url":"https://api.github.com/repos/franciscop/umbrella/issues/130","repository_url":"https://api.github.com/repos/franciscop/umbrella","labels_url":"https://api.github.com/repos/franciscop/umbrella/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/franciscop/umbrella/issues/130/comments","events_url":"https://api.github.com/repos/franciscop/umbrella/issues/130/events","html_url":"https://github.com/franciscop/umbrella/issues/130","id":358808882,"node_id":"MDU6SXNzdWUzNTg4MDg4ODI=","number":130,"title":"Help translating a jQuery dependent script to Umbrella","user":{"login":"kaushalmodi","id":3578197,"node_id":"MDQ6VXNlcjM1NzgxOTc=","avatar_url":"https://avatars2.githubusercontent.com/u/3578197?v=4","gravatar_id":"","url":"https://api.github.com/users/kaushalmodi","html_url":"https://github.com/kaushalmodi","followers_url":"https://api.github.com/users/kaushalmodi/followers","following_url":"https://api.github.com/users/kaushalmodi/following{/other_user}","gists_url":"https://api.github.com/users/kaushalmodi/gists{/gist_id}","starred_url":"https://api.github.com/users/kaushalmodi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaushalmodi/subscriptions","organizations_url":"https://api.github.com/users/kaushalmodi/orgs","repos_url":"https://api.github.com/users/kaushalmodi/repos","events_url":"https://api.github.com/users/kaushalmodi/events{/privacy}","received_events_url":"https://api.github.com/users/kaushalmodi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-10T21:53:58Z","updated_at":"2018-09-11T15:42:26Z","closed_at":"2018-09-11T15:42:26Z","author_association":"NONE","body":"Hello,\r\n\r\nFirst of all, I am not a web developer and I don't know JS. So I am asking for help converting a jQuery dependent script to Umbrella, as I want to reduce the weight of my static site.\r\n\r\n---\r\n\r\n### Script\r\n\r\n```js\r\n(function() {\r\n    var $window = $(window);\r\n    if ($window.width() >= 1400) { // Match this number with the min-width CSS rule for .hugotoc\r\n        var $toc = $('#TableOfContents');\r\n        if ($toc.length > 0) {\r\n            function onScroll(){\r\n                var currentScroll = $window.scrollTop();\r\n                var h = $('.content h1, .content h2, .content h3, .content h4, .content h5, .content h6, .h-feed h2');\r\n                var id = \"\";\r\n                h.each(function (i, e) {\r\n                    e = $(e);\r\n                    if (e.offset().top - 10 <= currentScroll) {\r\n                        id = e.attr('id');\r\n                    }\r\n                });\r\n                var current = $toc.find('a.current');\r\n                if (current.length == 1 && current.eq(0).attr('href') == '#' + id) return true;\r\n\r\n                current.each(function (i, e) {\r\n                    $(e).removeClass('current').siblings('ul').hide();\r\n                });\r\n                $toc.find('a[href=\"#' + id + '\"]').parentsUntil('#TableOfContents').each(function (i, e) {\r\n                    $(e).children('a').addClass('current').siblings('ul').show();\r\n                });\r\n            }\r\n            $window.on('scroll', onScroll);\r\n            $(document).ready(function() {\r\n                $toc.find('a').parent('li').find('ul').hide();\r\n                onScroll();\r\n                document.getElementsByClassName('hugotoc')[0].style.display = '';\r\n            });}}})();\r\n```\r\n\r\n[Ref][1]\r\n\r\n---\r\n\r\nIf it's possible to convert the above code to use Umbrella, can you please provide equivalent code.\r\n\r\nI looked though [documentation][0] (searched for \"window\") but failed at finding something equivalent to `$(window)`.\r\n\r\n[0]: https://umbrellajs.com/documentation\r\n[1]: https://gitlab.com/kaushalmodi/hugo-theme-refined/blob/fed3553bdc35472ba6ed7018bd6463a976bd784c/layouts/partials/toc_on_side.html#L6-36\r\n"}}
{"actor":{"display_login":"franciscop"}}