Sha256: 97d43396d150331b3a43b68f9a2dc1cfe2c798dc906be42603bdc2f00e36bfe8

Contents?: true

Size: 1.39 KB

Versions: 14

Compression:

Stored size: 1.39 KB

Contents

rbbt.aesthetics = {LS_key: "rbbt.aesthetics"}

var aes_module = rbbt.aesthetics 

aes_module.load = function(){
 this.aesthetics = rbbt.LS.load(this.LS_key)
 if (undefined === this.aesthetics)
  this.aesthetics = []
}

aes_module.store = function(){
 rbbt.LS.store(this.LS_key, this.aesthetics)
}

aes_module.add = function(selector, aes, value){
  var mod = this
  if (typeof selector == 'function'){ 
    return selector.then(function(_selector){
      mod.aesthetics.push({selector: _selector, aes: aes, value: value})
    })
  }else{
    this.aesthetics.push({selector: selector, aes: aes, value: value})
  }
}

aes_module.clear_aesthetic = function(aes){
  var data_key = 'data-aes-' + aesthetic.aes

  $('[' + data_key + ']').attr(data_key, 'none')
}

aes_module.apply_aesthetic = function(aesthetic){

 if (typeof aesthetic.selector == "string"){
  targets = $(aesthetic.selector)
 }else{
  var items = aesthetic.selector
  if (typeof items[0] == 'object') items = $.map(items, function(i){return i.id})
  targets = $('.entity').filter(function(index){ 
   var id = $(this).attr('data-entity-id')
   return items.indexOf(id) >= 0
  })
 }

 var data_key = 'data-aes-' + aesthetic.aes
 targets.attr(data_key, aesthetic.value)
}

aes_module.apply = function(aesthetic){
 if (undefined === aesthetic)
  aes_module.aesthetics.map(aes_module.apply_aesthetic)
 else
  aes_module.apply_aesthetic(aesthetic)
}

aes_module.load()

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rbbt-rest-1.6.28 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.26 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.25 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.24 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.23 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.22 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.21 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.20 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.19 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.18 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.17 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.16 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.15 share/views/public/js/rbbt.aesthetics.js
rbbt-rest-1.6.14 share/views/public/js/rbbt.aesthetics.js