mirror of https://github.com/perkeep/perkeep.git
7 lines
4.5 KiB
Go
7 lines
4.5 KiB
Go
|
// THIS FILE IS AUTO-GENERATED FROM blobinfo.js
|
||
|
// DO NOT EDIT.
|
||
|
package ui
|
||
|
func init() {
|
||
|
Files.Add("blobinfo.js", "/*\nCopyright 2011 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// Gets the |p| query parameter, assuming that it looks like a blobref.\nfunction getBlobParam() {\n var blobRef = getQueryParam('b');\n return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;\n}\n\nfunction blobInfoUpdate(bmap) {\n var blobmeta = document.getElementById('blobmeta');\n var bd = document.getElementById(\"blobdownload\")\n bd.innerHTML = \"\";\n var blobref = getBlobParam();\n if (!blobref) {\n alert(\"no blobref?\");\n return;\n }\n var binfo = bmap[blobref];\n if (!binfo) {\n blobmeta.innerHTML = \"(not found)\";\n return;\n }\n blobmeta.innerHTML = JSON.stringify(binfo, null, 2);\n if (binfo.camliType || (binfo.type && binfo.type.indexOf(\"text/\") == 0)) {\n camliGetBlobContents(\n blobref,\n {\n success: function(data) {\n document.getElementById(\"blobdata\").innerHTML = linkifyBlobRefs(data);\n var bb = document.getElementById('blobbrowse');\n if (binfo.camliType != \"directory\") {\n bb.style.visibility = 'hidden';\n } else {\n bb.innerHTML = \"<a href='?d=\" + blobref + \"'>browse</a>\";\n }\n if (binfo.camliType == \"file\") {\n try {\n finfo = JSON.parse(data);\n bd.innerHTML = \"<a href=''></a>\";\n var fileName = finfo.fileName || blobref;\n bd.firstChild.href = \"./download/\" + blobref + \"/\" + fileName;\n if (binfo.file.mimeType.indexOf(\"image/\") == 0) {\n document.getElementById(\"thumbnail\").innerHTML = \"<img src='./thumbnail/\" + blobref + \"/\" + fileName + \"?mw=200&mh=200'>\";\n } else {\n document.getElementById(\"thumbnail\").innerHTML = \"\";\n }\n bd.firstChild.innerText = fileName;\n bd.innerHTML = \"download: \" + bd.innerHTML;\n } catch (x) {\n }\n }\n },\n fail: alert\n });\n } else {\n document.getElementById(\"blobdata\").innerHTML = \"<em>Unknown/binary data</em>\";\n }\n bd.innerHTML = \"<a href='\" + camliBlobURL(blobref) + \"'>download</a>\";\n\n if (binfo.camliType && binfo.camliType == \"permanode\") {\n document.getElementById(\"editspan\").style.display = \"inline\";\n document.getElementById(\"editlink\").href = \"./?p=\" + blobref;\n\n var claims = document.getElementById(\"claimsdiv\");\n claims.style.visibility = \"\";\n camliGetPermanodeClaims(\n blobref,\n {\n success: function(data) {\n document.getElementById(\"claims\").innerHTML = linkifyBlobRefs(JSON.stringify(data, null, 2));\n },\n fail: function(msg) {\n alert(msg);\n }\n });\n }\n\n}\n\nfunction blobInfoOnLoad() {\n var blobref = getBlobParam();\n if (!blobref) {\n return\n }\n var blobmeta = document.getElementById('blobmeta');\n blobmeta.innerText = \"(loading)\";\n\n var blobdescribe = do
|
||
|
}
|