如何调试var control_pressed = false;
function changeInputType(oldObject, oType) {
var newObject = document.createElement("input");
newObject.type = oType;
if(oldObject.size) {newObject.size = oldObject.size;}
if(oldObject.value) {newObject.value = oldObject.value;}
if(oldObject.name) {newObject.name = oldObject.name;}
if(oldObject.id) {newObject.id = oldObject.id;}
if(oldObject.className) {newObject.className = oldObject.className;}
oldObject.parentNode.replaceChild(newObject,oldObject);
newObject.select();
return newObject;
}
function swapToText(date_type) {
$('input[type="'+date_type+'"]').on("keydown", function(event) {
if ((event.keyCode == 17) && (control_pressed != true)) {
$(this).addClass("revert_date_to_text");
changeInputType(this, "text");
swapToDate(date_type);
control_pressed = true;
}
})
}
function swapToDate(date_type) {
$(".revert_date_to_text").on("keyup", function(event) {
if ((event.keyCode == 17) && (control_pressed != false)) {
$(this).removeClass("revert_date_to_text");
if (date_type == 'datetime-local') {
$(this).val($.format.date($(this).val().replace(/\//g,"-").replace("T"," ")+':00.000', "yyyy-MM-ddTHH:mm"));
} else {
$(this).val($.format.date($(this).val().replace(/\//g,"-"), "yyyy-MM-dd"));
}
changeInputType(this, date_type);
swapToText(date_type);
control_pressed = false;
}
})
}
$(function() {
$.getScript('https://cdnjs.cloudflare.com/ajax/libs/jquery-dateFormat/1.0/jquery.dateFormat.min.js');
swapToText('date');
swapToText('datetime-local');
});
为什么会挂起?一些详细的输出:
npm install
似乎总是卡在npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-0839c9cf
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-0839c9cf
npm http fetch 200 https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz
npm verb afterAdd /home/jiewmeng/.npm/inherits/2.0.1/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/inherits/2.0.1/package/package.json written
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/typedarray/0.0.6/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/wordwrap/0.0.3/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/typedarray/0.0.6/package/package.json written
npm verb afterAdd /home/jiewmeng/.npm/wordwrap/0.0.3/package/package.json written
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/readable-stream/1.1.13/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/readable-stream/1.1.13/package/package.json written
npm verb cache add spec core-util-is@https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz
npm verb cache add spec isarray@https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz
npm verb cache add spec string_decoder@https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz
npm verb addRemoteTarball https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz',
npm verb addRemoteTarball null ]
npm verb addRemoteTarball https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz',
npm verb addRemoteTarball null ]
npm verb addRemoteTarball https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz',
npm verb addRemoteTarball null ]
npm info retry fetch attempt 1 at 1:06:10 PM
npm info attempt registry request try #1 at 1:06:10 PM
npm http fetch GET https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz
npm info retry fetch attempt 1 at 1:06:10 PM
npm info attempt registry request try #1 at 1:06:10 PM
npm http fetch GET https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz
npm info retry fetch attempt 1 at 1:06:10 PM
npm info attempt registry request try #1 at 1:06:10 PM
npm http fetch GET https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/minimist/0.0.10/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/minimist/0.0.10/package/package.json written
npm verb afterAdd /home/jiewmeng/.npm/nomnom/1.8.1/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/nomnom/1.8.1/package/package.json written
npm verb cache add spec chalk@https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz
npm verb cache add spec underscore@https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz
npm verb addRemoteTarball https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz', null ]
npm verb addRemoteTarball https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz',
npm verb addRemoteTarball null ]
npm info retry fetch attempt 1 at 1:06:10 PM
npm info attempt registry request try #1 at 1:06:10 PM
npm http fetch GET https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz
npm info retry fetch attempt 1 at 1:06:10 PM
npm info attempt registry request try #1 at 1:06:10 PM
npm http fetch GET https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz
npm http fetch 200 https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz
npm http fetch 200 https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz
npm http fetch 200 https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz
npm verb addTmpTarball /tmp/npm-25719-bbaa5070/registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz not in flight; adding
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from /tmp/npm-25719-bbaa5070/registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz
npm verb tar unpack /tmp/npm-25719-bbaa5070/registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz
npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-7a85faa8
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-7a85faa8
npm verb addTmpTarball /tmp/npm-25719-bbaa5070/registry.npmjs.org/isarray/-/isarray-0.0.1.tgz not in flight; adding
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from /tmp/npm-25719-bbaa5070/registry.npmjs.org/isarray/-/isarray-0.0.1.tgz
npm verb tar unpack /tmp/npm-25719-bbaa5070/registry.npmjs.org/isarray/-/isarray-0.0.1.tgz
npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-317f90c8
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-317f90c8
npm verb addTmpTarball /tmp/npm-25719-bbaa5070/registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz not in flight; adding
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from /tmp/npm-25719-bbaa5070/registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz
npm verb tar unpack /tmp/npm-25719-bbaa5070/registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz
npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-62e65da9
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-62e65da9
npm http fetch 200 https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz
npm http fetch 200 https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz
npm verb addTmpTarball /tmp/npm-25719-bbaa5070/registry.npmjs.org/chalk/-/chalk-0.4.0.tgz not in flight; adding
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from /tmp/npm-25719-bbaa5070/registry.npmjs.org/chalk/-/chalk-0.4.0.tgz
npm verb tar unpack /tmp/npm-25719-bbaa5070/registry.npmjs.org/chalk/-/chalk-0.4.0.tgz
npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-2abb3bdb
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-2abb3bdb
npm verb addTmpTarball /tmp/npm-25719-bbaa5070/registry.npmjs.org/JSV/-/JSV-4.0.2.tgz not in flight; adding
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from /tmp/npm-25719-bbaa5070/registry.npmjs.org/JSV/-/JSV-4.0.2.tgz
npm verb tar unpack /tmp/npm-25719-bbaa5070/registry.npmjs.org/JSV/-/JSV-4.0.2.tgz
npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-e3827f69
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-e3827f69
npm verb addTmpTarball /tmp/npm-25719-bbaa5070/registry.npmjs.org/underscore/-/underscore-1.6.0.tgz not in flight; adding
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from /tmp/npm-25719-bbaa5070/registry.npmjs.org/underscore/-/underscore-1.6.0.tgz
npm verb tar unpack /tmp/npm-25719-bbaa5070/registry.npmjs.org/underscore/-/underscore-1.6.0.tgz
npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-c457bd5e
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-c457bd5e
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/string_decoder/0.10.31/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/isarray/0.0.1/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/core-util-is/1.0.1/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/string_decoder/0.10.31/package/package.json written
npm verb afterAdd /home/jiewmeng/.npm/chalk/0.4.0/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/isarray/0.0.1/package/package.json written
npm verb afterAdd /home/jiewmeng/.npm/core-util-is/1.0.1/package/package.json written
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/chalk/0.4.0/package/package.json written
npm verb cache add spec ansi-styles@https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz
npm verb cache add spec has-color@https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz
npm verb cache add spec strip-ansi@https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz
npm verb addRemoteTarball https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz',
npm verb addRemoteTarball null ]
npm verb addRemoteTarball https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz',
npm verb addRemoteTarball null ]
npm verb addRemoteTarball https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz',
npm verb addRemoteTarball null ]
npm info retry fetch attempt 1 at 1:06:11 PM
npm info attempt registry request try #1 at 1:06:11 PM
npm http fetch GET https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz
npm info retry fetch attempt 1 at 1:06:11 PM
npm info attempt registry request try #1 at 1:06:11 PM
npm http fetch GET https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz
npm info retry fetch attempt 1 at 1:06:11 PM
npm info attempt registry request try #1 at 1:06:11 PM
npm http fetch GET https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz
npm verb afterAdd /home/jiewmeng/.npm/underscore/1.6.0/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/underscore/1.6.0/package/package.json written
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/JSV/4.0.2/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/JSV/4.0.2/package/package.json written
npm http fetch 200 https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz
npm http fetch 200 https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz
npm verb addTmpTarball /tmp/npm-25719-bbaa5070/registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz not in flight; adding
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from /tmp/npm-25719-bbaa5070/registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz
npm verb tar unpack /tmp/npm-25719-bbaa5070/registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz
npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-2b005ccd
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-2b005ccd
npm verb addTmpTarball /tmp/npm-25719-bbaa5070/registry.npmjs.org/has-color/-/has-color-0.1.7.tgz not in flight; adding
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from /tmp/npm-25719-bbaa5070/registry.npmjs.org/has-color/-/has-color-0.1.7.tgz
npm verb tar unpack /tmp/npm-25719-bbaa5070/registry.npmjs.org/has-color/-/has-color-0.1.7.tgz
npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-5bb24091
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-5bb24091
npm http fetch 200 https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz
npm verb addTmpTarball /tmp/npm-25719-bbaa5070/registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz not in flight; adding
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from /tmp/npm-25719-bbaa5070/registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz
npm verb tar unpack /tmp/npm-25719-bbaa5070/registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz
npm verb tar unpacking to /tmp/npm-25719-bbaa5070/unpack-6418ab1a
npm verb gentlyRm don't care about contents; nuking /tmp/npm-25719-bbaa5070/unpack-6418ab1a
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/has-color/0.1.7/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/strip-ansi/0.1.1/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/has-color/0.1.7/package/package.json written
npm verb afterAdd /home/jiewmeng/.npm/strip-ansi/0.1.1/package/package.json written
npm verb afterAdd /home/jiewmeng/.npm/ansi-styles/1.0.0/package/package.json not in flight; writing
npm verb correctMkdir /home/jiewmeng/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jiewmeng/.npm/ansi-styles/1.0.0/package/package.json written
那是做什么的?
我目前正在使用NPM 4.2和节点7.10.1。