Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: $.isBase64(str)の関数で audio, video の形式も受け入れるように変更 #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions tyrano/libs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1299,14 +1299,16 @@
});
};

/**
* 文字列がdata-URLであるかを判定する
* @param {string} str - 判定する文字列
* @returns {boolean} data-URLの場合はtrue、そうでない場合はfalse
*/
$.isBase64 = function (str) {
if (!str) return false;

if (str.substr(0, 10) == "data:image") {
return true;
} else {
return false;
}
if (!str || typeof str !== "string" ) return false;

// 画像, 音声, 動画ファイルを受け入れる
return str.startsWith("data:image") || str.startsWith("data:audio") || str.startsWith("data:video")
};

//オブジェクトの個数をもってきます。1
Expand Down