前端代码

This commit is contained in:
ChloeChen0423
2025-05-12 16:42:36 +09:00
commit 7c63f2f07b
4531 changed files with 656010 additions and 0 deletions

3
node_modules/openurl/.npmignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
.DS_Store
.idea

29
node_modules/openurl/README.md generated vendored Normal file
View File

@ -0,0 +1,29 @@
openurl Node.js module for opening URLs
=========================================
openurl is a Node.js module for opening a URL via the operating system. This will usually trigger actions such as:
- http URLs: open the default browser
- mailto URLs: open the default email client
- file URLs: open a window showing the directory (on OS X)
Example interaction on the Node.js REPL:
> require("openurl").open("http://rauschma.de")
> require("openurl").open("mailto:john@example.com")
You can generate emails as follows:
require("openurl").mailto(["john@example.com", "jane@example.com"],
{ subject: "Hello!", body: "This is\nan automatically sent email!\n" });
Install via npm:
npm install openurl
Im not yet terribly familiar with implementing npm packages, so any feedback is welcome
(especially experience reports on Windows and Linux, which I cant test on).
Related reading:
- [Write your shell scripts in JavaScript, via Node.js](http://www.2ality.com/2011/12/nodejs-shell-scripting.html)

68
node_modules/openurl/openurl.js generated vendored Normal file
View File

@ -0,0 +1,68 @@
var spawn = require('child_process').spawn;
var command;
switch(process.platform) {
case 'darwin':
command = 'open';
break;
case 'win32':
command = 'explorer.exe';
break;
case 'linux':
command = 'xdg-open';
break;
default:
throw new Error('Unsupported platform: ' + process.platform);
}
/**
* Error handling is deliberately minimal, as this function is to be easy to use for shell scripting
*
* @param url The URL to open
* @param callback A function with a single error argument. Optional.
*/
function open(url, callback) {
var child = spawn(command, [url]);
var errorText = "";
child.stderr.setEncoding('utf8');
child.stderr.on('data', function (data) {
errorText += data;
});
child.stderr.on('end', function () {
if (errorText.length > 0) {
var error = new Error(errorText);
if (callback) {
callback(error);
} else {
throw error;
}
} else if (callback) {
callback(error);
}
});
}
/**
* @param fields Common fields are: "subject", "body".
* Some email apps let you specify arbitrary headers here.
* @param recipientsSeparator Default is ",". Use ";" for Outlook.
*/
function mailto(recipients, fields, recipientsSeparator, callback) {
recipientsSeparator = recipientsSeparator || ",";
var url = "mailto:"+recipients.join(recipientsSeparator);
Object.keys(fields).forEach(function (key, index) {
if (index === 0) {
url += "?";
} else {
url += "&";
}
url += key + "=" + encodeURIComponent(fields[key]);
});
open(url, callback);
}
exports.open = open;
exports.mailto = mailto;

16
node_modules/openurl/package.json generated vendored Normal file
View File

@ -0,0 +1,16 @@
{
"name": "openurl",
"version": "1.1.1",
"author": "Axel Rauschmayer <axe@rauschma.de>",
"description": "Open a URL via the operating system (http: in default browser, mailto: in mail client etc.",
"main": "./openurl.js",
"repository": {
"type": "git",
"url": "https://github.com/rauschma/openurl"
},
"keywords": [
"desktop",
"browser"
],
"license": "MIT"
}