mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-26 17:38:20 +01:00
move non basic app to another repository
This commit is contained in:
parent
40b06f8f1a
commit
d1496c6530
2
Makefile
2
Makefile
@ -52,7 +52,7 @@ coffees= src/core/core.coffee \
|
||||
|
||||
|
||||
|
||||
packages = CoreServices ActivityMonitor Files Setting ShowCase MarkOn CodePad# Files MarketPlace Preview NotePad wTerm
|
||||
packages = CoreServices Files Setting CodePad
|
||||
|
||||
main: initd build_coffees build_themes libs build_packages languages
|
||||
- cp src/index.html $(BUILDDIR)/
|
||||
|
@ -1,11 +0,0 @@
|
||||
coffee_files = main.coffee
|
||||
|
||||
jsfiles =
|
||||
|
||||
cssfiles = main.css
|
||||
|
||||
copyfiles = scheme.html package.json
|
||||
|
||||
PKG_NAME=ActivityMonitor
|
||||
|
||||
include ../pkg.mk
|
@ -1,97 +0,0 @@
|
||||
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
# AnTOS Web desktop is is licensed under the GNU General Public
|
||||
# License v3.0, see the LICENCE file for more information
|
||||
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
_PM = this.OS.PM
|
||||
_APP = this.OS.APP
|
||||
class ActivityMonitor extends this.OS.GUI.BaseApplication
|
||||
constructor: (args) ->
|
||||
super "ActivityMonitor", args
|
||||
main: () ->
|
||||
@scheme.set "apptitle", "Activity Monitor"
|
||||
@grid = @find "mygrid"
|
||||
@on "btclick", (e) =>
|
||||
return unless e.id == "btkill"
|
||||
item = @grid.get "selectedRow"
|
||||
return unless item
|
||||
data = item.get("data")[0]
|
||||
app = _PM.appByPid data.text
|
||||
app.quit(true) if app
|
||||
|
||||
header = [
|
||||
{
|
||||
width: 50,
|
||||
text: "__(Pid)"
|
||||
},
|
||||
{
|
||||
text: "__(Name)"
|
||||
},
|
||||
{
|
||||
text: "__(Type)",
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
width: 80,
|
||||
text: "__(Alive (ms))"
|
||||
}
|
||||
]
|
||||
@gdata = {
|
||||
processes: {}
|
||||
alive: []
|
||||
}
|
||||
@grid.set "header", header
|
||||
@monitor()
|
||||
|
||||
monitor: () ->
|
||||
#get all current running process
|
||||
@gdata.alive = []
|
||||
now = (new Date).getTime()
|
||||
$.each _PM.processes, (i, d) =>
|
||||
$.each d , (j, a) =>
|
||||
if @gdata.processes[a.pid] #update it
|
||||
@gdata.processes[a.pid][3].text = now - a.birth
|
||||
@gdata.processes[a.pid][3].domel.update()
|
||||
else #add it
|
||||
@gdata.processes[a.pid] = [
|
||||
{ text: a.pid },
|
||||
{
|
||||
icon: if _APP[a.name].type == 1 then _APP[a.name].meta.icon else a.icon,
|
||||
iconclass: if _APP[a.name].type == 1 then _APP[a.name].meta.iconclass else a.iconclass,
|
||||
text: a.name
|
||||
},
|
||||
{
|
||||
text: if _APP[a.name].type == 1 then "__(Application)" else "__(Service)"
|
||||
},
|
||||
{
|
||||
text: now - a.birth
|
||||
}
|
||||
]
|
||||
@grid.push @gdata.processes[a.pid]
|
||||
@gdata.alive.push a.pid
|
||||
|
||||
$.each @gdata.processes, (i, e) =>
|
||||
if ($.inArray (Number i), @gdata.alive) < 0
|
||||
@grid.remove @gdata.processes[i].domel
|
||||
@gdata.processes[i] = undefined
|
||||
delete @gdata.processes[i]
|
||||
|
||||
@timer = setTimeout (() => @monitor()), 500
|
||||
|
||||
cleanup: (e) ->
|
||||
clearTimeout @timer if @timer
|
||||
|
||||
ActivityMonitor.singleton = true
|
||||
this.OS.register "ActivityMonitor", ActivityMonitor
|
@ -1,13 +0,0 @@
|
||||
afx-app-window[data-id="am-window"] afx-button{
|
||||
margin: 3px;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="am-window"] afx-grid-view afx-grid-row afx-grid-cell{
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
|
||||
afx-app-window[data-id="am-window"] afx-grid-view .grid_row_header afx-grid-cell{
|
||||
border: 1px solid #a6a6a6;
|
||||
padding: 5px;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"app":"ActivityMonitor",
|
||||
"name":"Activity monitor",
|
||||
"description":"Processes monitor and manager",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.0.1-a",
|
||||
"category":"System",
|
||||
"iconclass":"fa fa-heartbeat",
|
||||
"mimes":["none"]
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<afx-app-window data-id = "am-window" apptitle="" width="400" height="300">
|
||||
<afx-hbox>
|
||||
<div data-width="7"></div>
|
||||
<afx-vbox>
|
||||
<div data-height="7"></div>
|
||||
<afx-grid-view data-id = "mygrid"></afx-grid-view>
|
||||
<afx-button data-height="30" data-id = "btkill" text = "__(Kill process)" iconclass="fa fa-times"></afx-button>
|
||||
</afx-vbox>
|
||||
<div data-width="7"></div>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
@ -1,11 +0,0 @@
|
||||
coffee_files = dialogs.coffee main.coffee
|
||||
|
||||
jsfiles = katex/katex.js katex/auto-render.js
|
||||
|
||||
cssfiles = main.css katex/katex.css
|
||||
|
||||
copyfiles = scheme.html cvsection.html package.json katex/fonts api/sendmail.lua sendmail.html
|
||||
|
||||
|
||||
PKG_NAME=Blogger
|
||||
include ../pkg.mk
|
@ -1,17 +0,0 @@
|
||||
|
||||
local data = ...
|
||||
print(data.content)
|
||||
for k,v in pairs(data.to) do
|
||||
print("sent to:"..v)
|
||||
local to = v
|
||||
local from = "From: xsang.le@gmail.com\n"
|
||||
local suject = "Subject: " .. data.title .. "\n"
|
||||
local content = data.content.."\n"
|
||||
local cmd = 'echo "' .. utils.escape(from .. suject .. content) .. '"| sendmail ' .. to
|
||||
--print(cmd)
|
||||
local r = os.execute(cmd)
|
||||
if not r then
|
||||
print("Cannot send mail to: "..v)
|
||||
end
|
||||
end
|
||||
return "Email sent"
|
@ -1,32 +0,0 @@
|
||||
<afx-app-window data-id = "blogger-cv-sec-win" apptitle="Porforlio section" width="450" height="400">
|
||||
<afx-vbox >
|
||||
<div data-height="5"></div>
|
||||
<afx-hbox data-height = "30" >
|
||||
<afx-label data-width= "70" text = "__(Title)"></afx-label>
|
||||
<input type = "text" name="title" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30" >
|
||||
<afx-label text = "__(Subtitle)" data-width= "70"></afx-label>
|
||||
<input type = "text" name="subtitle" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30" >
|
||||
<afx-label text = "__(Location)" data-width= "70"></afx-label>
|
||||
<input type = "text" name="location" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30" >
|
||||
<afx-label text = "__(From)" data-width= "70"></afx-label>
|
||||
<input type = "text" name="start" input-class = "user-input"/>
|
||||
<afx-label text = "To:" style="text-align:center;" data-width= "70"></afx-label>
|
||||
<input type = "text" name="end" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-label data-height = "30" text = "Content" style = "margin-left:5px;"/>
|
||||
<div data-id="editor-container">
|
||||
<textarea name="content" data-id = "contentarea" />
|
||||
</div>
|
||||
<afx-hbox data-height = "35">
|
||||
<div></div>
|
||||
<afx-switch data data-id = "section-publish" data-width="30"></afx-switch>
|
||||
<afx-button iconclass = "fa fa-save" data-id = "bt-cv-sec-save" data-width="60" text = "__(Save)"/>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
@ -1,176 +0,0 @@
|
||||
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
# AnTOS Web desktop is is licensed under the GNU General Public
|
||||
# License v3.0, see the LICENCE file for more information
|
||||
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
class BloggerCategoryDialog extends this.OS.GUI.BasicDialog
|
||||
constructor: () ->
|
||||
super "BloggerCategoryDialog", {
|
||||
tags: [
|
||||
{ tag: "afx-label", att: "data-height = '20', text = 'Pick a parent'" },
|
||||
{ tag: "afx-tree-view" },
|
||||
{ tag: "afx-label", att: "data-height = '20', text = 'Category name'" },
|
||||
{ tag: "input", att: "type = 'text' data-height = '20'" }
|
||||
],
|
||||
width: 200,
|
||||
height: 300,
|
||||
resizable: true,
|
||||
buttons: [
|
||||
{
|
||||
label: "0k",
|
||||
onclick: (d) ->
|
||||
sel = (d.find "content1").get "selectedItem"
|
||||
return d.notify __("Please select a parent category") unless sel
|
||||
val = (d.find "content3").value
|
||||
return d.notify __("Please enter category name") if val is "" and not d.data.selonly
|
||||
return d.notify __("Parent can not be the category itself") if d.data.cat and d.data.cat.id is sel.id
|
||||
d.handler { p: sel, value: val } if d.handler
|
||||
d.quit()
|
||||
},
|
||||
{
|
||||
label: "Cancel",
|
||||
onclick: (d) -> d.quit()
|
||||
}
|
||||
],
|
||||
filldata: (d) ->
|
||||
return unless d.data
|
||||
#console.log d.data
|
||||
tree = d.find "content1"
|
||||
tree.set "data", d.data.tree if d.data.tree
|
||||
if d.data.cat
|
||||
it = (tree.find "id", d.data.cat.pid)[0]
|
||||
tree.set "selectedItem", it
|
||||
(d.find "content3").value = d.data.cat.name
|
||||
#(d.find "content0").set "text", d.data.label
|
||||
#(d.find "content1").value = d.data.value if d.data.value
|
||||
xtra: (d) ->
|
||||
$( d.find "content3" ).keyup (e) ->
|
||||
(d.find "bt0").trigger() if e.which is 13
|
||||
}
|
||||
|
||||
# This dialog is use for cv section editing
|
||||
|
||||
class BloggerCVSectionDiaglog extends this.OS.GUI.BaseDialog
|
||||
constructor: () ->
|
||||
super "BloggerCVSectionDiaglog"
|
||||
|
||||
init: () ->
|
||||
@render "#{@path()}/cvsection.html"
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", @title
|
||||
@editor = new SimpleMDE
|
||||
element: @find "contentarea"
|
||||
status: false
|
||||
toolbar: false
|
||||
($ (@select '[class = "CodeMirror-scroll"]')[0]).css "min-height", "50px"
|
||||
($ (@select '[class="CodeMirror cm-s-paper CodeMirror-wrap"]')[0]).css "min-height", "50px"
|
||||
@on "vboxchange", () ->
|
||||
me.resizeContent()
|
||||
|
||||
inputs = me.select "[input-class='user-input']"
|
||||
(($ v).val me.data[v.name] for v in inputs ) if me.data
|
||||
@editor.value me.data.content if me.data and me.data.content
|
||||
(me.find "section-publish").set "swon", (if Number(me.data.publish) then true else false)
|
||||
(@find "bt-cv-sec-save").set "onbtclick", (e) ->
|
||||
data = {}
|
||||
console.log inputs
|
||||
data[v.name] = ($ v).val() for v in inputs
|
||||
data.content = me.editor.value()
|
||||
return me.notify __("Title or content must not be blank") if data.title is "" and data.content is ""
|
||||
#return me.notify "Content must not be blank" if data.content is ""
|
||||
data.id = me.data.id if me.data and me.data.id
|
||||
if (me.find "section-publish").get "swon"
|
||||
data.publish = 1
|
||||
else
|
||||
data.publish = 0
|
||||
|
||||
me.handler data if me.handler
|
||||
me.quit()
|
||||
me.resizeContent()
|
||||
resizeContent: () ->
|
||||
container = @find "editor-container"
|
||||
children = ($ container).children()
|
||||
cheight = ($ container).height() - 30
|
||||
($ children[1]).css("height", cheight + "px")
|
||||
|
||||
# this dialog is for send mail
|
||||
class BloggerSendmailDiaglog extends this.OS.GUI.BaseDialog
|
||||
constructor: () ->
|
||||
super "BloggerCVSectionDiaglog"
|
||||
|
||||
init: () ->
|
||||
@render "#{@path()}/sendmail.html"
|
||||
@subdb = new @.parent._api.DB("subscribers")
|
||||
|
||||
main: () ->
|
||||
# get db
|
||||
me = @
|
||||
@maillinglist = @find "email-list"
|
||||
title = (new RegExp "^#+(.*)\n", "g").exec @data.content
|
||||
(@find "mail-title").value = title[1]
|
||||
content = (@data.content.substring 0, 500) + "..."
|
||||
(@find "contentarea").value = BloggerSendmailDiaglog.template.format @data.id, content, @data.id
|
||||
|
||||
@subdb.find {}, (d) ->
|
||||
return me.error __("Cannot fetch subscribers data: {0}", d.error) if d.error
|
||||
for v in d.result
|
||||
v.text = v.name
|
||||
v.switch = true
|
||||
v.checked = true
|
||||
|
||||
me.maillinglist.set "items", d.result
|
||||
|
||||
(@find "bt-sendmail").set "onbtclick", (e) ->
|
||||
items = me.maillinglist.get "items"
|
||||
emails = []
|
||||
emails.push v.email for v in items when v.checked is true
|
||||
return me.notify __("No email selected") if emails.length is 0
|
||||
# send the email
|
||||
data =
|
||||
path: "#{me.parent.path()}/sendmail.lua",
|
||||
parameters:
|
||||
to: emails,
|
||||
title: (me.find "mail-title").value,
|
||||
content: (me.find "contentarea").value
|
||||
me._api.post "system/apigateway", data, (d) ->
|
||||
me.notify "Sendmail: {0}".format d
|
||||
me.quit()
|
||||
, (e, s) ->
|
||||
console.log e
|
||||
me.error __("Error sending mail: {0}", e.responseText)
|
||||
|
||||
|
||||
|
||||
BloggerSendmailDiaglog.template = """
|
||||
Hello,
|
||||
|
||||
Xuan Sang LE has just published a new post on his blog: https://blog.lxsang.me/post/id/{0}
|
||||
|
||||
==========
|
||||
{1}
|
||||
==========
|
||||
|
||||
|
||||
Read the full article via:
|
||||
https://blog.lxsang.me/post/id/{2}
|
||||
|
||||
You receive this email because you have been subscribed to his blog.
|
||||
|
||||
Have a nice day,
|
||||
|
||||
Sent from Blogger, an AntOS application
|
||||
"""
|
@ -1,790 +0,0 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory(require("katex"));
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define(["katex"], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["renderMathInElement"] = factory(require("katex"));
|
||||
else
|
||||
root["renderMathInElement"] = factory(root["katex"]);
|
||||
})(this, function(__WEBPACK_EXTERNAL_MODULE_38__) {
|
||||
return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 9);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
||||
var global = module.exports = typeof window != 'undefined' && window.Math == Math
|
||||
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
|
||||
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = function(it){
|
||||
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 2 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// Thank's IE8 for his funny defineProperty
|
||||
module.exports = !__webpack_require__(3)(function(){
|
||||
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = function(exec){
|
||||
try {
|
||||
return !!exec();
|
||||
} catch(e){
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 4 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var core = module.exports = {version: '2.4.0'};
|
||||
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
|
||||
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// to indexed object, toObject with fallback for non-array-like ES3 strings
|
||||
var IObject = __webpack_require__(6)
|
||||
, defined = __webpack_require__(7);
|
||||
module.exports = function(it){
|
||||
return IObject(defined(it));
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
||||
var cof = __webpack_require__(27);
|
||||
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
|
||||
return cof(it) == 'String' ? it.split('') : Object(it);
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 7 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
// 7.2.1 RequireObjectCoercible(argument)
|
||||
module.exports = function(it){
|
||||
if(it == undefined)throw TypeError("Can't call method on " + it);
|
||||
return it;
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
// 7.1.4 ToInteger
|
||||
var ceil = Math.ceil
|
||||
, floor = Math.floor;
|
||||
module.exports = function(it){
|
||||
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(10);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_katex__ = __webpack_require__(38);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_katex___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_katex__);
|
||||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__splitAtDelimiters__ = __webpack_require__(39);
|
||||
|
||||
/* eslint no-console:0 */
|
||||
|
||||
|
||||
|
||||
|
||||
var splitWithDelimiters = function splitWithDelimiters(text, delimiters) {
|
||||
var data = [{ type: "text", data: text }];
|
||||
for (var i = 0; i < delimiters.length; i++) {
|
||||
var delimiter = delimiters[i];
|
||||
data = Object(__WEBPACK_IMPORTED_MODULE_2__splitAtDelimiters__["a" /* default */])(data, delimiter.left, delimiter.right, delimiter.display || false);
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
/* Note: optionsCopy is mutated by this method. If it is ever exposed in the
|
||||
* API, we should copy it before mutating.
|
||||
*/
|
||||
var renderMathInText = function renderMathInText(text, optionsCopy) {
|
||||
var data = splitWithDelimiters(text, optionsCopy.delimiters);
|
||||
var fragment = document.createDocumentFragment();
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data[i].type === "text") {
|
||||
fragment.appendChild(document.createTextNode(data[i].data));
|
||||
} else {
|
||||
var span = document.createElement("span");
|
||||
var math = data[i].data;
|
||||
// Override any display mode defined in the settings with that
|
||||
// defined by the text itself
|
||||
optionsCopy.displayMode = data[i].display;
|
||||
try {
|
||||
__WEBPACK_IMPORTED_MODULE_1_katex___default.a.render(math, span, optionsCopy);
|
||||
} catch (e) {
|
||||
if (!(e instanceof __WEBPACK_IMPORTED_MODULE_1_katex___default.a.ParseError)) {
|
||||
throw e;
|
||||
}
|
||||
optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
|
||||
fragment.appendChild(document.createTextNode(data[i].rawData));
|
||||
continue;
|
||||
}
|
||||
fragment.appendChild(span);
|
||||
}
|
||||
}
|
||||
|
||||
return fragment;
|
||||
};
|
||||
|
||||
var renderElem = function renderElem(elem, optionsCopy) {
|
||||
for (var i = 0; i < elem.childNodes.length; i++) {
|
||||
var childNode = elem.childNodes[i];
|
||||
if (childNode.nodeType === 3) {
|
||||
// Text node
|
||||
var frag = renderMathInText(childNode.textContent, optionsCopy);
|
||||
i += frag.childNodes.length - 1;
|
||||
elem.replaceChild(frag, childNode);
|
||||
} else if (childNode.nodeType === 1) {
|
||||
// Element node
|
||||
var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1;
|
||||
|
||||
if (shouldRender) {
|
||||
renderElem(childNode, optionsCopy);
|
||||
}
|
||||
}
|
||||
// Otherwise, it's something else, and ignore it.
|
||||
}
|
||||
};
|
||||
|
||||
var defaultAutoRenderOptions = {
|
||||
delimiters: [{ left: "$$", right: "$$", display: true }, { left: "\\[", right: "\\]", display: true }, { left: "\\(", right: "\\)", display: false }],
|
||||
|
||||
ignoredTags: ["script", "noscript", "style", "textarea", "pre", "code"],
|
||||
|
||||
errorCallback: function errorCallback(msg, err) {
|
||||
console.error(msg, err);
|
||||
}
|
||||
};
|
||||
|
||||
var renderMathInElement = function renderMathInElement(elem, options) {
|
||||
if (!elem) {
|
||||
throw new Error("No element provided to render");
|
||||
}
|
||||
|
||||
var optionsCopy = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()({}, defaultAutoRenderOptions, options);
|
||||
renderElem(elem, optionsCopy);
|
||||
};
|
||||
|
||||
/* harmony default export */ __webpack_exports__["default"] = (renderMathInElement);
|
||||
|
||||
/***/ }),
|
||||
/* 10 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = { "default": __webpack_require__(11), __esModule: true };
|
||||
|
||||
/***/ }),
|
||||
/* 11 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
__webpack_require__(12);
|
||||
module.exports = __webpack_require__(4).Object.assign;
|
||||
|
||||
/***/ }),
|
||||
/* 12 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 19.1.3.1 Object.assign(target, source)
|
||||
var $export = __webpack_require__(13);
|
||||
|
||||
$export($export.S + $export.F, 'Object', {assign: __webpack_require__(23)});
|
||||
|
||||
/***/ }),
|
||||
/* 13 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var global = __webpack_require__(0)
|
||||
, core = __webpack_require__(4)
|
||||
, ctx = __webpack_require__(14)
|
||||
, hide = __webpack_require__(16)
|
||||
, PROTOTYPE = 'prototype';
|
||||
|
||||
var $export = function(type, name, source){
|
||||
var IS_FORCED = type & $export.F
|
||||
, IS_GLOBAL = type & $export.G
|
||||
, IS_STATIC = type & $export.S
|
||||
, IS_PROTO = type & $export.P
|
||||
, IS_BIND = type & $export.B
|
||||
, IS_WRAP = type & $export.W
|
||||
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
|
||||
, expProto = exports[PROTOTYPE]
|
||||
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
|
||||
, key, own, out;
|
||||
if(IS_GLOBAL)source = name;
|
||||
for(key in source){
|
||||
// contains in native
|
||||
own = !IS_FORCED && target && target[key] !== undefined;
|
||||
if(own && key in exports)continue;
|
||||
// export native or passed
|
||||
out = own ? target[key] : source[key];
|
||||
// prevent global pollution for namespaces
|
||||
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
|
||||
// bind timers to global for call from export context
|
||||
: IS_BIND && own ? ctx(out, global)
|
||||
// wrap global constructors for prevent change them in library
|
||||
: IS_WRAP && target[key] == out ? (function(C){
|
||||
var F = function(a, b, c){
|
||||
if(this instanceof C){
|
||||
switch(arguments.length){
|
||||
case 0: return new C;
|
||||
case 1: return new C(a);
|
||||
case 2: return new C(a, b);
|
||||
} return new C(a, b, c);
|
||||
} return C.apply(this, arguments);
|
||||
};
|
||||
F[PROTOTYPE] = C[PROTOTYPE];
|
||||
return F;
|
||||
// make static versions for prototype methods
|
||||
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
|
||||
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
|
||||
if(IS_PROTO){
|
||||
(exports.virtual || (exports.virtual = {}))[key] = out;
|
||||
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
|
||||
if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
|
||||
}
|
||||
}
|
||||
};
|
||||
// type bitmap
|
||||
$export.F = 1; // forced
|
||||
$export.G = 2; // global
|
||||
$export.S = 4; // static
|
||||
$export.P = 8; // proto
|
||||
$export.B = 16; // bind
|
||||
$export.W = 32; // wrap
|
||||
$export.U = 64; // safe
|
||||
$export.R = 128; // real proto method for `library`
|
||||
module.exports = $export;
|
||||
|
||||
/***/ }),
|
||||
/* 14 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// optional / simple context binding
|
||||
var aFunction = __webpack_require__(15);
|
||||
module.exports = function(fn, that, length){
|
||||
aFunction(fn);
|
||||
if(that === undefined)return fn;
|
||||
switch(length){
|
||||
case 1: return function(a){
|
||||
return fn.call(that, a);
|
||||
};
|
||||
case 2: return function(a, b){
|
||||
return fn.call(that, a, b);
|
||||
};
|
||||
case 3: return function(a, b, c){
|
||||
return fn.call(that, a, b, c);
|
||||
};
|
||||
}
|
||||
return function(/* ...args */){
|
||||
return fn.apply(that, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 15 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = function(it){
|
||||
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
|
||||
return it;
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 16 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var dP = __webpack_require__(17)
|
||||
, createDesc = __webpack_require__(22);
|
||||
module.exports = __webpack_require__(2) ? function(object, key, value){
|
||||
return dP.f(object, key, createDesc(1, value));
|
||||
} : function(object, key, value){
|
||||
object[key] = value;
|
||||
return object;
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 17 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var anObject = __webpack_require__(18)
|
||||
, IE8_DOM_DEFINE = __webpack_require__(19)
|
||||
, toPrimitive = __webpack_require__(21)
|
||||
, dP = Object.defineProperty;
|
||||
|
||||
exports.f = __webpack_require__(2) ? Object.defineProperty : function defineProperty(O, P, Attributes){
|
||||
anObject(O);
|
||||
P = toPrimitive(P, true);
|
||||
anObject(Attributes);
|
||||
if(IE8_DOM_DEFINE)try {
|
||||
return dP(O, P, Attributes);
|
||||
} catch(e){ /* empty */ }
|
||||
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
|
||||
if('value' in Attributes)O[P] = Attributes.value;
|
||||
return O;
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 18 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var isObject = __webpack_require__(1);
|
||||
module.exports = function(it){
|
||||
if(!isObject(it))throw TypeError(it + ' is not an object!');
|
||||
return it;
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 19 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = !__webpack_require__(2) && !__webpack_require__(3)(function(){
|
||||
return Object.defineProperty(__webpack_require__(20)('div'), 'a', {get: function(){ return 7; }}).a != 7;
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 20 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var isObject = __webpack_require__(1)
|
||||
, document = __webpack_require__(0).document
|
||||
// in old IE typeof document.createElement is 'object'
|
||||
, is = isObject(document) && isObject(document.createElement);
|
||||
module.exports = function(it){
|
||||
return is ? document.createElement(it) : {};
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 21 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 7.1.1 ToPrimitive(input [, PreferredType])
|
||||
var isObject = __webpack_require__(1);
|
||||
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
||||
// and the second argument - flag - preferred type is a string
|
||||
module.exports = function(it, S){
|
||||
if(!isObject(it))return it;
|
||||
var fn, val;
|
||||
if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
|
||||
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
|
||||
if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
|
||||
throw TypeError("Can't convert object to primitive value");
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 22 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = function(bitmap, value){
|
||||
return {
|
||||
enumerable : !(bitmap & 1),
|
||||
configurable: !(bitmap & 2),
|
||||
writable : !(bitmap & 4),
|
||||
value : value
|
||||
};
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 23 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// 19.1.2.1 Object.assign(target, source, ...)
|
||||
var getKeys = __webpack_require__(24)
|
||||
, gOPS = __webpack_require__(35)
|
||||
, pIE = __webpack_require__(36)
|
||||
, toObject = __webpack_require__(37)
|
||||
, IObject = __webpack_require__(6)
|
||||
, $assign = Object.assign;
|
||||
|
||||
// should work with symbols and should have deterministic property order (V8 bug)
|
||||
module.exports = !$assign || __webpack_require__(3)(function(){
|
||||
var A = {}
|
||||
, B = {}
|
||||
, S = Symbol()
|
||||
, K = 'abcdefghijklmnopqrst';
|
||||
A[S] = 7;
|
||||
K.split('').forEach(function(k){ B[k] = k; });
|
||||
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
|
||||
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
|
||||
var T = toObject(target)
|
||||
, aLen = arguments.length
|
||||
, index = 1
|
||||
, getSymbols = gOPS.f
|
||||
, isEnum = pIE.f;
|
||||
while(aLen > index){
|
||||
var S = IObject(arguments[index++])
|
||||
, keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
|
||||
, length = keys.length
|
||||
, j = 0
|
||||
, key;
|
||||
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
|
||||
} return T;
|
||||
} : $assign;
|
||||
|
||||
/***/ }),
|
||||
/* 24 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
|
||||
var $keys = __webpack_require__(25)
|
||||
, enumBugKeys = __webpack_require__(34);
|
||||
|
||||
module.exports = Object.keys || function keys(O){
|
||||
return $keys(O, enumBugKeys);
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 25 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var has = __webpack_require__(26)
|
||||
, toIObject = __webpack_require__(5)
|
||||
, arrayIndexOf = __webpack_require__(28)(false)
|
||||
, IE_PROTO = __webpack_require__(31)('IE_PROTO');
|
||||
|
||||
module.exports = function(object, names){
|
||||
var O = toIObject(object)
|
||||
, i = 0
|
||||
, result = []
|
||||
, key;
|
||||
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
|
||||
// Don't enum bug & hidden keys
|
||||
while(names.length > i)if(has(O, key = names[i++])){
|
||||
~arrayIndexOf(result, key) || result.push(key);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 26 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var hasOwnProperty = {}.hasOwnProperty;
|
||||
module.exports = function(it, key){
|
||||
return hasOwnProperty.call(it, key);
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 27 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var toString = {}.toString;
|
||||
|
||||
module.exports = function(it){
|
||||
return toString.call(it).slice(8, -1);
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 28 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// false -> Array#indexOf
|
||||
// true -> Array#includes
|
||||
var toIObject = __webpack_require__(5)
|
||||
, toLength = __webpack_require__(29)
|
||||
, toIndex = __webpack_require__(30);
|
||||
module.exports = function(IS_INCLUDES){
|
||||
return function($this, el, fromIndex){
|
||||
var O = toIObject($this)
|
||||
, length = toLength(O.length)
|
||||
, index = toIndex(fromIndex, length)
|
||||
, value;
|
||||
// Array#includes uses SameValueZero equality algorithm
|
||||
if(IS_INCLUDES && el != el)while(length > index){
|
||||
value = O[index++];
|
||||
if(value != value)return true;
|
||||
// Array#toIndex ignores holes, Array#includes - not
|
||||
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
|
||||
if(O[index] === el)return IS_INCLUDES || index || 0;
|
||||
} return !IS_INCLUDES && -1;
|
||||
};
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 29 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 7.1.15 ToLength
|
||||
var toInteger = __webpack_require__(8)
|
||||
, min = Math.min;
|
||||
module.exports = function(it){
|
||||
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 30 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var toInteger = __webpack_require__(8)
|
||||
, max = Math.max
|
||||
, min = Math.min;
|
||||
module.exports = function(index, length){
|
||||
index = toInteger(index);
|
||||
return index < 0 ? max(index + length, 0) : min(index, length);
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 31 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var shared = __webpack_require__(32)('keys')
|
||||
, uid = __webpack_require__(33);
|
||||
module.exports = function(key){
|
||||
return shared[key] || (shared[key] = uid(key));
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 32 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var global = __webpack_require__(0)
|
||||
, SHARED = '__core-js_shared__'
|
||||
, store = global[SHARED] || (global[SHARED] = {});
|
||||
module.exports = function(key){
|
||||
return store[key] || (store[key] = {});
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 33 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var id = 0
|
||||
, px = Math.random();
|
||||
module.exports = function(key){
|
||||
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 34 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
// IE 8- don't enum bug keys
|
||||
module.exports = (
|
||||
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
|
||||
).split(',');
|
||||
|
||||
/***/ }),
|
||||
/* 35 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
exports.f = Object.getOwnPropertySymbols;
|
||||
|
||||
/***/ }),
|
||||
/* 36 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
exports.f = {}.propertyIsEnumerable;
|
||||
|
||||
/***/ }),
|
||||
/* 37 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// 7.1.13 ToObject(argument)
|
||||
var defined = __webpack_require__(7);
|
||||
module.exports = function(it){
|
||||
return Object(defined(it));
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 38 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE_38__;
|
||||
|
||||
/***/ }),
|
||||
/* 39 */
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/* eslint no-constant-condition:0 */
|
||||
var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
|
||||
// Adapted from
|
||||
// https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
|
||||
var index = startIndex;
|
||||
var braceLevel = 0;
|
||||
|
||||
var delimLength = delimiter.length;
|
||||
|
||||
while (index < text.length) {
|
||||
var character = text[index];
|
||||
|
||||
if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
|
||||
return index;
|
||||
} else if (character === "\\") {
|
||||
index++;
|
||||
} else if (character === "{") {
|
||||
braceLevel++;
|
||||
} else if (character === "}") {
|
||||
braceLevel--;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
var splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) {
|
||||
var finalData = [];
|
||||
|
||||
for (var i = 0; i < startData.length; i++) {
|
||||
if (startData[i].type === "text") {
|
||||
var text = startData[i].data;
|
||||
|
||||
var lookingForLeft = true;
|
||||
var currIndex = 0;
|
||||
var nextIndex = void 0;
|
||||
|
||||
nextIndex = text.indexOf(leftDelim);
|
||||
if (nextIndex !== -1) {
|
||||
currIndex = nextIndex;
|
||||
finalData.push({
|
||||
type: "text",
|
||||
data: text.slice(0, currIndex)
|
||||
});
|
||||
lookingForLeft = false;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (lookingForLeft) {
|
||||
nextIndex = text.indexOf(leftDelim, currIndex);
|
||||
if (nextIndex === -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
finalData.push({
|
||||
type: "text",
|
||||
data: text.slice(currIndex, nextIndex)
|
||||
});
|
||||
|
||||
currIndex = nextIndex;
|
||||
} else {
|
||||
nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length);
|
||||
if (nextIndex === -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
finalData.push({
|
||||
type: "math",
|
||||
data: text.slice(currIndex + leftDelim.length, nextIndex),
|
||||
rawData: text.slice(currIndex, nextIndex + rightDelim.length),
|
||||
display: display
|
||||
});
|
||||
|
||||
currIndex = nextIndex + rightDelim.length;
|
||||
}
|
||||
|
||||
lookingForLeft = !lookingForLeft;
|
||||
}
|
||||
|
||||
finalData.push({
|
||||
type: "text",
|
||||
data: text.slice(currIndex)
|
||||
});
|
||||
} else {
|
||||
finalData.push(startData[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return finalData;
|
||||
};
|
||||
|
||||
/* harmony default export */ __webpack_exports__["a"] = (splitAtDelimiters);
|
||||
|
||||
/***/ })
|
||||
/******/ ])["default"];
|
||||
});
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,994 +0,0 @@
|
||||
@font-face {
|
||||
font-family: 'KaTeX_AMS';
|
||||
src: url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'), url(fonts/KaTeX_AMS-Regular.woff) format('woff'), url(fonts/KaTeX_AMS-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Caligraphic';
|
||||
src: url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'), url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'), url(fonts/KaTeX_Caligraphic-Bold.ttf) format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Caligraphic';
|
||||
src: url(fonts/KaTeX_Caligraphic-Regular.woff2) format('woff2'), url(fonts/KaTeX_Caligraphic-Regular.woff) format('woff'), url(fonts/KaTeX_Caligraphic-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Fraktur';
|
||||
src: url(fonts/KaTeX_Fraktur-Bold.woff2) format('woff2'), url(fonts/KaTeX_Fraktur-Bold.woff) format('woff'), url(fonts/KaTeX_Fraktur-Bold.ttf) format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Fraktur';
|
||||
src: url(fonts/KaTeX_Fraktur-Regular.woff2) format('woff2'), url(fonts/KaTeX_Fraktur-Regular.woff) format('woff'), url(fonts/KaTeX_Fraktur-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Main';
|
||||
src: url(fonts/KaTeX_Main-Bold.woff2) format('woff2'), url(fonts/KaTeX_Main-Bold.woff) format('woff'), url(fonts/KaTeX_Main-Bold.ttf) format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Main';
|
||||
src: url(fonts/KaTeX_Main-BoldItalic.woff2) format('woff2'), url(fonts/KaTeX_Main-BoldItalic.woff) format('woff'), url(fonts/KaTeX_Main-BoldItalic.ttf) format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Main';
|
||||
src: url(fonts/KaTeX_Main-Italic.woff2) format('woff2'), url(fonts/KaTeX_Main-Italic.woff) format('woff'), url(fonts/KaTeX_Main-Italic.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Main';
|
||||
src: url(fonts/KaTeX_Main-Regular.woff2) format('woff2'), url(fonts/KaTeX_Main-Regular.woff) format('woff'), url(fonts/KaTeX_Main-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Math';
|
||||
src: url(fonts/KaTeX_Math-Italic.woff2) format('woff2'), url(fonts/KaTeX_Math-Italic.woff) format('woff'), url(fonts/KaTeX_Math-Italic.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_SansSerif';
|
||||
src: url(fonts/KaTeX_SansSerif-Bold.woff2) format('woff2'), url(fonts/KaTeX_SansSerif-Bold.woff) format('woff'), url(fonts/KaTeX_SansSerif-Bold.ttf) format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_SansSerif';
|
||||
src: url(fonts/KaTeX_SansSerif-Italic.woff2) format('woff2'), url(fonts/KaTeX_SansSerif-Italic.woff) format('woff'), url(fonts/KaTeX_SansSerif-Italic.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_SansSerif';
|
||||
src: url(fonts/KaTeX_SansSerif-Regular.woff2) format('woff2'), url(fonts/KaTeX_SansSerif-Regular.woff) format('woff'), url(fonts/KaTeX_SansSerif-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Script';
|
||||
src: url(fonts/KaTeX_Script-Regular.woff2) format('woff2'), url(fonts/KaTeX_Script-Regular.woff) format('woff'), url(fonts/KaTeX_Script-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Size1';
|
||||
src: url(fonts/KaTeX_Size1-Regular.woff2) format('woff2'), url(fonts/KaTeX_Size1-Regular.woff) format('woff'), url(fonts/KaTeX_Size1-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Size2';
|
||||
src: url(fonts/KaTeX_Size2-Regular.woff2) format('woff2'), url(fonts/KaTeX_Size2-Regular.woff) format('woff'), url(fonts/KaTeX_Size2-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Size3';
|
||||
src: url(fonts/KaTeX_Size3-Regular.woff2) format('woff2'), url(fonts/KaTeX_Size3-Regular.woff) format('woff'), url(fonts/KaTeX_Size3-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Size4';
|
||||
src: url(fonts/KaTeX_Size4-Regular.woff2) format('woff2'), url(fonts/KaTeX_Size4-Regular.woff) format('woff'), url(fonts/KaTeX_Size4-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'KaTeX_Typewriter';
|
||||
src: url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'), url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'), url(fonts/KaTeX_Typewriter-Regular.ttf) format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
.katex-display {
|
||||
display: block;
|
||||
margin: 1em 0;
|
||||
text-align: center;
|
||||
}
|
||||
.katex-display > .katex {
|
||||
display: inline-block;
|
||||
text-align: initial;
|
||||
}
|
||||
.katex {
|
||||
font: normal 1.21em KaTeX_Main, Times New Roman, serif;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
text-indent: 0;
|
||||
text-rendering: auto;
|
||||
}
|
||||
.katex * {
|
||||
-ms-high-contrast-adjust: none !important;
|
||||
}
|
||||
.katex .katex-html {
|
||||
display: inline-block;
|
||||
}
|
||||
.katex .katex-mathml {
|
||||
position: absolute;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
padding: 0;
|
||||
border: 0;
|
||||
height: 1px;
|
||||
width: 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.katex .base {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
.katex .strut {
|
||||
display: inline-block;
|
||||
}
|
||||
.katex .textbf {
|
||||
font-weight: bold;
|
||||
}
|
||||
.katex .textit {
|
||||
font-style: italic;
|
||||
}
|
||||
.katex .textrm {
|
||||
font-family: KaTeX_Main;
|
||||
}
|
||||
.katex .textsf {
|
||||
font-family: KaTeX_SansSerif;
|
||||
}
|
||||
.katex .texttt {
|
||||
font-family: KaTeX_Typewriter;
|
||||
}
|
||||
.katex .mathit {
|
||||
font-family: KaTeX_Math;
|
||||
font-style: italic;
|
||||
}
|
||||
.katex .mathrm {
|
||||
font-style: normal;
|
||||
}
|
||||
.katex .mathbf {
|
||||
font-family: KaTeX_Main;
|
||||
font-weight: bold;
|
||||
}
|
||||
.katex .boldsymbol {
|
||||
font-family: KaTeX_Math;
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
.katex .amsrm {
|
||||
font-family: KaTeX_AMS;
|
||||
}
|
||||
.katex .mathbb {
|
||||
font-family: KaTeX_AMS;
|
||||
}
|
||||
.katex .mathcal {
|
||||
font-family: KaTeX_Caligraphic;
|
||||
}
|
||||
.katex .mathfrak {
|
||||
font-family: KaTeX_Fraktur;
|
||||
}
|
||||
.katex .mathtt {
|
||||
font-family: KaTeX_Typewriter;
|
||||
}
|
||||
.katex .mathscr {
|
||||
font-family: KaTeX_Script;
|
||||
}
|
||||
.katex .mathsf {
|
||||
font-family: KaTeX_SansSerif;
|
||||
}
|
||||
.katex .mainit {
|
||||
font-family: KaTeX_Main;
|
||||
font-style: italic;
|
||||
}
|
||||
.katex .mainrm {
|
||||
font-family: KaTeX_Main;
|
||||
font-style: normal;
|
||||
}
|
||||
.katex .vlist-t {
|
||||
display: inline-table;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.katex .vlist-r {
|
||||
display: table-row;
|
||||
}
|
||||
.katex .vlist {
|
||||
display: table-cell;
|
||||
vertical-align: bottom;
|
||||
position: relative;
|
||||
}
|
||||
.katex .vlist > span {
|
||||
display: block;
|
||||
height: 0;
|
||||
position: relative;
|
||||
}
|
||||
.katex .vlist > span > span {
|
||||
display: inline-block;
|
||||
}
|
||||
.katex .vlist > span > .pstrut {
|
||||
overflow: hidden;
|
||||
width: 0;
|
||||
}
|
||||
.katex .vlist-t2 {
|
||||
margin-right: -2px;
|
||||
}
|
||||
.katex .vlist-s {
|
||||
display: table-cell;
|
||||
vertical-align: bottom;
|
||||
font-size: 1px;
|
||||
width: 2px;
|
||||
}
|
||||
.katex .msupsub {
|
||||
text-align: left;
|
||||
}
|
||||
.katex .mfrac > span > span {
|
||||
text-align: center;
|
||||
}
|
||||
.katex .mfrac .frac-line {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
.katex .mspace {
|
||||
display: inline-block;
|
||||
}
|
||||
.katex .mspace.negativethinspace {
|
||||
margin-left: -0.16667em;
|
||||
}
|
||||
.katex .mspace.muspace {
|
||||
width: 0.055556em;
|
||||
}
|
||||
.katex .mspace.thinspace {
|
||||
width: 0.16667em;
|
||||
}
|
||||
.katex .mspace.negativemediumspace {
|
||||
margin-left: -0.22222em;
|
||||
}
|
||||
.katex .mspace.mediumspace {
|
||||
width: 0.22222em;
|
||||
}
|
||||
.katex .mspace.thickspace {
|
||||
width: 0.27778em;
|
||||
}
|
||||
.katex .mspace.sixmuspace {
|
||||
width: 0.333333em;
|
||||
}
|
||||
.katex .mspace.eightmuspace {
|
||||
width: 0.444444em;
|
||||
}
|
||||
.katex .mspace.enspace {
|
||||
width: 0.5em;
|
||||
}
|
||||
.katex .mspace.twelvemuspace {
|
||||
width: 0.666667em;
|
||||
}
|
||||
.katex .mspace.quad {
|
||||
width: 1em;
|
||||
}
|
||||
.katex .mspace.qquad {
|
||||
width: 2em;
|
||||
}
|
||||
.katex .llap,
|
||||
.katex .rlap,
|
||||
.katex .clap {
|
||||
width: 0;
|
||||
position: relative;
|
||||
}
|
||||
.katex .llap > .inner,
|
||||
.katex .rlap > .inner,
|
||||
.katex .clap > .inner {
|
||||
position: absolute;
|
||||
}
|
||||
.katex .llap > .fix,
|
||||
.katex .rlap > .fix,
|
||||
.katex .clap > .fix {
|
||||
display: inline-block;
|
||||
}
|
||||
.katex .llap > .inner {
|
||||
right: 0;
|
||||
}
|
||||
.katex .rlap > .inner,
|
||||
.katex .clap > .inner {
|
||||
left: 0;
|
||||
}
|
||||
.katex .clap > .inner > span {
|
||||
margin-left: -50%;
|
||||
margin-right: 50%;
|
||||
}
|
||||
.katex .rule {
|
||||
display: inline-block;
|
||||
border: solid 0;
|
||||
position: relative;
|
||||
}
|
||||
.katex .overline .overline-line,
|
||||
.katex .underline .underline-line {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
.katex .sqrt > .root {
|
||||
margin-left: 0.27777778em;
|
||||
margin-right: -0.55555556em;
|
||||
}
|
||||
.katex .sizing,
|
||||
.katex .fontsize-ensurer {
|
||||
display: inline-block;
|
||||
}
|
||||
.katex .sizing.reset-size1.size1,
|
||||
.katex .fontsize-ensurer.reset-size1.size1 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size2,
|
||||
.katex .fontsize-ensurer.reset-size1.size2 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size3,
|
||||
.katex .fontsize-ensurer.reset-size1.size3 {
|
||||
font-size: 1.4em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size4,
|
||||
.katex .fontsize-ensurer.reset-size1.size4 {
|
||||
font-size: 1.6em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size5,
|
||||
.katex .fontsize-ensurer.reset-size1.size5 {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size6,
|
||||
.katex .fontsize-ensurer.reset-size1.size6 {
|
||||
font-size: 2em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size7,
|
||||
.katex .fontsize-ensurer.reset-size1.size7 {
|
||||
font-size: 2.4em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size8,
|
||||
.katex .fontsize-ensurer.reset-size1.size8 {
|
||||
font-size: 2.88em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size9,
|
||||
.katex .fontsize-ensurer.reset-size1.size9 {
|
||||
font-size: 3.456em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size10,
|
||||
.katex .fontsize-ensurer.reset-size1.size10 {
|
||||
font-size: 4.148em;
|
||||
}
|
||||
.katex .sizing.reset-size1.size11,
|
||||
.katex .fontsize-ensurer.reset-size1.size11 {
|
||||
font-size: 4.976em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size1,
|
||||
.katex .fontsize-ensurer.reset-size2.size1 {
|
||||
font-size: 0.83333333em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size2,
|
||||
.katex .fontsize-ensurer.reset-size2.size2 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size3,
|
||||
.katex .fontsize-ensurer.reset-size2.size3 {
|
||||
font-size: 1.16666667em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size4,
|
||||
.katex .fontsize-ensurer.reset-size2.size4 {
|
||||
font-size: 1.33333333em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size5,
|
||||
.katex .fontsize-ensurer.reset-size2.size5 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size6,
|
||||
.katex .fontsize-ensurer.reset-size2.size6 {
|
||||
font-size: 1.66666667em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size7,
|
||||
.katex .fontsize-ensurer.reset-size2.size7 {
|
||||
font-size: 2em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size8,
|
||||
.katex .fontsize-ensurer.reset-size2.size8 {
|
||||
font-size: 2.4em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size9,
|
||||
.katex .fontsize-ensurer.reset-size2.size9 {
|
||||
font-size: 2.88em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size10,
|
||||
.katex .fontsize-ensurer.reset-size2.size10 {
|
||||
font-size: 3.45666667em;
|
||||
}
|
||||
.katex .sizing.reset-size2.size11,
|
||||
.katex .fontsize-ensurer.reset-size2.size11 {
|
||||
font-size: 4.14666667em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size1,
|
||||
.katex .fontsize-ensurer.reset-size3.size1 {
|
||||
font-size: 0.71428571em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size2,
|
||||
.katex .fontsize-ensurer.reset-size3.size2 {
|
||||
font-size: 0.85714286em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size3,
|
||||
.katex .fontsize-ensurer.reset-size3.size3 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size4,
|
||||
.katex .fontsize-ensurer.reset-size3.size4 {
|
||||
font-size: 1.14285714em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size5,
|
||||
.katex .fontsize-ensurer.reset-size3.size5 {
|
||||
font-size: 1.28571429em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size6,
|
||||
.katex .fontsize-ensurer.reset-size3.size6 {
|
||||
font-size: 1.42857143em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size7,
|
||||
.katex .fontsize-ensurer.reset-size3.size7 {
|
||||
font-size: 1.71428571em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size8,
|
||||
.katex .fontsize-ensurer.reset-size3.size8 {
|
||||
font-size: 2.05714286em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size9,
|
||||
.katex .fontsize-ensurer.reset-size3.size9 {
|
||||
font-size: 2.46857143em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size10,
|
||||
.katex .fontsize-ensurer.reset-size3.size10 {
|
||||
font-size: 2.96285714em;
|
||||
}
|
||||
.katex .sizing.reset-size3.size11,
|
||||
.katex .fontsize-ensurer.reset-size3.size11 {
|
||||
font-size: 3.55428571em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size1,
|
||||
.katex .fontsize-ensurer.reset-size4.size1 {
|
||||
font-size: 0.625em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size2,
|
||||
.katex .fontsize-ensurer.reset-size4.size2 {
|
||||
font-size: 0.75em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size3,
|
||||
.katex .fontsize-ensurer.reset-size4.size3 {
|
||||
font-size: 0.875em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size4,
|
||||
.katex .fontsize-ensurer.reset-size4.size4 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size5,
|
||||
.katex .fontsize-ensurer.reset-size4.size5 {
|
||||
font-size: 1.125em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size6,
|
||||
.katex .fontsize-ensurer.reset-size4.size6 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size7,
|
||||
.katex .fontsize-ensurer.reset-size4.size7 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size8,
|
||||
.katex .fontsize-ensurer.reset-size4.size8 {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size9,
|
||||
.katex .fontsize-ensurer.reset-size4.size9 {
|
||||
font-size: 2.16em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size10,
|
||||
.katex .fontsize-ensurer.reset-size4.size10 {
|
||||
font-size: 2.5925em;
|
||||
}
|
||||
.katex .sizing.reset-size4.size11,
|
||||
.katex .fontsize-ensurer.reset-size4.size11 {
|
||||
font-size: 3.11em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size1,
|
||||
.katex .fontsize-ensurer.reset-size5.size1 {
|
||||
font-size: 0.55555556em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size2,
|
||||
.katex .fontsize-ensurer.reset-size5.size2 {
|
||||
font-size: 0.66666667em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size3,
|
||||
.katex .fontsize-ensurer.reset-size5.size3 {
|
||||
font-size: 0.77777778em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size4,
|
||||
.katex .fontsize-ensurer.reset-size5.size4 {
|
||||
font-size: 0.88888889em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size5,
|
||||
.katex .fontsize-ensurer.reset-size5.size5 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size6,
|
||||
.katex .fontsize-ensurer.reset-size5.size6 {
|
||||
font-size: 1.11111111em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size7,
|
||||
.katex .fontsize-ensurer.reset-size5.size7 {
|
||||
font-size: 1.33333333em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size8,
|
||||
.katex .fontsize-ensurer.reset-size5.size8 {
|
||||
font-size: 1.6em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size9,
|
||||
.katex .fontsize-ensurer.reset-size5.size9 {
|
||||
font-size: 1.92em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size10,
|
||||
.katex .fontsize-ensurer.reset-size5.size10 {
|
||||
font-size: 2.30444444em;
|
||||
}
|
||||
.katex .sizing.reset-size5.size11,
|
||||
.katex .fontsize-ensurer.reset-size5.size11 {
|
||||
font-size: 2.76444444em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size1,
|
||||
.katex .fontsize-ensurer.reset-size6.size1 {
|
||||
font-size: 0.5em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size2,
|
||||
.katex .fontsize-ensurer.reset-size6.size2 {
|
||||
font-size: 0.6em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size3,
|
||||
.katex .fontsize-ensurer.reset-size6.size3 {
|
||||
font-size: 0.7em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size4,
|
||||
.katex .fontsize-ensurer.reset-size6.size4 {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size5,
|
||||
.katex .fontsize-ensurer.reset-size6.size5 {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size6,
|
||||
.katex .fontsize-ensurer.reset-size6.size6 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size7,
|
||||
.katex .fontsize-ensurer.reset-size6.size7 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size8,
|
||||
.katex .fontsize-ensurer.reset-size6.size8 {
|
||||
font-size: 1.44em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size9,
|
||||
.katex .fontsize-ensurer.reset-size6.size9 {
|
||||
font-size: 1.728em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size10,
|
||||
.katex .fontsize-ensurer.reset-size6.size10 {
|
||||
font-size: 2.074em;
|
||||
}
|
||||
.katex .sizing.reset-size6.size11,
|
||||
.katex .fontsize-ensurer.reset-size6.size11 {
|
||||
font-size: 2.488em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size1,
|
||||
.katex .fontsize-ensurer.reset-size7.size1 {
|
||||
font-size: 0.41666667em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size2,
|
||||
.katex .fontsize-ensurer.reset-size7.size2 {
|
||||
font-size: 0.5em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size3,
|
||||
.katex .fontsize-ensurer.reset-size7.size3 {
|
||||
font-size: 0.58333333em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size4,
|
||||
.katex .fontsize-ensurer.reset-size7.size4 {
|
||||
font-size: 0.66666667em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size5,
|
||||
.katex .fontsize-ensurer.reset-size7.size5 {
|
||||
font-size: 0.75em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size6,
|
||||
.katex .fontsize-ensurer.reset-size7.size6 {
|
||||
font-size: 0.83333333em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size7,
|
||||
.katex .fontsize-ensurer.reset-size7.size7 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size8,
|
||||
.katex .fontsize-ensurer.reset-size7.size8 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size9,
|
||||
.katex .fontsize-ensurer.reset-size7.size9 {
|
||||
font-size: 1.44em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size10,
|
||||
.katex .fontsize-ensurer.reset-size7.size10 {
|
||||
font-size: 1.72833333em;
|
||||
}
|
||||
.katex .sizing.reset-size7.size11,
|
||||
.katex .fontsize-ensurer.reset-size7.size11 {
|
||||
font-size: 2.07333333em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size1,
|
||||
.katex .fontsize-ensurer.reset-size8.size1 {
|
||||
font-size: 0.34722222em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size2,
|
||||
.katex .fontsize-ensurer.reset-size8.size2 {
|
||||
font-size: 0.41666667em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size3,
|
||||
.katex .fontsize-ensurer.reset-size8.size3 {
|
||||
font-size: 0.48611111em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size4,
|
||||
.katex .fontsize-ensurer.reset-size8.size4 {
|
||||
font-size: 0.55555556em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size5,
|
||||
.katex .fontsize-ensurer.reset-size8.size5 {
|
||||
font-size: 0.625em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size6,
|
||||
.katex .fontsize-ensurer.reset-size8.size6 {
|
||||
font-size: 0.69444444em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size7,
|
||||
.katex .fontsize-ensurer.reset-size8.size7 {
|
||||
font-size: 0.83333333em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size8,
|
||||
.katex .fontsize-ensurer.reset-size8.size8 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size9,
|
||||
.katex .fontsize-ensurer.reset-size8.size9 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size10,
|
||||
.katex .fontsize-ensurer.reset-size8.size10 {
|
||||
font-size: 1.44027778em;
|
||||
}
|
||||
.katex .sizing.reset-size8.size11,
|
||||
.katex .fontsize-ensurer.reset-size8.size11 {
|
||||
font-size: 1.72777778em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size1,
|
||||
.katex .fontsize-ensurer.reset-size9.size1 {
|
||||
font-size: 0.28935185em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size2,
|
||||
.katex .fontsize-ensurer.reset-size9.size2 {
|
||||
font-size: 0.34722222em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size3,
|
||||
.katex .fontsize-ensurer.reset-size9.size3 {
|
||||
font-size: 0.40509259em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size4,
|
||||
.katex .fontsize-ensurer.reset-size9.size4 {
|
||||
font-size: 0.46296296em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size5,
|
||||
.katex .fontsize-ensurer.reset-size9.size5 {
|
||||
font-size: 0.52083333em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size6,
|
||||
.katex .fontsize-ensurer.reset-size9.size6 {
|
||||
font-size: 0.5787037em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size7,
|
||||
.katex .fontsize-ensurer.reset-size9.size7 {
|
||||
font-size: 0.69444444em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size8,
|
||||
.katex .fontsize-ensurer.reset-size9.size8 {
|
||||
font-size: 0.83333333em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size9,
|
||||
.katex .fontsize-ensurer.reset-size9.size9 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size10,
|
||||
.katex .fontsize-ensurer.reset-size9.size10 {
|
||||
font-size: 1.20023148em;
|
||||
}
|
||||
.katex .sizing.reset-size9.size11,
|
||||
.katex .fontsize-ensurer.reset-size9.size11 {
|
||||
font-size: 1.43981481em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size1,
|
||||
.katex .fontsize-ensurer.reset-size10.size1 {
|
||||
font-size: 0.24108004em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size2,
|
||||
.katex .fontsize-ensurer.reset-size10.size2 {
|
||||
font-size: 0.28929605em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size3,
|
||||
.katex .fontsize-ensurer.reset-size10.size3 {
|
||||
font-size: 0.33751205em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size4,
|
||||
.katex .fontsize-ensurer.reset-size10.size4 {
|
||||
font-size: 0.38572806em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size5,
|
||||
.katex .fontsize-ensurer.reset-size10.size5 {
|
||||
font-size: 0.43394407em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size6,
|
||||
.katex .fontsize-ensurer.reset-size10.size6 {
|
||||
font-size: 0.48216008em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size7,
|
||||
.katex .fontsize-ensurer.reset-size10.size7 {
|
||||
font-size: 0.57859209em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size8,
|
||||
.katex .fontsize-ensurer.reset-size10.size8 {
|
||||
font-size: 0.69431051em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size9,
|
||||
.katex .fontsize-ensurer.reset-size10.size9 {
|
||||
font-size: 0.83317261em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size10,
|
||||
.katex .fontsize-ensurer.reset-size10.size10 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .sizing.reset-size10.size11,
|
||||
.katex .fontsize-ensurer.reset-size10.size11 {
|
||||
font-size: 1.19961427em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size1,
|
||||
.katex .fontsize-ensurer.reset-size11.size1 {
|
||||
font-size: 0.20096463em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size2,
|
||||
.katex .fontsize-ensurer.reset-size11.size2 {
|
||||
font-size: 0.24115756em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size3,
|
||||
.katex .fontsize-ensurer.reset-size11.size3 {
|
||||
font-size: 0.28135048em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size4,
|
||||
.katex .fontsize-ensurer.reset-size11.size4 {
|
||||
font-size: 0.32154341em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size5,
|
||||
.katex .fontsize-ensurer.reset-size11.size5 {
|
||||
font-size: 0.36173633em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size6,
|
||||
.katex .fontsize-ensurer.reset-size11.size6 {
|
||||
font-size: 0.40192926em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size7,
|
||||
.katex .fontsize-ensurer.reset-size11.size7 {
|
||||
font-size: 0.48231511em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size8,
|
||||
.katex .fontsize-ensurer.reset-size11.size8 {
|
||||
font-size: 0.57877814em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size9,
|
||||
.katex .fontsize-ensurer.reset-size11.size9 {
|
||||
font-size: 0.69453376em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size10,
|
||||
.katex .fontsize-ensurer.reset-size11.size10 {
|
||||
font-size: 0.83360129em;
|
||||
}
|
||||
.katex .sizing.reset-size11.size11,
|
||||
.katex .fontsize-ensurer.reset-size11.size11 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.katex .delimsizing.size1 {
|
||||
font-family: KaTeX_Size1;
|
||||
}
|
||||
.katex .delimsizing.size2 {
|
||||
font-family: KaTeX_Size2;
|
||||
}
|
||||
.katex .delimsizing.size3 {
|
||||
font-family: KaTeX_Size3;
|
||||
}
|
||||
.katex .delimsizing.size4 {
|
||||
font-family: KaTeX_Size4;
|
||||
}
|
||||
.katex .delimsizing.mult .delim-size1 > span {
|
||||
font-family: KaTeX_Size1;
|
||||
}
|
||||
.katex .delimsizing.mult .delim-size4 > span {
|
||||
font-family: KaTeX_Size4;
|
||||
}
|
||||
.katex .nulldelimiter {
|
||||
display: inline-block;
|
||||
width: 0.12em;
|
||||
}
|
||||
.katex .delimcenter {
|
||||
position: relative;
|
||||
}
|
||||
.katex .op-symbol {
|
||||
position: relative;
|
||||
}
|
||||
.katex .op-symbol.small-op {
|
||||
font-family: KaTeX_Size1;
|
||||
}
|
||||
.katex .op-symbol.large-op {
|
||||
font-family: KaTeX_Size2;
|
||||
}
|
||||
.katex .op-limits > .vlist-t {
|
||||
text-align: center;
|
||||
}
|
||||
.katex .accent > .vlist-t {
|
||||
text-align: center;
|
||||
}
|
||||
.katex .accent .accent-body {
|
||||
width: 0;
|
||||
position: relative;
|
||||
}
|
||||
.katex .overlay {
|
||||
display: block;
|
||||
}
|
||||
.katex .mtable .vertical-separator {
|
||||
display: inline-block;
|
||||
margin: 0 -0.125em;
|
||||
width: 0.25em;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
.katex .mtable .arraycolsep {
|
||||
display: inline-block;
|
||||
}
|
||||
.katex .mtable .col-align-c > .vlist-t {
|
||||
text-align: center;
|
||||
}
|
||||
.katex .mtable .col-align-l > .vlist-t {
|
||||
text-align: left;
|
||||
}
|
||||
.katex .mtable .col-align-r > .vlist-t {
|
||||
text-align: right;
|
||||
}
|
||||
.katex .svg-align {
|
||||
text-align: left;
|
||||
}
|
||||
.katex svg {
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
fill: currentColor;
|
||||
stroke: currentColor;
|
||||
fill-rule: nonzero;
|
||||
fill-opacity: 1;
|
||||
stroke-width: 1;
|
||||
stroke-linecap: butt;
|
||||
stroke-linejoin: miter;
|
||||
stroke-miterlimit: 4;
|
||||
stroke-dasharray: none;
|
||||
stroke-dashoffset: 0;
|
||||
stroke-opacity: 1;
|
||||
}
|
||||
.katex svg path {
|
||||
stroke: none;
|
||||
}
|
||||
.katex .vertical-separator svg {
|
||||
width: 0.25em;
|
||||
}
|
||||
.katex .stretchy {
|
||||
width: 100%;
|
||||
display: block;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.katex .stretchy:before,
|
||||
.katex .stretchy:after {
|
||||
content: "";
|
||||
}
|
||||
.katex .hide-tail {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.katex .halfarrow-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 50.2%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.katex .halfarrow-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 50.2%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.katex .brace-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 25.1%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.katex .brace-center {
|
||||
position: absolute;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.katex .brace-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 25.1%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.katex .x-arrow-pad {
|
||||
padding: 0 0.5em;
|
||||
}
|
||||
.katex .x-arrow,
|
||||
.katex .mover,
|
||||
.katex .munder {
|
||||
text-align: center;
|
||||
}
|
||||
.katex .boxpad {
|
||||
padding: 0 0.3em 0 0.3em;
|
||||
}
|
||||
.katex .fbox {
|
||||
box-sizing: border-box;
|
||||
border: 0.04em solid black;
|
||||
}
|
||||
.katex .fcolorbox {
|
||||
box-sizing: border-box;
|
||||
border: 0.04em solid;
|
||||
}
|
||||
.katex .cancel-pad {
|
||||
padding: 0 0.2em 0 0.2em;
|
||||
}
|
||||
.katex .mord + .cancel-lap,
|
||||
.katex .mbin + .cancel-lap {
|
||||
margin-left: -0.2em;
|
||||
}
|
||||
.katex .cancel-lap + .mord,
|
||||
.katex .cancel-lap + .mbin,
|
||||
.katex .cancel-lap + .msupsub {
|
||||
margin-left: -0.2em;
|
||||
}
|
||||
.katex .sout {
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 0.08em;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,435 +0,0 @@
|
||||
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
# AnTOS Web desktop is is licensed under the GNU General Public
|
||||
# License v3.0, see the LICENCE file for more information
|
||||
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
class Blogger extends this.OS.GUI.BaseApplication
|
||||
constructor: (args) ->
|
||||
super "Blogger", args
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
@tabbar = @find "tabbar"
|
||||
@containers = [
|
||||
@find("user-container"),
|
||||
@find("cv-container"),
|
||||
@find("blog-container")
|
||||
]
|
||||
@user = {}
|
||||
@cvlist = @find "cv-list"
|
||||
@cvlist.set "ontreeselect", (d) ->
|
||||
me.CVSectionByCID Number(d.id)
|
||||
@inputtags = @.find "input-tags"
|
||||
@bloglist = @find "blog-list"
|
||||
@userdb = new @_api.DB("user")
|
||||
@cvcatdb = new @_api.DB("cv_cat")
|
||||
@cvsecdb = new @_api.DB("cv_sections")
|
||||
@blogdb = new @_api.DB("blogs")
|
||||
@tabbar.set "onlistselect", (e) ->
|
||||
($ el).hide() for el in me.containers
|
||||
me.fetchData e.idx
|
||||
($ me.containers[e.idx]).show()
|
||||
me.trigger "calibrate"
|
||||
|
||||
@tabbar.set "items", [
|
||||
{ iconclass: "fa fa-user-circle", selected: true },
|
||||
{ iconclass: "fa fa-info-circle" },
|
||||
{ iconclass: "fa fa-book" }
|
||||
]
|
||||
(@find "bt-user-save").set "onbtclick", (e) ->
|
||||
me.saveUser()
|
||||
|
||||
(@find "cv-cat-add").set "onbtclick", (e) ->
|
||||
me.openDialog new BloggerCategoryDialog(),
|
||||
(d) ->
|
||||
c =
|
||||
name: d.value,
|
||||
pid: d.p.id,
|
||||
publish: 1
|
||||
me.cvcatdb.save c, (r) ->
|
||||
me.error __("Cannot add new category") if r.error
|
||||
me.refreshCVCat()
|
||||
#update the list
|
||||
|
||||
, __("Add category"), { tree: me.cvlist.get "data" }
|
||||
|
||||
(@find "cv-cat-edit").set "onbtclick", (e) ->
|
||||
cat = me.cvlist.get "selectedItem"
|
||||
return unless cat
|
||||
me.openDialog new BloggerCategoryDialog(), (d) ->
|
||||
c =
|
||||
id: cat.id,
|
||||
publish: cat.publish,
|
||||
pid: d.p.id,
|
||||
name: d.value
|
||||
|
||||
me.cvcatdb.save c, (r) ->
|
||||
return me.error __("Cannot Edit category") if r.error
|
||||
me.refreshCVCat()
|
||||
, __("Edit category"), { tree: (me.cvlist.get "data"), cat: cat }
|
||||
|
||||
(@find "cv-cat-del").set "onbtclick", (e) ->
|
||||
cat = me.cvlist.get "selectedItem"
|
||||
return unless cat
|
||||
me.openDialog "YesNoDialog",
|
||||
(d) ->
|
||||
return unless d
|
||||
me.deleteCVCat cat
|
||||
, __("Delete category") ,
|
||||
{ iconclass: "fa fa-question-circle", text: __("Do you really want to delete: {0}?", cat.name) }
|
||||
|
||||
(@find "cv-sec-add").set "onbtclick", (e) ->
|
||||
cat = me.cvlist.get "selectedItem"
|
||||
return me.notify __("Please select a category") unless cat and cat.id isnt 0
|
||||
me.openDialog new BloggerCVSectionDiaglog(), (d) ->
|
||||
d.cid = Number cat.id
|
||||
d.start = Number d.start
|
||||
d.end = Number d.end
|
||||
d.publish = 1
|
||||
me.cvsecdb.save d, (r) ->
|
||||
return me.error __("Cannot save section: {0}", r.error) if r.error
|
||||
me.CVSectionByCID Number(cat.id)
|
||||
|
||||
, __("New section entry for {0}", cat.name), null
|
||||
|
||||
(@find "cv-sec-move").set "onbtclick", (e) ->
|
||||
sec = (me.find "cv-sec-list").get "selected"
|
||||
return me.notify __("Please select a section to move") unless sec
|
||||
|
||||
me.openDialog new BloggerCategoryDialog(), (d) ->
|
||||
c =
|
||||
id: sec.id,
|
||||
cid: d.p.id
|
||||
|
||||
me.cvsecdb.save c, (r) ->
|
||||
return me.error __("Cannot move section") if r.error
|
||||
me.CVSectionByCID(sec.cid)
|
||||
(me.find "cv-sec-list").set "selected", -1
|
||||
, __("Move to"), { tree: (me.cvlist.get "data"), selonly: true }
|
||||
|
||||
(@find "cv-sec-edit").set "onbtclick", (e) ->
|
||||
sec = (me.find "cv-sec-list").get "selected"
|
||||
return me.notify __("Please select a section to edit") unless sec
|
||||
|
||||
me.openDialog new BloggerCVSectionDiaglog(), (d) ->
|
||||
d.cid = Number sec.cid
|
||||
d.start = Number d.start
|
||||
d.end = Number d.end
|
||||
#d.publish = Number sec.publish
|
||||
me.cvsecdb.save d, (r) ->
|
||||
return me.error __("Cannot save section: {0}", r.error) if r.error
|
||||
me.CVSectionByCID Number(sec.cid)
|
||||
|
||||
, __("Modify section entry"), sec
|
||||
|
||||
@editor = new SimpleMDE
|
||||
element: me.find "markarea"
|
||||
autofocus: true
|
||||
tabSize: 4
|
||||
indentWithTabs: true
|
||||
toolbar: [
|
||||
{
|
||||
name: __("New"),
|
||||
className: "fa fa-file",
|
||||
action: (e) ->
|
||||
me.bloglist.set "selected", -1
|
||||
me.clearEditor()
|
||||
},
|
||||
{
|
||||
name: __("Save"),
|
||||
className: "fa fa-save",
|
||||
action: (e) ->
|
||||
me.saveBlog()
|
||||
}
|
||||
, "|", "bold", "italic", "heading", "|", "quote", "code",
|
||||
"unordered-list", "ordered-list", "|", "link",
|
||||
"image", "table", "horizontal-rule",
|
||||
{
|
||||
name: "image",
|
||||
className: "fa fa-file-image-o",
|
||||
action: (e) ->
|
||||
me.openDialog "FileDiaLog", (d, n, p) ->
|
||||
p.asFileHandler().publish (r) ->
|
||||
return me.error __("Cannot export file for embedding to text") if r.error
|
||||
doc = me.editor.codemirror.getDoc()
|
||||
doc.replaceSelection "![](#{me._api.handler.shared}/#{r.result})"
|
||||
, __("Select image file"), { mimes: ["image/.*"] }
|
||||
},
|
||||
{
|
||||
name:"Youtube",
|
||||
className: "fa fa-youtube",
|
||||
action: (e) ->
|
||||
doc = me.editor.codemirror.getDoc()
|
||||
doc.replaceSelection "[[youtube:]]"
|
||||
}
|
||||
"|",
|
||||
{
|
||||
name: __("Preview"),
|
||||
className: "fa fa-eye no-disable",
|
||||
action: (e) ->
|
||||
me.previewOn = !me.previewOn
|
||||
SimpleMDE.togglePreview e
|
||||
#/console.log me.select ".editor-preview editor-preview-active"
|
||||
renderMathInElement me.find "editor-container"
|
||||
},
|
||||
"|",
|
||||
{
|
||||
name: __("Send mail"),
|
||||
className: "fa fa-paper-plane",
|
||||
action: (e) ->
|
||||
sel = me.bloglist.get "selected"
|
||||
return me.error __("No post selected") unless sel
|
||||
me.openDialog new BloggerSendmailDiaglog(), (d) ->
|
||||
console.log "test"
|
||||
, __("Send mail"), { content: me.editor.value(), id: sel.id }
|
||||
}
|
||||
]
|
||||
@bloglist.set "onlistselect", (e) ->
|
||||
sel = me.bloglist.get "selected"
|
||||
return unless sel
|
||||
me.blogdb.get Number(sel.id), (r) ->
|
||||
me.error __("Cannot fetch the entry content") if r.error
|
||||
me.editor.value atob(r.result.content)
|
||||
me.inputtags.value = r.result.tags
|
||||
(me.find "blog-publish").set "swon", (if Number(r.result.publish) then true else false)
|
||||
|
||||
@.bloglist.set "onitemclose", (e) ->
|
||||
me.openDialog "YesNoDialog", (b) ->
|
||||
return unless b
|
||||
me.blogdb.delete e.item.item.id, (r) ->
|
||||
return me.error __("Cannot delete: {0}", r.error) if r.error
|
||||
me.bloglist.remove e.item.item, true
|
||||
me.bloglist.set "selected", -1
|
||||
me.clearEditor()
|
||||
, __("Delete a post") ,
|
||||
{ iconclass: "fa fa-question-circle", text: __("Do you really want to delete this post ?") }
|
||||
return false
|
||||
@bindKey "CTRL-S", () ->
|
||||
sel = me.tabbar.get "selidx"
|
||||
return unless sel is 2
|
||||
me.saveBlog()
|
||||
@on "vboxchange", () ->
|
||||
me.resizeContent()
|
||||
# USER TAB
|
||||
fetchData: (idx) ->
|
||||
me = @
|
||||
switch idx
|
||||
when 0 #user info
|
||||
|
||||
@userdb.get null, (d) ->
|
||||
return me.error __("Cannot fetch user data") if d.error
|
||||
me.user = d.result[0]
|
||||
inputs = me.select "[input-class='user-input']"
|
||||
($ v).val me.user[v.name] for v in inputs
|
||||
when 1 # category
|
||||
@refreshCVCat()
|
||||
else
|
||||
@loadBlogs()
|
||||
|
||||
saveUser:() ->
|
||||
me = @
|
||||
inputs = @select "[input-class='user-input']"
|
||||
@user[v.name] = ($ v).val() for v in inputs
|
||||
return @notify __("Full name must be entered") if not @user.fullname or @user.fullname is ""
|
||||
#console.log @user
|
||||
@userdb.save @user, (r) ->
|
||||
return me.error __("Cannot save user data") if r.error
|
||||
return me.notify __("User data updated")
|
||||
|
||||
|
||||
# PORFOLIO TAB
|
||||
refreshCVCat: () ->
|
||||
me = @
|
||||
data =
|
||||
name: "Porfolio",
|
||||
id:0,
|
||||
nodes: []
|
||||
cnd =
|
||||
order:
|
||||
name: "ASC"
|
||||
@cvcatdb.find cnd, (d) ->
|
||||
if d.error
|
||||
me.cvlist.set "data", data
|
||||
return me.notify __("Cannot fetch CV categories")
|
||||
me.fetchCVCat d.result, data, "0"
|
||||
me.cvlist.set "data", data
|
||||
#it = (me.cvlist.find "pid", "2")[0]
|
||||
#me.cvlist.set "selectedItem", it
|
||||
|
||||
fetchCVCat: (table, data, id) ->
|
||||
result = (v for v in table when v.pid is id)
|
||||
return data.nodes = null if result.length is 0
|
||||
for v in result
|
||||
v.nodes = []
|
||||
@fetchCVCat table, v, v.id
|
||||
#v.nodes = null if v.nodes.length is 0
|
||||
data.nodes.push v
|
||||
|
||||
deleteCVCat: (cat) ->
|
||||
me = @
|
||||
ids = []
|
||||
func = (c) ->
|
||||
ids.push c.id
|
||||
func(v) for v in c.nodes if c.nodes
|
||||
func(cat)
|
||||
|
||||
cond = ({ "=": { cid: v } } for v in ids)
|
||||
# delete all content
|
||||
@cvsecdb.delete { "or": cond }, (r) ->
|
||||
return me.error __("Cannot delete all content of: {0} [{1}]", cat.name, r.error) if r.error
|
||||
cond = ({ "=": { id: v } } for v in ids)
|
||||
me.cvcatdb.delete { "or": cond }, (re) ->
|
||||
return me.error __("Cannot delete the category: {0} [{1}]", cat.name, re.error) if re.error
|
||||
me.refreshCVCat()
|
||||
|
||||
CVSectionByCID: (cid) ->
|
||||
me = @
|
||||
cond =
|
||||
exp:
|
||||
"=":
|
||||
cid: cid
|
||||
order:
|
||||
start: "DESC"
|
||||
@cvsecdb.find cond, (d) ->
|
||||
return me.notify __("Section list is empty, please add one") if d.error
|
||||
v.text = v.title for v in d.result
|
||||
items = []
|
||||
$(me.find "cv-sec-status").html __("Found {0} sections", d.result.length)
|
||||
for v in d.result
|
||||
v.text = v.title
|
||||
v.complex = true
|
||||
v.start = Number(v.start)
|
||||
v.end = Number(v.end)
|
||||
v.detail = []
|
||||
v.detail.push { text: v.subtitle, class: "cv-subtitle" } if v.subtitle isnt ""
|
||||
if v.start isnt 0 and v.end isnt 0
|
||||
v.detail.push { text: "#{v.start} - #{v.end}", class: "cv-period" }
|
||||
else
|
||||
v.detail.push { text: "", class: "cv-period" }
|
||||
v.detail.push { text: v.location, class: "cv-loc" } if v.location isnt ""
|
||||
#v.detail.push { text: v.end } if v.end isnt 0
|
||||
v.closable = true
|
||||
v.detail.push { text: v.content, class: "cv-content" }
|
||||
items.push v
|
||||
el = me.find "cv-sec-list"
|
||||
el.set "onitemclose", (e) ->
|
||||
me.openDialog "YesNoDialog", (b) ->
|
||||
return unless b
|
||||
me.cvsecdb.delete e.item.item.id, (r) ->
|
||||
return me.error __("Cannot delete the section: {0}", r.error) if r.error
|
||||
el.remove e.item.item, true
|
||||
, __("Delete section") ,
|
||||
{ iconclass: "fa fa-question-circle", text: __("Do you really want to delete: {0}?",e.item.item.text) }
|
||||
return false
|
||||
|
||||
el.set "items", items
|
||||
|
||||
# blog
|
||||
saveBlog: () ->
|
||||
me = @
|
||||
sel = @bloglist.get "selected"
|
||||
tags = @inputtags.value
|
||||
content = @editor.value()
|
||||
title = (new RegExp "^#+(.*)\n", "g").exec content
|
||||
return @notify __("Please insert a title in the text: beginning with heading") unless title and title.length is 2
|
||||
return @notify __("Please enter tags") if tags is ""
|
||||
d = new Date()
|
||||
data =
|
||||
content: content.asBase64()
|
||||
title: title[1].trim()
|
||||
tags: tags
|
||||
ctime: if sel then sel.ctime else d.timestamp()
|
||||
ctimestr: if sel then sel.ctimestr else d.toString()
|
||||
utime: d.timestamp()
|
||||
utimestr: d.toString()
|
||||
rendered: me.process(me.editor.options.previewRender(content))
|
||||
publish: if ((@find "blog-publish").get "swon") then 1 else 0
|
||||
data.id = sel.id if sel
|
||||
#save the data
|
||||
@blogdb.save data, (r) ->
|
||||
return me.error __("Cannot save blog: {0}", r.error) if r.error
|
||||
me.loadBlogs()
|
||||
|
||||
process: (text) ->
|
||||
# find video tag and rendered it
|
||||
embed = (id) ->
|
||||
return """
|
||||
<iframe
|
||||
class = "embeded-video"
|
||||
width="560" height="315"
|
||||
src="https://www.youtube.com/embed/#{id}"
|
||||
frameborder="0" allow="encrypted-media" allowfullscreen
|
||||
></iframe>
|
||||
"""
|
||||
re = /\[\[([^:]*):([^\]]*)\]\]/g
|
||||
replace = []
|
||||
while (found = re.exec text) isnt null
|
||||
replace.push found
|
||||
return text.asBase64() unless replace.length > 0
|
||||
ret = ""
|
||||
begin = 0
|
||||
for it in replace
|
||||
ret += text.substring begin, it.index
|
||||
ret += embed(it[2])
|
||||
begin = it.index + it[0].length
|
||||
ret += text.substring begin, text.length
|
||||
#console.log ret
|
||||
return ret.asBase64()
|
||||
|
||||
clearEditor:() ->
|
||||
@.editor.value ""
|
||||
@.inputtags.value = ""
|
||||
(@.find "blog-publish").set "swon", false
|
||||
# load blog
|
||||
loadBlogs: () ->
|
||||
me = @
|
||||
selidx = @bloglist.get "selidx"
|
||||
cond =
|
||||
order:
|
||||
ctime: "DESC"
|
||||
fields: [
|
||||
"id",
|
||||
"title",
|
||||
"ctimestr",
|
||||
"ctime",
|
||||
"utime",
|
||||
"utimestr"
|
||||
]
|
||||
@blogdb.find cond, (r) ->
|
||||
return me.notify __("No post found: {0}", r.error) if r.error
|
||||
for v in r.result
|
||||
v.text = v.title
|
||||
v.complex = true
|
||||
v.closable = true
|
||||
v.detail = [
|
||||
{ text: __("Created: {0}", v.ctimestr), class: "blog-dates" },
|
||||
{ text: __("Updated: {0}", v.utimestr), class: "blog-dates" }]
|
||||
me.bloglist.set "items", r.result
|
||||
if selidx isnt -1
|
||||
me.bloglist.set "selected", selidx
|
||||
else
|
||||
me.clearEditor()
|
||||
me.bloglist.set "selected", -1
|
||||
resizeContent: () ->
|
||||
container = @find "editor-container"
|
||||
children = ($ container).children()
|
||||
titlebar = (($ @scheme).find ".afx-window-top")[0]
|
||||
toolbar = children[1]
|
||||
statusbar = children[4]
|
||||
cheight = ($ @scheme).height() - ($ titlebar).height() - ($ toolbar).height() - ($ statusbar).height() - 90
|
||||
($ children[2]).css("height", cheight + "px")
|
||||
Blogger.singleton = true
|
||||
Blogger.dependencies = [ "mde/simplemde.min" ]
|
||||
this.OS.register "Blogger", Blogger
|
@ -1,94 +0,0 @@
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[data-id="tabbar"] {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: #333333;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[data-id="tabbar"] > div > ul > li {
|
||||
background-color: #333333;
|
||||
font-size: 20px;
|
||||
color: #929292;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[data-id="tabbar"] > div > ul > li.selected{
|
||||
color:white;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-hbox[data-id="user-container"] {
|
||||
padding: 10px;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-hbox[data-id="user-container"] afx-hbox{
|
||||
margin-bottom: 5px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-hbox[data-id="user-container"] afx-label{
|
||||
font-weight: bold;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-hbox.cv-side-bar-btn{
|
||||
padding-left:3px;
|
||||
padding-top:3px;
|
||||
background-color: #f6F6F6;
|
||||
border-top: 1px solid #cbcbcb;
|
||||
color:#414339;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-resizer{
|
||||
border-left: 1px solid #cbcbcb;
|
||||
background-color: transparent;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-hbox[data-id="cv-container"] afx-label.cat-header{
|
||||
background-color: #f6F6F6;
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="blogger-cv-sec-win"] afx-hbox{
|
||||
padding-left:5px;
|
||||
padding-right:5px;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] > div.list-container > ul > li{
|
||||
padding-bottom: 10px;
|
||||
padding-top:10px;
|
||||
/*border-bottom: 1px solid #cbcbcb;*/
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] > div.list-container > ul afx-label{
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] > div.list-container > ul >li:nth-child(odd){
|
||||
background-color: white;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] > div.list-container > ul > li.selected {
|
||||
border: 2px solid #116cd6;
|
||||
color: #414339;
|
||||
background-color: transparent;
|
||||
border-radius: 5px;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] > div.list-container > ul > li.selected ul.complex-content li{
|
||||
color: #414339;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] .cv-content{
|
||||
text-align: justify;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] .cv-period, .cv-loc{
|
||||
text-align: right;
|
||||
clear: both;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] .cv-subtitle{
|
||||
font-style: italic;
|
||||
float:left;
|
||||
}
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "cv-sec-list"] i.closable::before{
|
||||
content: "\f014";
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "blog-list"] > div.list-container > ul afx-label{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "blog-list"] > div.list-container > ul .blog-dates{
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="blogger-win"] afx-list-view[ data-id = "blog-list"] > div.list-container > ul > li.selected .blog-dates{
|
||||
color: white;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"app":"Blogger",
|
||||
"name":"Blogging application",
|
||||
"description":"Backend manager for blogging",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.0.6-a",
|
||||
"category":"Internet",
|
||||
"iconclass":"fa fa-book",
|
||||
"mimes":["none"]
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
<afx-app-window data-id = "blogger-win" apptitle="Blogger" width="500" height="500">
|
||||
<afx-hbox >
|
||||
<afx-list-view data-id="tabbar" data-width="30"></afx-list-view>
|
||||
<afx-vbox>
|
||||
<afx-hbox data-id="user-container" data-height="100%">
|
||||
<afx-vbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label data-width= "70" text = "__(Full name)"></afx-label>
|
||||
<input type = "text" name="fullname" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label text = "__(Address)" data-width= "70"></afx-label>
|
||||
<input type = "text" name="address" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label text = "__(Phone)" data-width= "70"></afx-label>
|
||||
<input type = "text" name="Phone" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label text = "__(Email)" data-width= "70"></afx-label>
|
||||
<input type = "text" name="email" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height = "30">
|
||||
<afx-label text = "__(Url)" data-width= "70"></afx-label>
|
||||
<input type = "text" name="url" input-class = "user-input"/>
|
||||
</afx-hbox>
|
||||
<afx-label data-height = "30" text = "__(Short biblio)"/>
|
||||
<textarea name="shortbiblio" input-class = "user-input"/>
|
||||
<afx-hbox data-height = "35">
|
||||
<div></div>
|
||||
<afx-button iconclass = "fa fa-save" data-id = "bt-user-save" data-width="60" text = "__(Save)"/>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-id="cv-container" data-height="100%">
|
||||
<afx-vbox data-width="150" min-width="100">
|
||||
<afx-label class = "cat-header" data-height = "23" text = "__(Categories)" iconclass = "fa fa-bars"></afx-label>
|
||||
<afx-tree-view data-id = "cv-list" ></afx-tree-view>
|
||||
<afx-hbox data-height="30" class = "cv-side-bar-btn">
|
||||
<afx-button data-id = "cv-cat-add" data-width = "25" text = "" iconclass = "fa fa-plus-circle"></afx-button>
|
||||
<afx-button data-id = "cv-cat-del" data-width = "25" text = "" iconclass = "fa fa-minus-circle"></afx-button>
|
||||
<afx-button data-id = "cv-cat-edit" data-width = "25" text = "" iconclass = "fa fa-pencil-square-o"></afx-button>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
<afx-resizer data-width = "3"/>
|
||||
<afx-vbox>
|
||||
<afx-list-view data-id = "cv-sec-list" ></afx-list-view>
|
||||
<afx-hbox data-height="30" class = "cv-side-bar-btn">
|
||||
<div data-id = "cv-sec-status"></div>
|
||||
<afx-button data-id = "cv-sec-add" data-width = "25" text = "" iconclass = "fa fa-plus-circle"></afx-button>
|
||||
<afx-button data-id = "cv-sec-edit" data-width = "25" text = "" iconclass = "fa fa-pencil-square-o"></afx-button>
|
||||
<afx-button data-id = "cv-sec-move" data-width = "25" text = "" iconclass = "fa fa-exchange"></afx-button>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
<afx-hbox data-id = "blog-container" data-height="100%">
|
||||
<afx-list-view data-id = "blog-list" min-width="100" data-width="150"></afx-list-view>
|
||||
<afx-resizer data-width = "3"/>
|
||||
<afx-vbox>
|
||||
<div data-id = "editor-container">
|
||||
<textarea data-id="markarea" ></textarea>
|
||||
</div>
|
||||
<afx-label text = "__(Tags)" style="font-weight:bold;" data-height="25" ></afx-label>
|
||||
<afx-hbox data-height="25">
|
||||
<input type = "text" data-id = "input-tags" />
|
||||
<div data-width="5"></div>
|
||||
<afx-switch data data-id = "blog-publish" data-width="30"></afx-switch>
|
||||
<div data-width="5"></div>
|
||||
</afx-hbox>
|
||||
|
||||
<div data-height="5"></div>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
@ -1,20 +0,0 @@
|
||||
<afx-app-window data-id = "blogger-send-mail-win" apptitle="Send mail" width="500" height="400" resizable = "false">
|
||||
<afx-hbox>
|
||||
<afx-menu data-width="150" data-id="email-list"></afx-menu>
|
||||
<afx-resizer data-width="3"></afx-resizer>
|
||||
<div data-width="5"></div>
|
||||
<afx-vbox >
|
||||
<div data-height="5"></div>
|
||||
<afx-label data-height="20" text = "__(Title)"></afx-label>
|
||||
<input type = "text" data-height="20" name="title" data-id = "mail-title"/>
|
||||
<afx-label data-height = "20" text = "Content" />
|
||||
<textarea name="content" data-id = "contentarea" />
|
||||
<div data-height="5"></div>
|
||||
<afx-hbox data-height = "30">
|
||||
<div></div>
|
||||
<afx-button iconclass = "fa fa-paper-plane" data-id = "bt-sendmail" data-width="60" text = "__(Send)"/>
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
<div data-width="5"></div>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
@ -1,11 +0,0 @@
|
||||
coffee_files = main.coffee
|
||||
|
||||
jsfiles = blockly/blockly_compressed.js blockly/en.js blockly/blocks_compressed.js blockly/javascript_compressed.js
|
||||
|
||||
cssfiles =
|
||||
|
||||
copyfiles = scheme.html package.json
|
||||
|
||||
|
||||
PKG_NAME=CodeBlock
|
||||
include ../pkg.mk
|
File diff suppressed because it is too large
Load Diff
@ -1,164 +0,0 @@
|
||||
// Do not edit this file; automatically generated by build.py.
|
||||
'use strict';
|
||||
|
||||
|
||||
Blockly.Blocks.colour={};Blockly.Constants={};Blockly.Constants.Colour={};Blockly.Constants.Colour.HUE=20;Blockly.Blocks.colour.HUE=Blockly.Constants.Colour.HUE;
|
||||
Blockly.defineBlocksWithJsonArray([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",colour:"%{BKY_COLOUR_HUE}",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",colour:"%{BKY_COLOUR_HUE}",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"},{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",
|
||||
args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",colour:"%{BKY_COLOUR_HUE}",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"},{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",
|
||||
check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",colour:"%{BKY_COLOUR_HUE}",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}]);Blockly.Blocks.lists={};Blockly.Constants.Lists={};Blockly.Constants.Lists.HUE=260;Blockly.Blocks.lists.HUE=Blockly.Constants.Lists.HUE;
|
||||
Blockly.defineBlocksWithJsonArray([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",colour:"%{BKY_LISTS_HUE}",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",colour:"%{BKY_LISTS_HUE}",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",
|
||||
message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,colour:"%{BKY_LISTS_HUE}",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",colour:"%{BKY_LISTS_HUE}",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",
|
||||
message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",colour:"%{BKY_LISTS_HUE}",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
|
||||
Blockly.Blocks.lists_create_with={init:function(){this.setHelpUrl(Blockly.Msg.LISTS_CREATE_WITH_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setMutator(new Blockly.Mutator(["lists_create_with_item"]));this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),
|
||||
10);this.updateShape_()},decompose:function(a){var b=a.newBlock("lists_create_with_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=a.newBlock("lists_create_with_item");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)a.push(b.valueConnection_),b=b.nextConnection&&b.nextConnection.targetBlock();for(b=0;b<this.itemCount_;b++){var c=this.getInput("ADD"+b).connection.targetConnection;
|
||||
c&&-1==a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)Blockly.Mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;b++;a=a.nextConnection&&a.nextConnection.targetBlock()}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||
|
||||
this.appendDummyInput("EMPTY").appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){var b=this.appendValueInput("ADD"+a);0==a&&b.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH)}for(;this.getInput("ADD"+a);)this.removeInput("ADD"+a),a++}};
|
||||
Blockly.Blocks.lists_create_with_container={init:function(){this.setColour(Blockly.Blocks.lists.HUE);this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
|
||||
Blockly.Blocks.lists_create_with_item={init:function(){this.setColour(Blockly.Blocks.lists.HUE);this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
|
||||
Blockly.Blocks.lists_indexOf={init:function(){var a=[[Blockly.Msg.LISTS_INDEX_OF_FIRST,"FIRST"],[Blockly.Msg.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.LISTS_INDEX_OF_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);this.setOutput(!0,"Number");this.appendValueInput("VALUE").setCheck("Array").appendField(Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST);this.appendValueInput("FIND").appendField(new Blockly.FieldDropdown(a),"END");this.setInputsInline(!0);var b=this;this.setTooltip(function(){return Blockly.Msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",
|
||||
b.workspace.options.oneBasedIndex?"0":"-1")})}};
|
||||
Blockly.Blocks.lists_getIndex={init:function(){var a=[[Blockly.Msg.LISTS_GET_INDEX_GET,"GET"],[Blockly.Msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[Blockly.Msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[Blockly.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[Blockly.Msg.LISTS_GET_INDEX_LAST,"LAST"],[Blockly.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl(Blockly.Msg.LISTS_GET_INDEX_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);
|
||||
a=new Blockly.FieldDropdown(a,function(a){this.sourceBlock_.updateStatement_("REMOVE"==a)});this.appendValueInput("VALUE").setCheck("Array").appendField(Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST);this.appendDummyInput().appendField(a,"MODE").appendField("","SPACE");this.appendDummyInput("AT");Blockly.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.LISTS_GET_INDEX_TAIL);this.setInputsInline(!0);this.setOutput(!0);this.updateAt_(!0);var b=this;this.setTooltip(function(){var a=
|
||||
b.getFieldValue("MODE"),d=b.getFieldValue("WHERE"),e="";switch(a+" "+d){case "GET FROM_START":case "GET FROM_END":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case "GET FIRST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case "GET LAST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case "GET RANDOM":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case "GET_REMOVE FROM_START":case "GET_REMOVE FROM_END":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case "GET_REMOVE FIRST":e=
|
||||
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case "GET_REMOVE LAST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case "GET_REMOVE RANDOM":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case "REMOVE FROM_START":case "REMOVE FROM_END":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case "REMOVE FIRST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case "REMOVE LAST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case "REMOVE RANDOM":e=
|
||||
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}if("FROM_START"==d||"FROM_END"==d)e+=" "+("FROM_START"==d?Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP:Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",b.workspace.options.oneBasedIndex?"#1":"#0");return e})},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("statement",!this.outputConnection);var b=this.getInput("AT").type==Blockly.INPUT_VALUE;a.setAttribute("at",b);return a},domToMutation:function(a){var b="true"==
|
||||
a.getAttribute("statement");this.updateStatement_(b);a="false"!=a.getAttribute("at");this.updateAt_(a)},updateStatement_:function(a){a!=!this.outputConnection&&(this.unplug(!0,!0),a?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):
|
||||
this.appendDummyInput("AT");var b=new Blockly.FieldDropdown(this.WHERE_OPTIONS,function(b){var c="FROM_START"==b||"FROM_END"==b;if(c!=a){var e=this.sourceBlock_;e.updateAt_(c);e.setFieldValue(b,"WHERE");return null}});this.getInput("AT").appendField(b,"WHERE");Blockly.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};
|
||||
Blockly.Blocks.lists_setIndex={init:function(){var a=[[Blockly.Msg.LISTS_SET_INDEX_SET,"SET"],[Blockly.Msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[Blockly.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[Blockly.Msg.LISTS_GET_INDEX_LAST,"LAST"],[Blockly.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl(Blockly.Msg.LISTS_SET_INDEX_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST);
|
||||
this.appendDummyInput().appendField(new Blockly.FieldDropdown(a),"MODE").appendField("","SPACE");this.appendDummyInput("AT");this.appendValueInput("TO").appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_TO);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.LISTS_SET_INDEX_TOOLTIP);this.updateAt_(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("MODE"),d=b.getFieldValue("WHERE"),e="";switch(a+" "+d){case "SET FROM_START":case "SET FROM_END":e=
|
||||
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case "SET FIRST":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case "SET LAST":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case "SET RANDOM":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case "INSERT FROM_START":case "INSERT FROM_END":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;
|
||||
break;case "INSERT RANDOM":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if("FROM_START"==d||"FROM_END"==d)e+=" "+Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",b.workspace.options.oneBasedIndex?"#1":"#0");return e})},mutationToDom:function(){var a=document.createElement("mutation"),b=this.getInput("AT").type==Blockly.INPUT_VALUE;a.setAttribute("at",b);return a},domToMutation:function(a){a="false"!=a.getAttribute("at");this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT");
|
||||
this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var b=new Blockly.FieldDropdown(this.WHERE_OPTIONS,function(b){var c="FROM_START"==b||"FROM_END"==b;if(c!=a){var e=this.sourceBlock_;e.updateAt_(c);e.setFieldValue(b,"WHERE");return null}});this.moveInputBefore("AT","TO");this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL",
|
||||
"TO");this.getInput("AT").appendField(b,"WHERE")}};
|
||||
Blockly.Blocks.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.LISTS_GET_SUBLIST_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);
|
||||
this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);this.appendDummyInput("AT1");this.appendDummyInput("AT2");Blockly.Msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.LISTS_GET_SUBLIST_TAIL);this.setInputsInline(!0);this.setOutput(!0,"Array");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip(Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation"),b=this.getInput("AT1").type==
|
||||
Blockly.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type==Blockly.INPUT_VALUE;a.setAttribute("at2",b);return a},domToMutation:function(a){var b="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.updateAt_(1,b);this.updateAt_(2,a)},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):
|
||||
this.appendDummyInput("AT"+a);var c=new Blockly.FieldDropdown(this["WHERE_OPTIONS_"+a],function(c){var d="FROM_START"==c||"FROM_END"==c;if(d!=b){var f=this.sourceBlock_;f.updateAt_(a,d);f.setFieldValue(c,"WHERE"+a);return null}});this.getInput("AT"+a).appendField(c,"WHERE"+a);1==a&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"));Blockly.Msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};
|
||||
Blockly.Blocks.lists_sort={init:function(){this.jsonInit({message0:Blockly.Msg.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[Blockly.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[Blockly.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[Blockly.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[Blockly.Msg.LISTS_SORT_ORDER_ASCENDING,"1"],[Blockly.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",colour:Blockly.Blocks.lists.HUE,
|
||||
tooltip:Blockly.Msg.LISTS_SORT_TOOLTIP,helpUrl:Blockly.Msg.LISTS_SORT_HELPURL})}};
|
||||
Blockly.Blocks.lists_split={init:function(){var a=this,b=new Blockly.FieldDropdown([[Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(b){a.updateType_(b)});this.setHelpUrl(Blockly.Msg.LISTS_SPLIT_HELPURL);this.setColour(Blockly.Blocks.lists.HUE);this.appendValueInput("INPUT").setCheck("String").appendField(b,"MODE");this.appendValueInput("DELIM").setCheck("String").appendField(Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER);this.setInputsInline(!0);
|
||||
this.setOutput(!0,"Array");this.setTooltip(function(){var b=a.getFieldValue("MODE");if("SPLIT"==b)return Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"==b)return Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN;throw"Unknown mode: "+b;})},updateType_:function(a){"SPLIT"==a?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("mode",
|
||||
this.getFieldValue("MODE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("mode"))}};Blockly.Blocks.logic={};Blockly.Constants.Logic={};Blockly.Constants.Logic.HUE=210;Blockly.Blocks.logic.HUE=Blockly.Constants.Logic.HUE;
|
||||
Blockly.defineBlocksWithJsonArray([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",colour:"%{BKY_LOGIC_HUE}",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",
|
||||
name:"DO0"}],previousStatement:null,nextStatement:null,colour:"%{BKY_LOGIC_HUE}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,
|
||||
colour:"%{BKY_LOGIC_HUE}",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["\u2260","NEQ"],["<","LT"],["\u2264","LTE"],[">","GT"],["\u2265","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",colour:"%{BKY_LOGIC_HUE}",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare",
|
||||
"logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",colour:"%{BKY_LOGIC_HUE}",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",
|
||||
check:"Boolean"}],output:"Boolean",colour:"%{BKY_LOGIC_HUE}",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,colour:"%{BKY_LOGIC_HUE}",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],
|
||||
message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,colour:"%{BKY_LOGIC_HUE}",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]);
|
||||
Blockly.defineBlocksWithJsonArray([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,colour:"%{BKY_LOGIC_HUE}",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,colour:"%{BKY_LOGIC_HUE}",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,
|
||||
enableContextMenu:!1,colour:"%{BKY_LOGIC_HUE}",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);Blockly.Constants.Logic.TOOLTIPS_BY_OP={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};
|
||||
Blockly.Extensions.register("logic_op_tooltip",Blockly.Extensions.buildTooltipForDropdown("OP",Blockly.Constants.Logic.TOOLTIPS_BY_OP));
|
||||
Blockly.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN={elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=document.createElement("mutation");this.elseifCount_&&a.setAttribute("elseif",this.elseifCount_);this.elseCount_&&a.setAttribute("else",1);return a},domToMutation:function(a){this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0;this.elseCount_=parseInt(a.getAttribute("else"),10)||0;this.updateShape_()},decompose:function(a){var b=a.newBlock("controls_if_if");
|
||||
b.initSvg();for(var c=b.nextConnection,d=1;d<=this.elseifCount_;d++){var e=a.newBlock("controls_if_elseif");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}this.elseCount_&&(a=a.newBlock("controls_if_else"),a.initSvg(),c.connect(a.previousConnection));return b},compose:function(a){var b=a.nextConnection.targetBlock();this.elseCount_=this.elseifCount_=0;a=[null];for(var c=[null],d=null;b;){switch(b.type){case "controls_if_elseif":this.elseifCount_++;a.push(b.valueConnection_);c.push(b.statementConnection_);
|
||||
break;case "controls_if_else":this.elseCount_++;d=b.statementConnection_;break;default:throw"Unknown block type.";}b=b.nextConnection&&b.nextConnection.targetBlock()}this.updateShape_();for(b=1;b<=this.elseifCount_;b++)Blockly.Mutator.reconnect(a[b],this,"IF"+b),Blockly.Mutator.reconnect(c[b],this,"DO"+b);Blockly.Mutator.reconnect(d,this,"ELSE")},saveConnections:function(a){a=a.nextConnection.targetBlock();for(var b=1;a;){switch(a.type){case "controls_if_elseif":var c=this.getInput("IF"+b),d=this.getInput("DO"+
|
||||
b);a.valueConnection_=c&&c.connection.targetConnection;a.statementConnection_=d&&d.connection.targetConnection;b++;break;case "controls_if_else":d=this.getInput("ELSE");a.statementConnection_=d&&d.connection.targetConnection;break;default:throw"Unknown block type.";}a=a.nextConnection&&a.nextConnection.targetBlock()}},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var a=1;this.getInput("IF"+a);)this.removeInput("IF"+a),this.removeInput("DO"+a),a++;for(a=1;a<=this.elseifCount_;a++)this.appendValueInput("IF"+
|
||||
a).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+a).appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)}};Blockly.Extensions.registerMutator("controls_if_mutator",Blockly.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN,null,["controls_if_elseif","controls_if_else"]);
|
||||
Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){if(this.elseifCount_||this.elseCount_){if(!this.elseifCount_&&this.elseCount_)return Blockly.Msg.CONTROLS_IF_TOOLTIP_2;if(this.elseifCount_&&!this.elseCount_)return Blockly.Msg.CONTROLS_IF_TOOLTIP_3;if(this.elseifCount_&&this.elseCount_)return Blockly.Msg.CONTROLS_IF_TOOLTIP_4}else return Blockly.Msg.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))};Blockly.Extensions.register("controls_if_tooltip",Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION);
|
||||
Blockly.Constants.Logic.fixLogicCompareRtlOpLabels=function(){var a={LT:"\u200f<\u200f",LTE:"\u200f\u2264\u200f",GT:"\u200f>\u200f",GTE:"\u200f\u2265\u200f"},b=this.getField("OP");if(b){b=b.getOptions();for(var c=0;c<b.length;++c){var d=b[c],e=a[d[1]];goog.isString(d[0])&&e&&(d[0]=e)}}};
|
||||
Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN={prevBlocks_:[null,null],onchange:function(a){var b=this.getInputTargetBlock("A"),c=this.getInputTargetBlock("B");if(b&&c&&!b.outputConnection.checkType_(c.outputConnection)){Blockly.Events.setGroup(a.group);for(a=0;a<this.prevBlocks_.length;a++){var d=this.prevBlocks_[a];if(d===b||d===c)d.unplug(),d.bumpNeighbours_()}Blockly.Events.setGroup(!1)}this.prevBlocks_[0]=b;this.prevBlocks_[1]=c}};
|
||||
Blockly.Constants.Logic.LOGIC_COMPARE_EXTENSION=function(){this.RTL&&Blockly.Constants.Logic.fixLogicCompareRtlOpLabels.apply(this);this.mixin(Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN)};Blockly.Extensions.register("logic_compare",Blockly.Constants.Logic.LOGIC_COMPARE_EXTENSION);
|
||||
Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(var e=0;2>e;e++){var f=1==e?b:c;f&&!f.outputConnection.checkType_(d)&&(Blockly.Events.setGroup(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours_()):(f.unplug(),f.bumpNeighbours_()),Blockly.Events.setGroup(!1))}this.prevParentConnection_=
|
||||
d}};Blockly.Extensions.registerMixin("logic_ternary",Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN);Blockly.Blocks.loops={};Blockly.Constants.Loops={};Blockly.Constants.Loops.HUE=120;Blockly.Blocks.loops.HUE=Blockly.Constants.Loops.HUE;
|
||||
Blockly.defineBlocksWithJsonArray([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,colour:"%{BKY_LOOPS_HUE}",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",
|
||||
value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,colour:"%{BKY_LOOPS_HUE}",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",
|
||||
check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,colour:"%{BKY_LOOPS_HUE}",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",
|
||||
name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:"%{BKY_LOOPS_HUE}",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",
|
||||
args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,colour:"%{BKY_LOOPS_HUE}",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,colour:"%{BKY_LOOPS_HUE}",
|
||||
helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]);Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};Blockly.Extensions.register("controls_whileUntil_tooltip",Blockly.Extensions.buildTooltipForDropdown("MODE",Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS));
|
||||
Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};Blockly.Extensions.register("controls_flow_tooltip",Blockly.Extensions.buildTooltipForDropdown("FLOW",Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS));
|
||||
Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(a){var b=this.getFieldValue("VAR");if(!this.isCollapsed()&&null!=b){var c={enabled:!0};c.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",b);b=goog.dom.createDom("field",null,b);b.setAttribute("name","VAR");b=goog.dom.createDom("block",null,b);b.setAttribute("type","variables_get");c.callback=Blockly.ContextMenu.callbackFactory(this,b);a.push(c)}}};
|
||||
Blockly.Extensions.registerMixin("contextMenu_newGetVariableBlock",Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN);Blockly.Extensions.register("controls_for_tooltip",Blockly.Extensions.buildTooltipWithFieldValue("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR"));Blockly.Extensions.register("controls_forEach_tooltip",Blockly.Extensions.buildTooltipWithFieldValue("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));
|
||||
Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],onchange:function(){if(this.workspace.isDragging&&!this.workspace.isDragging()){var a=!1,b=this;do{if(-1!=this.LOOP_TYPES.indexOf(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);a?(this.setWarningText(null),this.isInFlyout||this.setDisabled(!1)):(this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING),this.isInFlyout||
|
||||
this.getInheritedDisabled()||this.setDisabled(!0))}}};Blockly.Extensions.registerMixin("controls_flow_in_loop_check",Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN);Blockly.Blocks.math={};Blockly.Constants.Math={};Blockly.Constants.Math.HUE=230;Blockly.Blocks.math.HUE=Blockly.Constants.Math.HUE;
|
||||
Blockly.defineBlocksWithJsonArray([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",colour:"%{BKY_MATH_HUE}",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}",
|
||||
"MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",colour:"%{BKY_MATH_HUE}",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},
|
||||
{type:"input_value",name:"NUM",check:"Number"}],output:"Number",colour:"%{BKY_MATH_HUE}",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",colour:"%{BKY_MATH_HUE}",
|
||||
helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"],["\u221e","INFINITY"]]}],output:"Number",colour:"%{BKY_MATH_HUE}",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},
|
||||
{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",colour:"%{BKY_MATH_HUE}",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",
|
||||
name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,colour:"%{BKY_VARIABLES_HUE}",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",
|
||||
name:"NUM",check:"Number"}],output:"Number",colour:"%{BKY_MATH_HUE}",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}",
|
||||
"STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",colour:"%{BKY_MATH_HUE}",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",colour:"%{BKY_MATH_HUE}",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",
|
||||
helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",colour:"%{BKY_MATH_HUE}",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},
|
||||
{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",colour:"%{BKY_MATH_HUE}",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",colour:"%{BKY_MATH_HUE}",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"}]);
|
||||
Blockly.Constants.Math.TOOLTIPS_BY_OP={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",
|
||||
SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};
|
||||
Blockly.Extensions.register("math_op_tooltip",Blockly.Extensions.buildTooltipForDropdown("OP",Blockly.Constants.Math.TOOLTIPS_BY_OP));
|
||||
Blockly.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN={mutationToDom:function(){var a=document.createElement("mutation"),b="DIVISIBLE_BY"==this.getFieldValue("PROPERTY");a.setAttribute("divisor_input",b);return a},domToMutation:function(a){a="true"==a.getAttribute("divisor_input");this.updateShape_(a)},updateShape_:function(a){var b=this.getInput("DIVISOR");a?b||this.appendValueInput("DIVISOR").setCheck("Number"):b&&this.removeInput("DIVISOR")}};
|
||||
Blockly.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION=function(){this.getField("PROPERTY").setValidator(function(a){this.sourceBlock_.updateShape_("DIVISIBLE_BY"==a)})};Blockly.Extensions.registerMutator("math_is_divisibleby_mutator",Blockly.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN,Blockly.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION);Blockly.Constants.Math.CHANGE_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){return Blockly.Msg.MATH_CHANGE_TOOLTIP.replace("%1",this.getFieldValue("VAR"))}.bind(this))};
|
||||
Blockly.Extensions.register("math_change_tooltip",Blockly.Extensions.buildTooltipWithFieldValue("%{BKY_MATH_CHANGE_TOOLTIP}","VAR"));Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN={updateType_:function(a){"MODE"==a?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("op",this.getFieldValue("OP"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("op"))}};
|
||||
Blockly.Constants.Math.LIST_MODES_MUTATOR_EXTENSION=function(){this.getField("OP").setValidator(function(a){this.updateType_(a)}.bind(this))};Blockly.Extensions.registerMutator("math_modes_of_list_mutator",Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN,Blockly.Constants.Math.LIST_MODES_MUTATOR_EXTENSION);Blockly.Blocks.procedures={};Blockly.Blocks.procedures.HUE=290;
|
||||
Blockly.Blocks.procedures_defnoreturn={init:function(){var a=new Blockly.FieldTextInput("",Blockly.Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT&&
|
||||
this.setCommentText(Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT);this.setColour(Blockly.Blocks.procedures.HUE);this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK",
|
||||
"RETURN")):this.removeInput("STACK",!0),this.hasStatements_=a)},updateParams_:function(){for(var a=!1,b={},c=0;c<this.arguments_.length;c++){if(b["arg_"+this.arguments_[c].toLowerCase()]){a=!0;break}b["arg_"+this.arguments_[c].toLowerCase()]=!0}a?this.setWarningText(Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING):this.setWarningText(null);a="";this.arguments_.length&&(a=Blockly.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));Blockly.Events.disable();try{this.setFieldValue(a,"PARAMS")}finally{Blockly.Events.enable()}},
|
||||
mutationToDom:function(a){var b=document.createElement("mutation");a&&b.setAttribute("name",this.getFieldValue("NAME"));for(var c=0;c<this.argumentVarModels_.length;c++){var d=document.createElement("arg"),e=this.argumentVarModels_[c];d.setAttribute("name",e.name);d.setAttribute("varId",e.getId());a&&this.paramIds_&&d.setAttribute("paramId",this.paramIds_[c]);b.appendChild(d)}this.hasStatements_||b.setAttribute("statements","false");return b},domToMutation:function(a){this.arguments_=[];this.argumentVarModels_=
|
||||
[];for(var b=0,c;c=a.childNodes[b];b++)if("arg"==c.nodeName.toLowerCase()){var d=c.getAttribute("name");c=c.getAttribute("varId");this.arguments_.push(d);d=Blockly.Variables.getOrCreateVariablePackage(this.workspace,c,d,"");this.argumentVarModels_.push(d)}this.updateParams_();Blockly.Procedures.mutateCallers(this);this.setStatements_("false"!==a.getAttribute("statements"))},decompose:function(a){var b=a.newBlock("procedures_mutatorcontainer");b.initSvg();this.getInput("RETURN")?b.setFieldValue(this.hasStatements_?
|
||||
"TRUE":"FALSE","STATEMENTS"):b.getInput("STATEMENT_INPUT").setVisible(!1);for(var c=b.getInput("STACK").connection,d=0;d<this.arguments_.length;d++){var e=a.newBlock("procedures_mutatorarg");e.initSvg();e.setFieldValue(this.arguments_[d],"NAME");e.oldLocation=d;c.connect(e.previousConnection);c=e.nextConnection}Blockly.Procedures.mutateCallers(this);return b},compose:function(a){this.arguments_=[];this.paramIds_=[];this.argumentVarModels_=[];for(var b=a.getInputTargetBlock("STACK");b;){var c=b.getFieldValue("NAME");
|
||||
this.arguments_.push(c);c=this.workspace.getVariable(c,"");this.argumentVarModels_.push(c);this.paramIds_.push(b.id);b=b.nextConnection&&b.nextConnection.targetBlock()}this.updateParams_();Blockly.Procedures.mutateCallers(this);a=a.getFieldValue("STATEMENTS");if(null!==a&&(a="TRUE"==a,this.hasStatements_!=a))if(a)this.setStatements_(!0),Blockly.Mutator.reconnect(this.statementConnection_,this,"STACK"),this.statementConnection_=null;else{a=this.getInput("STACK").connection;if(this.statementConnection_=
|
||||
a.targetConnection)a=a.targetBlock(),a.unplug(),a.bumpNeighbours_();this.setStatements_(!1)}},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(a,b){var c=this.workspace.getVariableById(a);if(""==c.type){c=c.name;for(var d=this.workspace.getVariableById(b),e=!1,f=0;f<this.argumentVarModels_.length;f++)this.argumentVarModels_[f].getId()==a&&(this.arguments_[f]=
|
||||
d.name,this.argumentVarModels_[f]=d,e=!0);e&&this.displayRenamedVar_(c,d.name)}},updateVarName:function(a){for(var b=a.name,c=!1,d=0;d<this.argumentVarModels_.length;d++)if(this.argumentVarModels_[d].getId()==a.getId()){var e=this.arguments_[d];this.arguments_[d]=b;c=!0}c&&this.displayRenamedVar_(e,b)},displayRenamedVar_:function(a,b){this.updateParams_();if(this.mutator.isVisible())for(var c=this.mutator.workspace_.getAllBlocks(),d=0,e;e=c[d];d++)"procedures_mutatorarg"==e.type&&Blockly.Names.equals(a,
|
||||
e.getFieldValue("NAME"))&&e.setFieldValue(b,"NAME")},customContextMenu:function(a){var b={enabled:!0},c=this.getFieldValue("NAME");b.text=Blockly.Msg.PROCEDURES_CREATE_DO.replace("%1",c);var d=goog.dom.createDom("mutation");d.setAttribute("name",c);for(var e=0;e<this.arguments_.length;e++)c=goog.dom.createDom("arg"),c.setAttribute("name",this.arguments_[e]),d.appendChild(c);d=goog.dom.createDom("block",null,d);d.setAttribute("type",this.callType_);b.callback=Blockly.ContextMenu.callbackFactory(this,
|
||||
d);a.push(b);if(!this.isCollapsed())for(e=0;e<this.arguments_.length;e++)b={enabled:!0},c=this.arguments_[e],b.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c),d=goog.dom.createDom("field",null,c),d.setAttribute("name","VAR"),d=goog.dom.createDom("block",null,d),d.setAttribute("type","variables_get"),b.callback=Blockly.ContextMenu.callbackFactory(this,d),a.push(b)},callType_:"procedures_callnoreturn"};
|
||||
Blockly.Blocks.procedures_defreturn={init:function(){var a=new Blockly.FieldTextInput("",Blockly.Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.appendValueInput("RETURN").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&
|
||||
this.workspace.options.parentWorkspace.options.comments)&&Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT);this.setColour(Blockly.Blocks.procedures.HUE);this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},setStatements_:Blockly.Blocks.procedures_defnoreturn.setStatements_,updateParams_:Blockly.Blocks.procedures_defnoreturn.updateParams_,
|
||||
mutationToDom:Blockly.Blocks.procedures_defnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_defnoreturn.domToMutation,decompose:Blockly.Blocks.procedures_defnoreturn.decompose,compose:Blockly.Blocks.procedures_defnoreturn.compose,getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},getVars:Blockly.Blocks.procedures_defnoreturn.getVars,getVarModels:Blockly.Blocks.procedures_defnoreturn.getVarModels,renameVarById:Blockly.Blocks.procedures_defnoreturn.renameVarById,
|
||||
updateVarName:Blockly.Blocks.procedures_defnoreturn.updateVarName,displayRenamedVar_:Blockly.Blocks.procedures_defnoreturn.displayRenamedVar_,customContextMenu:Blockly.Blocks.procedures_defnoreturn.customContextMenu,callType_:"procedures_callreturn"};
|
||||
Blockly.Blocks.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);this.appendStatementInput("STACK");this.appendDummyInput("STATEMENT_INPUT").appendField(Blockly.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new Blockly.FieldCheckbox("TRUE"),"STATEMENTS");this.setColour(Blockly.Blocks.procedures.HUE);this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1}};
|
||||
Blockly.Blocks.procedures_mutatorarg={init:function(){var a=new Blockly.FieldTextInput("x",this.validator_);a.oldShowEditorFn_=a.showEditor_;a.showEditor_=function(){this.createdVariables_=[];this.oldShowEditorFn_()};this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE).appendField(a,"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour(Blockly.Blocks.procedures.HUE);this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1;a.onFinishEditing_=
|
||||
this.deleteIntermediateVars_;a.createdVariables_=[];a.onFinishEditing_("x")},validator_:function(a){var b=Blockly.Mutator.findParentWs(this.sourceBlock_.workspace);a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"");if(!a)return null;var c=b.getVariable(a,"");c&&c.name!=a&&b.renameVarById(c.getId(),a);c||(c=b.createVariable(a,""))&&this.createdVariables_&&this.createdVariables_.push(c);return a},deleteIntermediateVars_:function(a){var b=Blockly.Mutator.findParentWs(this.sourceBlock_.workspace);if(b)for(var c=
|
||||
0;c<this.createdVariables_.length;c++){var d=this.createdVariables_[c];d.name!=a&&b.deleteVariableById(d.getId())}}};
|
||||
Blockly.Blocks.procedures_callnoreturn={init:function(){this.appendDummyInput("TOPROW").appendField(this.id,"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour(Blockly.Blocks.procedures.HUE);this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null},getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(a,b){Blockly.Names.equals(a,this.getProcedureCall())&&
|
||||
(this.setFieldValue(b,"NAME"),this.setTooltip((this.outputConnection?Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP:Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",b)))},setProcedureParameters_:function(a,b){var c=Blockly.Procedures.getDefinition(this.getProcedureCall(),this.workspace),d=c&&c.mutator&&c.mutator.isVisible();d||(this.quarkConnections_={},this.quarkIds_=null);if(b)if(goog.array.equals(this.arguments_,a))this.quarkIds_=b;else{if(b.length!=a.length)throw"Error: paramNames and paramIds must be the same length.";
|
||||
this.setCollapsed(!1);this.quarkIds_||(this.quarkConnections_={},a.join("\n")==this.arguments_.join("\n")?this.quarkIds_=b:this.quarkIds_=[]);c=this.rendered;this.rendered=!1;for(var e=0;e<this.arguments_.length;e++){var f=this.getInput("ARG"+e);f&&(f=f.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=f,d&&f&&-1==b.indexOf(this.quarkIds_[e])&&(f.disconnect(),f.getSourceBlock().bumpNeighbours_()))}this.arguments_=[].concat(a);this.argumentVarModels_=[];for(e=0;e<this.arguments_.length;e++)d=
|
||||
Blockly.Variables.getOrCreateVariablePackage(this.workspace,null,this.arguments_[e],""),this.argumentVarModels_.push(d);this.updateShape_();if(this.quarkIds_=b)for(e=0;e<this.arguments_.length;e++)d=this.quarkIds_[e],d in this.quarkConnections_&&(f=this.quarkConnections_[d],Blockly.Mutator.reconnect(f,this,"ARG"+e)||delete this.quarkConnections_[d]);(this.rendered=c)&&this.render()}},updateShape_:function(){for(var a=0;a<this.arguments_.length;a++){var b=this.getField("ARGNAME"+a);if(b){Blockly.Events.disable();
|
||||
try{b.setValue(this.arguments_[a])}finally{Blockly.Events.enable()}}else b=new Blockly.FieldLabel(this.arguments_[a]),this.appendValueInput("ARG"+a).setAlign(Blockly.ALIGN_RIGHT).appendField(b,"ARGNAME"+a).init()}for(;this.getInput("ARG"+a);)this.removeInput("ARG"+a),a++;if(a=this.getInput("TOPROW"))this.arguments_.length?this.getField("WITH")||(a.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"),a.init()):this.getField("WITH")&&a.removeField("WITH")},mutationToDom:function(){var a=document.createElement("mutation");
|
||||
a.setAttribute("name",this.getProcedureCall());for(var b=0;b<this.arguments_.length;b++){var c=document.createElement("arg");c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}return a},domToMutation:function(a){var b=a.getAttribute("name");this.renameProcedure(this.getProcedureCall(),b);b=[];for(var c=[],d=0,e;e=a.childNodes[d];d++)"arg"==e.nodeName.toLowerCase()&&(b.push(e.getAttribute("name")),c.push(e.getAttribute("paramId")));this.setProcedureParameters_(b,c)},getVarModels:function(){return this.argumentVarModels_},
|
||||
onchange:function(a){if(this.workspace&&!this.workspace.isFlyout)if(a.type==Blockly.Events.BLOCK_CREATE&&-1!=a.ids.indexOf(this.id)){var b=this.getProcedureCall();b=Blockly.Procedures.getDefinition(b,this.workspace);!b||b.type==this.defType_&&JSON.stringify(b.arguments_)==JSON.stringify(this.arguments_)||(b=null);if(!b){Blockly.Events.setGroup(a.group);a=goog.dom.createDom("xml");b=goog.dom.createDom("block");b.setAttribute("type",this.defType_);var c=this.getRelativeToSurfaceXY(),d=c.y+2*Blockly.SNAP_RADIUS;
|
||||
b.setAttribute("x",c.x+Blockly.SNAP_RADIUS*(this.RTL?-1:1));b.setAttribute("y",d);c=this.mutationToDom();b.appendChild(c);c=goog.dom.createDom("field");c.setAttribute("name","NAME");c.appendChild(document.createTextNode(this.getProcedureCall()));b.appendChild(c);a.appendChild(b);Blockly.Xml.domToWorkspace(a,this.workspace);Blockly.Events.setGroup(!1)}}else a.type==Blockly.Events.BLOCK_DELETE&&(b=this.getProcedureCall(),b=Blockly.Procedures.getDefinition(b,this.workspace),b||(Blockly.Events.setGroup(a.group),
|
||||
this.dispose(!0,!1),Blockly.Events.setGroup(!1)))},customContextMenu:function(a){var b={enabled:!0};b.text=Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF;var c=this.getProcedureCall(),d=this.workspace;b.callback=function(){var a=Blockly.Procedures.getDefinition(c,d);a&&a.select()};a.push(b)},defType_:"procedures_defnoreturn"};
|
||||
Blockly.Blocks.procedures_callreturn={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.setColour(Blockly.Blocks.procedures.HUE);this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);this.arguments_=[];this.quarkConnections_={};this.quarkIds_=null},getProcedureCall:Blockly.Blocks.procedures_callnoreturn.getProcedureCall,renameProcedure:Blockly.Blocks.procedures_callnoreturn.renameProcedure,setProcedureParameters_:Blockly.Blocks.procedures_callnoreturn.setProcedureParameters_,
|
||||
updateShape_:Blockly.Blocks.procedures_callnoreturn.updateShape_,mutationToDom:Blockly.Blocks.procedures_callnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_callnoreturn.domToMutation,getVarModels:Blockly.Blocks.procedures_callnoreturn.getVarModels,onchange:Blockly.Blocks.procedures_callnoreturn.onchange,customContextMenu:Blockly.Blocks.procedures_callnoreturn.customContextMenu,defType_:"procedures_defreturn"};
|
||||
Blockly.Blocks.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour(Blockly.Blocks.procedures.HUE);this.setTooltip(Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_IFRETURN_HELPURL);this.hasReturnValue_=!0},
|
||||
mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("value",Number(this.hasReturnValue_));return a},domToMutation:function(a){this.hasReturnValue_=1==a.getAttribute("value");this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){if(this.workspace.isDragging&&!this.workspace.isDragging()){var a=!1,b=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);
|
||||
a?("procedures_defnoreturn"==b.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=b.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null),this.isInFlyout||this.setDisabled(!1)):(this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING),
|
||||
this.isInFlyout||this.getInheritedDisabled()||this.setDisabled(!0))}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};Blockly.Blocks.texts={};Blockly.Constants.Text={};Blockly.Constants.Text.HUE=160;Blockly.Blocks.texts.HUE=Blockly.Constants.Text.HUE;
|
||||
Blockly.defineBlocksWithJsonArray([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",colour:"%{BKY_TEXTS_HUE}",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",colour:"%{BKY_TEXTS_HUE}",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",
|
||||
args0:[{type:"input_dummy"},{type:"input_statement",name:"STACK"}],colour:"%{BKY_TEXTS_HUE}",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,colour:"%{BKY_TEXTS_HUE}",tooltip:"{%BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},
|
||||
{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,colour:"%{BKY_TEXTS_HUE}",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",colour:"%{BKY_TEXTS_HUE}",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],
|
||||
output:"Boolean",colour:"%{BKY_TEXTS_HUE}",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}","LAST"]]},{type:"input_value",name:"FIND",check:"String"}],output:"Number",colour:"%{BKY_TEXTS_HUE}",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,
|
||||
extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START"],["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",colour:"%{BKY_TEXTS_HUE}",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]);
|
||||
Blockly.Blocks.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);
|
||||
this.appendValueInput("STRING").setCheck("String").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);this.appendDummyInput("AT1");this.appendDummyInput("AT2");Blockly.Msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL);this.setInputsInline(!0);this.setOutput(!0,"String");this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip(Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=document.createElement("mutation"),
|
||||
b=this.getInput("AT1").type==Blockly.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type==Blockly.INPUT_VALUE;a.setAttribute("at2",b);return a},domToMutation:function(a){var b="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.updateAt_(1,b);this.updateAt_(2,a)},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+a).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):
|
||||
this.appendDummyInput("AT"+a);2==a&&Blockly.Msg.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL));var c=new Blockly.FieldDropdown(this["WHERE_OPTIONS_"+a],function(c){var d="FROM_START"==c||"FROM_END"==c;if(d!=b){var f=this.sourceBlock_;f.updateAt_(a,d);f.setFieldValue(c,"WHERE"+a);return null}});this.getInput("AT"+a).appendField(c,"WHERE"+a);1==a&&this.moveInputBefore("AT1","AT2")}};
|
||||
Blockly.Blocks.text_changeCase={init:function(){var a=[[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl(Blockly.Msg.TEXT_CHANGECASE_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.appendValueInput("TEXT").setCheck("String").appendField(new Blockly.FieldDropdown(a),"CASE");this.setOutput(!0,"String");this.setTooltip(Blockly.Msg.TEXT_CHANGECASE_TOOLTIP)}};
|
||||
Blockly.Blocks.text_trim={init:function(){var a=[[Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl(Blockly.Msg.TEXT_TRIM_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);this.appendValueInput("TEXT").setCheck("String").appendField(new Blockly.FieldDropdown(a),"MODE");this.setOutput(!0,"String");this.setTooltip(Blockly.Msg.TEXT_TRIM_TOOLTIP)}};
|
||||
Blockly.Blocks.text_print={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,colour:Blockly.Blocks.texts.HUE,tooltip:Blockly.Msg.TEXT_PRINT_TOOLTIP,helpUrl:Blockly.Msg.TEXT_PRINT_HELPURL})}};
|
||||
Blockly.Blocks.text_prompt_ext={init:function(){var a=[[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);var b=this;a=new Blockly.FieldDropdown(a,function(a){b.updateType_(a)});this.appendValueInput("TEXT").appendField(a,"TYPE");this.setOutput(!0,"String");this.setTooltip(function(){return"TEXT"==b.getFieldValue("TYPE")?Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT:Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})},
|
||||
updateType_:function(a){this.outputConnection.setCheck("NUMBER"==a?"Number":"String")},mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("type",this.getFieldValue("TYPE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("type"))}};
|
||||
Blockly.Blocks.text_prompt={init:function(){this.mixin(Blockly.Constants.Text.QUOTE_IMAGE_MIXIN);var a=[[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]],b=this;this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);this.setColour(Blockly.Blocks.texts.HUE);a=new Blockly.FieldDropdown(a,function(a){b.updateType_(a)});this.appendDummyInput().appendField(a,"TYPE").appendField(this.newQuote_(!0)).appendField(new Blockly.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1));
|
||||
this.setOutput(!0,"String");this.setTooltip(function(){return"TEXT"==b.getFieldValue("TYPE")?Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT:Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})},updateType_:Blockly.Blocks.text_prompt_ext.updateType_,mutationToDom:Blockly.Blocks.text_prompt_ext.mutationToDom,domToMutation:Blockly.Blocks.text_prompt_ext.domToMutation};
|
||||
Blockly.Blocks.text_count={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"Number",inputsInline:!0,colour:Blockly.Blocks.texts.HUE,tooltip:Blockly.Msg.TEXT_COUNT_TOOLTIP,helpUrl:Blockly.Msg.TEXT_COUNT_HELPURL})}};
|
||||
Blockly.Blocks.text_replace={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String"},{type:"input_value",name:"TO",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,colour:Blockly.Blocks.texts.HUE,tooltip:Blockly.Msg.TEXT_REPLACE_TOOLTIP,helpUrl:Blockly.Msg.TEXT_REPLACE_HELPURL})}};
|
||||
Blockly.Blocks.text_reverse={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,colour:Blockly.Blocks.texts.HUE,tooltip:Blockly.Msg.TEXT_REVERSE_TOOLTIP,helpUrl:Blockly.Msg.TEXT_REVERSE_HELPURL})}};
|
||||
Blockly.Constants.Text.QUOTE_IMAGE_MIXIN={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",
|
||||
QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(a){for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)if(a==e.name){c.insertFieldAt(d,this.newQuote_(!0));c.insertFieldAt(d+2,this.newQuote_(!1));return}console.warn('field named "'+a+'" not found in '+this.toDevString())},newQuote_:function(a){a=this.RTL?!a:a;return new Blockly.FieldImage(a?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,this.QUOTE_IMAGE_WIDTH,this.QUOTE_IMAGE_HEIGHT,a?"\u201c":"\u201d")}};
|
||||
Blockly.Constants.Text.TEXT_QUOTES_EXTENSION=function(){this.mixin(Blockly.Constants.Text.QUOTE_IMAGE_MIXIN);this.quoteField_("TEXT")};
|
||||
Blockly.Constants.Text.TEXT_JOIN_MUTATOR_MIXIN={mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},decompose:function(a){var b=a.newBlock("text_create_join_container");b.initSvg();for(var c=b.getInput("STACK").connection,d=0;d<this.itemCount_;d++){var e=a.newBlock("text_create_join_item");e.initSvg();c.connect(e.previousConnection);c=
|
||||
e.nextConnection}return b},compose:function(a){var b=a.getInputTargetBlock("STACK");for(a=[];b;)a.push(b.valueConnection_),b=b.nextConnection&&b.nextConnection.targetBlock();for(b=0;b<this.itemCount_;b++){var c=this.getInput("ADD"+b).connection.targetConnection;c&&-1==a.indexOf(c)&&c.disconnect()}this.itemCount_=a.length;this.updateShape_();for(b=0;b<this.itemCount_;b++)Blockly.Mutator.reconnect(a[b],this,"ADD"+b)},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){var c=
|
||||
this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;b++;a=a.nextConnection&&a.nextConnection.targetBlock()}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));for(var a=0;a<this.itemCount_;a++)if(!this.getInput("ADD"+a)){var b=this.appendValueInput("ADD"+a);0==a&&b.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH)}for(;this.getInput("ADD"+
|
||||
a);)this.removeInput("ADD"+a),a++}};Blockly.Constants.Text.TEXT_JOIN_EXTENSION=function(){this.mixin(Blockly.Constants.Text.QUOTE_IMAGE_MIXIN);this.itemCount_=2;this.updateShape_();this.setMutator(new Blockly.Mutator(["text_create_join_item"]))};Blockly.Constants.Text.TEXT_APPEND_TOOLTIP_EXTENSION=function(){var a=this;this.setTooltip(function(){return Blockly.Msg.TEXT_APPEND_TOOLTIP?Blockly.Msg.TEXT_APPEND_TOOLTIP.replace("%1",a.getFieldValue("VAR")):""})};
|
||||
Blockly.Constants.Text.TEXT_INDEXOF_TOOLTIP_EXTENSION=function(){var a=this;this.setTooltip(function(){return Blockly.Msg.TEXT_INDEXOF_TOOLTIP.replace("%1",a.workspace.options.oneBasedIndex?"0":"-1")})};
|
||||
Blockly.Constants.Text.TEXT_CHARAT_MUTATOR_MIXIN={mutationToDom:function(){var a=document.createElement("mutation");a.setAttribute("at",!!this.isAt_);return a},domToMutation:function(a){a="false"!=a.getAttribute("at");this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT",!0);this.removeInput("ORDINAL",!0);a&&(this.appendValueInput("AT").setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX));Blockly.Msg.TEXT_CHARAT_TAIL&&
|
||||
(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_CHARAT_TAIL));this.isAt_=a}};
|
||||
Blockly.Constants.Text.TEXT_CHARAT_EXTENSION=function(){this.getField("WHERE").setValidator(function(a){var b="FROM_START"==a||"FROM_END"==a;if(b!=this.isAt_){var d=this.sourceBlock_;d.updateAt_(b);d.setFieldValue(a,"WHERE");return null}});this.updateAt_(!0);var a=this;this.setTooltip(function(){var b=a.getFieldValue("WHERE"),c=Blockly.Msg.TEXT_CHARAT_TOOLTIP;("FROM_START"==b||"FROM_END"==b)&&(b="FROM_START"==b?Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP:Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP)&&
|
||||
(c+=" "+b.replace("%1",a.workspace.options.oneBasedIndex?"#1":"#0"));return c})};Blockly.Extensions.register("text_indexOf_tooltip",Blockly.Constants.Text.TEXT_INDEXOF_TOOLTIP_EXTENSION);Blockly.Extensions.register("text_quotes",Blockly.Constants.Text.TEXT_QUOTES_EXTENSION);Blockly.Extensions.register("text_append_tooltip",Blockly.Constants.Text.TEXT_APPEND_TOOLTIP_EXTENSION);Blockly.Extensions.registerMutator("text_join_mutator",Blockly.Constants.Text.TEXT_JOIN_MUTATOR_MIXIN,Blockly.Constants.Text.TEXT_JOIN_EXTENSION);
|
||||
Blockly.Extensions.registerMutator("text_charAt_mutator",Blockly.Constants.Text.TEXT_CHARAT_MUTATOR_MIXIN,Blockly.Constants.Text.TEXT_CHARAT_EXTENSION);Blockly.Blocks.variables={};Blockly.Constants.Variables={};Blockly.Constants.Variables.HUE=330;Blockly.Blocks.variables.HUE=Blockly.Constants.Variables.HUE;
|
||||
Blockly.defineBlocksWithJsonArray([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,colour:"%{BKY_VARIABLES_HUE}",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,
|
||||
nextStatement:null,colour:"%{BKY_VARIABLES_HUE}",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]);
|
||||
Blockly.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){if("variables_get"==this.type)var b="variables_set",c=Blockly.Msg.VARIABLES_GET_CREATE_SET;else b="variables_get",c=Blockly.Msg.VARIABLES_SET_CREATE_GET;var d={enabled:0<this.workspace.remainingCapacity()},e=this.getFieldValue("VAR");d.text=c.replace("%1",e);c=goog.dom.createDom("field",null,e);c.setAttribute("name","VAR");c=goog.dom.createDom("block",null,c);c.setAttribute("type",
|
||||
b);d.callback=Blockly.ContextMenu.callbackFactory(this,c);a.push(d)}}};Blockly.Extensions.registerMixin("contextMenu_variableSetterGetter",Blockly.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);
|
||||
Blockly.Constants.VariablesDynamic={};Blockly.Constants.VariablesDynamic.HUE=310;
|
||||
Blockly.defineBlocksWithJsonArray([{type:"variables_get_dynamic",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,colour:"%{BKY_VARIABLES_DYNAMIC_HUE}",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableDynamicSetterGetter"]},{type:"variables_set_dynamic",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",
|
||||
name:"VALUE"}],previousStatement:null,nextStatement:null,colour:"%{BKY_VARIABLES_DYNAMIC_HUE}",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableDynamicSetterGetter"]}]);
|
||||
Blockly.Constants.VariablesDynamic.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){if("variables_get_dynamic"==this.type){var b="variables_set_dynamic";var c=Blockly.Msg.VARIABLES_GET_CREATE_SET}else b="variables_get_dynamic",c=Blockly.Msg.VARIABLES_SET_CREATE_GET;var d={enabled:0<this.workspace.remainingCapacity()},e=this.getFieldValue("VAR");d.text=c.replace("%1",e);c=goog.dom.createDom("field",null,e);c.setAttribute("name","VAR");e=this.workspace.getVariable(e);
|
||||
c.setAttribute("variabletype",e.type);e=goog.dom.createDom("block",null,c);e.setAttribute("type",b);d.callback=Blockly.ContextMenu.callbackFactory(this,e);a.push(d)}},onchange:function(){var a=this.getFieldValue("VAR");a=this.workspace.getVariableById(a);"variables_get_dynamic"==this.type?this.outputConnection.setCheck(a.type):this.getInput("VALUE").connection.setCheck(a.type)}};Blockly.Extensions.registerMixin("contextMenu_variableDynamicSetterGetter",Blockly.Constants.VariablesDynamic.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);
|
@ -1,430 +0,0 @@
|
||||
// This file was automatically generated. Do not modify.
|
||||
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.Msg.en');
|
||||
|
||||
goog.require('Blockly.Msg');
|
||||
|
||||
/** @export */ Blockly.Msg.ADD_COMMENT = "Add Comment";
|
||||
/** @export */ Blockly.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE = "Can't delete the variable '%1' because it's part of the definition of the function '%2'";
|
||||
/** @export */ Blockly.Msg.CHANGE_VALUE_TITLE = "Change value:";
|
||||
/** @export */ Blockly.Msg.CLEAN_UP = "Clean up Blocks";
|
||||
/** @export */ Blockly.Msg.COLLAPSE_ALL = "Collapse Blocks";
|
||||
/** @export */ Blockly.Msg.COLLAPSE_BLOCK = "Collapse Block";
|
||||
/** @export */ Blockly.Msg.COLOUR_BLEND_COLOUR1 = "colour 1";
|
||||
/** @export */ Blockly.Msg.COLOUR_BLEND_COLOUR2 = "colour 2";
|
||||
/** @export */ Blockly.Msg.COLOUR_BLEND_HELPURL = "http://meyerweb.com/eric/tools/color-blend/";
|
||||
/** @export */ Blockly.Msg.COLOUR_BLEND_RATIO = "ratio";
|
||||
/** @export */ Blockly.Msg.COLOUR_BLEND_TITLE = "blend";
|
||||
/** @export */ Blockly.Msg.COLOUR_BLEND_TOOLTIP = "Blends two colours together with a given ratio (0.0 - 1.0).";
|
||||
/** @export */ Blockly.Msg.COLOUR_PICKER_HELPURL = "https://en.wikipedia.org/wiki/Color";
|
||||
/** @export */ Blockly.Msg.COLOUR_PICKER_TOOLTIP = "Choose a colour from the palette.";
|
||||
/** @export */ Blockly.Msg.COLOUR_RANDOM_HELPURL = "http://randomcolour.com";
|
||||
/** @export */ Blockly.Msg.COLOUR_RANDOM_TITLE = "random colour";
|
||||
/** @export */ Blockly.Msg.COLOUR_RANDOM_TOOLTIP = "Choose a colour at random.";
|
||||
/** @export */ Blockly.Msg.COLOUR_RGB_BLUE = "blue";
|
||||
/** @export */ Blockly.Msg.COLOUR_RGB_GREEN = "green";
|
||||
/** @export */ Blockly.Msg.COLOUR_RGB_HELPURL = "http://www.december.com/html/spec/colorper.html";
|
||||
/** @export */ Blockly.Msg.COLOUR_RGB_RED = "red";
|
||||
/** @export */ Blockly.Msg.COLOUR_RGB_TITLE = "colour with";
|
||||
/** @export */ Blockly.Msg.COLOUR_RGB_TOOLTIP = "Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 100.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL = "https://github.com/google/blockly/wiki/Loops#loop-termination-blocks";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK = "break out of loop";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE = "continue with next iteration of loop";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK = "Break out of the containing loop.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE = "Skip the rest of this loop, and continue with the next iteration.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING = "Warning: This block may only be used within a loop.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://github.com/google/blockly/wiki/Loops#for-each";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FOREACH_TITLE = "for each item %1 in list %2";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FOREACH_TOOLTIP = "For each item in a list, set the variable '%1' to the item, and then do some statements.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FOR_HELPURL = "https://github.com/google/blockly/wiki/Loops#count-with";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FOR_TITLE = "count with %1 from %2 to %3 by %4";
|
||||
/** @export */ Blockly.Msg.CONTROLS_FOR_TOOLTIP = "Have the variable '%1' take on the values from the start number to the end number, counting by the specified interval, and do the specified blocks.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP = "Add a condition to the if block.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP = "Add a final, catch-all condition to the if block.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_HELPURL = "https://github.com/google/blockly/wiki/IfElse";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_IF_TOOLTIP = "Add, remove, or reorder sections to reconfigure this if block.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_MSG_ELSE = "else";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_MSG_ELSEIF = "else if";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_MSG_IF = "if";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_TOOLTIP_1 = "If a value is true, then do some statements.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_TOOLTIP_2 = "If a value is true, then do the first block of statements. Otherwise, do the second block of statements.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_TOOLTIP_3 = "If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_TOOLTIP_4 = "If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements. If none of the values are true, do the last block of statements.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_REPEAT_HELPURL = "https://en.wikipedia.org/wiki/For_loop";
|
||||
/** @export */ Blockly.Msg.CONTROLS_REPEAT_INPUT_DO = "do";
|
||||
/** @export */ Blockly.Msg.CONTROLS_REPEAT_TITLE = "repeat %1 times";
|
||||
/** @export */ Blockly.Msg.CONTROLS_REPEAT_TOOLTIP = "Do some statements several times.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_WHILEUNTIL_HELPURL = "https://github.com/google/blockly/wiki/Loops#repeat";
|
||||
/** @export */ Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL = "repeat until";
|
||||
/** @export */ Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE = "repeat while";
|
||||
/** @export */ Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL = "While a value is false, then do some statements.";
|
||||
/** @export */ Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE = "While a value is true, then do some statements.";
|
||||
/** @export */ Blockly.Msg.DELETE_ALL_BLOCKS = "Delete all %1 blocks?";
|
||||
/** @export */ Blockly.Msg.DELETE_BLOCK = "Delete Block";
|
||||
/** @export */ Blockly.Msg.DELETE_VARIABLE = "Delete the '%1' variable";
|
||||
/** @export */ Blockly.Msg.DELETE_VARIABLE_CONFIRMATION = "Delete %1 uses of the '%2' variable?";
|
||||
/** @export */ Blockly.Msg.DELETE_X_BLOCKS = "Delete %1 Blocks";
|
||||
/** @export */ Blockly.Msg.DISABLE_BLOCK = "Disable Block";
|
||||
/** @export */ Blockly.Msg.DUPLICATE_BLOCK = "Duplicate";
|
||||
/** @export */ Blockly.Msg.ENABLE_BLOCK = "Enable Block";
|
||||
/** @export */ Blockly.Msg.EXPAND_ALL = "Expand Blocks";
|
||||
/** @export */ Blockly.Msg.EXPAND_BLOCK = "Expand Block";
|
||||
/** @export */ Blockly.Msg.EXTERNAL_INPUTS = "External Inputs";
|
||||
/** @export */ Blockly.Msg.HELP = "Help";
|
||||
/** @export */ Blockly.Msg.INLINE_INPUTS = "Inline Inputs";
|
||||
/** @export */ Blockly.Msg.IOS_CANCEL = "Cancel";
|
||||
/** @export */ Blockly.Msg.IOS_ERROR = "Error";
|
||||
/** @export */ Blockly.Msg.IOS_OK = "OK";
|
||||
/** @export */ Blockly.Msg.IOS_PROCEDURES_ADD_INPUT = "+ Add Input";
|
||||
/** @export */ Blockly.Msg.IOS_PROCEDURES_ALLOW_STATEMENTS = "Allow statements";
|
||||
/** @export */ Blockly.Msg.IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR = "This function has duplicate inputs.";
|
||||
/** @export */ Blockly.Msg.IOS_PROCEDURES_INPUTS = "INPUTS";
|
||||
/** @export */ Blockly.Msg.IOS_VARIABLES_ADD_BUTTON = "Add";
|
||||
/** @export */ Blockly.Msg.IOS_VARIABLES_ADD_VARIABLE = "+ Add Variable";
|
||||
/** @export */ Blockly.Msg.IOS_VARIABLES_DELETE_BUTTON = "Delete";
|
||||
/** @export */ Blockly.Msg.IOS_VARIABLES_EMPTY_NAME_ERROR = "You can't use an empty variable name.";
|
||||
/** @export */ Blockly.Msg.IOS_VARIABLES_RENAME_BUTTON = "Rename";
|
||||
/** @export */ Blockly.Msg.IOS_VARIABLES_VARIABLE_NAME = "Variable name";
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL = "https://github.com/google/blockly/wiki/Lists#create-empty-list";
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_EMPTY_TITLE = "create empty list";
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP = "Returns a list, of length 0, containing no data records";
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD = "list";
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP = "Add, remove, or reorder sections to reconfigure this list block.";
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_WITH_HELPURL = "https://github.com/google/blockly/wiki/Lists#create-list-with";
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH = "create list with";
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP = "Add an item to the list.";
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP = "Create a list with any number of items.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_FIRST = "first";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_FROM_END = "# from end";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_FROM_START = "#";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_GET = "get";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_GET_REMOVE = "get and remove";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_LAST = "last";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_RANDOM = "random";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_REMOVE = "remove";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TAIL = "";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST = "Returns the first item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM = "Returns the item at the specified position in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST = "Returns the last item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM = "Returns a random item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST = "Removes and returns the first item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM = "Removes and returns the item at the specified position in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST = "Removes and returns the last item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM = "Removes and returns a random item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST = "Removes the first item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM = "Removes the item at the specified position in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST = "Removes the last item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM = "Removes a random item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_END = "to # from end";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START = "to #";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_END_LAST = "to last";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_HELPURL = "https://github.com/google/blockly/wiki/Lists#getting-a-sublist";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_START_FIRST = "get sub-list from first";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_END = "get sub-list from # from end";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_START = "get sub-list from #";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_TAIL = "";
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP = "Creates a copy of the specified portion of a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP = "%1 is the last item.";
|
||||
/** @export */ Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP = "%1 is the first item.";
|
||||
/** @export */ Blockly.Msg.LISTS_INDEX_OF_FIRST = "find first occurrence of item";
|
||||
/** @export */ Blockly.Msg.LISTS_INDEX_OF_HELPURL = "https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list";
|
||||
/** @export */ Blockly.Msg.LISTS_INDEX_OF_LAST = "find last occurrence of item";
|
||||
/** @export */ Blockly.Msg.LISTS_INDEX_OF_TOOLTIP = "Returns the index of the first/last occurrence of the item in the list. Returns %1 if item is not found.";
|
||||
/** @export */ Blockly.Msg.LISTS_INLIST = "in list";
|
||||
/** @export */ Blockly.Msg.LISTS_ISEMPTY_HELPURL = "https://github.com/google/blockly/wiki/Lists#is-empty";
|
||||
/** @export */ Blockly.Msg.LISTS_ISEMPTY_TITLE = "%1 is empty";
|
||||
/** @export */ Blockly.Msg.LISTS_ISEMPTY_TOOLTIP = "Returns true if the list is empty.";
|
||||
/** @export */ Blockly.Msg.LISTS_LENGTH_HELPURL = "https://github.com/google/blockly/wiki/Lists#length-of";
|
||||
/** @export */ Blockly.Msg.LISTS_LENGTH_TITLE = "length of %1";
|
||||
/** @export */ Blockly.Msg.LISTS_LENGTH_TOOLTIP = "Returns the length of a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_REPEAT_HELPURL = "https://github.com/google/blockly/wiki/Lists#create-list-with";
|
||||
/** @export */ Blockly.Msg.LISTS_REPEAT_TITLE = "create list with item %1 repeated %2 times";
|
||||
/** @export */ Blockly.Msg.LISTS_REPEAT_TOOLTIP = "Creates a list consisting of the given value repeated the specified number of times.";
|
||||
/** @export */ Blockly.Msg.LISTS_REVERSE_HELPURL = "https://github.com/google/blockly/wiki/Lists#reversing-a-list";
|
||||
/** @export */ Blockly.Msg.LISTS_REVERSE_MESSAGE0 = "reverse %1";
|
||||
/** @export */ Blockly.Msg.LISTS_REVERSE_TOOLTIP = "Reverse a copy of a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_HELPURL = "https://github.com/google/blockly/wiki/Lists#in-list--set";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_INPUT_TO = "as";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_INSERT = "insert at";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_SET = "set";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST = "Inserts the item at the start of a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM = "Inserts the item at the specified position in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST = "Append the item to the end of a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM = "Inserts the item randomly in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST = "Sets the first item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM = "Sets the item at the specified position in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST = "Sets the last item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM = "Sets a random item in a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SORT_HELPURL = "https://github.com/google/blockly/wiki/Lists#sorting-a-list";
|
||||
/** @export */ Blockly.Msg.LISTS_SORT_ORDER_ASCENDING = "ascending";
|
||||
/** @export */ Blockly.Msg.LISTS_SORT_ORDER_DESCENDING = "descending";
|
||||
/** @export */ Blockly.Msg.LISTS_SORT_TITLE = "sort %1 %2 %3";
|
||||
/** @export */ Blockly.Msg.LISTS_SORT_TOOLTIP = "Sort a copy of a list.";
|
||||
/** @export */ Blockly.Msg.LISTS_SORT_TYPE_IGNORECASE = "alphabetic, ignore case";
|
||||
/** @export */ Blockly.Msg.LISTS_SORT_TYPE_NUMERIC = "numeric";
|
||||
/** @export */ Blockly.Msg.LISTS_SORT_TYPE_TEXT = "alphabetic";
|
||||
/** @export */ Blockly.Msg.LISTS_SPLIT_HELPURL = "https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists";
|
||||
/** @export */ Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT = "make list from text";
|
||||
/** @export */ Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST = "make text from list";
|
||||
/** @export */ Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN = "Join a list of texts into one text, separated by a delimiter.";
|
||||
/** @export */ Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT = "Split text into a list of texts, breaking at each delimiter.";
|
||||
/** @export */ Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER = "with delimiter";
|
||||
/** @export */ Blockly.Msg.LOGIC_BOOLEAN_FALSE = "false";
|
||||
/** @export */ Blockly.Msg.LOGIC_BOOLEAN_HELPURL = "https://github.com/google/blockly/wiki/Logic#values";
|
||||
/** @export */ Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP = "Returns either true or false.";
|
||||
/** @export */ Blockly.Msg.LOGIC_BOOLEAN_TRUE = "true";
|
||||
/** @export */ Blockly.Msg.LOGIC_COMPARE_HELPURL = "https://en.wikipedia.org/wiki/Inequality_(mathematics)";
|
||||
/** @export */ Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ = "Return true if both inputs equal each other.";
|
||||
/** @export */ Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT = "Return true if the first input is greater than the second input.";
|
||||
/** @export */ Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE = "Return true if the first input is greater than or equal to the second input.";
|
||||
/** @export */ Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT = "Return true if the first input is smaller than the second input.";
|
||||
/** @export */ Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE = "Return true if the first input is smaller than or equal to the second input.";
|
||||
/** @export */ Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ = "Return true if both inputs are not equal to each other.";
|
||||
/** @export */ Blockly.Msg.LOGIC_NEGATE_HELPURL = "https://github.com/google/blockly/wiki/Logic#not";
|
||||
/** @export */ Blockly.Msg.LOGIC_NEGATE_TITLE = "not %1";
|
||||
/** @export */ Blockly.Msg.LOGIC_NEGATE_TOOLTIP = "Returns true if the input is false. Returns false if the input is true.";
|
||||
/** @export */ Blockly.Msg.LOGIC_NULL = "null";
|
||||
/** @export */ Blockly.Msg.LOGIC_NULL_HELPURL = "https://en.wikipedia.org/wiki/Nullable_type";
|
||||
/** @export */ Blockly.Msg.LOGIC_NULL_TOOLTIP = "Returns null.";
|
||||
/** @export */ Blockly.Msg.LOGIC_OPERATION_AND = "and";
|
||||
/** @export */ Blockly.Msg.LOGIC_OPERATION_HELPURL = "https://github.com/google/blockly/wiki/Logic#logical-operations";
|
||||
/** @export */ Blockly.Msg.LOGIC_OPERATION_OR = "or";
|
||||
/** @export */ Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND = "Return true if both inputs are true.";
|
||||
/** @export */ Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR = "Return true if at least one of the inputs is true.";
|
||||
/** @export */ Blockly.Msg.LOGIC_TERNARY_CONDITION = "test";
|
||||
/** @export */ Blockly.Msg.LOGIC_TERNARY_HELPURL = "https://en.wikipedia.org/wiki/%3F:";
|
||||
/** @export */ Blockly.Msg.LOGIC_TERNARY_IF_FALSE = "if false";
|
||||
/** @export */ Blockly.Msg.LOGIC_TERNARY_IF_TRUE = "if true";
|
||||
/** @export */ Blockly.Msg.LOGIC_TERNARY_TOOLTIP = "Check the condition in 'test'. If the condition is true, returns the 'if true' value; otherwise returns the 'if false' value.";
|
||||
/** @export */ Blockly.Msg.MATH_ADDITION_SYMBOL = "+";
|
||||
/** @export */ Blockly.Msg.MATH_ARITHMETIC_HELPURL = "https://en.wikipedia.org/wiki/Arithmetic";
|
||||
/** @export */ Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_ADD = "Return the sum of the two numbers.";
|
||||
/** @export */ Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE = "Return the quotient of the two numbers.";
|
||||
/** @export */ Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS = "Return the difference of the two numbers.";
|
||||
/** @export */ Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY = "Return the product of the two numbers.";
|
||||
/** @export */ Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_POWER = "Return the first number raised to the power of the second number.";
|
||||
/** @export */ Blockly.Msg.MATH_CHANGE_HELPURL = "https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter";
|
||||
/** @export */ Blockly.Msg.MATH_CHANGE_TITLE = "change %1 by %2";
|
||||
/** @export */ Blockly.Msg.MATH_CHANGE_TOOLTIP = "Add a number to variable '%1'.";
|
||||
/** @export */ Blockly.Msg.MATH_CONSTANT_HELPURL = "https://en.wikipedia.org/wiki/Mathematical_constant";
|
||||
/** @export */ Blockly.Msg.MATH_CONSTANT_TOOLTIP = "Return one of the common constants: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), or ∞ (infinity).";
|
||||
/** @export */ Blockly.Msg.MATH_CONSTRAIN_HELPURL = "https://en.wikipedia.org/wiki/Clamping_(graphics)";
|
||||
/** @export */ Blockly.Msg.MATH_CONSTRAIN_TITLE = "constrain %1 low %2 high %3";
|
||||
/** @export */ Blockly.Msg.MATH_CONSTRAIN_TOOLTIP = "Constrain a number to be between the specified limits (inclusive).";
|
||||
/** @export */ Blockly.Msg.MATH_DIVISION_SYMBOL = "÷";
|
||||
/** @export */ Blockly.Msg.MATH_IS_DIVISIBLE_BY = "is divisible by";
|
||||
/** @export */ Blockly.Msg.MATH_IS_EVEN = "is even";
|
||||
/** @export */ Blockly.Msg.MATH_IS_NEGATIVE = "is negative";
|
||||
/** @export */ Blockly.Msg.MATH_IS_ODD = "is odd";
|
||||
/** @export */ Blockly.Msg.MATH_IS_POSITIVE = "is positive";
|
||||
/** @export */ Blockly.Msg.MATH_IS_PRIME = "is prime";
|
||||
/** @export */ Blockly.Msg.MATH_IS_TOOLTIP = "Check if a number is an even, odd, prime, whole, positive, negative, or if it is divisible by certain number. Returns true or false.";
|
||||
/** @export */ Blockly.Msg.MATH_IS_WHOLE = "is whole";
|
||||
/** @export */ Blockly.Msg.MATH_MODULO_HELPURL = "https://en.wikipedia.org/wiki/Modulo_operation";
|
||||
/** @export */ Blockly.Msg.MATH_MODULO_TITLE = "remainder of %1 ÷ %2";
|
||||
/** @export */ Blockly.Msg.MATH_MODULO_TOOLTIP = "Return the remainder from dividing the two numbers.";
|
||||
/** @export */ Blockly.Msg.MATH_MULTIPLICATION_SYMBOL = "×";
|
||||
/** @export */ Blockly.Msg.MATH_NUMBER_HELPURL = "https://en.wikipedia.org/wiki/Number";
|
||||
/** @export */ Blockly.Msg.MATH_NUMBER_TOOLTIP = "A number.";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_HELPURL = "";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_OPERATOR_AVERAGE = "average of list";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_OPERATOR_MAX = "max of list";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_OPERATOR_MEDIAN = "median of list";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_OPERATOR_MIN = "min of list";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_OPERATOR_MODE = "modes of list";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_OPERATOR_RANDOM = "random item of list";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_OPERATOR_STD_DEV = "standard deviation of list";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_OPERATOR_SUM = "sum of list";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_TOOLTIP_AVERAGE = "Return the average (arithmetic mean) of the numeric values in the list.";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_TOOLTIP_MAX = "Return the largest number in the list.";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_TOOLTIP_MEDIAN = "Return the median number in the list.";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_TOOLTIP_MIN = "Return the smallest number in the list.";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_TOOLTIP_MODE = "Return a list of the most common item(s) in the list.";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_TOOLTIP_RANDOM = "Return a random element from the list.";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_TOOLTIP_STD_DEV = "Return the standard deviation of the list.";
|
||||
/** @export */ Blockly.Msg.MATH_ONLIST_TOOLTIP_SUM = "Return the sum of all the numbers in the list.";
|
||||
/** @export */ Blockly.Msg.MATH_POWER_SYMBOL = "^";
|
||||
/** @export */ Blockly.Msg.MATH_RANDOM_FLOAT_HELPURL = "https://en.wikipedia.org/wiki/Random_number_generation";
|
||||
/** @export */ Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM = "random fraction";
|
||||
/** @export */ Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP = "Return a random fraction between 0.0 (inclusive) and 1.0 (exclusive).";
|
||||
/** @export */ Blockly.Msg.MATH_RANDOM_INT_HELPURL = "https://en.wikipedia.org/wiki/Random_number_generation";
|
||||
/** @export */ Blockly.Msg.MATH_RANDOM_INT_TITLE = "random integer from %1 to %2";
|
||||
/** @export */ Blockly.Msg.MATH_RANDOM_INT_TOOLTIP = "Return a random integer between the two specified limits, inclusive.";
|
||||
/** @export */ Blockly.Msg.MATH_ROUND_HELPURL = "https://en.wikipedia.org/wiki/Rounding";
|
||||
/** @export */ Blockly.Msg.MATH_ROUND_OPERATOR_ROUND = "round";
|
||||
/** @export */ Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN = "round down";
|
||||
/** @export */ Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDUP = "round up";
|
||||
/** @export */ Blockly.Msg.MATH_ROUND_TOOLTIP = "Round a number up or down.";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_HELPURL = "https://en.wikipedia.org/wiki/Square_root";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_OP_ABSOLUTE = "absolute";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_OP_ROOT = "square root";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_TOOLTIP_ABS = "Return the absolute value of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_TOOLTIP_EXP = "Return e to the power of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_TOOLTIP_LN = "Return the natural logarithm of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_TOOLTIP_LOG10 = "Return the base 10 logarithm of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_TOOLTIP_NEG = "Return the negation of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_TOOLTIP_POW10 = "Return 10 to the power of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_SINGLE_TOOLTIP_ROOT = "Return the square root of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_SUBTRACTION_SYMBOL = "-";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_ACOS = "acos";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_ASIN = "asin";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_ATAN = "atan";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_COS = "cos";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_HELPURL = "https://en.wikipedia.org/wiki/Trigonometric_functions";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_SIN = "sin";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_TAN = "tan";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_TOOLTIP_ACOS = "Return the arccosine of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_TOOLTIP_ASIN = "Return the arcsine of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_TOOLTIP_ATAN = "Return the arctangent of a number.";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_TOOLTIP_COS = "Return the cosine of a degree (not radian).";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_TOOLTIP_SIN = "Return the sine of a degree (not radian).";
|
||||
/** @export */ Blockly.Msg.MATH_TRIG_TOOLTIP_TAN = "Return the tangent of a degree (not radian).";
|
||||
/** @export */ Blockly.Msg.NEW_COLOUR_VARIABLE = "Create colour variable...";
|
||||
/** @export */ Blockly.Msg.NEW_NUMBER_VARIABLE = "Create number variable...";
|
||||
/** @export */ Blockly.Msg.NEW_STRING_VARIABLE = "Create string variable...";
|
||||
/** @export */ Blockly.Msg.NEW_VARIABLE = "Create variable...";
|
||||
/** @export */ Blockly.Msg.NEW_VARIABLE_TITLE = "New variable name:";
|
||||
/** @export */ Blockly.Msg.NEW_VARIABLE_TYPE_TITLE = "New variable type:";
|
||||
/** @export */ Blockly.Msg.ORDINAL_NUMBER_SUFFIX = "";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_ALLOW_STATEMENTS = "allow statements";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_BEFORE_PARAMS = "with:";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL = "https://en.wikipedia.org/wiki/Subroutine";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP = "Run the user-defined function '%1'.";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL = "https://en.wikipedia.org/wiki/Subroutine";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP = "Run the user-defined function '%1' and use its output.";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS = "with:";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_CREATE_DO = "Create '%1'";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT = "Describe this function...";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFNORETURN_DO = "";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL = "https://en.wikipedia.org/wiki/Subroutine";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE = "do something";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE = "to";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP = "Creates a function with no output.";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL = "https://en.wikipedia.org/wiki/Subroutine";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFRETURN_RETURN = "return";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP = "Creates a function with an output.";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING = "Warning: This function has duplicate parameters.";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF = "Highlight function definition";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_IFRETURN_HELPURL = "http://c2.com/cgi/wiki?GuardClause";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP = "If a value is true, then return a second value.";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_IFRETURN_WARNING = "Warning: This block may be used only within a function definition.";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_MUTATORARG_TITLE = "input name:";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP = "Add an input to the function.";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE = "inputs";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP = "Add, remove, or reorder inputs to this function.";
|
||||
/** @export */ Blockly.Msg.REDO = "Redo";
|
||||
/** @export */ Blockly.Msg.REMOVE_COMMENT = "Remove Comment";
|
||||
/** @export */ Blockly.Msg.RENAME_VARIABLE = "Rename variable...";
|
||||
/** @export */ Blockly.Msg.RENAME_VARIABLE_TITLE = "Rename all '%1' variables to:";
|
||||
/** @export */ Blockly.Msg.TEXT_APPEND_HELPURL = "https://github.com/google/blockly/wiki/Text#text-modification";
|
||||
/** @export */ Blockly.Msg.TEXT_APPEND_TITLE = "to %1 append text %2";
|
||||
/** @export */ Blockly.Msg.TEXT_APPEND_TOOLTIP = "Append some text to variable '%1'.";
|
||||
/** @export */ Blockly.Msg.TEXT_CHANGECASE_HELPURL = "https://github.com/google/blockly/wiki/Text#adjusting-text-case";
|
||||
/** @export */ Blockly.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE = "to lower case";
|
||||
/** @export */ Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE = "to Title Case";
|
||||
/** @export */ Blockly.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE = "to UPPER CASE";
|
||||
/** @export */ Blockly.Msg.TEXT_CHANGECASE_TOOLTIP = "Return a copy of the text in a different case.";
|
||||
/** @export */ Blockly.Msg.TEXT_CHARAT_FIRST = "get first letter";
|
||||
/** @export */ Blockly.Msg.TEXT_CHARAT_FROM_END = "get letter # from end";
|
||||
/** @export */ Blockly.Msg.TEXT_CHARAT_FROM_START = "get letter #";
|
||||
/** @export */ Blockly.Msg.TEXT_CHARAT_HELPURL = "https://github.com/google/blockly/wiki/Text#extracting-text";
|
||||
/** @export */ Blockly.Msg.TEXT_CHARAT_LAST = "get last letter";
|
||||
/** @export */ Blockly.Msg.TEXT_CHARAT_RANDOM = "get random letter";
|
||||
/** @export */ Blockly.Msg.TEXT_CHARAT_TAIL = "";
|
||||
/** @export */ Blockly.Msg.TEXT_CHARAT_TITLE = "in text %1 %2";
|
||||
/** @export */ Blockly.Msg.TEXT_CHARAT_TOOLTIP = "Returns the letter at the specified position.";
|
||||
/** @export */ Blockly.Msg.TEXT_COUNT_HELPURL = "https://github.com/google/blockly/wiki/Text#counting-substrings";
|
||||
/** @export */ Blockly.Msg.TEXT_COUNT_MESSAGE0 = "count %1 in %2";
|
||||
/** @export */ Blockly.Msg.TEXT_COUNT_TOOLTIP = "Count how many times some text occurs within some other text.";
|
||||
/** @export */ Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP = "Add an item to the text.";
|
||||
/** @export */ Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN = "join";
|
||||
/** @export */ Blockly.Msg.TEXT_CREATE_JOIN_TOOLTIP = "Add, remove, or reorder sections to reconfigure this text block.";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_END = "to letter # from end";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_START = "to letter #";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST = "to last letter";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL = "https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT = "in text";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_START_FIRST = "get substring from first letter";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_END = "get substring from letter # from end";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_START = "get substring from letter #";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_TAIL = "";
|
||||
/** @export */ Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP = "Returns a specified portion of the text.";
|
||||
/** @export */ Blockly.Msg.TEXT_INDEXOF_HELPURL = "https://github.com/google/blockly/wiki/Text#finding-text";
|
||||
/** @export */ Blockly.Msg.TEXT_INDEXOF_OPERATOR_FIRST = "find first occurrence of text";
|
||||
/** @export */ Blockly.Msg.TEXT_INDEXOF_OPERATOR_LAST = "find last occurrence of text";
|
||||
/** @export */ Blockly.Msg.TEXT_INDEXOF_TITLE = "in text %1 %2 %3";
|
||||
/** @export */ Blockly.Msg.TEXT_INDEXOF_TOOLTIP = "Returns the index of the first/last occurrence of the first text in the second text. Returns %1 if text is not found.";
|
||||
/** @export */ Blockly.Msg.TEXT_ISEMPTY_HELPURL = "https://github.com/google/blockly/wiki/Text#checking-for-empty-text";
|
||||
/** @export */ Blockly.Msg.TEXT_ISEMPTY_TITLE = "%1 is empty";
|
||||
/** @export */ Blockly.Msg.TEXT_ISEMPTY_TOOLTIP = "Returns true if the provided text is empty.";
|
||||
/** @export */ Blockly.Msg.TEXT_JOIN_HELPURL = "https://github.com/google/blockly/wiki/Text#text-creation";
|
||||
/** @export */ Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH = "create text with";
|
||||
/** @export */ Blockly.Msg.TEXT_JOIN_TOOLTIP = "Create a piece of text by joining together any number of items.";
|
||||
/** @export */ Blockly.Msg.TEXT_LENGTH_HELPURL = "https://github.com/google/blockly/wiki/Text#text-modification";
|
||||
/** @export */ Blockly.Msg.TEXT_LENGTH_TITLE = "length of %1";
|
||||
/** @export */ Blockly.Msg.TEXT_LENGTH_TOOLTIP = "Returns the number of letters (including spaces) in the provided text.";
|
||||
/** @export */ Blockly.Msg.TEXT_PRINT_HELPURL = "https://github.com/google/blockly/wiki/Text#printing-text";
|
||||
/** @export */ Blockly.Msg.TEXT_PRINT_TITLE = "print %1";
|
||||
/** @export */ Blockly.Msg.TEXT_PRINT_TOOLTIP = "Print the specified text, number or other value.";
|
||||
/** @export */ Blockly.Msg.TEXT_PROMPT_HELPURL = "https://github.com/google/blockly/wiki/Text#getting-input-from-the-user";
|
||||
/** @export */ Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER = "Prompt for user for a number.";
|
||||
/** @export */ Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT = "Prompt for user for some text.";
|
||||
/** @export */ Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER = "prompt for number with message";
|
||||
/** @export */ Blockly.Msg.TEXT_PROMPT_TYPE_TEXT = "prompt for text with message";
|
||||
/** @export */ Blockly.Msg.TEXT_REPLACE_HELPURL = "https://github.com/google/blockly/wiki/Text#replacing-substrings";
|
||||
/** @export */ Blockly.Msg.TEXT_REPLACE_MESSAGE0 = "replace %1 with %2 in %3";
|
||||
/** @export */ Blockly.Msg.TEXT_REPLACE_TOOLTIP = "Replace all occurances of some text within some other text.";
|
||||
/** @export */ Blockly.Msg.TEXT_REVERSE_HELPURL = "https://github.com/google/blockly/wiki/Text#reversing-text";
|
||||
/** @export */ Blockly.Msg.TEXT_REVERSE_MESSAGE0 = "reverse %1";
|
||||
/** @export */ Blockly.Msg.TEXT_REVERSE_TOOLTIP = "Reverses the order of the characters in the text.";
|
||||
/** @export */ Blockly.Msg.TEXT_TEXT_HELPURL = "https://en.wikipedia.org/wiki/String_(computer_science)";
|
||||
/** @export */ Blockly.Msg.TEXT_TEXT_TOOLTIP = "A letter, word, or line of text.";
|
||||
/** @export */ Blockly.Msg.TEXT_TRIM_HELPURL = "https://github.com/google/blockly/wiki/Text#trimming-removing-spaces";
|
||||
/** @export */ Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH = "trim spaces from both sides of";
|
||||
/** @export */ Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT = "trim spaces from left side of";
|
||||
/** @export */ Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT = "trim spaces from right side of";
|
||||
/** @export */ Blockly.Msg.TEXT_TRIM_TOOLTIP = "Return a copy of the text with spaces removed from one or both ends.";
|
||||
/** @export */ Blockly.Msg.TODAY = "Today";
|
||||
/** @export */ Blockly.Msg.UNDO = "Undo";
|
||||
/** @export */ Blockly.Msg.VARIABLES_DEFAULT_NAME = "item";
|
||||
/** @export */ Blockly.Msg.VARIABLES_GET_CREATE_SET = "Create 'set %1'";
|
||||
/** @export */ Blockly.Msg.VARIABLES_GET_HELPURL = "https://github.com/google/blockly/wiki/Variables#get";
|
||||
/** @export */ Blockly.Msg.VARIABLES_GET_TOOLTIP = "Returns the value of this variable.";
|
||||
/** @export */ Blockly.Msg.VARIABLES_SET = "set %1 to %2";
|
||||
/** @export */ Blockly.Msg.VARIABLES_SET_CREATE_GET = "Create 'get %1'";
|
||||
/** @export */ Blockly.Msg.VARIABLES_SET_HELPURL = "https://github.com/google/blockly/wiki/Variables#set";
|
||||
/** @export */ Blockly.Msg.VARIABLES_SET_TOOLTIP = "Sets this variable to be equal to the input.";
|
||||
/** @export */ Blockly.Msg.VARIABLE_ALREADY_EXISTS = "A variable named '%1' already exists.";
|
||||
/** @export */ Blockly.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE = "A variable named '%1' already exists for another type: '%2'.";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFRETURN_TITLE = Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE;
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_IF_TITLE_IF = Blockly.Msg.CONTROLS_IF_MSG_IF;
|
||||
/** @export */ Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_MSG_THEN = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE = Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE;
|
||||
/** @export */ Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
|
||||
/** @export */ Blockly.Msg.MATH_CHANGE_TITLE_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME;
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFRETURN_DO = Blockly.Msg.PROCEDURES_DEFNORETURN_DO;
|
||||
/** @export */ Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF = Blockly.Msg.CONTROLS_IF_MSG_ELSEIF;
|
||||
/** @export */ Blockly.Msg.LISTS_GET_INDEX_HELPURL = Blockly.Msg.LISTS_INDEX_OF_HELPURL;
|
||||
/** @export */ Blockly.Msg.CONTROLS_FOREACH_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
|
||||
/** @export */ Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
|
||||
/** @export */ Blockly.Msg.CONTROLS_FOR_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO;
|
||||
/** @export */ Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE = Blockly.Msg.VARIABLES_DEFAULT_NAME;
|
||||
/** @export */ Blockly.Msg.TEXT_APPEND_VARIABLE = Blockly.Msg.VARIABLES_DEFAULT_NAME;
|
||||
/** @export */ Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME;
|
||||
/** @export */ Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST;
|
||||
/** @export */ Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT = Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT;
|
||||
|
||||
/** @export */ Blockly.Msg.MATH_HUE = "230";
|
||||
/** @export */ Blockly.Msg.LOOPS_HUE = "120";
|
||||
/** @export */ Blockly.Msg.LISTS_HUE = "260";
|
||||
/** @export */ Blockly.Msg.LOGIC_HUE = "210";
|
||||
/** @export */ Blockly.Msg.VARIABLES_HUE = "330";
|
||||
/** @export */ Blockly.Msg.TEXTS_HUE = "160";
|
||||
/** @export */ Blockly.Msg.PROCEDURES_HUE = "290";
|
||||
/** @export */ Blockly.Msg.COLOUR_HUE = "20";
|
||||
/** @export */ Blockly.Msg.VARIABLES_DYNAMIC_HUE = "310";
|
File diff suppressed because one or more lines are too long
@ -1,117 +0,0 @@
|
||||
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
# AnTOS Web desktop is is licensed under the GNU General Public
|
||||
# License v3.0, see the LICENCE file for more information
|
||||
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
class CodeBlock extends this.OS.GUI.BaseApplication
|
||||
constructor: (args) ->
|
||||
super "CodeBlock", args
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", "CodeBlock"
|
||||
@btnact = @find "btn-action"
|
||||
@container = @find "ws"
|
||||
|
||||
#file = "#{@path()}/toolbox.xml".asFileHandler()
|
||||
#console.log file
|
||||
#file.read (d) ->
|
||||
# return me.error "Cannot load the toolbox" if d.error
|
||||
#console.log d
|
||||
#toolbox = $.parseHTML d
|
||||
#me.scheme.append toolbox
|
||||
|
||||
me.workspace = Blockly.inject me.container,
|
||||
{
|
||||
grid:
|
||||
spacing: 25
|
||||
length: 3
|
||||
colour: '#ccc'
|
||||
snap: true
|
||||
zoom:
|
||||
controls: true
|
||||
wheel: true
|
||||
toolbox: @find "blockly_toolbox"
|
||||
}
|
||||
|
||||
#if(Blockly.RpiControl)
|
||||
# this.workspace.registerToolboxCategoryCallback('EXTRAS', function(workspace)
|
||||
# {
|
||||
# var xmlList = [];
|
||||
# for (var i = 0; i < Blockly.RpiControl.length; i++) {
|
||||
# var el = Blockly.RpiControl[i];
|
||||
# if (Blockly.Blocks[el]) {
|
||||
# var blockText = '<xml><block type="'+el+'"></block></xml>';
|
||||
# var block = Blockly.Xml.textToDom(blockText).firstChild;
|
||||
# xmlList.push(block);
|
||||
# }
|
||||
# }
|
||||
# return xmlList;
|
||||
#});
|
||||
|
||||
@blen = 1024
|
||||
#@btnact.set "onbtclick", (e) ->
|
||||
#me.openSession()
|
||||
# code = Blockly.JavaScript.workspaceToCode me.workspace
|
||||
# console.log code
|
||||
@on "resize", () ->
|
||||
Blockly.svgResize me.workspace
|
||||
@bindKey "ALT-N", () -> me.actionFile "#{me.name}-New"
|
||||
@bindKey "ALT-O", () -> me.actionFile "#{me.name}-Open"
|
||||
@bindKey "CTRL-S", () -> me.actionFile "#{me.name}-Save"
|
||||
@bindKey "ALT-W", () -> me.actionFile "#{me.name}-Saveas"
|
||||
|
||||
menu: () ->
|
||||
me = @
|
||||
menu = [{
|
||||
text: "File",
|
||||
child: [
|
||||
{ text: __("New"), dataid: "#{@name}-New", shortcut: "A-N" },
|
||||
{ text: "__(Open)", dataid: "#{@name}-Open", shortcut: "A-O" },
|
||||
{ text: "__(Save)", dataid: "#{@name}-Save", shortcut: "C-S" },
|
||||
{ text: "__(Save as)", dataid: "#{@name}-Saveas", shortcut: "A-W" }
|
||||
],
|
||||
onmenuselect: (e) -> me.actionFile e.item.data.dataid
|
||||
}]
|
||||
menu
|
||||
|
||||
actionFile: (n) ->
|
||||
console.log n
|
||||
openSession: () ->
|
||||
me = @
|
||||
proto = if window.location.protocol is "https:" then "wss://" else "ws://"
|
||||
@socket = new WebSocket proto + @_api.HOST + "/ws/filestream.lua"
|
||||
@socket.binaryType = "arraybuffer"
|
||||
@socket.onopen = () ->
|
||||
console.log "socket open"
|
||||
enc = new TextEncoder "utf-8"
|
||||
me.socket.send enc.encode me.blen + "os://packages/packages.json"
|
||||
|
||||
@socket.onmessage = (e) ->
|
||||
console.log e.data
|
||||
console.log new TextDecoder("utf-8").decode new Uint8Array e.data
|
||||
me.socket.close() if e.data.byteLength < me.blen
|
||||
|
||||
@socket.onclose = () ->
|
||||
me.socket = null
|
||||
console.log "socket closed"
|
||||
|
||||
|
||||
|
||||
cleanup: (e) ->
|
||||
@socket.close() if @socket
|
||||
|
||||
CodeBlock.singleton = true
|
||||
this.OS.register "CodeBlock", CodeBlock
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"app":"CodeBlock",
|
||||
"name":"CodeBlock",
|
||||
"description":"Programming using interlocking blocks",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.0.1-a",
|
||||
"category":"Programming",
|
||||
"iconclass":"fa fa-puzzle-piece",
|
||||
"mimes":["none"]
|
||||
}
|
@ -1,302 +0,0 @@
|
||||
<afx-app-window apptitle="CodeBlock" width="600" height="400">
|
||||
<afx-vbox data-id = "mybox">
|
||||
<!--afx-button data-height="20" text= "Action" data-id = "btn-action" ></afx-button-->
|
||||
<div data-id="ws"></div>
|
||||
<xml id="blockly_toolbox" data-height="0" data-id="blockly_toolbox" style="display: none">
|
||||
<category name="Logic" colour="210">
|
||||
<block type="controls_if"></block>
|
||||
<block type="logic_compare"></block>
|
||||
<block type="logic_operation"></block>
|
||||
<block type="logic_negate"></block>
|
||||
<block type="logic_boolean"></block>
|
||||
<block type="logic_null"></block>
|
||||
<block type="logic_ternary"></block>
|
||||
</category>
|
||||
<category name="Loops" colour="120">
|
||||
<block type="controls_repeat_ext">
|
||||
<value name="TIMES">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">10</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="controls_whileUntil"></block>
|
||||
<block type="controls_for">
|
||||
<value name="FROM">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="TO">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">10</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="BY">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="controls_forEach"></block>
|
||||
<block type="controls_flow_statements"></block>
|
||||
</category>
|
||||
<category name="Math" colour="230">
|
||||
<block type="math_number"></block>
|
||||
<block type="math_arithmetic">
|
||||
<value name="A">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="B">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="math_single">
|
||||
<value name="NUM">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">9</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="math_trig">
|
||||
<value name="NUM">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">45</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="math_constant"></block>
|
||||
<block type="math_number_property">
|
||||
<value name="NUMBER_TO_CHECK">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">0</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="math_round">
|
||||
<value name="NUM">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">3.1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="math_on_list"></block>
|
||||
<block type="math_modulo">
|
||||
<value name="DIVIDEND">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">64</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="DIVISOR">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">10</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="math_constrain">
|
||||
<value name="VALUE">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">50</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="LOW">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="HIGH">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">100</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="math_random_int">
|
||||
<value name="FROM">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="TO">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">100</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="math_random_float"></block>
|
||||
</category>
|
||||
<category name="Text" colour="160">
|
||||
<block type="text"></block>
|
||||
<block type="text_join"></block>
|
||||
<block type="text_append">
|
||||
<value name="TEXT">
|
||||
<shadow type="text"></shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_length">
|
||||
<value name="VALUE">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">abc</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_isEmpty">
|
||||
<value name="VALUE">
|
||||
<shadow type="text">
|
||||
<field name="TEXT"></field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_indexOf">
|
||||
<value name="VALUE">
|
||||
<block type="variables_get">
|
||||
<field name="VAR">{textVariable}</field>
|
||||
</block>
|
||||
</value>
|
||||
<value name="FIND">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">abc</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_charAt">
|
||||
<value name="VALUE">
|
||||
<block type="variables_get">
|
||||
<field name="VAR">{textVariable}</field>
|
||||
</block>
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_getSubstring">
|
||||
<value name="STRING">
|
||||
<block type="variables_get">
|
||||
<field name="VAR">{textVariable}</field>
|
||||
</block>
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_changeCase">
|
||||
<value name="TEXT">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">abc</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_trim">
|
||||
<value name="TEXT">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">abc</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_print">
|
||||
<value name="TEXT">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">abc</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="text_prompt_ext">
|
||||
<value name="TEXT">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">abc</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
</category>
|
||||
<category name="List" colour="260">
|
||||
<block type="lists_create_with">
|
||||
<mutation items="0"></mutation>
|
||||
</block>
|
||||
<block type="lists_create_with"></block>
|
||||
<block type="lists_repeat">
|
||||
<value name="NUM">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">5</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="lists_length"></block>
|
||||
<block type="lists_isEmpty"></block>
|
||||
<block type="lists_indexOf">
|
||||
<value name="VALUE">
|
||||
<block type="variables_get">
|
||||
<field name="VAR">{listVariable}</field>
|
||||
</block>
|
||||
</value>
|
||||
</block>
|
||||
<block type="lists_getIndex">
|
||||
<value name="VALUE">
|
||||
<block type="variables_get">
|
||||
<field name="VAR">{listVariable}</field>
|
||||
</block>
|
||||
</value>
|
||||
</block>
|
||||
<block type="lists_setIndex">
|
||||
<value name="LIST">
|
||||
<block type="variables_get">
|
||||
<field name="VAR">{listVariable}</field>
|
||||
</block>
|
||||
</value>
|
||||
</block>
|
||||
<block type="lists_getSublist">
|
||||
<value name="LIST">
|
||||
<block type="variables_get">
|
||||
<field name="VAR">{listVariable}</field>
|
||||
</block>
|
||||
</value>
|
||||
</block>
|
||||
<block type="lists_split">
|
||||
<value name="DELIM">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">,</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="lists_sort"></block>
|
||||
</category>
|
||||
<category name="Colour" colour="20">
|
||||
<block type="colour_picker"></block>
|
||||
<block type="colour_random"></block>
|
||||
<block type="colour_rgb">
|
||||
<value name="RED">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">100</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="GREEN">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">50</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="BLUE">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">0</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="colour_blend">
|
||||
<value name="COLOUR1">
|
||||
<shadow type="colour_picker">
|
||||
<field name="COLOUR">#ff0000</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="COLOUR2">
|
||||
<shadow type="colour_picker">
|
||||
<field name="COLOUR">#3333ff</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="RATIO">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">0.5</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
</category>
|
||||
<sep></sep>
|
||||
<category name="Variables" colour="330" custom="VARIABLE"></category>
|
||||
<category name="Functions" colour="290" custom="PROCEDURE"></category>
|
||||
</xml>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
@ -1,14 +1,14 @@
|
||||
afx-app-window[data-id ='files-app-window'] afx-list-view{
|
||||
/*afx-app-window[data-id ='files-app-window'] afx-list-view{
|
||||
border-top:1px solid #A6A6A6;
|
||||
}
|
||||
}*/
|
||||
afx-app-window[data-id ='files-app-window'] afx-list-view[data-id='favouri']{
|
||||
border-right: 0;
|
||||
border-top:1px solid #A6A6A6;
|
||||
/* border-top:1px solid #A6A6A6; */
|
||||
padding:0;
|
||||
}
|
||||
afx-app-window[data-id ='files-app-window'] afx-resizer{
|
||||
background-color: transparent;
|
||||
border-left: 1px solid #cbcbcb;
|
||||
/* border-left: 1px solid #cbcbcb; */
|
||||
}
|
||||
afx-app-window[data-id ='files-app-window'] afx-file-view afx-list-view i:before{
|
||||
font-size: 32px;
|
||||
|
@ -1,11 +0,0 @@
|
||||
coffee_files = main.coffee
|
||||
|
||||
jsfiles =
|
||||
|
||||
cssfiles = main.css
|
||||
|
||||
copyfiles = scheme.html package.json
|
||||
|
||||
|
||||
PKG_NAME=MarkOn
|
||||
include ../pkg.mk
|
@ -1,164 +0,0 @@
|
||||
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
# AnTOS Web desktop is is licensed under the GNU General Public
|
||||
# License v3.0, see the LICENCE file for more information
|
||||
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
class MarkOn extends this.OS.GUI.BaseApplication
|
||||
constructor: (args) ->
|
||||
super "MarkOn", args
|
||||
|
||||
main: () ->
|
||||
markarea = @find "markarea"
|
||||
@container = @find "mycontainer"
|
||||
@previewOn = false
|
||||
if @args and @args.length > 0
|
||||
@currfile = @args[0].path.asFileHandle()
|
||||
else
|
||||
@currfile = "Untitled".asFileHandle()
|
||||
@editormux = false
|
||||
@editor = new SimpleMDE
|
||||
element: markarea
|
||||
autofocus: true
|
||||
tabSize: 4
|
||||
indentWithTabs: true
|
||||
toolbar: [
|
||||
"bold", "italic", "heading", "|", "quote", "code",
|
||||
"unordered-list", "ordered-list", "|", "link",
|
||||
"image", "table", "horizontal-rule", "|",
|
||||
{
|
||||
name: "preview",
|
||||
className: "fa fa-eye no-disable",
|
||||
action: (e) =>
|
||||
@previewOn = !@previewOn
|
||||
SimpleMDE.togglePreview e
|
||||
#if(self.previewOn) toggle the highlight
|
||||
#{
|
||||
# var container = self._scheme.find(self,"Text")
|
||||
# .$element.getElementsByClassName("editor-preview");
|
||||
# if(container.length == 0) return;
|
||||
# var codes = container[0].getElementsByTagName('pre');
|
||||
# codes.forEach(function(el){
|
||||
# hljs.highlightBlock(el);
|
||||
# });
|
||||
# //console.log(code);
|
||||
#}
|
||||
}
|
||||
]
|
||||
|
||||
@editor.codemirror.on "change", () =>
|
||||
return if @editormux
|
||||
if @currfile.dirty is false
|
||||
@currfile.dirty = true
|
||||
@scheme.set "apptitle", "#{@currfile.basename}*"
|
||||
@on "hboxchange", (e) => @resizeContent()
|
||||
@bindKey "ALT-N", () => @actionFile "#{@name}-New"
|
||||
@bindKey "ALT-O", () => @actionFile "#{@name}-Open"
|
||||
@bindKey "CTRL-S", () => @actionFile "#{@name}-Save"
|
||||
@bindKey "ALT-W", () => @actionFile "#{@name}-Saveas"
|
||||
@resizeContent()
|
||||
@open @currfile
|
||||
|
||||
resizeContent: () ->
|
||||
children = ($ @container).children()
|
||||
titlebar = (($ @scheme).find ".afx-window-top")[0]
|
||||
toolbar = children[1]
|
||||
statusbar = children[4]
|
||||
cheight = ($ @scheme).height() - ($ titlebar).height() - ($ toolbar).height() - ($ statusbar).height() - 40
|
||||
($ children[2]).css("height", cheight + "px")
|
||||
|
||||
open: (file) ->
|
||||
#find table
|
||||
return if file.path is "Untitled"
|
||||
file.dirty = false
|
||||
file.read()
|
||||
.then (d) =>
|
||||
@currfile = file
|
||||
@editormux = true
|
||||
@editor.value d
|
||||
@scheme.set "apptitle", "#{@currfile.basename}"
|
||||
@editormux = false
|
||||
.catch (e) => @error __("Unable to open: {0}", file.path), e
|
||||
|
||||
|
||||
save: (file) ->
|
||||
file.write("text/plain")
|
||||
.then (d) =>
|
||||
return @error __("Error saving file {0}: {1}", file.basename, d.error) if d.error
|
||||
file.dirty = false
|
||||
file.text = file.basename
|
||||
@scheme.set "apptitle", "#{@currfile.basename}"
|
||||
.catch (e) => @error __("Unable to save file: {0}", file.path), e
|
||||
|
||||
menu: () ->
|
||||
menu = [{
|
||||
text: "__(File)",
|
||||
child: [
|
||||
{ text: "__(New)", dataid: "#{@name}-New", shortcut: "A-N" },
|
||||
{ text: "__(Open)", dataid: "#{@name}-Open", shortcut: "A-O" },
|
||||
{ text: "__(Save)", dataid: "#{@name}-Save", shortcut: "C-S" },
|
||||
{ text: "__(Save as)", dataid: "#{@name}-Saveas", shortcut: "A-W" }
|
||||
],
|
||||
onchildselect: (e) => @actionFile e.data.item.get("data").dataid
|
||||
}]
|
||||
menu
|
||||
|
||||
actionFile: (e) ->
|
||||
saveas = () =>
|
||||
@openDialog("FileDialog", {
|
||||
title: __("Save as"),
|
||||
file: @currfile
|
||||
})
|
||||
.then (f) =>
|
||||
d = f.file.path.asFileHandle()
|
||||
d = d.parent() if f.file.type is "file"
|
||||
@currfile.setPath "#{d.path}/#{f.name}"
|
||||
@save @currfile
|
||||
|
||||
switch e
|
||||
when "#{@name}-Open"
|
||||
@openDialog("FileDialog", {
|
||||
title: __("Open file")
|
||||
})
|
||||
.then (f) =>
|
||||
@open f.file.path.asFileHandle()
|
||||
|
||||
when "#{@name}-Save"
|
||||
@currfile.cache = @editor.value()
|
||||
return @save @currfile if @currfile.basename
|
||||
saveas()
|
||||
when "#{@name}-Saveas"
|
||||
@currfile.cache = @editor.value()
|
||||
saveas()
|
||||
when "#{@name}-New"
|
||||
@currfile = "Untitled".asFileHandle()
|
||||
@currfile.cache = ""
|
||||
@editor.value("")
|
||||
|
||||
cleanup: (evt) ->
|
||||
return unless @currfile.dirty
|
||||
evt.preventDefault()
|
||||
@.openDialog "YesNoDialog", (d) =>
|
||||
if d
|
||||
@currfile.dirty = false
|
||||
@quit()
|
||||
, __("Quit"), { text: __("Quit without saving ?") }
|
||||
|
||||
MarkOn.dependencies = [
|
||||
"os://scripts/mde/simplemde.min.js",
|
||||
"os://scripts/mde/simplemde.min.css"
|
||||
]
|
||||
|
||||
this.OS.register "MarkOn", MarkOn
|
@ -1,3 +0,0 @@
|
||||
afx-app-window[data-id ='markon-win'] div.editor-toolbar{
|
||||
background-color: white;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"app":"MarkOn",
|
||||
"name":"Markdown editor",
|
||||
"description":"Simple markdown editor",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.0.1-a",
|
||||
"category":"Utils",
|
||||
"iconclass":"fa fa-leanpub",
|
||||
"mimes":["text/.*"]
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<afx-app-window data-id = "markon-win" apptitle="Markon" width="600" height="450">
|
||||
<afx-hbox >
|
||||
<div data-id = "mycontainer">
|
||||
<textarea data-id="markarea" ></textarea>
|
||||
</div>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
@ -1,11 +0,0 @@
|
||||
coffee_files = main.coffee
|
||||
|
||||
jsfiles = pdf.js
|
||||
|
||||
cssfiles = main.css
|
||||
|
||||
copyfiles = pdf.worker.js scheme.html package.json bg.jpg
|
||||
|
||||
|
||||
PKG_NAME=Preview
|
||||
include ../pkg.mk
|
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB |
@ -1,146 +0,0 @@
|
||||
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
# AnTOS Web desktop is is licensed under the GNU General Public
|
||||
# License v3.0, see the LICENCE file for more information
|
||||
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
class Preview extends this.OS.GUI.BaseApplication
|
||||
constructor: (args) ->
|
||||
super "Preview", args
|
||||
|
||||
main: () ->
|
||||
me = @
|
||||
@currfile = @args[0].asFileHandler() if @args and @args.length > 0
|
||||
@view = @find "view"
|
||||
@status = @find "status"
|
||||
PDFJS.workerSrc = @_api.handler.get + "/#{@path()}/pdf.worker.js"
|
||||
@bindKey "ALT-O", () -> me.actionFile "#{me.name}-Open"
|
||||
@bindKey "CTRL-X", () -> me.actionFile "#{me.name}-Close"
|
||||
@open @currfile
|
||||
|
||||
|
||||
open: (file) ->
|
||||
me = @
|
||||
return unless file
|
||||
@currfile = file unless @currfile is file
|
||||
file.onready () ->
|
||||
file.info.size = (file.info.size / 1024).toFixed(2)
|
||||
me.renderFile file
|
||||
, (err) ->
|
||||
me.error __("File not found {0}", file.path)
|
||||
|
||||
renderFile: (file) ->
|
||||
mime = file.info.mime
|
||||
return unless mime
|
||||
if mime.match /^[^\/]+\/.*pdf.*/g
|
||||
@renderPDF file
|
||||
else if mime.match /image\/.*svg.*/g
|
||||
@renderSVG file
|
||||
else if mime.match /image\/.*/g
|
||||
@renderImage file
|
||||
else
|
||||
@notify __("Mime type {0} is not supported", file.info.mime)
|
||||
|
||||
setStatus: (t) ->
|
||||
($ @status).html t
|
||||
|
||||
renderPDF: (file) ->
|
||||
me = @
|
||||
status = "#{file.info.name} (#{file.info.size} Kb)"
|
||||
($ me.view).empty()
|
||||
file.read (d) ->
|
||||
q = me._api.mid()
|
||||
me._api.loading q, "RENDERING"
|
||||
PDFJS.getDocument { data: d }
|
||||
#PDFJS.getDocument(url)
|
||||
.then (pdf) ->
|
||||
fn = (p) ->
|
||||
if p > pdf.numPages
|
||||
me.setStatus "#{status} - loaded"
|
||||
return me._api.loaded q, "OK"
|
||||
pdf.getPage(p).then (page) ->
|
||||
scale = 1.5
|
||||
viewport = page.getViewport scale
|
||||
div = ($ "<div/>").attr("id", "page-" + (page.pageIndex + 1))
|
||||
($ me.view).append div
|
||||
canvas = ($ "<canvas/>")[0]
|
||||
div.append canvas
|
||||
context = canvas.getContext '2d'
|
||||
canvas.height = viewport.height
|
||||
canvas.width = viewport.width
|
||||
renderContext =
|
||||
canvasContext: context
|
||||
viewport: viewport
|
||||
page.render renderContext
|
||||
me.setStatus "#{status} - #{p}/#{pdf.numPages} loaded"
|
||||
fn(p+1)
|
||||
fn(1)
|
||||
.catch (err) ->
|
||||
me.error __("Cannot render the PDF file")
|
||||
me._api.loaded q, "FAIL"
|
||||
, "binary"
|
||||
|
||||
renderSVG: (file) ->
|
||||
me = @
|
||||
($ @view).attr("class", "image").empty()
|
||||
file.read (d) ->
|
||||
#console.log d
|
||||
me.view.innerHTML = d
|
||||
|
||||
renderImage: (file) ->
|
||||
me = @
|
||||
($ @view).attr("class", "image").empty()
|
||||
|
||||
file.read (d) ->
|
||||
img = new Image()
|
||||
canvas = ($ "<canvas/>")[0]
|
||||
($ me.view).append canvas
|
||||
|
||||
#($ me.view).append img
|
||||
img.onload = () ->
|
||||
context = canvas.getContext '2d'
|
||||
canvas.height = img.height
|
||||
canvas.width = img.width
|
||||
#console.log canvas.width, canvas.height
|
||||
context.drawImage img, 0, 0
|
||||
me.setStatus "#{file.info.name} (#{file.info.size} Kb) - #{img.width}x#{img.height}"
|
||||
|
||||
blob = new Blob [d], { type: file.info.mime }
|
||||
img.src = URL.createObjectURL blob
|
||||
, "binary"
|
||||
|
||||
menu: () ->
|
||||
me = @
|
||||
menu = [{
|
||||
text: "__(File)",
|
||||
child: [
|
||||
{ text: "__(Open)", dataid: "#{@name}-Open", shortcut: "A-O" },
|
||||
{ text: "__(Close)", dataid: "#{@name}-Close", shortcut: "C-X" },
|
||||
],
|
||||
onmenuselect: (e) -> me.actionFile e.item.data.dataid
|
||||
}]
|
||||
menu
|
||||
|
||||
actionFile: (e) ->
|
||||
me = @
|
||||
switch e
|
||||
when "#{@name}-Open"
|
||||
@openDialog "FileDiaLog", ( d, f ) ->
|
||||
me.open "#{d}/#{f}".asFileHandler()
|
||||
, __("Open file"), { mimes: me.meta().mimes }
|
||||
when "#{@name}-Close"
|
||||
@quit()
|
||||
|
||||
this.OS.register "Preview", Preview
|
@ -1,30 +0,0 @@
|
||||
|
||||
afx-app-window[data-id = "preview-win"] afx-vbox[data-id="container"] div[data-id = "view"]
|
||||
{
|
||||
display: block;
|
||||
overflow:auto;
|
||||
background-image: url("bg.jpg");
|
||||
background-repeat: repeat;
|
||||
}
|
||||
|
||||
afx-app-window[data-id = "preview-win"] afx-vbox[data-id="container"] div[data-id = "status"]
|
||||
{
|
||||
background-color: #f6F6F6;
|
||||
border-top: 1px solid #cbcbcb;
|
||||
color:#414339;
|
||||
padding-left: 10px;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
afx-app-window[data-id = "preview-win"] afx-vbox[data-id="container"] canvas{
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
afx-app-window[data-id = "preview-win"] afx-vbox[data-id="container"] div[data-id = "view"].image
|
||||
{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"app":"Preview",
|
||||
"name":"Preview",
|
||||
"description":"Media files viewer",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "xsang.le@gmail.com"
|
||||
},
|
||||
"version":"0.0.1-a",
|
||||
"category":"Utils",
|
||||
"iconclass":"fa fa-eye",
|
||||
"mimes":["[^\/]*/.*pdf", "image/.*"]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
1
src/packages/Preview/pdf.worker.js
vendored
1
src/packages/Preview/pdf.worker.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +0,0 @@
|
||||
<afx-app-window data-id = "preview-win" apptitle="Preview" width="600" height="400">
|
||||
<afx-vbox data-id = "container">
|
||||
<div data-id="view" ></div>
|
||||
<div data-id = "status" data-height = "20"></div>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
@ -1,11 +0,0 @@
|
||||
coffee_files = coffees/main.coffee
|
||||
|
||||
jsfiles =
|
||||
|
||||
cssfiles = css/main.css
|
||||
|
||||
copyfiles = assets/scheme.html package.json
|
||||
|
||||
|
||||
PKG_NAME=ShowCase
|
||||
include ../pkg.mk
|
@ -1,50 +0,0 @@
|
||||
<afx-app-window data-id="example-show-case" apptitle="AntOS GUI widgets" width="650" height="500">
|
||||
<afx-vbox>
|
||||
<afx-menu data-height="30" data-id="menu" />
|
||||
<afx-tab-container data-id="tabctn" tabbarheight= "30">
|
||||
|
||||
<afx-hbox tabname="Widgets">
|
||||
<afx-vbox data-width="150">
|
||||
<afx-tree-view data-id="tree" />
|
||||
<afx-slider data-id="slider" data-height="30" value="50"/>
|
||||
</afx-vbox>
|
||||
<afx-resizer data-width="5" />
|
||||
<afx-vbox data-width="grow">
|
||||
<afx-hbox min-height="50">
|
||||
<afx-switch data-id="switch" />
|
||||
<afx-button text="__(This is the label)"
|
||||
data-id="bttest"
|
||||
iconclass="fa fa-camera-retro fa-lg"
|
||||
icon="os://packages/DummyApp/icon.png"/>
|
||||
<afx-nspinner data-id="spin" value="10" step="2" />
|
||||
</afx-hbox>
|
||||
<afx-resizer data-height="5" />
|
||||
<afx-hbox>
|
||||
<afx-list-view data-id="list" dropdown="false" multiselect="true" />
|
||||
</afx-hbox>
|
||||
<afx-hbox data-height="150">
|
||||
<afx-grid-view data-id="grid" multiselect="false" />
|
||||
</afx-hbox>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
<afx-hbox tabname="Calendar & color picker">
|
||||
<afx-calendar-view data-id = "cal"/>
|
||||
<afx-color-picker data-id = "cpk"/>
|
||||
</afx-hbox>
|
||||
<afx-hbox tabname="File view">
|
||||
<afx-vbox>
|
||||
<afx-file-view data-id = "fileview" view="icon" />
|
||||
<afx-list-view data-id = "viewoption" data-height="30" dropdown="true" />
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
|
||||
<afx-hbox tabname="Dialogs">
|
||||
<afx-vbox>
|
||||
<afx-list-view data-id = "dialoglist"/>
|
||||
<afx-button data-id = "btrundia" text="Run dialog" data-height="30"/>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
|
||||
</afx-tab-container>
|
||||
</afx-vbox>
|
||||
</afx-app-window>
|
@ -1,273 +0,0 @@
|
||||
Ant = this
|
||||
class ShowCase extends this.OS.GUI.BaseApplication
|
||||
constructor: (args) ->
|
||||
super "ShowCase", args
|
||||
|
||||
main: () ->
|
||||
|
||||
bt = @find 'bttest'
|
||||
bt.set "onbtclick", (e) =>
|
||||
@notify "btclicked"
|
||||
|
||||
@observable.on "btclick", (e) =>
|
||||
@notify "button clicked"
|
||||
|
||||
@observable.on "menuselect", (e) =>
|
||||
@notify e.id
|
||||
|
||||
list = @find 'list'
|
||||
|
||||
list.set "data", [
|
||||
{ text: "some thing with avery long text" },
|
||||
{ text: "some thing 1", closable: true },
|
||||
{ text: "some thing 2", iconclass: "fa fa-camera-retro fa-lg" },
|
||||
{ text: "some thing 3" },
|
||||
{ text: "some thing 4" },
|
||||
{ text: "some thing 5" }
|
||||
]
|
||||
list.unshift { text: "shifted el" }
|
||||
list.set "onlistselect", (e) => @notify(e.data.items)
|
||||
|
||||
sw = @find 'switch'
|
||||
sw.set "onchange", (e) =>
|
||||
@notify e.data
|
||||
|
||||
spin = @find 'spin'
|
||||
spin.set "onchange", (e) =>
|
||||
@notify e.data
|
||||
|
||||
menu = @find 'menu'
|
||||
menu.set "items", @menu()
|
||||
|
||||
list.contextmenuHandle = (e, m) =>
|
||||
m.set "items", @menu()
|
||||
m.show e
|
||||
|
||||
grid = @find 'grid'
|
||||
grid.set "oncelldbclick", (e) =>
|
||||
@notify "on dbclick", e
|
||||
grid.set "onrowselect", (e) =>
|
||||
@notify "on rowselect", e.data.items
|
||||
|
||||
@observable.on "cellselect", (e) ->
|
||||
console.log "observable", e
|
||||
|
||||
grid.set "header", [{ text: "header1", width: 80 }, { text: "header2" }, { text: "header3" }]
|
||||
grid.set "rows", [
|
||||
[{ text: "text 1" }, { text: "text 2" }, { text: "text 3" }],
|
||||
[{ text: "text 4" }, { text: "text 5" }, { text: "text 6" }],
|
||||
[{ text: "text 7" }, { text: "text 8" }, { text: "text 9" }],
|
||||
[{ text: "text 7" }, { text: "Subgrid on columns and rows. Subgrid on columns, implicit grid rows. Subgrid on rows, defined column tracks" }, { text: "text 9" }],
|
||||
[{ text: "text 7" }, { text: "text 8" }, { text: "text 9" }],
|
||||
[{ text: "text 7" }, { text: "text 8" }, { text: "text 9" }],
|
||||
[{ text: "text 7" }, { text: "text 8" }, { text: "text 9" }],
|
||||
[{ text: "text 7" }, { text: "text 8" }, { text: "text 9" }],
|
||||
[{ text: "text 7" }, { text: "text 8" }, { text: "text 9" }],
|
||||
[{ text: "text 7" }, { text: "text 8" }, { text: "text 9" }],
|
||||
[{ text: "text 7" }, { text: "text 8" }, { text: "text 9" }]
|
||||
]
|
||||
|
||||
tdata = {
|
||||
name: 'My Tree',
|
||||
nodes: [
|
||||
{ name: 'hello', iconclass:'fa fa-car'},
|
||||
{ name: 'wat' },
|
||||
{
|
||||
name: 'child folder',
|
||||
nodes: [
|
||||
{
|
||||
name: 'child folder',
|
||||
nodes: [
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' }
|
||||
]
|
||||
},
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' },
|
||||
{
|
||||
name: 'child folder',
|
||||
nodes: [
|
||||
{ name: 'hello' },
|
||||
{ name: 'wat' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
tree = @find 'tree'
|
||||
tree.set "data", tdata
|
||||
tree.set "ontreeselect", (e) =>
|
||||
@notify e.data.item.get "treepath"
|
||||
tree.set "ontreedbclick", (e) =>
|
||||
@notify "treedbclick", e
|
||||
@observable.on "treedbclick", (e) =>
|
||||
@notify "observable treedbclick", e
|
||||
|
||||
slider = @find 'slider'
|
||||
slider.set "onchange", (v) =>
|
||||
@notify v
|
||||
|
||||
cal = @find 'cal'
|
||||
cal.set "ondateselect", (e) =>
|
||||
@notify e
|
||||
|
||||
pk = @find 'cpk'
|
||||
pk.set "oncolorselect", (e) =>
|
||||
@notify e
|
||||
pk.set "oncolorselect", (e) =>
|
||||
@notify e
|
||||
|
||||
fileview = @find 'fileview'
|
||||
fileview.set "fetch", (path) ->
|
||||
new Promise (resolve, reject) ->
|
||||
dir = path.asFileHandle()
|
||||
dir.read().then (d) ->
|
||||
p = dir.parent().asFileHandle()
|
||||
p.filename = "[..]"
|
||||
p.type = "dir"
|
||||
return reject d.error if d.error
|
||||
d.result.unshift p
|
||||
resolve d.result
|
||||
fileview.set "path", "home:///"
|
||||
|
||||
viewoption = @find 'viewoption'
|
||||
viewoption.set "data", [
|
||||
{ text: "icon" },
|
||||
{ text: "list" },
|
||||
{ text: "tree" }
|
||||
]
|
||||
viewoption.set "onlistselect", (e) =>
|
||||
@notify e.data.item.get("data").text
|
||||
fileview.set "view", e.data.item.get("data").text
|
||||
|
||||
dllist = @find "dialoglist"
|
||||
btrun = @find "btrundia"
|
||||
|
||||
dllist.set "data", [
|
||||
{ text: "Prompt dialog", id: "prompt" },
|
||||
{ text: "Calendar dialog", id: "calendar" },
|
||||
{ text: "Color picker dialog", id: "colorpicker" },
|
||||
{ text: "Info dialog", id: "info" },
|
||||
{ text: "YesNo dialog", id: "yesno" },
|
||||
{ text: "Selection dialog", id: "selection" },
|
||||
{ text: "About dialog", id: "about" },
|
||||
{ text: "File dialog", id: "file" }
|
||||
]
|
||||
|
||||
btrun.set "onbtclick", (e) =>
|
||||
item = dllist.get "selectedItem"
|
||||
return unless item
|
||||
switch item.get("data").id
|
||||
when "prompt"
|
||||
@openDialog("PromptDialog", {
|
||||
title: "Prompt review",
|
||||
value: "txt data",
|
||||
label: "enter value"
|
||||
})
|
||||
.then (d) =>
|
||||
@notify d
|
||||
when "calendar"
|
||||
@openDialog("CalendarDialog", {
|
||||
title: "Calendar"
|
||||
})
|
||||
.then (d) =>
|
||||
@notify d
|
||||
when "colorpicker"
|
||||
@openDialog("ColorPickerDialog")
|
||||
.then (d) =>
|
||||
@notify d
|
||||
when "info"
|
||||
@openDialog("InfoDialog", {
|
||||
title: "Info application",
|
||||
name: "Show case",
|
||||
date: "10/12/2014",
|
||||
description: "the brown fox jumps over the lazy dog"
|
||||
})
|
||||
.then (d) ->
|
||||
when "yesno"
|
||||
@openDialog("YesNoDialog", {
|
||||
title: "Question ?",
|
||||
text: "Do you realy want to delete file ?"
|
||||
})
|
||||
.then (d) =>
|
||||
@notify d
|
||||
when "selection"
|
||||
@openDialog("SelectionDialog", {
|
||||
title: "Select data ?",
|
||||
data: [
|
||||
{ text: "Option 1" },
|
||||
{ text: "Option 2" },
|
||||
{ text: "Option 3", iconclass: "fa fa-camera-retro fa-lg" }
|
||||
]
|
||||
})
|
||||
.then (d) =>
|
||||
@notify d.text
|
||||
when "about"
|
||||
@openDialog("AboutDialog" )
|
||||
.then (d) =>
|
||||
when "file"
|
||||
@openDialog("FileDialog", {
|
||||
title: "Select file ?",
|
||||
#root: "home:///",
|
||||
mimes: ["text/*", "dir"],
|
||||
file: "Untitled".asFileHandle()
|
||||
})
|
||||
.then (f, name) =>
|
||||
@notify f, name
|
||||
else return
|
||||
|
||||
|
||||
|
||||
mnFile: () ->
|
||||
#@notify file
|
||||
arr = {
|
||||
text: "__(File)",
|
||||
child: [
|
||||
{ text: "__(New file)", dataid: "#{@name}-mkf", shortcut: 'C-F' },
|
||||
{ text: "__(New folder)", dataid: "#{@name}-mkdir", shortcut: 'C-D' },
|
||||
{ text: "__(Open with)", dataid: "#{@name}-open", child: @apps },
|
||||
{ text: "__(Upload)", dataid: "#{@name}-upload", shortcut: 'C-U' },
|
||||
{ text: "__(Download)", dataid: "#{@name}-download" },
|
||||
{ text: "__(Share file)", dataid: "#{@name}-share", shortcut: 'C-S' },
|
||||
{ text: "__(Properties)", dataid: "#{@name}-info", shortcut: 'C-I' }
|
||||
], onchildselect: (e) => @notify "child", e
|
||||
}
|
||||
return arr
|
||||
mnEdit: () ->
|
||||
|
||||
{
|
||||
text: "__(Edit)",
|
||||
child: [
|
||||
{ text: "__(Rename)", dataid: "#{@name}-mv", shortcut: 'C-R' },
|
||||
{ text: "__(Delete)", dataid: "#{@name}-rm", shortcut: 'C-M' },
|
||||
{ text: "__(Cut)", dataid: "#{@name}-cut", shortcut: 'C-X' },
|
||||
{ text: "__(Copy)", dataid: "#{@name}-copy", shortcut: 'C-C' },
|
||||
{ text: "__(Paste)", dataid: "#{@name}-paste", shortcut: 'C-P' }
|
||||
], onchildselect: (e) => console.log "child", e
|
||||
}
|
||||
|
||||
menu: () ->
|
||||
menu = [
|
||||
@mnFile(),
|
||||
@mnEdit(),
|
||||
{
|
||||
text: "__(View)",
|
||||
child: [
|
||||
{ text: "__(Refresh)", dataid: "#{@name}-refresh", onmenuselect: (e) -> console.log "select", e },
|
||||
{ text: "__(Sidebar)", switch: true, checked: true },
|
||||
{ text: "__(Navigation bar)", switch: true, checked: false },
|
||||
{ text: "__(Hidden files)", switch: true, checked: true, dataid: "#{@name}-hidden" },
|
||||
{ text: "__(Type)", child: [
|
||||
{ text: "__(Icon view)", radio: true, checked: true, dataid: "#{@name}-icon", type: 'icon' },
|
||||
{ text: "__(List view)", radio:true, checked: false, dataid: "#{@name}-list", type: 'list' },
|
||||
{ text: "__(Tree view)", radio:true, checked: false, dataid: "#{@name}-tree", type: 'tree' }
|
||||
], onchildselect: (e) -> console.log "child", e
|
||||
},
|
||||
], onchildselect: (e) => console.log "child", e
|
||||
},
|
||||
]
|
||||
menu
|
||||
ShowCase.singleton = true
|
||||
this.OS.register "ShowCase", ShowCase
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user