Sha256: d6217f21b39cf6b5269cf01f4d5ac963d6e4aa5ffaf131bcdc2047d5e6113637

Contents?: true

Size: 1.68 KB

Versions: 1

Compression:

Stored size: 1.68 KB

Contents

#= require 'menu'
#= require 'menu_item'
#= require 'overlays/init'
#= require 'overlays/image'
#= require 'overlays/dynamic_images_mngmt'
#= require 'overlays/content_div_mngmt'
#= require 'overlays/images_mngt_div'

if OverlayMe.mustLoad()

  # creating a overlay_panel
  overlay_panel = new OverlayMe.MenuItem({id: "overlay_panel", title: "Overlays" })

  # adding the #container management block
  overlay_panel.append new OverlayMe.Overlays.ContentDivManagementBlock().render()

  # adding image management block
  OverlayMe.images_management_div = new OverlayMe.Overlays.ImagesManagementDiv()
  overlay_panel.append OverlayMe.images_management_div.render()

  # add the panel to the page menu
  $(OverlayMe.Menu).append overlay_panel.render()
  
  # repeating original window#mousemove event
  $(window).bind 'mousemove', (event) ->
    $(window).trigger('mymousemove', event)

  # once everything rendered, load dynamicly added images
  OverlayMe.dyn_manager = new OverlayMe.Overlays.DynamicManager()
  OverlayMe.dyn_manager.loadAll()

  OverlayMe.loadDefaultImage = ->
    # double check that the dynamic loading list is also empty
    if OverlayMe.dyn_manager.isEmpty()
      OverlayMe.dyn_manager.addImage('https://a248.e.akamai.net/assets.github.com/images/modules/about_page/octocat.png')

  # adding all overlay images
  $.ajax
    url: '/overlay_images'
    dataType: 'json'
    success: (data) ->
      if data.length == 0 # in case all is empty (default for newcomers)
        OverlayMe.loadDefaultImage()
      else
        $.each data, (index, img_path) ->
          OverlayMe.images_management_div.append new OverlayMe.Overlays.Image(img_path).render()
    error: ->
      OverlayMe.loadDefaultImage()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
overlay_me-0.12.0 javascripts/overlays.js.coffee