PageSourceSearch

https://newtabplus.me/js/8442.9f66de85fb784f148ca9.js

js newtabplus.me collected 2026-10-02 02:01:14 UTC 12,900 bytes, 1 lines download raw bytes

1(self.webpackChunknewtab=self.webpackChunknewtab||[]).push([[8442,8444,7725,5875,6796],{7725:(t,e,s)=>{var i='<div class="widget-todo"> <div class="todo-task-list"> </div> <div class="todo-add-task"> <form> <div class="input-group input-group-sm"> <input type="text" placeholder="{{placeholder}}" class="todo-task-input form-control"> <div class="input-group-append"> <button class="btn btn-info"> <img src="'+s(7091)(s(6935))+'" width="18"/> </button> </div> </div> </form> </div> </div>';t.exports=i},5875:t=>{t.exports='<form class="setting-form"> <div class="form-group"> <label>{{title}}:</label> <input type="text" id="title" autocomplete="off" class="form-control form-control-sm"> </div> <div class="form-group text-right mt-4"> <input type="button" value="{{cancel}}" class="btn btn-cancel btn-sm btn-light"> <input type="submit" value="{{done}}" class="btn btn-submit btn-sm btn-info"/> </div> </form>'},6796:t=>{t.exports='<div class="todo-task-item"> <i class="draggble-handler"></i> <input type="checkbox" class="todo-task-checkbox"/> <span>{{content}}</span> <div class="todo-task-item-setting"> <i class="rounded-circle" data-toggle="dropdown"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"> <path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path> </svg> </i> <div class="dropdown-menu"> <a class="dropdown-item" data-action="remove">{{remove}}</a> </div> </div> </div>'},6935:(t,e,s)=>{"use strict";t.exports=s.p+"images/plus.svg"},8919:(t,e,s)=>{"use strict";s.r(e),s.d(e,{SortableTouch:()=>i});class i{constructor(t={}){this.options={selector:null,swap:.3,swapNS:!1,onDown:(t,e)=>{},onMove:(t,e)=>{},onUp:(t,e)=>{},onMergeEnter:(t,e,s)=>{},onMergeOut:(t,e,s)=>{},onMerge:(t,e,s)=>{},onSwap:(t,e,s)=>{},stayTime:1e3,mergeAllow:!0,zIndex:9999999},this.options=Object.assign(this.options,t),this.offsetX=0,this.offsetY=0,this.clientX=0,this.clientY=0,this.currentClientX=0,this.currentClientY=0,this.timeout=null,this.dragging=!1,this.merging=!1,this.supportTouchEvent()?this.eventTypes={down:"touchstart",up:"touchend",move:"touchmove"}:this.eventTypes={down:"mousedown",up:"mouseup",move:"mousemove"},this.activeElement=null,this.targetElement=null,this.virElement=null,this.virElementId="__virElement",this.options.selector?this.initEvents():this.elements=[]}initEvents(){this.elements=[],this.options.selector instanceof Node?this.elements.push(this.options.selector):this.options.selector instanceof NodeList?this.elements=this.options.selector:this.elements=document.querySelectorAll(this.options.selector),this._downEvent=t=>this.downEvent(t),this.nodeListToArray(),this.elements.forEach((t=>{t.addEventListener(this.eventTypes.down,this._downEvent)}))}destroy(){this.elements.forEach((t=>{t.removeEventListener(this.eventTypes.down,this._downEvent)})),this.elements=[]}nodeListToArray(){const t=[];this.elements instanceof NodeList&&(this.elements.forEach((e=>{t.push(e)})),this.elements=t)}addElement(t){t.sort=this.elements.length,t.addEventListener(this.eventTypes.down,this._downEvent),this.elements.push(t)}downEvent(t){if(t instanceof MouseEvent&&1!=t.which)return;this.activeElement=t.currentTarget,this.setPositionAll(),this.dragging=!0,"mousedown"==t.type&&this.cancelDefaultEvent(t);const e=this.activeElement.getBoundingClientRect();let s=t.touches?t.touches[0]:t;this.clientX=s.clientX,this.clientY=s.clientY,this.offsetX=e.left,this.offsetY=e.top;let i=this,n=function(t){return i.moveEvent(t)};document.addEventListener(this.eventTypes.move,n);let o=function(t){return document.removeEventListener(i.eventTypes.move,n),document.removeEventListener(i.eventTypes.up,o),i.upEvent(t)};document.addEventListener(this.eventTypes.up,o),this.options.onDown(this.activeElement,t)}_isMerge(t,e,s){const i=t.getBoundingClientRect();return e>i.left&&e<i.right&&s>i.top&&s<i.bottom}setPositionAll(){this.elements.forEach(((t,e)=>{t.sort=e}))}moveEvent(t){this.virElement||(this.virElement=document.createElement("div"),this.virElement.id=this.virElementId,this.virElement.className=this.virElementId,this.virElement.style.position="fixed",this.virElement.style.listStyleType="none",this.virElement.style.opacity=.7,this.virElement.style.zIndex=this.options.zIndex,this.virElement.style.top=this.activeElement.offsetTop+"px",this.virElement.style.left=this.activeElement.offsetLeft+"px",this.virElement.style.margin="0",this.virElement.appendChild(this.activeElement.cloneNode(!0)),document.body.append(this.virElement));let e=t.touches?t.touches[0]:t,s=e.clientX-this.clientX,i=e.clientY-this.clientY;if(s+=this.offsetX,i+=this.offsetY,this.virElement.style.top=i+"px",this.virElement.style.left=s+"px",this.dragging){this.currentClientX=e.clientX,this.currentClientY=e.clientY;let s=!1;for(let t=0;t<this.elements.length;t++){const e=this.elements[t];if(this.activeElement!=e&&this._isMerge(e,this.currentClientX,this.currentClientY)){if(s=!0,this.targetElement==this.activeElement||this.targetElement==e)break;this.targetElement=e;break}}if(s||(this.merging&&(this.merging=!1,this.options.onMergeOut(this.activeElement,this.targetElement,t)),this.targetElement=null),null!==this.targetElement&&this.activeElement!=this.targetElement){const e=this.targetElement.getBoundingClientRect();let s=e.left+e.width*this.options.swap,i=e.left+(e.width-e.width*this.options.swap),n=e.top+e.top*this.options.swap,o=e.bottom-e.height*this.options.swap;if(this.options.swapNS?this.currentClientY>=n&&this.currentClientY<=o:this.currentClientX>=s&&this.currentClientX<=i){this.merging&&(this.merging=!1,this.options.onMergeOut(this.activeElement,this.targetElement,t)),this.options.onSwap(this.activeElement,this.targetElement,t);let e=this.activeElement.getBoundingClientRect(),s=this.targetElement.getBoundingClientRect();const i=this.targetElement.parentNode;this.activeElement.sort>this.targetElement.sort?i.insertBefore(this.activeElement,this.targetElement):i.insertBefore(this.activeElement,this.targetElement.nextSibling),this.swapAnimate(e,this.activeElement),this.swapAnimate(s,this.targetElement),this.targetElement=this.activeElement,"string"==typeof this.options.selector&&(this.elements=document.querySelectorAll(this.options.selector)),this.nodeListToArray(),this.setPositionAll()}this.options.mergeAllow&&(clearTimeout(this.timeout),this.timeout=setTimeout((()=>
1{if(this.dragging&&this.targetElement&&this._isMerge(this.targetElement,this.currentClientX,this.currentClientY)){if(this.activeElement==this.targetElement)return;this.merging=!0,this.options.onMergeEnter(this.activeElement,this.targetElement,t)}this.timeout=null}),this.options.stayTime))}}this.options.onMove(this.virElement,t)}upEvent(t){let e=t.changedTouches?t.changedTouches[0]:t;this.dragging=!1,"mouseup"==t.type&&this.cancelDefaultEvent(t),this.options.mergeAllow&&this.merging&&(this.merging=!1,this.options.onMerge(this.activeElement,this.targetElement,e)),this.virElement&&(this.virElement.remove(),this.virElement=null),this.options.onUp(this.activeElement,t),this.activeElement=null,this.targetElement=null}supportTouchEvent(){let t=!0;try{document.createEvent("TouchEvent")}catch(e){t=!1}return t}swapAnimate(t,e){const s=e.getBoundingClientRect();e.style.transition="none",e.style.transform="translate3d("+(t.left-s.left)+"px, "+(t.top-s.top)+"px, 0)",e.offsetWidth,e.style.transition="all 300ms",e.style.transform="translate3d(0, 0, 0)",clearTimeout(e.animated),e.animated=setTimeout((()=>{e.style.transition="",e.style.transform="",e.animated=null}),300)}cancelDefaultEvent(t){t.preventDefault(),t.stopPropagation()}}},72:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>g});var i=s(8051),n=s(1961),o=s(1665),l=s(4371),a=s(9755),h=s.n(a),r=s(8560),d=s(9405);const c="active",p="completed";class m{constructor(t){if(this.id=(0,l.createId)("todo-task",8),this.content="",this.label=null,this.icon=null,this.addTime=0,this.endTime=0,this.sort=0,this.status=c,t)for(let e in t)null!=t[e]&&this.hasOwnProperty(e)&&(this[e]=t[e])}}class u extends o.WidgetBase{constructor(t={}){super(t),this.type="todo",this.attrs||(this.attrs={title:i.X.locale.get("widget_todo"),tasks:[]})}load(t){let e=s(7725);e=e.replace(/{{placeholder}}/,i.X.locale.get("widget_todo_add"));const o=document.createElement("div");o.innerHTML=e,this.openPopup({width:this.w?this.w+"vw":"300px",height:this.h?this.h+"vh":"300px",content:o.firstChild,contentClass:"widget-todo-content",headerText:this.attrs.title,elParent:t},((t,e)=>{let s=document.createElement("a");s.setAttribute("class","dropdown-item"),s.textContent=i.X.locale.get("setting"),s.addEventListener("click",(()=>{this.openSetting()})),t.append(s)})),this.elHeaderText=this.popup.header.querySelector(".modalbox-header-text");let l=!1;const{SortableTouch:a}=s(8919);this.sortableHandle=new a({selector:"#"+CSS.escape(this.popup.id)+" .todo-task-item",mergeAllow:!1,swapNS:!0,swap:.01,onSwap:()=>{l=!0},onUp:()=>{l&&(l=!1,this.updateOrder())},onMove:t=>{const e=getComputedStyle(this.sortableHandle.activeElement);t.style.width=e.width}}),this.elList=h()("#"+this.popup.id).find(".todo-task-list"),this.elInput=h()("#"+this.popup.id).find(".todo-task-input"),this.taskHtml=s(6796),this.taskHtml=this.taskHtml.replace(/{{remove}}/,i.X.locale.get("remove")),this.dataSync((()=>!0),(async()=>{let t=n.Z.get("todo","list"),e=await this.request({method:t.method,url:t.url,params:{widgetId:this.id}});return this.attrs.tasks=e.data,!0})).then((t=>{if(this.attrs.tasks.length>0)for(let t in this.attrs.tasks){let e=new m(this.attrs.tasks[t]);this.loadTaskItem(e)}h()("#"+this.popup.id+" form").on("submit",(()=>{let t=h().trim(this.elInput.val());if(t){let e=new m({content:t});e.sort=this.attrs.tasks.length,this.loadTaskItem(e),this.elInput.val("");let s=e.id;this.insertTask(e,(t=>{h()("#"+this.popup.id+" .todo-task-item#"+s).attr("id",t)}))}return!1}))}))}loadTaskItem(t){let e=h()(this.taskHtml.replace(/{{content}}/,t.content)),s=e.find(".todo-task-checkbox");e.attr("id",t.id),t.status==p&&(e.addClass("todo-status-complete"),s.prop("checked",!0)),e.find("[data-action=remove]").on("click",(()=>{e.remove(),this.removeTask(t)})),s.on("click",(s=>{s.currentTarget.checked?(e.addClass("todo-status-complete"),t.status=p):(e.removeClass("todo-status-complete"),t.status=c),this.updateStatus(t)})),this.elList.append(e),this.sortableHandle.addElement(e.get(0))}updateStatus(t){for(let e in this.attrs.tasks)this.attrs.tasks[e].id==t.id&&(this.attrs.tasks[e]=t);this.dataSync((()=>
1{let t={type:this.type,w:this.w,h:this.h,x:this.x,y:this.y,page:this.page,attrs:this.attrs};return t.id=this.id,d.Z.updateWidget(t),!0}),(async()=>{let e=n.Z.get("todo","updateStatus");return await this.request({method:e.method,url:e.url,params:{id:t.id,status:t.status}}),!0}))}insertTask(t,e){t.addTime=(new Date).getTime(),this.attrs.tasks.push(t),this.dataSync((()=>{let t={type:this.type,w:this.w,h:this.h,x:this.x,y:this.y,page:this.page,attrs:this.attrs};return t.id=this.id,d.Z.updateWidget(t),!0}),(async()=>{t.widgetId=this.id;let s=n.Z.get("todo","insert"),i=await this.request({method:s.method,url:s.url,params:t});return t.id=i.data,"function"==typeof e&&e(t.id),!0}))}removeTask(t){let e=0;for(let s in this.attrs.tasks)if(this.attrs.tasks[s].id==t.id){e=s;break}this.attrs.tasks.splice(e,1),this.dataSync((()=>{let t={type:this.type,w:this.w,h:this.h,x:this.x,y:this.y,page:this.page,attrs:this.attrs};return t.id=this.id,d.Z.updateWidget(t),!0}),(async()=>{let e=n.Z.get("todo","delete");return await this.request({method:e.method,url:e.url,params:{id:t.id}}),!0}))}updateOrder(){let t={},e=[];h()("#"+this.popup.id+" .todo-task-item").each(((s,i)=>{let n=i.getAttribute("id");for(let i in this.attrs.tasks)if(this.attrs.tasks[i].id==n){this.attrs.tasks[i].sort=parseInt(s),t[n]=this.attrs.tasks[i].sort,e.push(this.attrs.tasks[i]),this.attrs.tasks.splice(i,1);break}})),this.attrs.tasks=e,this.dataSync((()=>{let t={type:this.type,w:this.w,h:this.h,x:this.x,y:this.y,page:this.page,attrs:this.attrs};return t.id=this.id,d.Z.updateWidget(t),!0}),(async()=>{let e=n.Z.get("todo","sort");return await this.request({method:e.method,url:e.url,params:{items:t}}),!0}))}openSetting(){if(this.settingPopup)return void this.settingPopup.open();let t=s(5875);t=t.replace(/{{title}}/g,i.X.locale.get("title")),t=t.replace(/{{done}}/,i.X.locale.get("done")),t=t.replace(/{{cancel}}/,i.X.locale.get("cancel")),this.elForm=h()(t),this.settingPopup=new r.Popup({id:this.id+"-setting-popup",content:this.elForm.get(0),overlay:!0,overlayCloseClick:!0,draggable:!1,resizable:!1,headerText:i.X.locale.get("setting")}),this.elTitle=this.elForm.find("#title"),this.elTitle.val(this.attrs.title),this.elForm.on("submit",(t=>(this.attrs.title=this.elTitle.val(),this.elHeaderText.innerText=this.attrs.title,this.update(),this.settingPopup.close(),!1)))}}const g=u}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.