Spaces:
Running
Running
Add search-plus-loader.js - self-injecting script
Browse files- search-plus-loader.js +24 -0
search-plus-loader.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Search Plus Loader - Auto-injects into page
|
| 2 |
+
(function(){
|
| 3 |
+
// Load search-plus.js
|
| 4 |
+
var s=document.createElement('script');
|
| 5 |
+
s.src='search-plus.js';
|
| 6 |
+
document.body.appendChild(s);
|
| 7 |
+
|
| 8 |
+
// Add Search Plus button to search box
|
| 9 |
+
s.onload=function(){
|
| 10 |
+
var sb=document.querySelector('.search-box');
|
| 11 |
+
if(sb){
|
| 12 |
+
var btn=document.createElement('button');
|
| 13 |
+
btn.onclick=function(){toggleSearchPlus()};
|
| 14 |
+
btn.title='Tìm kiếm Plus - AI tìm SP từ internet';
|
| 15 |
+
btn.style.cssText='position:absolute;right:70px;top:50%;transform:translateY(-50%);width:28px;height:28px;border-radius:7px;background:linear-gradient(135deg,#db9815,#f0b840);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:.7rem;z-index:2;transition:all .25s';
|
| 16 |
+
btn.innerHTML='<i class="fas fa-magic"></i>';
|
| 17 |
+
sb.appendChild(btn);
|
| 18 |
+
}
|
| 19 |
+
// Load saved external products after main data loads
|
| 20 |
+
setTimeout(function(){
|
| 21 |
+
if(typeof loadExternalProducts==='function')loadExternalProducts();
|
| 22 |
+
},3000);
|
| 23 |
+
};
|
| 24 |
+
})();
|