5 examples of 'javascript init function' in JavaScript

Every line of 'javascript init function' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
13function init() {
14 ui.Finder.id = '#finder_bar';
15 ui.Finder.tbox = '#tbox_finder';
16 $(ui.Finder.tbox).keyup(
17 function (event) {
18 if (event.keyCode == 13) { // Enter to search
19 var query = $.trim($(ui.Finder.tbox).val());
20 if (query.length == 0)
21 return;
22 if (ui.Finder.query != query) {
23 ui.Finder.search(query);
24 ui.Finder.next_result();
25 } else {
26 ui.Finder.next_result();
27 }
28 } else if (event.keyCode == 27) { //ESC to close
29 $('#btn_finder_close').click();
30 return false;
31 }
32 });
33 $('#btn_finder_next').click(
34 function (event) {
35 ui.Finder.next_result();
36 return false;
37 });
38 $('#btn_finder_prev').click(
39 function (event) {
40 ui.Finder.prev_result();
41 return false;
42 });
43 $('#btn_finder_close').click(
44 function (event) {
45 ui.Finder.clear();
46 ui.Finder.hide();
47 return false;
48 });
49 return this;
50},
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

44function init() {
45 var query = decodeURI(getParameterByName('query'));
46
47 var noWeb3 = document.getElementById('noWeb3')
48
49 // Web3 Initialization
50 window.addEventListener('load', function() {
51 if(typeof web3 !== 'undefined' && typeof Web3 !== 'undefined') {
52 // If there's a web3 library loaded, then make your own web3
53 web3 = new Web3(web3.currentProvider);
54 load();
55 } else if (typeof Web3 !== 'undefined') {
56 // If there isn't then set a provider
57 web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
58 load();
59 } else if(typeof web3 == 'undefined') {
60 // Alert the user he is not in a web3 compatible browser
61 console.log("not web3 compatible");
62 document.getElementById("noWeb3").style.display = "block";
63 return;
64 }
65 })
66}
9function init() {
10 ui.SearchTabs.search_entry = $('#tbox_search_entry');
11
12 $('#tbox_search_entry').keypress(
13 function (event) {
14 if (event.keyCode == 13) {
15 ui.SearchTabs.do_search(
16 $.trim(ui.SearchTabs.search_entry.attr('value')));
17 }
18 });
19 var search_btn
20 = new widget.Button('#btn_search_entry');
21 search_btn.on_clicked = function (event) {
22 ui.SearchTabs.do_search(
23 $.trim(ui.SearchTabs.search_entry.val()));
24 };
25 search_btn.create();
26},
119function Initialize() {
120 for(prop in SbiJsInitializer) {
121 if(prop != "initialize") {
122 eval("SbiJsInitializer."+prop+"()");
123 }
124 }
125}
11function init () {
12 var _this = this;
13 $(document).keyup(
14 function (event) {
15 if (event.ctrlKey && event.keyCode == 192) { //Ctrl+`
16 if (_this.is_show)
17 $('#console').hide();
18 else
19 $('#console').show();
20 _this.is_show = !_this.is_show;
21 $('#console_in').focus();
22 }
23 });
24
25 $('#console_in').keyup(
26 function(event) {
27 if (event.keyCode == 13) {
28 var cmd = $(this).attr('value');
29 if (cmd == '')
30 return;
31 $(this).attr('value', '');
32
33 _this.cmd_count += 1;
34 cmd_in = _this.form_result('in', cmd)
35 _this.raw_out(cmd_in);
36 _this.raw_out(_this.interpret(cmd));
37 }
38 });
39},

Related snippets