Nodes Studio includes a large library of JavaScript functions.
The procedure of forming the files is as follows:
1. jQuery framework /script/jquery-1.11.1.js.
2. Primary JavaScript /script/script.js.
3. Template JavaScript /template/../template.js.
During development, you should concentrate on the /template/../template.js only
(adding new hfunctions, reboot the existing) to avoid conflicts with new versions of framework.
The file /script/script.js contains primary JavaScript library, comprising the following functions:
$id(id) - Gets an DOM element using ID.
string id - Element ID.
Returns a DOM elemnt on success, or die with error.
var foo = $id("content");
getBodyScrollTop() - Gets height of hidden top part of page after scrolling.
Returns height of hidden top part in pixels.
var bar = getBodyScrollTop();
getDocumentHeight() - Gets a document height.
Returns height of document in pixels.
var foo = getDocumentHeight();
getDocumentWidth() - Gets a document width.
Returns width of document in pixels.
var bar = getDocumentWidth();
getViewportHeight() - Gets a screen height.
Returns height of screen in pixels.
var foo = getViewportHeight();
getViewportWidth() - Gets a screen width.
Returns width of screen in pixels.
var bar = getViewportWidth();
addHandler(object, event, handler, useCapture) - Attaches an event handler to the specified element.
object object - DOM Element.
string event - A String that specifies the name of the event.
function handler - Callback function.
bool useCapture - Execute in the capturing or in the bubbling phase.
addHandler(window, "resize", resize_footer);
js_pos_wnd() - Positions any popup windows.
js_hide_wnd() - Hides any popup windows.
show_window(content) - Displays a fullscreen window with specified content.
string content - HTML to display.
show_window("<div>Hello, world!</div>");
show_popup_window(content) - Displays a popup window with specified content.
string content - HTML to display.
show_popup_window("<div>Hello, world!</div>");
show_editor(file) - Displays file source code viewer.
string file - File path.
show_editor("index.php");
show_photo_editor(id, pos) - Displays photo editor.
int id - @mysql[nodes_product]->id.
int pos - Image order number.
show_photo_editor(1, 0);
show_order() - Displays order window.
login() - Displays login popup window.
logout() - Destorys current user http-session and resets cookie data.
is_array(mixed_var) - Checking if variable an array.
mixed mixed_var - Variable to check.
Returns TRUE if variable an array and FALSE if not.
var foo = "bar";
var foo_bar = is_array(foo);
empty(mixed_var) - Checking if variable is empty.
mixed mixed_var - Variable to check.
Returns TRUE if variable is empty and FALSE if not.
var foo = "bar";
var foo_bar = empty(foo);
preventDefault(e) - Prevents default event-listener function.
object e - Event object.
var foo = $id("content");
foo.onClick = preventDefault;
disableScroll() - Disables page scrolling.
enableScroll() - Enables page scrolling.
base64_decode(data) - Decodes a string from base64-encode.
string data - String to decode.
Returns decoded string.
var foo = "Zm9v";
var bar = base64_decode(foo);
print_r(arr, level) - Prints human-readable information about a variable.
array arr - Target array.
int level - The nesting level.
Returns string with information about a variable.
var foo = array("bar_1", "bar_2");
echo print_r(foo);
searchText(string, needle) - Checks for an occurrence of a substring in a string.
string string - String to search in.
string needle - The value being searched for.
Returns position of substring in string.
var foo = "bar";
var pos = searchText("foobar", foo);
ajaxing() - Updates <a> tag onclick event with async jquery page loading function.
refresh_page() - Submits a search results details form.
goto(href) - Async page loading using AJAX.
string href - Page URL.
goto("/");
scrolltoTop() - Scrolls page to top.
showAnchor(anchor) - Scrolls a page to specified anchor.
string anchor - Name of <a> element.
showAnchor("text");
checkAnchors() - Checking for #info in URL and scroll page to anchor if exists.
goto_page(page) - Loading specified table's page.
int page - Number of page.
goto_page(1);
admin_init() - Initialize admin functions /script/admin.js.
tinymce_init() - Initialize event tinymce library /script/tinymce.js.
submit_search_form() - Submits search form.
addSiteFade() - Displays screen fade.
removeSiteFade() - Removes screen fade.
browser_time() - Converts dates in Unixtime format to current Local time format.
remove_from_bin(id) - Removes a product from cart.
int id - @mysql[nodes_product]->id.
remove_from_bin(1);
buy_now(id, t0, t1, t2) - Displays Add-To-Cart message.
int id - @mysql[nodes_product]->id.
string t0 - Text of message.
string t1 - Cancel button text.
string t2 - Checkout button text.
buy_now(1, "Message", "Cancel", "Checkout");
withdrawal(text) - Displays money withdrawal form.
string text - Text of message.
withdrawal("Confirm your PayPal");
deposit(text) - Displays money deposit form.
string text - Text of message.
deposit("Amount to deposit");
process_payment(id, price) - Redirects to PayPal payment page.
int id - @mysql[nodes_order]->id.
double price - Sum of transaction.
process_payment(1, 100.00);
post_message(id) - Submits a new message to chat.
int id - To @mysql[nodes_user]->id.
post_message(1);
refresh_chat(id) - Refreshes chat window.
int id - Target @mysql[nodes_user]->id.
refresh_chat(1);
star_rating(total_rating) - Displays star rating form.
int total_rating - Rating from 0 to 5.
star_rating(4);
ScaleSlider() - Scales an image rotator.
show_rotator() - Displays an image rotator.