winlin

refine the utility of js.

1 The MIT License (MIT) 1 The MIT License (MIT)
2 2
3 -Copyright (c) 2013 winlin 3 +Copyright (c) 2013-2014 winlin
4 4
5 Permission is hereby granted, free of charge, to any person obtaining a copy of 5 Permission is hereby granted, free of charge, to any person obtaining a copy of
6 this software and associated documentation files (the "Software"), to deal in 6 this software and associated documentation files (the "Software"), to deal in
@@ -13,6 +13,21 @@ function padding(number, length, prefix) { @@ -13,6 +13,21 @@ function padding(number, length, prefix) {
13 13
14 /** 14 /**
15 * parse the query string to object. 15 * parse the query string to object.
  16 +* parse the url location object as: host(hostname:http_port), pathname(dir/filename)
  17 +* for example, url http://192.168.1.168:1980/ui/players.html?vhost=player.vhost.com&app=test&stream=livestream
  18 +* parsed to object:
  19 +{
  20 + host : "192.168.1.168:1980",
  21 + hostname : "192.168.1.168",
  22 + http_port : 1980,
  23 + pathname : "/ui/players.html",
  24 + dir : "/ui",
  25 + filename : "/players.html",
  26 +
  27 + vhost : "player.vhost.com",
  28 + app : "test",
  29 + stream : "livestream"
  30 +}
16 */ 31 */
17 function parse_query_string(){ 32 function parse_query_string(){
18 var obj = {}; 33 var obj = {};