Sha256: 903565752958637c12b346b97c4535d9f8056c0a7bd4a73d197f702c7379995a

Contents?: true

Size: 1.57 KB

Versions: 34

Compression:

Stored size: 1.57 KB

Contents

# PluginFactoryScaffolding : PARTIAL
########################################################################################################################
window.Utils = {}
########################################################################################################################

Utils.$safeApply = ((fn) ->
  phase = this.$root.$$phase;
  if(phase == '$apply' || phase == '$digest')
    fn() if(fn && (typeof(fn) == 'function'))
  else
    this.$apply(fn)
)
Utils.removeFromArray = ((value, array) ->
  index = array.indexOf(value)
  array.splice(index, 1)
)

Utils.parseUrl = ((url_string) ->
  uriPartNames = ["source","scheme","authority","host","port","path","directory_path","file_name","query_string","hash"]
  uriParts = new RegExp("^(?:([^:/?#.]+):)?(?://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#]|$)))*/?)?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?").exec(url_string)
  uri = {};
  for i in [0..uriPartNames.length]
    uri[uriPartNames[i]] = (if uriParts[i] then uriParts[i] else '')
  uri.port = if uri.port then parseInt(uri.port) else 80
  domain_parts = (/^(.*?)\.?([^\.]*\.\w+)$/).exec(uri.host)
  if domain_parts?
    uri.sub_domain = domain_parts[1]
    uri.root_domain = domain_parts[2]
  else
    uri.sub_domain = uri.root_domain = ''
  if(uri.directory_path.length > 0)
    uri.directory_path = uri.directory_path.replace(/\/?$/, "/")
  return uri
)

Utils.parseQueryString = ((query_string) ->
  $.deparam(query_string)
)

# END PARTIAL ##########################################################################################################

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
fanforce-plugin-factory-2.0.0.rc29 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc28 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc27 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc26 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc25 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc24 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc23 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc22 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc21 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc19 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc18 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc17 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc16 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc15 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc13 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc12 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc11 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc10 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc9 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee
fanforce-plugin-factory-2.0.0.rc8 lib/fanforce/plugin_factory/scaffolding/assets/js/lib/utils.coffee