MCPcopy Create free account
hub / github.com/dajie111/nodeseek-userscript / getOrCreateNiGlobalFileInput

Function getOrCreateNiGlobalFileInput

nodeImage.js:881–901  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

879 }
880 var nsNiGlobalFileInput = null;
881 function getOrCreateNiGlobalFileInput() {
882 if (nsNiGlobalFileInput && document.body.contains(nsNiGlobalFileInput)) return nsNiGlobalFileInput;
883 var inp = document.createElement('input');
884 inp.type = 'file';
885 inp.multiple = true;
886 inp.accept = 'image/jpeg,image/png,image/gif,image/webp';
887 inp.id = 'ns-ni-mde-global-file';
888 inp.setAttribute('aria-hidden', 'true');
889 inp.style.cssText = 'position:fixed;left:-9999px;width:1px;height:1px;opacity:0;';
890 inp.addEventListener('change', function () {
891 var fs = inp.files;
892 if (!fs || !fs.length) return;
893 var arr = [];
894 for (var j = 0; j < fs.length; j++) arr.push(fs[j]);
895 inp.value = '';
896 niQuickUploadRunBatch(arr);
897 });
898 document.body.appendChild(inp);
899 nsNiGlobalFileInput = inp;
900 return inp;
901 }
902 // 当前激活的分类筛选:'all' | 'pinned' | catId。上传图片时自动归类到当前分类
903 var currentCatFilter = 'all';
904

Callers 1

Calls 1

niQuickUploadRunBatchFunction · 0.85

Tested by

no test coverage detected