Sha256: f6857389b9da8dda471f9772c5e2bf882af0c60172b39e04cc5eeb68a0d1f08c

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

FnordMetric = {
  d: document,
  p: '/fnordmetric/',
  id: function(id){return FnordMetric.d.getElementById(id)},
  tag: function(element){return FnordMetric.d.getElementsByTagName(element)},
  ce: function(element){return FnordMetric.d.createElement(element)},

  init: function(){
    if(widget_config.path_prefix){ FnordMetric.p = widget_config.path_prefix; } 
  },

  js: function(url, callback){
    var s = FnordMetric.ce('script');
    s.type = "text/javascript";
    s.onload = callback;
    FnordMetric.init();
    s.src = FnordMetric.p+url;
    FnordMetric.tag('head')[0].appendChild(s);  
  },

  css: function(url, callback){
    var s = FnordMetric.ce('link');
    s.type = "text/css";
    s.rel = 'stylesheet';
    s.href = FnordMetric.p+url;
    s.onload = callback;         
    FnordMetric.tag('head')[0].appendChild(s); 
  },

  render: function(elem, widget_config){
    var f = FnordMetric.ce('iframe');    
    f.style.width = '100%'; f.style.height = widget_config.widget_height+'px';
    f.frameBorder = 'none'; f.scrolling = 'no';
    FnordMetric.id(elem).appendChild(f);
    var s = f.contentDocument.createElement('script')
    s.type = "text/javascript";
    s.src = FnordMetric.p+'/fnordmetric/fnordmetric.js';    
    widget_config.path_prefix = FnordMetric.p;
    s.onload = function(){ f.contentWindow.FnordMetric.js(widget_config.widget_url); }
    f.contentWindow.widget_config = widget_config;        
    f.contentDocument.getElementsByTagName('head')[0].appendChild(s);   	
  }

};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fnordmetric-0.3.2 pub/fnordmetric/fnordmetric.js