{"id":21829775,"url":"https://github.com/0xtlt/simplejs","last_synced_at":"2025-03-21T12:44:16.085Z","repository":{"id":136125352,"uuid":"133415298","full_name":"0xtlt/SimpleJs","owner":"0xtlt","description":"SimpleJs is made for simplify your javascript code without use jquery","archived":false,"fork":false,"pushed_at":"2018-06-22T07:04:01.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T05:51:41.481Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://thomast404.github.io/SimpleJs/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xtlt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-14T20:06:10.000Z","updated_at":"2022-05-12T12:34:31.000Z","dependencies_parsed_at":"2023-04-12T22:40:01.583Z","dependency_job_id":null,"html_url":"https://github.com/0xtlt/SimpleJs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2FSimpleJs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2FSimpleJs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2FSimpleJs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2FSimpleJs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xtlt","download_url":"https://codeload.github.com/0xtlt/SimpleJs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244801075,"owners_count":20512587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T18:29:11.030Z","updated_at":"2025-03-21T12:44:16.053Z","avatar_url":"https://github.com/0xtlt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple-JS\nSimple js is made for simplify your javascript code without use jquery\n\n# Functions ss.\n\n### Post and Get request\n\n```javascript\nss.get('data.html', {\n  params: [{name: 'ss', value: 'js'}],\n  success: function(result){\n    alert(result)\n  }\n});\n\nss.get('data.html', {\n  success: function(html){\n      //Callback function\n  }\n});\n\nss.get('data.html', {\n  params: [{name: 'ss', value: 'js'}],\n  success: function(result){\n    alert(result)\n  }\n});\n\nss.post('data.html', {\n  params: [{name: 'ss', value: 'js'}],\n  success: function(result){\n    alert(result)\n  }\n});\n\nss.post('data.html', {\n  params: [],\n  timeout: 4000,\n  success: function(result){\n\n  },\n  error: function(result){\n\n  }\n});\n\n```\n\n### DOM manipulation\n\n```javascript\nss.el('#container').toggleClass('superclass') //toggle one class\nss.el('#container').toggleClass('multiple super class') //toggle several class\n\nss.el('#container').html() //Return the html of the element\nss.el('#container').html('\u003ch1\u003eHello world !\u003c/h1\u003e') //Change the content of element\n\nss.el('#pseudo').val() //Return the value of the input pseudo\nss.el('#pseudo').val('Hello') //Change the value of the input pseudo | Let empty for remove the content\n\nss.el('#element').press(function(){\n  // Callback function when #element is pressed\n})\n\nss.el('#myID').change('\u003ch1\u003eMy html\u003c/h1\u003e') //If a change in the html between the given value and the previous value then the id will be updated |only works with IDs and with html\n```\n\n### Pages manipulation\nIf you want to create a multiples interfaces in your webapp, you can use the functions ss.pages and ss.page\n```javascript\n//initialize the pages with ss.pages | the first value will be display automatically when script will be terminated\nss.pages([\n  {\n    name: 'home',\n    el: '#myhomepage'\n  },\n  {\n    name: 'login',\n    el: '#myloginpage'\n  }//etc...\n])\n\n//now you can change the displayed page\nss.page('login')\nss.page('home') //etc...\n\n```\n\n### Form manipulation\n```javascript\nss.el('#myinput').check_input({\n  min_letters: 5,\n  max_letters: 10,\n  forbidden_characters: ['super', 'input']\n}) // Return true if all conditions are okay\n```\n\n### Mobile manipulation\n```javascript\nss.mobileswipe({\n  toLeft: function(){\n    //callback function\n  },\n  toRight: function(){\n    //callback function\n  },\n  toTop: function(){\n    //callback function\n  },\n  toBottom: function(){\n    //callback function\n  }\n}) //This function can be used once\n```\n\n# Beta Functions\n### TurboOn ~ Make page transitions on your website faster\nWhy use TurboOn ?  \n`TurboOn was created to free up your browser resources and server bandwidth by reloading only what is important for the navigation.`  \n```javascript\nss.turboOn(); // Just add this on your javascript code for launch the beast\n```\nIf you didn't want to reload your javascript resources you can add a property to indicate this\n```html\n\u003cscript ss-turbo-reload=\"false\"\u003e\n    ss.turboOn();\n\u003c/script\u003e\n\u003c!-- ss-turbo-reload=\"false\" indicate to turboOn to don't reload this resource --\u003e\n```\n### onTurbo Event\nIf you want to execute a function each time a page is loaded, you can do it with this function\n```javascript\nss.onTurbo(function(beforeBody, pageName){\n  console.log(pageName);\n});\n```\n\n### scrollToThis\n`scrollToThis is a function to scroll the page up to your element`\n```javascript\nss.el('#element').scrollToThis();\n```\n\n### isVisible\n`isVisible is a function that returns true if the item is displayed on the screen or false if it is not`\n```javascript\nss.el('#element').isVisible(); //return true or false\nss.el('#element').isVisible(true); // returns 1 if the element is totally visible or 0.5 if it is partially visible or 0 if it is not visible\n```\n\n### write\n`write does a little animation as if the user is writing`\n```javascript\nconst speed = 1000; //ms\nconst callback = function(element, text){\n\n};\nss.el('#element').write('Text', speed, callback)\n```\n\n### rand\n`make a random chain`\n```javascript\nconst params = {\n  length: 10,\n  alphabet: true, // abcdefghijklmnopqrstuvwxyzAZERTYUIOPQSDFGHJKLMWXCVBN\n  numbers: true, // 0123456789\n  extra: true // \u0026@*µ£$./°\n};\nss.rand(params); // params is not necessary\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xtlt%2Fsimplejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xtlt%2Fsimplejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xtlt%2Fsimplejs/lists"}