Skip to content
Snippets Groups Projects
Select Git revision
  • 88bdc981088faeba82adb888c4472bfc59c29d96
  • v2018.2.x default protected
  • 0x4A6F-rpi4
  • 0x4A6F-master
  • master
  • v2018.2.2-ffs
  • v2016.2.4-batmanbug
  • radv-filterd
  • v2016.2.x
  • hoodselector
  • v2016.1.x
  • babel
  • v2015.1.x
  • 2014.4.x
  • 2014.3.x
  • v2018.2.2-ffs0.1
  • v2018.2.1-ffs0.1
  • v2018.2.1
  • v2018.2-ffs0.1
  • v2018.2
  • v2018.1.4
  • v2018.1.3
  • v2018.1.2
  • v2018.1.1
  • v2018.1
  • v2017.1.8
  • v2017.1.7
  • v2017.1.6
  • v2017.1.5
  • v2017.1.4
  • v2017.1.3
  • v2017.1.2
  • v2016.2.7
  • v2017.1.1
  • v2017.1
35 results

menu.js

Blame
  • Forked from firmware / FFS Gluon
    Source project has a limited visibility.
    menu.js 1.03 KiB
    "use strict"
    define(function () {
      return function (menu) {
        return function () {
          var background = document.createElement("div")
          background.className = "menu-background"
          document.body.appendChild(background)
          document.body.classList.add("noscroll")
    
          var offset = this.getBoundingClientRect()
          var container = document.createElement("ul")
          container.className = "menu"
          container.style.top = offset.top + "px"
          container.style.left = offset.left + "px"
    
          background.onclick = destroy
    
          menu.forEach(function (item) {
            var li = document.createElement("li")
            li.textContent = item[0]
            li.action = item[1]
            li.onclick = function () {
              destroy()
              this.action()
            }
    
            container.appendChild(li)
          })
    
          document.body.appendChild(container)
    
          function destroy() {
            document.body.classList.remove("noscroll")
            document.body.removeChild(background)
            document.body.removeChild(container)
          }
        }
      }
    })