Skip to content
索引

工具函数

判断空

js
// 判断字符串
const a = ""
if(!a){
    console.log("字符串为空")
}

const b = []
if(b.length){
    console.log("数组为空")
}
// 判断字符串
const a = ""
if(!a){
    console.log("字符串为空")
}

const b = []
if(b.length){
    console.log("数组为空")
}

obj/删除对象属性

js
const a = {a:1,b:2}
delete a.a
console.log(a) // {b:2}
const a = {a:1,b:2}
delete a.a
console.log(a) // {b:2}

obj/清空对象属性值

Object.keys生成对象key的数组,再使用这个数组清空对象, 搭配slice,可以将指定属性情况

js
 for (let key of Object.keys(objData)) {
    objData[key] = ""
  } 
for (let key of Object.keys(objData).slice(3)) {
    objData[key] = ""
  }
 for (let key of Object.keys(objData)) {
    objData[key] = ""
  } 
for (let key of Object.keys(objData).slice(3)) {
    objData[key] = ""
  }

嵌套的对象

js
clearValue(obj){
    Object.keys(obj).forEach(key => {
        if (typeof obj[key]=='object'){
            clearValue(obj[key])
        }else {
            obj[key]=''
        }
    })
}
clearValue(obj){
    Object.keys(obj).forEach(key => {
        if (typeof obj[key]=='object'){
            clearValue(obj[key])
        }else {
            obj[key]=''
        }
    })
}

根据出生日期计算年龄

js
getAge(data) {
  data.forEach(item => {
    item.age = new Date(new Date().getTime() - new Date(item.birthTime).getTime()).getFullYear() - 1970
  })
}
getAge(data) {
  data.forEach(item => {
    item.age = new Date(new Date().getTime() - new Date(item.birthTime).getTime()).getFullYear() - 1970
  })
}

uuid

INFO

全局唯一标识符(GUID,Globally Unique Identifier)也称作 UUID(Universally Unique IDentifier)

GUID是一种由算法生成的二进制长度为128位的数字标识符。GUID 的格式为“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”,其中的 x 是 0-9 或 a-f 范围内的一个32位十六进制数。在理想情况下,任何计算机和计算机集群都不会生成两个相同的GUID

GUID 的总数达到了2128(3.4×1038)个,所以随机生成两个相同GUID的可能性非常小,但并不为0。GUID一词有时也专指微软对UUID标准的实现

js
function uuid() {
    var s = [];
    var hexDigits = "0123456789abcdef";
    for (var i = 0; i < 36; i++) {
        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
    }
    s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
    s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
    s[8] = s[13] = s[18] = s[23] = "-";
    var uuid = s.join("");
    return uuid;
}
function uuid() {
    var s = [];
    var hexDigits = "0123456789abcdef";
    for (var i = 0; i < 36; i++) {
        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
    }
    s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
    s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
    s[8] = s[13] = s[18] = s[23] = "-";
    var uuid = s.join("");
    return uuid;
}

监听键盘回车事件

js
const theEvent = window.event || e
const code = theEvent.keyCode || theEvent.which || theEvent.charCode
   if (code == 13) {
       ...
}
const theEvent = window.event || e
const code = theEvent.keyCode || theEvent.which || theEvent.charCode
   if (code == 13) {
       ...
}

日期处理

js
// 获取当前时间
export function nowTime(s = "-", S = ":") {
  const dt = new Date()
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + "").padStart(2, "0")
  const d = (dt.getDate() + "").padStart(2, "0")
  const h = (dt.getHours() + "").padStart(2, "0")
  const min = (dt.getMinutes() + "").padStart(2, "0")
  const sec = (dt.getSeconds() + "").padStart(2, "0")
  return {
    full: `${y}${s}${m}${s}${d} ${h}${S}${m}${S}${sec}`,
    date: `${y}${s}${m}${s}${d}`,
    time: `${h}${S}${m}${S}${sec}`,
    dateObj: {
      year: `${y}`,
      month: `${m}`,
      day: `${d}`
    },
    timeObj: {
      hour: `${h}`,
      minute: `${m}`,
      second: `${sec}`
    }
  }
}

// 格式化时间
export function formatTime(t = new Date(), s = "-", S = ":") {
  const dt = new Date(t)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + "").padStart(2, "0")
  const d = (dt.getDate() + "").padStart(2, "0")
  const h = (dt.getHours() + "").padStart(2, "0")
  const min = (dt.getMinutes() + "").padStart(2, "0")
  const sec = (dt.getSeconds() + "").padStart(2, "0")
  return {
    full: `${y}${s}${m}${s}${d} ${h}${S}${min}${S}${sec}`,
    date: `${y}${s}${m}${s}${d}`,
    time: `${h}${S}${min}${S}${sec}`,
    dateObj: {
      year: `${y}`,
      month: `${m}`,
      day: `${d}`
    },
    timeObj: {
      hour: `${h}`,
      minute: `${min}`,
      second: `${sec}`
    }
  }
}

// 获取中文格式时间
export function timeCnObj(s = new Date()) {
  const dt = new Date(s)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + "").padStart(2, "0")
  const d = (dt.getDate() + "").padStart(2, "0")
  const h = (dt.getHours() + "").padStart(2, "0")
  const min = (dt.getMinutes() + "").padStart(2, "0")
  const sec = (dt.getSeconds() + "").padStart(2, "0")
  return {
    full: `${y}${m}${d}${h}${min}${sec}秒`,
    date: `${y}${m}${d}日`,
    time: `${h}${min}${sec}秒`,
    dateObj: {
      year: `${y}年`,
      month: `${m}月`,
      day: `${d}日`
    },
    timeObj: {
      hour: `${h}时`,
      minute: `${min}分`,
      second: `${sec}秒`
    }
  }
}

// 获取该日星期几
export function whatDay(s = new Date()) {
  return ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"][new Date(s).getDay()]
}

// 获取该日星期几英文
export function whatDayEn(s = new Date()) {
  return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][new Date(s).getDay()]
}

// 获取该月天数,该月日期数组(年月日),该月日期数组(年月),该月日期数组(日)
// echarts渲染时很有用
export function getDays(y, m) {
  const yearMonthDay = []
  const monthDay = []
  const day = []
  const days = new Date(y, m, 0).getDate()
  for (let i = 1; i <= days; i++) {
    yearMonthDay.push(y + "-" + m + "-" + String(i).padStart(2, "0"))
    monthDay.push(m + "-" + String(i).padStart(2, "0"))
    day.push(i)
  }
  return {
    number: days,
    yearMonthDay,
    monthDay,
    day
  }
}
// 获取当前时间
export function nowTime(s = "-", S = ":") {
  const dt = new Date()
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + "").padStart(2, "0")
  const d = (dt.getDate() + "").padStart(2, "0")
  const h = (dt.getHours() + "").padStart(2, "0")
  const min = (dt.getMinutes() + "").padStart(2, "0")
  const sec = (dt.getSeconds() + "").padStart(2, "0")
  return {
    full: `${y}${s}${m}${s}${d} ${h}${S}${m}${S}${sec}`,
    date: `${y}${s}${m}${s}${d}`,
    time: `${h}${S}${m}${S}${sec}`,
    dateObj: {
      year: `${y}`,
      month: `${m}`,
      day: `${d}`
    },
    timeObj: {
      hour: `${h}`,
      minute: `${m}`,
      second: `${sec}`
    }
  }
}

// 格式化时间
export function formatTime(t = new Date(), s = "-", S = ":") {
  const dt = new Date(t)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + "").padStart(2, "0")
  const d = (dt.getDate() + "").padStart(2, "0")
  const h = (dt.getHours() + "").padStart(2, "0")
  const min = (dt.getMinutes() + "").padStart(2, "0")
  const sec = (dt.getSeconds() + "").padStart(2, "0")
  return {
    full: `${y}${s}${m}${s}${d} ${h}${S}${min}${S}${sec}`,
    date: `${y}${s}${m}${s}${d}`,
    time: `${h}${S}${min}${S}${sec}`,
    dateObj: {
      year: `${y}`,
      month: `${m}`,
      day: `${d}`
    },
    timeObj: {
      hour: `${h}`,
      minute: `${min}`,
      second: `${sec}`
    }
  }
}

// 获取中文格式时间
export function timeCnObj(s = new Date()) {
  const dt = new Date(s)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + "").padStart(2, "0")
  const d = (dt.getDate() + "").padStart(2, "0")
  const h = (dt.getHours() + "").padStart(2, "0")
  const min = (dt.getMinutes() + "").padStart(2, "0")
  const sec = (dt.getSeconds() + "").padStart(2, "0")
  return {
    full: `${y}${m}${d}${h}${min}${sec}秒`,
    date: `${y}${m}${d}日`,
    time: `${h}${min}${sec}秒`,
    dateObj: {
      year: `${y}年`,
      month: `${m}月`,
      day: `${d}日`
    },
    timeObj: {
      hour: `${h}时`,
      minute: `${min}分`,
      second: `${sec}秒`
    }
  }
}

// 获取该日星期几
export function whatDay(s = new Date()) {
  return ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"][new Date(s).getDay()]
}

// 获取该日星期几英文
export function whatDayEn(s = new Date()) {
  return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][new Date(s).getDay()]
}

// 获取该月天数,该月日期数组(年月日),该月日期数组(年月),该月日期数组(日)
// echarts渲染时很有用
export function getDays(y, m) {
  const yearMonthDay = []
  const monthDay = []
  const day = []
  const days = new Date(y, m, 0).getDate()
  for (let i = 1; i <= days; i++) {
    yearMonthDay.push(y + "-" + m + "-" + String(i).padStart(2, "0"))
    monthDay.push(m + "-" + String(i).padStart(2, "0"))
    day.push(i)
  }
  return {
    number: days,
    yearMonthDay,
    monthDay,
    day
  }
}

consoloe.log

打印包含引用的对象

js
 var cache = []
        var json_str = JSON.stringify(fs, function(key, value) {
          if (typeof value === 'object' && value !== null) {
            if (cache.indexOf(value) !== -1) {
              return
            }
            cache.push(value)
          }
          return value
        })
        cache = null
        console.log(json_str)
 var cache = []
        var json_str = JSON.stringify(fs, function(key, value) {
          if (typeof value === 'object' && value !== null) {
            if (cache.indexOf(value) !== -1) {
              return
            }
            cache.push(value)
          }
          return value
        })
        cache = null
        console.log(json_str)

move

js
function move() {
  const el = document.querySelector("#svgobj")
  el.style.position = "absolute"
  console.log(el, el.style)
  el.onmousedown = e => {
    e.preventDefault()

    let bw = document.body.clientWidth
    let bh = document.body.clientHeight
    //鼠标按下,计算当前元素距离可视区的距离
    // let disX = e.clientX - el.offsetLeft
    // let disY = e.clientY - el.offsetTop

    let disX = e.clientX - el.style.top.split("px")[0]
    let disY = e.clientY - el.style.top.split("px")[0]

    console.log(el.style.top, disX, disY)
    // 计算两边坐标
    document.onmousemove = function (e) {
      let l = 0,
        t = 0
      // 拖动边界
      if (e.clientX >= bw) {
        l = bw - disX
      } else if (e.clientX <= 0) {
        {
          l = 0 - disX
        }
      } else {
        l = e.clientX - disX
      }
      if (e.clientY >= bh) {
        t = bh - disY
      } else if (e.clientY <= 0) {
        t = 0 - disY
      } else {
        t = e.clientY - disY
      }
      //移动当前元素
      el.style.left = l + "px"
      el.style.top = t + "px"
    }
    // 鼠标停止移动时,事件移除
    document.onmouseup = function (e) {
      document.onmousemove = null
      document.onmouseup = null
    }
  }
}
function move() {
  const el = document.querySelector("#svgobj")
  el.style.position = "absolute"
  console.log(el, el.style)
  el.onmousedown = e => {
    e.preventDefault()

    let bw = document.body.clientWidth
    let bh = document.body.clientHeight
    //鼠标按下,计算当前元素距离可视区的距离
    // let disX = e.clientX - el.offsetLeft
    // let disY = e.clientY - el.offsetTop

    let disX = e.clientX - el.style.top.split("px")[0]
    let disY = e.clientY - el.style.top.split("px")[0]

    console.log(el.style.top, disX, disY)
    // 计算两边坐标
    document.onmousemove = function (e) {
      let l = 0,
        t = 0
      // 拖动边界
      if (e.clientX >= bw) {
        l = bw - disX
      } else if (e.clientX <= 0) {
        {
          l = 0 - disX
        }
      } else {
        l = e.clientX - disX
      }
      if (e.clientY >= bh) {
        t = bh - disY
      } else if (e.clientY <= 0) {
        t = 0 - disY
      } else {
        t = e.clientY - disY
      }
      //移动当前元素
      el.style.left = l + "px"
      el.style.top = t + "px"
    }
    // 鼠标停止移动时,事件移除
    document.onmouseup = function (e) {
      document.onmousemove = null
      document.onmouseup = null
    }
  }
}
js
const a = [
  {
    startDate: "2016-05-03",
    endDate: "2016-05-02",
    remarks: "上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄"
  },
  {
    startDate: "2016-05-02",
    endDate: "2016-05-02",
    remarks: "上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄"
  }
]

const b = [
  {
    startDate: "2016-05-03",
    endDate: "2016-05-08",
    remarks: "上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄"
  },
  {
    startDate: "2016-05-27",
    endDate: "2016-05-02",
    remarks: "上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄"
  }
]
const a = [
  {
    startDate: "2016-05-03",
    endDate: "2016-05-02",
    remarks: "上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄"
  },
  {
    startDate: "2016-05-02",
    endDate: "2016-05-02",
    remarks: "上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄"
  }
]

const b = [
  {
    startDate: "2016-05-03",
    endDate: "2016-05-08",
    remarks: "上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄"
  },
  {
    startDate: "2016-05-27",
    endDate: "2016-05-02",
    remarks: "上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄上海市普陀区金沙江路 1518 弄"
  }
]

比较数组不同并取出不同的对象

js
let A = [
  { id: 1, name: "张三", address: "北京" },
  { id: 2, name: "李四", address: "上海" },
  { id: 3, name: "赵信", address: "召唤师峡谷" }
]
let B = [
  { id: 1, name: "张三", address: "北京" },
  { id: 2, name: "李四", address: "北京" },
  { id: 3, name: "德玛西亚", address: "召唤师峡谷" },
  { id: 4, name: "李白", address: "王者峡谷" }
]
const diff = (arr1, arr2) => {
  const ans = []
  const map = new Map()
  for (let i = 0; i < arr1.length; ++i) {
    map.set(arr1[i].id, arr1[i])
  }
  const hasChanged = (obj1, obj2) => {
    const keys = Object.keys(obj2)
    for (const key of keys) {
      if (obj2[key] !== obj1[key]) return true
    }
    return false
  }
  for (let i = 0; i < arr2.length; ++i) {
    const old = map.get(arr2[i].id)
    if (!old) ans.push(arr2[i])
    else if (hasChanged(old, arr2[i])) {
      ans.push(arr2[i])
    }
  }
  return ans
}
console.log(diff(A, B))
let A = [
  { id: 1, name: "张三", address: "北京" },
  { id: 2, name: "李四", address: "上海" },
  { id: 3, name: "赵信", address: "召唤师峡谷" }
]
let B = [
  { id: 1, name: "张三", address: "北京" },
  { id: 2, name: "李四", address: "北京" },
  { id: 3, name: "德玛西亚", address: "召唤师峡谷" },
  { id: 4, name: "李白", address: "王者峡谷" }
]
const diff = (arr1, arr2) => {
  const ans = []
  const map = new Map()
  for (let i = 0; i < arr1.length; ++i) {
    map.set(arr1[i].id, arr1[i])
  }
  const hasChanged = (obj1, obj2) => {
    const keys = Object.keys(obj2)
    for (const key of keys) {
      if (obj2[key] !== obj1[key]) return true
    }
    return false
  }
  for (let i = 0; i < arr2.length; ++i) {
    const old = map.get(arr2[i].id)
    if (!old) ans.push(arr2[i])
    else if (hasChanged(old, arr2[i])) {
      ans.push(arr2[i])
    }
  }
  return ans
}
console.log(diff(A, B))

获取最大值

js
  // 获取最大值。用于设置地图组件
          const max = Math.max.apply(
            Math,
            res.data.map(item => {
              return item.fh
            })
          )
  // 获取最大值。用于设置地图组件
          const max = Math.max.apply(
            Math,
            res.data.map(item => {
              return item.fh
            })
          )

判断一个函数包含另一个数组

全屏

js
const html = document.querySelector('html')
html.requestFullscreen()
const html = document.querySelector('html')
html.requestFullscreen()

退出全屏

js
function exitFullscreen() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
    } else if (document.webkitExitFullscreen) {
        document.webkitExitFullscreen();
    }
function exitFullscreen() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
    } else if (document.webkitExitFullscreen) {
        document.webkitExitFullscreen();
    }

判断网络正常

boolean变量

js
navigator.onLine
navigator.onLine

新窗口打开图片

js
const img = new Image() 
img.src = 'data:image/png;base64,' + data.imgbase64 
const newWin = window.open('', '_blank') 
newWin.document.write(img.outerHTML)
const img = new Image() 
img.src = 'data:image/png;base64,' + data.imgbase64 
const newWin = window.open('', '_blank') 
newWin.document.write(img.outerHTML)

谷歌浏览器打开ie

https://www.cnblogs.com/xiongze520/p/11684570.html

一些应用软件可以通过点击URL链接启动并执行操作(例如迅雷),这是如何做到的呢? 主要是通过修改注册表,注册URL Protocol

sh
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\openupload]
@="URL:openupload Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\openupload\DefaultIcon]
@="cmd.exe,1"

[HKEY_CLASSES_ROOT\openupload\shell]

[HKEY_CLASSES_ROOT\openupload\shell\open]

[HKEY_CLASSES_ROOT\openupload\shell\open\command]
@="cmd /c start /min \"\" \"cmd /c start /max iexplore.exe https://www.baidu.com \""
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\openupload]
@="URL:openupload Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\openupload\DefaultIcon]
@="cmd.exe,1"

[HKEY_CLASSES_ROOT\openupload\shell]

[HKEY_CLASSES_ROOT\openupload\shell\open]

[HKEY_CLASSES_ROOT\openupload\shell\open\command]
@="cmd /c start /min \"\" \"cmd /c start /max iexplore.exe https://www.baidu.com \""
  • cmd /c - 这是指在CMD中运行一个命令,并在该命令完成后关闭CMD窗口。
  • start /min - 这是一个Windows命令,用于启动一个新窗口并将其最小化。
  • "" - 这是一个start命令的参数,用于指定窗口标题。
  • "cmd /c start /b iexplore.exe https://www.baidu.com" - 这是一个指定要运行的命令的字符串。它启动了一个新的CMD窗口,并在其中使用start /b命令启动Internet Explorer,该命令使用/b参数来绑定到新的进程组,使其独立于CMD窗口,并且不会在任务栏中显示。最后,该命令打开了百度首页。

因此,运行该命令将在后台启动Internet Explorer并将其窗口最小化,而不会显示CMD窗口

点击链接,打开IE浏览器,并传递单个参数

sh
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\openIE]

@="URL:OpenIE Protocol"

"URL Protocol"=""

[HKEY_CLASSES_ROOT\openIE\DefaultIcon]

@="iexplore.exe,1"

[HKEY_CLASSES_ROOT\openIE\shell]

[HKEY_CLASSES_ROOT\openIE\shell\open]

[HKEY_CLASSES_ROOT\openIE\shell\open\command]

@="cmd /c set m=%1 & call set m=%%m:openIE:=%% & call \"C:\\Program Files\\Internet Explorer\\iexplore.exe\" %%m%% & exit"
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\openIE]

@="URL:OpenIE Protocol"

"URL Protocol"=""

[HKEY_CLASSES_ROOT\openIE\DefaultIcon]

@="iexplore.exe,1"

[HKEY_CLASSES_ROOT\openIE\shell]

[HKEY_CLASSES_ROOT\openIE\shell\open]

[HKEY_CLASSES_ROOT\openIE\shell\open\command]

@="cmd /c set m=%1 & call set m=%%m:openIE:=%% & call \"C:\\Program Files\\Internet Explorer\\iexplore.exe\" %%m%% & exit"

set m=%1(%1为传递过来的参数,将其赋给变量m) set m=%%m:openupload:=%% (将前缀清除) “C:\Program Files\InternetExplorer\iexplore.exe” %%m%% (打开IE 浏览器并跳转到指定页面)

会导致ie一直闪退的错误写法

js
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\openupload]
@="URL:openupload Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\openupload\DefaultIcon]
@="iexplore.exe,1"

[HKEY_CLASSES_ROOT\openupload\shell]

[HKEY_CLASSES_ROOT\openupload\shell\open]

[HKEY_CLASSES_ROOT\openupload\shell\open\command]
@="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" %1 "
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\openupload]
@="URL:openupload Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\openupload\DefaultIcon]
@="iexplore.exe,1"

[HKEY_CLASSES_ROOT\openupload\shell]

[HKEY_CLASSES_ROOT\openupload\shell\open]

[HKEY_CLASSES_ROOT\openupload\shell\open\command]
@="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" %1 "
sh
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\openupload]
@="URL:openupload Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\openupload\DefaultIcon]
@="iexplore.exe,1"

[HKEY_CLASSES_ROOT\openupload\shell]

[HKEY_CLASSES_ROOT\openupload\shell\open]

[HKEY_CLASSES_ROOT\openupload\shell\open\command]
@="cmd /c start /min \"\" \"cmd /c start /max iexplore.exe %1 \""
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\openupload]
@="URL:openupload Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\openupload\DefaultIcon]
@="iexplore.exe,1"

[HKEY_CLASSES_ROOT\openupload\shell]

[HKEY_CLASSES_ROOT\openupload\shell\open]

[HKEY_CLASSES_ROOT\openupload\shell\open\command]
@="cmd /c start /min \"\" \"cmd /c start /max iexplore.exe %1 \""

Released under the MIT License.