-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README.md
- Loading branch information
Showing
1 changed file
with
36 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,34 +6,57 @@ Initialize is a framework for buiding web applications. | |
|
||
1. Using CDN | ||
|
||
Add the following after JQuery | ||
1) Create a file **config.js** | ||
|
||
```js | ||
var APP_ID = ""; // Your APP unique ID | ||
var WEBSITE_URL = ""; // Your website root URL | ||
var API_URL = ""; // Your website API URL | ||
if (location.hostname === "localhost" || location.hostname === "127.0.0.1" || location.hostname === "") { | ||
WEBSITE_URL = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port; | ||
} | ||
``` | ||
|
||
2) Add to your webpage after the JQuery library | ||
|
||
```html | ||
<script> | ||
var APP_ID = ""; // Your APP unique ID | ||
var WEBSITE_URL = ""; // Your website root URL | ||
var API_URL = ""; // Your website API URL | ||
</script> | ||
<script src="jquery.js"></script> | ||
<script src="config.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/lesichkovm/[email protected]/initialize.js"></script> | ||
``` | ||
|
||
2. Manual | ||
|
||
Download the initialize.js library and add to your webpage after JQuery | ||
1) Create a file **config.js** | ||
|
||
```js | ||
var APP_ID = ""; // Your APP unique ID | ||
var WEBSITE_URL = ""; // Your website root URL | ||
var API_URL = ""; // Your website API URL | ||
if (location.hostname === "localhost" || location.hostname === "127.0.0.1" || location.hostname === "") { | ||
WEBSITE_URL = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port; | ||
} | ||
``` | ||
|
||
2) Download the **initialize.js** library and add to your webpage after JQuery | ||
|
||
```html | ||
<script> | ||
var APP_ID = ""; // Your APP unique ID | ||
var WEBSITE_URL = ""; // Your website root URL | ||
var API_URL = ""; // Your website API URL | ||
</script> | ||
<script src="jquery.js"></script> | ||
<script src="config.js"></script> | ||
<script src="initialize.js"></script> | ||
``` | ||
|
||
# Usage # | ||
|
||
Initialize registers itself under the $$ name. | ||
|
||
```js | ||
$(function(){ | ||
var name = $$.getUrlParam('name'); | ||
alert('Your name is ' + name); | ||
}); | ||
``` | ||
|
||
## Methods ## | ||
|
||
### $$.get(key) ### | ||
|
@@ -50,7 +73,7 @@ Returns a hash parameter or NULL if not set | |
### $$.getUrl() ### | ||
Returns the current URL | ||
|
||
### $$.getUrlParams() ### | ||
### $$.getUrlParam() ### | ||
Returns a single query parameter or NULL if not set | ||
|
||
```javscript | ||
|