{"id":17676812,"url":"https://github.com/yoannchb-pro/preshootjsv2","last_synced_at":"2025-10-06T17:18:19.031Z","repository":{"id":108707502,"uuid":"363199414","full_name":"yoannchb-pro/PreshootJsV2","owner":"yoannchb-pro","description":"PreshootJsV2 is a new version of preshoot.js library inspired from premonish to predict on each object the user is going only with attributes to execute a function or to change the class of the object.","archived":false,"fork":false,"pushed_at":"2021-04-30T16:40:08.000Z","size":547,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T17:35:00.903Z","etag":null,"topics":["js","prediction","premonish","premonition","preshoot","v2"],"latest_commit_sha":null,"homepage":"","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/yoannchb-pro.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":"2021-04-30T16:32:30.000Z","updated_at":"2021-04-30T16:40:11.000Z","dependencies_parsed_at":"2023-03-22T01:18:24.521Z","dependency_job_id":null,"html_url":"https://github.com/yoannchb-pro/PreshootJsV2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yoannchb-pro/PreshootJsV2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoannchb-pro%2FPreshootJsV2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoannchb-pro%2FPreshootJsV2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoannchb-pro%2FPreshootJsV2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoannchb-pro%2FPreshootJsV2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoannchb-pro","download_url":"https://codeload.github.com/yoannchb-pro/PreshootJsV2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoannchb-pro%2FPreshootJsV2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278646830,"owners_count":26021523,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["js","prediction","premonish","premonition","preshoot","v2"],"created_at":"2024-10-24T07:26:50.092Z","updated_at":"2025-10-06T17:18:19.013Z","avatar_url":"https://github.com/yoannchb-pro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PreshootJs v2\r\n\r\nPreshootJsV2 is new version of preshoot.js a library inspired from \u003ca href=\"https://mathisonian.github.io/premonish\"\u003epremonish\u003c/a\u003e to predict on each object the user is going only with attributes to execute a function or to change the class of the object.\r\n\r\n\u003cimg alt=\"preshoot.gif\" src=\"./assets/preshoot.gif\"\u003e\r\n\r\n## Demo\r\n- https://yoannchb-pro.github.io/PreshootJsV2/\r\n\r\n## Import\r\n```html\r\n\u003c!-- IN THE HEAD --\u003e\r\n\u003c!-- CDN --\u003e\r\n\u003cscript type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/gh/yoannchb-pro/PreshootJsV2@latest/lib/preshootv2.js\"\u003e\u003c/script\u003e\r\n\r\n\u003c!-- NORMAL --\u003e\r\n\u003cscript type=\"text/javascript\" src=\"./lib/preshootv2.js\"\u003e\u003c/script\u003e\r\n```\r\n\r\n## How to use ?\r\nConfig preshoot.js\r\n```js\r\n    const preshoot = new Preshoot([\"#watchMe\", \".watchMe\"], {\r\n        fn: (event) =\u003e {\r\n            console.log(event);\r\n        },\r\n        exitFn: (event) =\u003e {\r\n            console.log(event);\r\n        },\r\n        className: \"user-going-on\"\r\n    }, {\r\n        mobile: true, //Look on mobile\r\n        detectWithArea: false, //If the cursor is not going on an object preshoot.js will detect the closer object\r\n        mouseInterval: 30, //The calcul will be make each 30 mouse move loop\r\n        resetClass: true, //Reset all the class if there are no matching element anymore\r\n        //Function to display when there is an error while executing the function of an object\r\n        onError: (el, msg) =\u003e {\r\n            console.warn(\"Error during executing function \", {\r\n                error: true,\r\n                element: el,\r\n                message: msg\r\n            });\r\n        }\r\n    });\r\n\r\n    //Debug mode\r\n    Preshoot.debugMode(preshoot);\r\n\r\n    //Start observing\r\n    preshoot.start();\r\n\r\n    //Stop observing\r\n    preshoot.stop();\r\n```\r\nSet the default class when matching\r\n```css\r\n /* Default class when matching */\r\n.preshoot{\r\n    border: 5px solid red!important;\r\n}\r\n```\r\nHow to use attributes ?\r\n```html\r\n\u003c!-- Watching --\u003e\r\n\u003cdiv id=\"watchMe\"\u003e\u003c/div\u003e\r\n\u003cdiv class=\"watchMe\"\u003e\u003c/div\u003e\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoannchb-pro%2Fpreshootjsv2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoannchb-pro%2Fpreshootjsv2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoannchb-pro%2Fpreshootjsv2/lists"}