diff --git a/bootdo/.gitignore b/.gitignore similarity index 100% rename from bootdo/.gitignore rename to .gitignore diff --git "a/bootdo/bootdo(\345\246\202\346\236\234\346\212\245\351\224\231\350\257\267\346\211\247\350\241\214\350\277\231\344\270\252\345\205\274\345\256\271\347\211\210\346\234\254).sql" "b/bootdo(\345\246\202\346\236\234\346\212\245\351\224\231\350\257\267\346\211\247\350\241\214\350\277\231\344\270\252\345\205\274\345\256\271\347\211\210\346\234\254).sql" similarity index 100% rename from "bootdo/bootdo(\345\246\202\346\236\234\346\212\245\351\224\231\350\257\267\346\211\247\350\241\214\350\277\231\344\270\252\345\205\274\345\256\271\347\211\210\346\234\254).sql" rename to "bootdo(\345\246\202\346\236\234\346\212\245\351\224\231\350\257\267\346\211\247\350\241\214\350\277\231\344\270\252\345\205\274\345\256\271\347\211\210\346\234\254).sql" diff --git a/bootdo/bootdo.sql b/bootdo.sql similarity index 100% rename from bootdo/bootdo.sql rename to bootdo.sql diff --git a/bootdo/src/main/resources/static/css/.DS_Store b/bootdo/src/main/resources/static/css/.DS_Store deleted file mode 100644 index cfec20c7460366091f0a1ca38cbcd2898edc493d..0000000000000000000000000000000000000000 Binary files a/bootdo/src/main/resources/static/css/.DS_Store and /dev/null differ diff --git a/bootdo/src/main/resources/static/docs/.DS_Store b/bootdo/src/main/resources/static/docs/.DS_Store deleted file mode 100644 index 8226a56a70482430d45f369f4480db8945d5c9f1..0000000000000000000000000000000000000000 Binary files a/bootdo/src/main/resources/static/docs/.DS_Store and /dev/null differ diff --git a/bootdo/src/main/resources/static/img/.DS_Store b/bootdo/src/main/resources/static/img/.DS_Store deleted file mode 100644 index 9a92c7eefe3f1ff8c89b9a0bee6f0edd5c7d4463..0000000000000000000000000000000000000000 Binary files a/bootdo/src/main/resources/static/img/.DS_Store and /dev/null differ diff --git a/bootdo/src/main/resources/static/js/.DS_Store b/bootdo/src/main/resources/static/js/.DS_Store deleted file mode 100644 index b34c7460ba31ec4ffb2d4d81264d44a86d9455fc..0000000000000000000000000000000000000000 Binary files a/bootdo/src/main/resources/static/js/.DS_Store and /dev/null differ diff --git a/bootdo/src/main/resources/static/js/plugins/bootstrap-table/.DS_Store b/bootdo/src/main/resources/static/js/plugins/bootstrap-table/.DS_Store deleted file mode 100644 index 3b4f88d240af9be4e017f58dbf6d0c7ce93612f9..0000000000000000000000000000000000000000 Binary files a/bootdo/src/main/resources/static/js/plugins/bootstrap-table/.DS_Store and /dev/null differ diff --git a/bootdo/src/main/resources/static/js/plugins/echarts/.DS_Store b/bootdo/src/main/resources/static/js/plugins/echarts/.DS_Store deleted file mode 100644 index 303a88eb384a6e273ecea24131629f95586801f1..0000000000000000000000000000000000000000 Binary files a/bootdo/src/main/resources/static/js/plugins/echarts/.DS_Store and /dev/null differ diff --git a/bootdo/src/main/resources/static/js/plugins/layer/.DS_Store b/bootdo/src/main/resources/static/js/plugins/layer/.DS_Store deleted file mode 100644 index e516f0111d8c6586e26a18066e31e9e5d193b421..0000000000000000000000000000000000000000 Binary files a/bootdo/src/main/resources/static/js/plugins/layer/.DS_Store and /dev/null differ diff --git a/bootdo/src/main/resources/static/js/plugins/suggest/.DS_Store b/bootdo/src/main/resources/static/js/plugins/suggest/.DS_Store deleted file mode 100644 index dbbaa7226c8401c68e08d3349211cb097cc8d08e..0000000000000000000000000000000000000000 Binary files a/bootdo/src/main/resources/static/js/plugins/suggest/.DS_Store and /dev/null differ diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/.DS_Store b/bootdo/src/main/resources/static/js/plugins/webuploader/.DS_Store deleted file mode 100644 index e94517ab2bbb9252bb5b1b86b92eca39d3568d1a..0000000000000000000000000000000000000000 Binary files a/bootdo/src/main/resources/static/js/plugins/webuploader/.DS_Store and /dev/null differ diff --git a/bootdo/src/main/resources/templates/login.html b/bootdo/src/main/resources/templates/login.html deleted file mode 100644 index 64db799d4becd36bc775190ad53634fb8735ad9d..0000000000000000000000000000000000000000 --- a/bootdo/src/main/resources/templates/login.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - BootDo - - - - - - - - - - - - - -
-
-
- -
-
-
-

用户登录

-

欢迎登录bootdo后台管理系统

- - - -
-
-
- -
-
-
- - 更换验证码 - -
-
- - - -
-
-
- -
- - - - - - - - - - - - - - - - diff --git a/bootdo/src/test/java/com/bootdo/testDemo/TestDemo.java b/bootdo/src/test/java/com/bootdo/testDemo/TestDemo.java deleted file mode 100644 index 4ff04b7b9d0b7b872581206509a23a26bf9e14ce..0000000000000000000000000000000000000000 --- a/bootdo/src/test/java/com/bootdo/testDemo/TestDemo.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.bootdo.testDemo; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.web.bind.annotation.RestController; - -@RestController() -@RunWith(SpringRunner.class) -@SpringBootTest -public class TestDemo { - @Autowired - RedisTemplate redisTemplate; - - @Test - public void test() { - redisTemplate.opsForValue().set("a", "b"); - System.out.println(redisTemplate.opsForValue().get("a")); - } - - ; -} diff --git a/bootdo/pom.xml b/pom.xml similarity index 88% rename from bootdo/pom.xml rename to pom.xml index b9befe526d120fe36977356301e50363bb4cc28d..a3c0e4af60dfb044a5995305527e1e838d0b4d8d 100644 --- a/bootdo/pom.xml +++ b/pom.xml @@ -71,6 +71,12 @@ mybatis-spring-boot-starter 1.1.1 + + + com.baomidou + mybatis-plus + 2.1.8 + com.alibaba @@ -256,12 +262,50 @@ + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.apache.httpcomponents + httpclient + + + + redis.clients + jedis + + + + cn.hutool + hutool-all + 4.6.8 + + + + + + org.springframework.boot spring-boot-maven-plugin + 2.0.5.RELEASE + + + + repackage + + + true diff --git a/bootdo/src/main/java/com/bootdo/BootdoApplication.java b/src/main/java/com/bootdo/BootdoApplication.java similarity index 99% rename from bootdo/src/main/java/com/bootdo/BootdoApplication.java rename to src/main/java/com/bootdo/BootdoApplication.java index 4555095b70c9081de72fbd80cfc0c747f89da2e4..40ceec96b650c22b1382fd9584e2c5f25e89ed5f 100644 --- a/bootdo/src/main/java/com/bootdo/BootdoApplication.java +++ b/src/main/java/com/bootdo/BootdoApplication.java @@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @SpringBootApplication @EnableCaching public class BootdoApplication { + public static void main(String[] args) { SpringApplication.run(BootdoApplication.class, args); System.out.println("ヾ(◍°∇°◍)ノ゙ bootdo启动成功 ヾ(◍°∇°◍)ノ゙\n" + diff --git a/bootdo/src/main/java/com/bootdo/activiti/config/ActivitiConfig.java b/src/main/java/com/bootdo/activiti/config/ActivitiConfig.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/config/ActivitiConfig.java rename to src/main/java/com/bootdo/activiti/config/ActivitiConfig.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/config/ActivitiConstant.java b/src/main/java/com/bootdo/activiti/config/ActivitiConstant.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/config/ActivitiConstant.java rename to src/main/java/com/bootdo/activiti/config/ActivitiConstant.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/controller/ModelController.java b/src/main/java/com/bootdo/activiti/controller/ModelController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/controller/ModelController.java rename to src/main/java/com/bootdo/activiti/controller/ModelController.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/controller/ProcessController.java b/src/main/java/com/bootdo/activiti/controller/ProcessController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/controller/ProcessController.java rename to src/main/java/com/bootdo/activiti/controller/ProcessController.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/controller/SalaryController.java b/src/main/java/com/bootdo/activiti/controller/SalaryController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/controller/SalaryController.java rename to src/main/java/com/bootdo/activiti/controller/SalaryController.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/controller/TaskController.java b/src/main/java/com/bootdo/activiti/controller/TaskController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/controller/TaskController.java rename to src/main/java/com/bootdo/activiti/controller/TaskController.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/dao/SalaryDao.java b/src/main/java/com/bootdo/activiti/dao/SalaryDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/dao/SalaryDao.java rename to src/main/java/com/bootdo/activiti/dao/SalaryDao.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/domain/ActivitiDO.java b/src/main/java/com/bootdo/activiti/domain/ActivitiDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/domain/ActivitiDO.java rename to src/main/java/com/bootdo/activiti/domain/ActivitiDO.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/domain/SalaryDO.java b/src/main/java/com/bootdo/activiti/domain/SalaryDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/domain/SalaryDO.java rename to src/main/java/com/bootdo/activiti/domain/SalaryDO.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/domain/TaskDO.java b/src/main/java/com/bootdo/activiti/domain/TaskDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/domain/TaskDO.java rename to src/main/java/com/bootdo/activiti/domain/TaskDO.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/domain/Variable.java b/src/main/java/com/bootdo/activiti/domain/Variable.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/domain/Variable.java rename to src/main/java/com/bootdo/activiti/domain/Variable.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/service/ActTaskService.java b/src/main/java/com/bootdo/activiti/service/ActTaskService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/service/ActTaskService.java rename to src/main/java/com/bootdo/activiti/service/ActTaskService.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/service/ProcessService.java b/src/main/java/com/bootdo/activiti/service/ProcessService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/service/ProcessService.java rename to src/main/java/com/bootdo/activiti/service/ProcessService.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/service/SalaryService.java b/src/main/java/com/bootdo/activiti/service/SalaryService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/service/SalaryService.java rename to src/main/java/com/bootdo/activiti/service/SalaryService.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/service/impl/ActTaskServiceImpl.java b/src/main/java/com/bootdo/activiti/service/impl/ActTaskServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/service/impl/ActTaskServiceImpl.java rename to src/main/java/com/bootdo/activiti/service/impl/ActTaskServiceImpl.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/service/impl/ProcessServiceImpl.java b/src/main/java/com/bootdo/activiti/service/impl/ProcessServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/service/impl/ProcessServiceImpl.java rename to src/main/java/com/bootdo/activiti/service/impl/ProcessServiceImpl.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/service/impl/SalaryServiceImpl.java b/src/main/java/com/bootdo/activiti/service/impl/SalaryServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/service/impl/SalaryServiceImpl.java rename to src/main/java/com/bootdo/activiti/service/impl/SalaryServiceImpl.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/utils/ActivitiUtils.java b/src/main/java/com/bootdo/activiti/utils/ActivitiUtils.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/utils/ActivitiUtils.java rename to src/main/java/com/bootdo/activiti/utils/ActivitiUtils.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/vo/DeploymentResponse.java b/src/main/java/com/bootdo/activiti/vo/DeploymentResponse.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/vo/DeploymentResponse.java rename to src/main/java/com/bootdo/activiti/vo/DeploymentResponse.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/vo/ProcessVO.java b/src/main/java/com/bootdo/activiti/vo/ProcessVO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/vo/ProcessVO.java rename to src/main/java/com/bootdo/activiti/vo/ProcessVO.java diff --git a/bootdo/src/main/java/com/bootdo/activiti/vo/TaskVO.java b/src/main/java/com/bootdo/activiti/vo/TaskVO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/activiti/vo/TaskVO.java rename to src/main/java/com/bootdo/activiti/vo/TaskVO.java diff --git a/bootdo/src/main/java/com/bootdo/blog/controller/BlogController.java b/src/main/java/com/bootdo/blog/controller/BlogController.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/blog/controller/BlogController.java rename to src/main/java/com/bootdo/blog/controller/BlogController.java index 91839318ca972260735c6ef4c90542aeac037468..d3aa2cb909bddbc1157b61727a4afd88e4b5b036 100644 --- a/bootdo/src/main/java/com/bootdo/blog/controller/BlogController.java +++ b/src/main/java/com/bootdo/blog/controller/BlogController.java @@ -1,59 +1,59 @@ -package com.bootdo.blog.controller; - -import com.bootdo.blog.domain.ContentDO; -import com.bootdo.blog.service.ContentService; -import com.bootdo.common.utils.DateUtils; -import com.bootdo.common.utils.PageUtils; -import com.bootdo.common.utils.Query; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author bootdo 1992lcg@163.com - */ -@RequestMapping("/blog") -@Controller -public class BlogController { - @Autowired - ContentService bContentService; - - @GetMapping() - String blog() { - return "blog/index/main"; - } - - @ResponseBody - @GetMapping("/open/list") - public PageUtils opentList(@RequestParam Map params) { - Query query = new Query(params); - List bContentList = bContentService.list(query); - int total = bContentService.count(query); - PageUtils pageUtils = new PageUtils(bContentList, total); - return pageUtils; - } - - @GetMapping("/open/post/{cid}") - String post(@PathVariable("cid") Long cid, Model model) { - ContentDO bContentDO = bContentService.get(cid); - model.addAttribute("bContent", bContentDO); - model.addAttribute("gtmModified", DateUtils.format(bContentDO.getGtmModified())); - return "blog/index/post"; - } - @GetMapping("/open/page/{categories}") - String about(@PathVariable("categories") String categories, Model model) { - Map map = new HashMap<>(16); - map.put("categories", categories); - ContentDO bContentDO =null; - if(bContentService.list(map).size()>0){ - bContentDO = bContentService.list(map).get(0); - } - model.addAttribute("bContent", bContentDO); - return "blog/index/post"; - } -} +package com.bootdo.blog.controller; + +import com.bootdo.blog.domain.ContentDO; +import com.bootdo.blog.service.ContentService; +import com.bootdo.common.utils.DateUtils; +import com.bootdo.common.utils.PageUtils; +import com.bootdo.common.utils.Query; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author bootdo 1992lcg@163.com + */ +@RequestMapping("/blog") +@Controller +public class BlogController { + @Autowired + ContentService bContentService; + + @GetMapping() + String blog() { + return "blog/index/main"; + } + + @ResponseBody + @GetMapping("/open/list") + public PageUtils opentList(@RequestParam Map params) { + Query query = new Query(params); + List bContentList = bContentService.list(query); + int total = bContentService.count(query); + PageUtils pageUtils = new PageUtils(bContentList, total); + return pageUtils; + } + + @GetMapping("/open/post/{cid}") + String post(@PathVariable("cid") Long cid, Model model) { + ContentDO bContentDO = bContentService.get(cid); + model.addAttribute("bContent", bContentDO); + model.addAttribute("gtmModified", DateUtils.format(bContentDO.getGtmModified())); + return "blog/index/post"; + } + @GetMapping("/open/page/{categories}") + String about(@PathVariable("categories") String categories, Model model) { + Map map = new HashMap<>(16); + map.put("categories", categories); + ContentDO bContentDO =null; + if(bContentService.list(map).size()>0){ + bContentDO = bContentService.list(map).get(0); + } + model.addAttribute("bContent", bContentDO); + return "blog/index/post"; + } +} diff --git a/bootdo/src/main/java/com/bootdo/blog/controller/ContentController.java b/src/main/java/com/bootdo/blog/controller/ContentController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/blog/controller/ContentController.java rename to src/main/java/com/bootdo/blog/controller/ContentController.java diff --git a/bootdo/src/main/java/com/bootdo/blog/dao/ContentDao.java b/src/main/java/com/bootdo/blog/dao/ContentDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/blog/dao/ContentDao.java rename to src/main/java/com/bootdo/blog/dao/ContentDao.java diff --git a/bootdo/src/main/java/com/bootdo/blog/domain/ContentDO.java b/src/main/java/com/bootdo/blog/domain/ContentDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/blog/domain/ContentDO.java rename to src/main/java/com/bootdo/blog/domain/ContentDO.java diff --git a/bootdo/src/main/java/com/bootdo/blog/service/ContentService.java b/src/main/java/com/bootdo/blog/service/ContentService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/blog/service/ContentService.java rename to src/main/java/com/bootdo/blog/service/ContentService.java diff --git a/bootdo/src/main/java/com/bootdo/blog/service/impl/ContentServiceImpl.java b/src/main/java/com/bootdo/blog/service/impl/ContentServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/blog/service/impl/ContentServiceImpl.java rename to src/main/java/com/bootdo/blog/service/impl/ContentServiceImpl.java diff --git a/bootdo/src/main/java/com/bootdo/common/annotation/Log.java b/src/main/java/com/bootdo/common/annotation/Log.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/common/annotation/Log.java rename to src/main/java/com/bootdo/common/annotation/Log.java index fa6827d8be04a70ca54949d64fdfc06c6ba31a95..32d97cab975a15738da4d29a81aac6a87ab6469e 100644 --- a/bootdo/src/main/java/com/bootdo/common/annotation/Log.java +++ b/src/main/java/com/bootdo/common/annotation/Log.java @@ -1,12 +1,12 @@ -package com.bootdo.common.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; -import java.lang.annotation.RetentionPolicy; - -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Log { - String value() default ""; -} +package com.bootdo.common.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.lang.annotation.RetentionPolicy; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Log { + String value() default ""; +} diff --git a/bootdo/src/main/java/com/bootdo/common/aspect/LogAspect.java b/src/main/java/com/bootdo/common/aspect/LogAspect.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/common/aspect/LogAspect.java rename to src/main/java/com/bootdo/common/aspect/LogAspect.java index 85b2152859a26012dd219113253b65a2a63eacc2..9091220cbe802fa5ed513276490a190002020000 100644 --- a/bootdo/src/main/java/com/bootdo/common/aspect/LogAspect.java +++ b/src/main/java/com/bootdo/common/aspect/LogAspect.java @@ -1,104 +1,104 @@ -package com.bootdo.common.aspect; - -import java.lang.reflect.Method; -import java.util.Date; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import javax.servlet.http.HttpServletRequest; - -import com.bootdo.common.service.LogService; -import com.bootdo.system.domain.UserToken; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -import com.bootdo.common.annotation.Log; -import com.bootdo.common.dao.LogDao; -import com.bootdo.common.domain.LogDO; -import com.bootdo.common.utils.HttpContextUtils; -import com.bootdo.common.utils.IPUtils; -import com.bootdo.common.utils.JSONUtils; -import com.bootdo.common.utils.ShiroUtils; -import com.bootdo.system.domain.UserDO; - -@Aspect -@Component -public class LogAspect { - private static final Logger logger = LoggerFactory.getLogger(LogAspect.class); - - @Autowired - LogService logService; - - - @Pointcut("@annotation(com.bootdo.common.annotation.Log)") - public void logPointCut() { - } - - @Around("logPointCut()") - public Object around(ProceedingJoinPoint point) throws Throwable { - long beginTime = System.currentTimeMillis(); - // 执行方法 - Object result = point.proceed(); - // 执行时长(毫秒) - long time = System.currentTimeMillis() - beginTime; - //异步保存日志 - saveLog(point, time); - return result; - } - - void saveLog(ProceedingJoinPoint joinPoint, long time) throws InterruptedException { - MethodSignature signature = (MethodSignature) joinPoint.getSignature(); - Method method = signature.getMethod(); - LogDO sysLog = new LogDO(); - Log syslog = method.getAnnotation(Log.class); - if (syslog != null) { - // 注解上的描述 - sysLog.setOperation(syslog.value()); - } - // 请求的方法名 - String className = joinPoint.getTarget().getClass().getName(); - String methodName = signature.getName(); - sysLog.setMethod(className + "." + methodName + "()"); - // 请求的参数 - Object[] args = joinPoint.getArgs(); - try { - String params = JSONUtils.beanToJson(args[0]).substring(0, 4999); - sysLog.setParams(params); - } catch (Exception e) { - - } - // 获取request - HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); - // 设置IP地址 - sysLog.setIp(IPUtils.getIpAddr(request)); - // 用户名 - UserDO currUser = ShiroUtils.getUser(); - if (null == currUser) { - if (null != sysLog.getParams()) { - sysLog.setUserId(-1L); - sysLog.setUsername(sysLog.getParams()); - } else { - sysLog.setUserId(-1L); - sysLog.setUsername("获取用户信息为空"); - } - } else { - sysLog.setUserId(ShiroUtils.getUserId()); - sysLog.setUsername(ShiroUtils.getUser().getUsername()); - } - sysLog.setTime((int) time); - // 系统当前时间 - Date date = new Date(); - sysLog.setGmtCreate(date); - // 保存系统日志 - logService.save(sysLog); - } -} +package com.bootdo.common.aspect; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import javax.servlet.http.HttpServletRequest; + +import com.bootdo.common.service.LogService; +import com.bootdo.system.domain.UserToken; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import com.bootdo.common.annotation.Log; +import com.bootdo.common.dao.LogDao; +import com.bootdo.common.domain.LogDO; +import com.bootdo.common.utils.HttpContextUtils; +import com.bootdo.common.utils.IPUtils; +import com.bootdo.common.utils.JSONUtils; +import com.bootdo.common.utils.ShiroUtils; +import com.bootdo.system.domain.UserDO; + +@Aspect +@Component +public class LogAspect { + private static final Logger logger = LoggerFactory.getLogger(LogAspect.class); + + @Autowired + LogService logService; + + + @Pointcut("@annotation(com.bootdo.common.annotation.Log)") + public void logPointCut() { + } + + @Around("logPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + long beginTime = System.currentTimeMillis(); + // 执行方法 + Object result = point.proceed(); + // 执行时长(毫秒) + long time = System.currentTimeMillis() - beginTime; + //异步保存日志 + saveLog(point, time); + return result; + } + + void saveLog(ProceedingJoinPoint joinPoint, long time) throws InterruptedException { + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + LogDO sysLog = new LogDO(); + Log syslog = method.getAnnotation(Log.class); + if (syslog != null) { + // 注解上的描述 + sysLog.setOperation(syslog.value()); + } + // 请求的方法名 + String className = joinPoint.getTarget().getClass().getName(); + String methodName = signature.getName(); + sysLog.setMethod(className + "." + methodName + "()"); + // 请求的参数 + Object[] args = joinPoint.getArgs(); + try { + String params = JSONUtils.beanToJson(args[0]).substring(0, 4999); + sysLog.setParams(params); + } catch (Exception e) { + + } + // 获取request + HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); + // 设置IP地址 + sysLog.setIp(IPUtils.getIpAddr(request)); + // 用户名 + UserDO currUser = ShiroUtils.getUser(); + if (null == currUser) { + if (null != sysLog.getParams()) { + sysLog.setUserId(-1L); + sysLog.setUsername(sysLog.getParams()); + } else { + sysLog.setUserId(-1L); + sysLog.setUsername("获取用户信息为空"); + } + } else { + sysLog.setUserId(ShiroUtils.getUserId()); + sysLog.setUsername(ShiroUtils.getUser().getUsername()); + } + sysLog.setTime((int) time); + // 系统当前时间 + Date date = new Date(); + sysLog.setGmtCreate(date); + // 保存系统日志 + logService.save(sysLog); + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/aspect/WebLogAspect.java b/src/main/java/com/bootdo/common/aspect/WebLogAspect.java similarity index 92% rename from bootdo/src/main/java/com/bootdo/common/aspect/WebLogAspect.java rename to src/main/java/com/bootdo/common/aspect/WebLogAspect.java index fda51d128f4ed9a15240595eb802374c6325cdf0..6cc50c7c9e58927f01e5fc14b50c3da38d9d8825 100644 --- a/bootdo/src/main/java/com/bootdo/common/aspect/WebLogAspect.java +++ b/src/main/java/com/bootdo/common/aspect/WebLogAspect.java @@ -34,6 +34,7 @@ public class WebLogAspect { HttpServletRequest request = attributes.getRequest(); // 记录下请求内容 + logger.info(startLine); logger.info("请求地址 : " + request.getRequestURL().toString()); logger.info("HTTP METHOD : " + request.getMethod()); // 获取真实的ip地址 @@ -49,6 +50,7 @@ public class WebLogAspect { public void doAfterReturning(Object ret) throws Throwable { // 处理完请求,返回内容(返回值太复杂时,打印的是物理存储空间的地址) logger.debug("返回值 : " + ret); + logger.info(endLine); } @Around("logPointCut()") @@ -58,4 +60,8 @@ public class WebLogAspect { logger.info("耗时 : " + (System.currentTimeMillis() - startTime)); return ob; } + + private final String startLine = "----------------------------"; + + private final String endLine = "\\_ _ _ _ _ _ _ _ _ _ _ _ _ _ _"; } diff --git a/bootdo/src/main/java/com/bootdo/common/config/ApplicationContextRegister.java b/src/main/java/com/bootdo/common/config/ApplicationContextRegister.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/config/ApplicationContextRegister.java rename to src/main/java/com/bootdo/common/config/ApplicationContextRegister.java diff --git a/bootdo/src/main/java/com/bootdo/common/config/BootdoConfig.java b/src/main/java/com/bootdo/common/config/BootdoConfig.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/common/config/BootdoConfig.java rename to src/main/java/com/bootdo/common/config/BootdoConfig.java index ce25ea483f203b66208a454ed32701c0e1bb50b0..1981a335b74947a0c003fb4913b4227af12b00a7 100644 --- a/bootdo/src/main/java/com/bootdo/common/config/BootdoConfig.java +++ b/src/main/java/com/bootdo/common/config/BootdoConfig.java @@ -1,39 +1,39 @@ -package com.bootdo.common.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -@Component -@ConfigurationProperties(prefix="bootdo") -public class BootdoConfig { - //上传路径 - private String uploadPath; - - private String username; - - private String password; - - public String getUploadPath() { - return uploadPath; - } - - public void setUploadPath(String uploadPath) { - this.uploadPath = uploadPath; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } -} +package com.bootdo.common.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix="bootdo") +public class BootdoConfig { + //上传路径 + private String uploadPath; + + private String username; + + private String password; + + public String getUploadPath() { + return uploadPath; + } + + public void setUploadPath(String uploadPath) { + this.uploadPath = uploadPath; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/config/Constant.java b/src/main/java/com/bootdo/common/config/Constant.java similarity index 76% rename from bootdo/src/main/java/com/bootdo/common/config/Constant.java rename to src/main/java/com/bootdo/common/config/Constant.java index 4b0054dac4ba93f31222499bf6a5ae7d14b5024c..c902e625b454252173447d5fbf411b5aee03eb4b 100644 --- a/bootdo/src/main/java/com/bootdo/common/config/Constant.java +++ b/src/main/java/com/bootdo/common/config/Constant.java @@ -20,5 +20,10 @@ public class Constant { public static String LOG_ERROR = "error"; - + //行分割线 + public static String lineSplit = "\n|\t\t\t"; + //起始线 + public static String startLine = "\n+---------------"; + //结束线 + public static String endLine = "\n\\______________"; } diff --git a/bootdo/src/main/java/com/bootdo/common/config/DateConverConfig.java b/src/main/java/com/bootdo/common/config/DateConverConfig.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/config/DateConverConfig.java rename to src/main/java/com/bootdo/common/config/DateConverConfig.java diff --git a/bootdo/src/main/java/com/bootdo/common/config/DruidDBConfig.java b/src/main/java/com/bootdo/common/config/DruidDBConfig.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/common/config/DruidDBConfig.java rename to src/main/java/com/bootdo/common/config/DruidDBConfig.java index 28332d7fc5bb232f97d78f1fd0c039c1de59df5f..cad37e091d09c26b3332352cf3511e60684f33d4 100644 --- a/bootdo/src/main/java/com/bootdo/common/config/DruidDBConfig.java +++ b/src/main/java/com/bootdo/common/config/DruidDBConfig.java @@ -1,132 +1,132 @@ -package com.bootdo.common.config; -import com.alibaba.druid.pool.DruidDataSource; -import com.alibaba.druid.support.http.StatViewServlet; -import com.alibaba.druid.support.http.WebStatFilter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.web.servlet.FilterRegistrationBean; -import org.springframework.boot.web.servlet.ServletRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; - -import javax.sql.DataSource; -import java.sql.SQLException; - -/** - * Created by PrimaryKey on 17/2/4. - */ -@SuppressWarnings("AlibabaRemoveCommentedCode") -@Configuration -public class DruidDBConfig { - private Logger logger = LoggerFactory.getLogger(DruidDBConfig.class); - @Value("${spring.datasource.url}") - private String dbUrl; - - @Value("${spring.datasource.username}") - private String username; - - @Value("${spring.datasource.password}") - private String password; - - @Value("${spring.datasource.driverClassName}") - private String driverClassName; - - @Value("${spring.datasource.initialSize}") - private int initialSize; - - @Value("${spring.datasource.minIdle}") - private int minIdle; - - @Value("${spring.datasource.maxActive}") - private int maxActive; - - @Value("${spring.datasource.maxWait}") - private int maxWait; - - @Value("${spring.datasource.timeBetweenEvictionRunsMillis}") - private int timeBetweenEvictionRunsMillis; - - @Value("${spring.datasource.minEvictableIdleTimeMillis}") - private int minEvictableIdleTimeMillis; - - @Value("${spring.datasource.validationQuery}") - private String validationQuery; - - @Value("${spring.datasource.testWhileIdle}") - private boolean testWhileIdle; - - @Value("${spring.datasource.testOnBorrow}") - private boolean testOnBorrow; - - @Value("${spring.datasource.testOnReturn}") - private boolean testOnReturn; - - @Value("${spring.datasource.poolPreparedStatements}") - private boolean poolPreparedStatements; - - @Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}") - private int maxPoolPreparedStatementPerConnectionSize; - - @Value("${spring.datasource.filters}") - private String filters; - - @Value("{spring.datasource.connectionProperties}") - private String connectionProperties; - - @Bean(initMethod = "init", destroyMethod = "close") //声明其为Bean实例 - @Primary //在同样的DataSource中,首先使用被标注的DataSource - public DataSource dataSource() { - DruidDataSource datasource = new DruidDataSource(); - - datasource.setUrl(this.dbUrl); - datasource.setUsername(username); - datasource.setPassword(password); - datasource.setDriverClassName(driverClassName); - - //configuration - datasource.setInitialSize(initialSize); - datasource.setMinIdle(minIdle); - datasource.setMaxActive(maxActive); - datasource.setMaxWait(maxWait); - datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); - datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); - datasource.setValidationQuery(validationQuery); - datasource.setTestWhileIdle(testWhileIdle); - datasource.setTestOnBorrow(testOnBorrow); - datasource.setTestOnReturn(testOnReturn); - datasource.setPoolPreparedStatements(poolPreparedStatements); - datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize); - try { - datasource.setFilters(filters); - } catch (SQLException e) { - logger.error("druid configuration initialization filter", e); - } - datasource.setConnectionProperties(connectionProperties); - - return datasource; - } - - @Bean - public ServletRegistrationBean druidServlet() { - ServletRegistrationBean reg = new ServletRegistrationBean(); - reg.setServlet(new StatViewServlet()); - reg.addUrlMappings("/druid/*"); - reg.addInitParameter("allow", ""); //白名单 - return reg; - } - - @Bean public FilterRegistrationBean filterRegistrationBean() { - FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); - filterRegistrationBean.setFilter(new WebStatFilter()); - filterRegistrationBean.addUrlPatterns("/*"); - filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"); - filterRegistrationBean.addInitParameter("profileEnable", "true"); - filterRegistrationBean.addInitParameter("principalCookieName","USER_COOKIE"); - filterRegistrationBean.addInitParameter("principalSessionName","USER_SESSION"); - filterRegistrationBean.addInitParameter("DruidWebStatFilter","/*"); - return filterRegistrationBean; - } -} - +package com.bootdo.common.config; +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.support.http.StatViewServlet; +import com.alibaba.druid.support.http.WebStatFilter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; + +import javax.sql.DataSource; +import java.sql.SQLException; + +/** + * Created by PrimaryKey on 17/2/4. + */ +@SuppressWarnings("AlibabaRemoveCommentedCode") +@Configuration +public class DruidDBConfig { + private Logger logger = LoggerFactory.getLogger(DruidDBConfig.class); + @Value("${spring.datasource.url}") + private String dbUrl; + + @Value("${spring.datasource.username}") + private String username; + + @Value("${spring.datasource.password}") + private String password; + + @Value("${spring.datasource.driverClassName}") + private String driverClassName; + + @Value("${spring.datasource.initialSize}") + private int initialSize; + + @Value("${spring.datasource.minIdle}") + private int minIdle; + + @Value("${spring.datasource.maxActive}") + private int maxActive; + + @Value("${spring.datasource.maxWait}") + private int maxWait; + + @Value("${spring.datasource.timeBetweenEvictionRunsMillis}") + private int timeBetweenEvictionRunsMillis; + + @Value("${spring.datasource.minEvictableIdleTimeMillis}") + private int minEvictableIdleTimeMillis; + + @Value("${spring.datasource.validationQuery}") + private String validationQuery; + + @Value("${spring.datasource.testWhileIdle}") + private boolean testWhileIdle; + + @Value("${spring.datasource.testOnBorrow}") + private boolean testOnBorrow; + + @Value("${spring.datasource.testOnReturn}") + private boolean testOnReturn; + + @Value("${spring.datasource.poolPreparedStatements}") + private boolean poolPreparedStatements; + + @Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}") + private int maxPoolPreparedStatementPerConnectionSize; + + @Value("${spring.datasource.filters}") + private String filters; + + @Value("{spring.datasource.connectionProperties}") + private String connectionProperties; + + @Bean(initMethod = "init", destroyMethod = "close") //声明其为Bean实例 + @Primary //在同样的DataSource中,首先使用被标注的DataSource + public DataSource dataSource() { + DruidDataSource datasource = new DruidDataSource(); + + datasource.setUrl(this.dbUrl); + datasource.setUsername(username); + datasource.setPassword(password); + datasource.setDriverClassName(driverClassName); + + //configuration + datasource.setInitialSize(initialSize); + datasource.setMinIdle(minIdle); + datasource.setMaxActive(maxActive); + datasource.setMaxWait(maxWait); + datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); + datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); + datasource.setValidationQuery(validationQuery); + datasource.setTestWhileIdle(testWhileIdle); + datasource.setTestOnBorrow(testOnBorrow); + datasource.setTestOnReturn(testOnReturn); + datasource.setPoolPreparedStatements(poolPreparedStatements); + datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize); + try { + datasource.setFilters(filters); + } catch (SQLException e) { + logger.error("druid configuration initialization filter", e); + } + datasource.setConnectionProperties(connectionProperties); + + return datasource; + } + + @Bean + public ServletRegistrationBean druidServlet() { + ServletRegistrationBean reg = new ServletRegistrationBean(); + reg.setServlet(new StatViewServlet()); + reg.addUrlMappings("/druid/*"); + reg.addInitParameter("allow", ""); //白名单 + return reg; + } + + @Bean public FilterRegistrationBean filterRegistrationBean() { + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); + filterRegistrationBean.setFilter(new WebStatFilter()); + filterRegistrationBean.addUrlPatterns("/*"); + filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"); + filterRegistrationBean.addInitParameter("profileEnable", "true"); + filterRegistrationBean.addInitParameter("principalCookieName","USER_COOKIE"); + filterRegistrationBean.addInitParameter("principalSessionName","USER_SESSION"); + filterRegistrationBean.addInitParameter("DruidWebStatFilter","/*"); + return filterRegistrationBean; + } +} + diff --git a/src/main/java/com/bootdo/common/config/HttpclientSpringConfig.java b/src/main/java/com/bootdo/common/config/HttpclientSpringConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..cc2f983e858548258db54cf098ba3cc6ae2ec8da --- /dev/null +++ b/src/main/java/com/bootdo/common/config/HttpclientSpringConfig.java @@ -0,0 +1,16 @@ +package com.bootdo.common.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/10/2 23:32 + * @Desc: + **/ + +@Configuration +@PropertySource(value = "classpath:httpclient.properties") +public class HttpclientSpringConfig { + +} diff --git a/bootdo/src/main/java/com/bootdo/common/config/QuartzConfigration.java b/src/main/java/com/bootdo/common/config/QuartzConfigration.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/common/config/QuartzConfigration.java rename to src/main/java/com/bootdo/common/config/QuartzConfigration.java index 744419dbf078a654404336510e2b6b904187ab70..0cb4307cf269b1c7708e33d710478d65a451f252 100644 --- a/bootdo/src/main/java/com/bootdo/common/config/QuartzConfigration.java +++ b/src/main/java/com/bootdo/common/config/QuartzConfigration.java @@ -1,50 +1,50 @@ -package com.bootdo.common.config; - -import java.io.IOException; -import java.util.Properties; - -import org.quartz.Scheduler; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.config.PropertiesFactoryBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.ClassPathResource; -import org.springframework.scheduling.quartz.SchedulerFactoryBean; - -import com.bootdo.common.quartz.factory.JobFactory; - -@Configuration -public class QuartzConfigration { - - @Autowired - JobFactory jobFactory; - - - @Bean - public SchedulerFactoryBean schedulerFactoryBean() { - SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean(); - try { - schedulerFactoryBean.setOverwriteExistingJobs(true); - schedulerFactoryBean.setQuartzProperties(quartzProperties()); - schedulerFactoryBean.setJobFactory(jobFactory); - } catch (IOException e) { - e.printStackTrace(); - } - return schedulerFactoryBean; - } - - // 指定quartz.properties - @Bean - public Properties quartzProperties() throws IOException { - PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(); - propertiesFactoryBean.setLocation(new ClassPathResource("/config/quartz.properties")); - propertiesFactoryBean.afterPropertiesSet(); - return propertiesFactoryBean.getObject(); - } - - // 创建schedule - @Bean(name = "scheduler") - public Scheduler scheduler() { - return schedulerFactoryBean().getScheduler(); - } -} +package com.bootdo.common.config; + +import java.io.IOException; +import java.util.Properties; + +import org.quartz.Scheduler; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.PropertiesFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.scheduling.quartz.SchedulerFactoryBean; + +import com.bootdo.common.quartz.factory.JobFactory; + +@Configuration +public class QuartzConfigration { + + @Autowired + JobFactory jobFactory; + + + @Bean + public SchedulerFactoryBean schedulerFactoryBean() { + SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean(); + try { + schedulerFactoryBean.setOverwriteExistingJobs(true); + schedulerFactoryBean.setQuartzProperties(quartzProperties()); + schedulerFactoryBean.setJobFactory(jobFactory); + } catch (IOException e) { + e.printStackTrace(); + } + return schedulerFactoryBean; + } + + // 指定quartz.properties + @Bean + public Properties quartzProperties() throws IOException { + PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(); + propertiesFactoryBean.setLocation(new ClassPathResource("/config/quartz.properties")); + propertiesFactoryBean.afterPropertiesSet(); + return propertiesFactoryBean.getObject(); + } + + // 创建schedule + @Bean(name = "scheduler") + public Scheduler scheduler() { + return schedulerFactoryBean().getScheduler(); + } +} diff --git a/src/main/java/com/bootdo/common/config/RedisSpringConfig.java b/src/main/java/com/bootdo/common/config/RedisSpringConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..ad6fc2954b9a8b1d3d7755a0858a8ead1b1e9a26 --- /dev/null +++ b/src/main/java/com/bootdo/common/config/RedisSpringConfig.java @@ -0,0 +1,9 @@ +package com.bootdo.common.config; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/10/2 23:31 + * @Desc: + **/ +public class RedisSpringConfig { +} diff --git a/bootdo/src/main/java/com/bootdo/common/config/SecuityConfig.java b/src/main/java/com/bootdo/common/config/SecuityConfig.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/config/SecuityConfig.java rename to src/main/java/com/bootdo/common/config/SecuityConfig.java diff --git a/bootdo/src/main/java/com/bootdo/common/config/SpringAsyncConfig.java b/src/main/java/com/bootdo/common/config/SpringAsyncConfig.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/config/SpringAsyncConfig.java rename to src/main/java/com/bootdo/common/config/SpringAsyncConfig.java diff --git a/bootdo/src/main/java/com/bootdo/common/config/SpringBootSampleApplication.java b/src/main/java/com/bootdo/common/config/SpringBootSampleApplication.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/config/SpringBootSampleApplication.java rename to src/main/java/com/bootdo/common/config/SpringBootSampleApplication.java diff --git a/bootdo/src/main/java/com/bootdo/common/config/WebConfigurer.java b/src/main/java/com/bootdo/common/config/WebConfigurer.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/common/config/WebConfigurer.java rename to src/main/java/com/bootdo/common/config/WebConfigurer.java index 8606642c8e7beab6fc098256f83be236c62a01cf..284661abdcb519bb5cdc35f1d02fb1da9418fb81 100644 --- a/bootdo/src/main/java/com/bootdo/common/config/WebConfigurer.java +++ b/src/main/java/com/bootdo/common/config/WebConfigurer.java @@ -1,17 +1,17 @@ -package com.bootdo.common.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -@Component -class WebConfigurer extends WebMvcConfigurerAdapter { - @Autowired - BootdoConfig bootdoConfig; - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/files/**").addResourceLocations("file:///"+bootdoConfig.getUploadPath()); - } - +package com.bootdo.common.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +@Component +class WebConfigurer extends WebMvcConfigurerAdapter { + @Autowired + BootdoConfig bootdoConfig; + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/files/**").addResourceLocations("file:///"+bootdoConfig.getUploadPath()); + } + } \ No newline at end of file diff --git a/bootdo/src/main/java/com/bootdo/common/controller/BaseController.java b/src/main/java/com/bootdo/common/controller/BaseController.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/common/controller/BaseController.java rename to src/main/java/com/bootdo/common/controller/BaseController.java index 8394c75cf2665ac4d6f6de4c144c476bcae4a915..15c9f9a58381e80874f5ef9183bb1e46e9b4e95c 100644 --- a/bootdo/src/main/java/com/bootdo/common/controller/BaseController.java +++ b/src/main/java/com/bootdo/common/controller/BaseController.java @@ -1,21 +1,21 @@ -package com.bootdo.common.controller; - -import com.bootdo.system.domain.UserToken; -import org.springframework.stereotype.Controller; -import com.bootdo.common.utils.ShiroUtils; -import com.bootdo.system.domain.UserDO; - -@Controller -public class BaseController { - public UserDO getUser() { - return ShiroUtils.getUser(); - } - - public Long getUserId() { - return getUser().getUserId(); - } - - public String getUsername() { - return getUser().getUsername(); - } +package com.bootdo.common.controller; + +import com.bootdo.system.domain.UserToken; +import org.springframework.stereotype.Controller; +import com.bootdo.common.utils.ShiroUtils; +import com.bootdo.system.domain.UserDO; + +@Controller +public class BaseController { + public UserDO getUser() { + return ShiroUtils.getUser(); + } + + public Long getUserId() { + return getUser().getUserId(); + } + + public String getUsername() { + return getUser().getUsername(); + } } \ No newline at end of file diff --git a/bootdo/src/main/java/com/bootdo/common/controller/DictController.java b/src/main/java/com/bootdo/common/controller/DictController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/controller/DictController.java rename to src/main/java/com/bootdo/common/controller/DictController.java diff --git a/bootdo/src/main/java/com/bootdo/common/controller/FileController.java b/src/main/java/com/bootdo/common/controller/FileController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/controller/FileController.java rename to src/main/java/com/bootdo/common/controller/FileController.java diff --git a/bootdo/src/main/java/com/bootdo/common/controller/GeneratorController.java b/src/main/java/com/bootdo/common/controller/GeneratorController.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/common/controller/GeneratorController.java rename to src/main/java/com/bootdo/common/controller/GeneratorController.java index 67261ec51b10a04531c6e4073fce1cd06981022b..8cb0288997251412ac41a13c3ab3cd3f303b9fd7 100644 --- a/bootdo/src/main/java/com/bootdo/common/controller/GeneratorController.java +++ b/src/main/java/com/bootdo/common/controller/GeneratorController.java @@ -1,97 +1,97 @@ -package com.bootdo.common.controller; - -import com.alibaba.fastjson.JSON; -import com.bootdo.common.service.GeneratorService; -import com.bootdo.common.utils.GenUtils; -import com.bootdo.common.utils.R; -import org.apache.commons.configuration.Configuration; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; -import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@RequestMapping("/common/generator") -@Controller -public class GeneratorController { - String prefix = "common/generator"; - @Autowired - GeneratorService generatorService; - - @GetMapping() - String generator() { - return prefix + "/list"; - } - - @ResponseBody - @GetMapping("/list") - List> list() { - List> list = generatorService.list(); - return list; - }; - - @RequestMapping("/code/{tableName}") - public void code(HttpServletRequest request, HttpServletResponse response, - @PathVariable("tableName") String tableName) throws IOException { - String[] tableNames = new String[] { tableName }; - byte[] data = generatorService.generatorCode(tableNames); - response.reset(); - response.setHeader("Content-Disposition", "attachment; filename=\"bootdo.zip\""); - response.addHeader("Content-Length", "" + data.length); - response.setContentType("application/octet-stream; charset=UTF-8"); - - IOUtils.write(data, response.getOutputStream()); - } - - @RequestMapping("/batchCode") - public void batchCode(HttpServletRequest request, HttpServletResponse response, String tables) throws IOException { - String[] tableNames = new String[] {}; - tableNames = JSON.parseArray(tables).toArray(tableNames); - byte[] data = generatorService.generatorCode(tableNames); - response.reset(); - response.setHeader("Content-Disposition", "attachment; filename=\"bootdo.zip\""); - response.addHeader("Content-Length", "" + data.length); - response.setContentType("application/octet-stream; charset=UTF-8"); - - IOUtils.write(data, response.getOutputStream()); - } - - @GetMapping("/edit") - public String edit(Model model) { - Configuration conf = GenUtils.getConfig(); - Map property = new HashMap<>(16); - property.put("author", conf.getProperty("author")); - property.put("email", conf.getProperty("email")); - property.put("package", conf.getProperty("package")); - property.put("autoRemovePre", conf.getProperty("autoRemovePre")); - property.put("tablePrefix", conf.getProperty("tablePrefix")); - model.addAttribute("property", property); - return prefix + "/edit"; - } - - @ResponseBody - @PostMapping("/update") - R update(@RequestParam Map map) { - try { - PropertiesConfiguration conf = new PropertiesConfiguration("generator.properties"); - conf.setProperty("author", map.get("author")); - conf.setProperty("email", map.get("email")); - conf.setProperty("package", map.get("package")); - conf.setProperty("autoRemovePre", map.get("autoRemovePre")); - conf.setProperty("tablePrefix", map.get("tablePrefix")); - conf.save(); - } catch (ConfigurationException e) { - return R.error("保存配置文件出错"); - } - return R.ok(); - } -} +package com.bootdo.common.controller; + +import com.alibaba.fastjson.JSON; +import com.bootdo.common.service.GeneratorService; +import com.bootdo.common.utils.GenUtils; +import com.bootdo.common.utils.R; +import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RequestMapping("/common/generator") +@Controller +public class GeneratorController { + String prefix = "common/generator"; + @Autowired + GeneratorService generatorService; + + @GetMapping() + String generator() { + return prefix + "/list"; + } + + @ResponseBody + @GetMapping("/list") + List> list() { + List> list = generatorService.list(); + return list; + }; + + @RequestMapping("/code/{tableName}") + public void code(HttpServletRequest request, HttpServletResponse response, + @PathVariable("tableName") String tableName) throws IOException { + String[] tableNames = new String[] { tableName }; + byte[] data = generatorService.generatorCode(tableNames); + response.reset(); + response.setHeader("Content-Disposition", "attachment; filename=\"bootdo.zip\""); + response.addHeader("Content-Length", "" + data.length); + response.setContentType("application/octet-stream; charset=UTF-8"); + + IOUtils.write(data, response.getOutputStream()); + } + + @RequestMapping("/batchCode") + public void batchCode(HttpServletRequest request, HttpServletResponse response, String tables) throws IOException { + String[] tableNames = new String[] {}; + tableNames = JSON.parseArray(tables).toArray(tableNames); + byte[] data = generatorService.generatorCode(tableNames); + response.reset(); + response.setHeader("Content-Disposition", "attachment; filename=\"bootdo.zip\""); + response.addHeader("Content-Length", "" + data.length); + response.setContentType("application/octet-stream; charset=UTF-8"); + + IOUtils.write(data, response.getOutputStream()); + } + + @GetMapping("/edit") + public String edit(Model model) { + Configuration conf = GenUtils.getConfig(); + Map property = new HashMap<>(16); + property.put("author", conf.getProperty("author")); + property.put("email", conf.getProperty("email")); + property.put("package", conf.getProperty("package")); + property.put("autoRemovePre", conf.getProperty("autoRemovePre")); + property.put("tablePrefix", conf.getProperty("tablePrefix")); + model.addAttribute("property", property); + return prefix + "/edit"; + } + + @ResponseBody + @PostMapping("/update") + R update(@RequestParam Map map) { + try { + PropertiesConfiguration conf = new PropertiesConfiguration("generator.properties"); + conf.setProperty("author", map.get("author")); + conf.setProperty("email", map.get("email")); + conf.setProperty("package", map.get("package")); + conf.setProperty("autoRemovePre", map.get("autoRemovePre")); + conf.setProperty("tablePrefix", map.get("tablePrefix")); + conf.save(); + } catch (ConfigurationException e) { + return R.error("保存配置文件出错"); + } + return R.ok(); + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/controller/JobController.java b/src/main/java/com/bootdo/common/controller/JobController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/controller/JobController.java rename to src/main/java/com/bootdo/common/controller/JobController.java diff --git a/bootdo/src/main/java/com/bootdo/common/controller/LogController.java b/src/main/java/com/bootdo/common/controller/LogController.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/common/controller/LogController.java rename to src/main/java/com/bootdo/common/controller/LogController.java index c28aeb01102331a1a3e817586f896917ff920654..0b7e01fc1fb32895f51aad0f5c4133ea0b563b24 100644 --- a/bootdo/src/main/java/com/bootdo/common/controller/LogController.java +++ b/src/main/java/com/bootdo/common/controller/LogController.java @@ -1,61 +1,61 @@ -package com.bootdo.common.controller; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking.RemoveCommand; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.format.annotation.DateTimeFormat; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import com.bootdo.common.domain.LogDO; -import com.bootdo.common.domain.PageDO; -import com.bootdo.common.service.LogService; -import com.bootdo.common.utils.Query; -import com.bootdo.common.utils.R; - -@RequestMapping("/common/log") -@Controller -public class LogController { - @Autowired - LogService logService; - String prefix = "common/log"; - - @GetMapping() - String log() { - return prefix + "/log"; - } - - @ResponseBody - @GetMapping("/list") - PageDO list(@RequestParam Map params) { - Query query = new Query(params); - PageDO page = logService.queryList(query); - return page; - } - - @ResponseBody - @PostMapping("/remove") - R remove(Long id) { - if (logService.remove(id)>0) { - return R.ok(); - } - return R.error(); - } - - @ResponseBody - @PostMapping("/batchRemove") - R batchRemove(@RequestParam("ids[]") Long[] ids) { - int r = logService.batchRemove(ids); - if (r > 0) { - return R.ok(); - } - return R.error(); - } -} +package com.bootdo.common.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking.RemoveCommand; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.bootdo.common.domain.LogDO; +import com.bootdo.common.domain.PageDO; +import com.bootdo.common.service.LogService; +import com.bootdo.common.utils.Query; +import com.bootdo.common.utils.R; + +@RequestMapping("/common/log") +@Controller +public class LogController { + @Autowired + LogService logService; + String prefix = "common/log"; + + @GetMapping() + String log() { + return prefix + "/log"; + } + + @ResponseBody + @GetMapping("/list") + PageDO list(@RequestParam Map params) { + Query query = new Query(params); + PageDO page = logService.queryList(query); + return page; + } + + @ResponseBody + @PostMapping("/remove") + R remove(Long id) { + if (logService.remove(id)>0) { + return R.ok(); + } + return R.error(); + } + + @ResponseBody + @PostMapping("/batchRemove") + R batchRemove(@RequestParam("ids[]") Long[] ids) { + int r = logService.batchRemove(ids); + if (r > 0) { + return R.ok(); + } + return R.error(); + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/dao/DictDao.java b/src/main/java/com/bootdo/common/dao/DictDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/dao/DictDao.java rename to src/main/java/com/bootdo/common/dao/DictDao.java diff --git a/bootdo/src/main/java/com/bootdo/common/dao/FileDao.java b/src/main/java/com/bootdo/common/dao/FileDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/dao/FileDao.java rename to src/main/java/com/bootdo/common/dao/FileDao.java diff --git a/bootdo/src/main/java/com/bootdo/common/dao/GeneratorMapper.java b/src/main/java/com/bootdo/common/dao/GeneratorMapper.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/common/dao/GeneratorMapper.java rename to src/main/java/com/bootdo/common/dao/GeneratorMapper.java index def03d19c5efdc304db4433a038e2753749876e3..df4d08bfd98758244c54c17171aa0bc277eb66ce 100644 --- a/bootdo/src/main/java/com/bootdo/common/dao/GeneratorMapper.java +++ b/src/main/java/com/bootdo/common/dao/GeneratorMapper.java @@ -1,23 +1,23 @@ -package com.bootdo.common.dao; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Select; - -public interface GeneratorMapper { - @Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables" - + " where table_schema = (select database())") - List> list(); - - @Select("select count(*) from information_schema.tables where table_schema = (select database())") - int count(Map map); - - @Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables \r\n" - + " where table_schema = (select database()) and table_name = #{tableName}") - Map get(String tableName); - - @Select("select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns\r\n" - + " where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position") - List> listColumns(String tableName); -} +package com.bootdo.common.dao; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Select; + +public interface GeneratorMapper { + @Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables" + + " where table_schema = (select database())") + List> list(); + + @Select("select count(*) from information_schema.tables where table_schema = (select database())") + int count(Map map); + + @Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables \r\n" + + " where table_schema = (select database()) and table_name = #{tableName}") + Map get(String tableName); + + @Select("select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns\r\n" + + " where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position") + List> listColumns(String tableName); +} diff --git a/bootdo/src/main/java/com/bootdo/common/dao/LogDao.java b/src/main/java/com/bootdo/common/dao/LogDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/dao/LogDao.java rename to src/main/java/com/bootdo/common/dao/LogDao.java diff --git a/bootdo/src/main/java/com/bootdo/common/dao/TaskDao.java b/src/main/java/com/bootdo/common/dao/TaskDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/dao/TaskDao.java rename to src/main/java/com/bootdo/common/dao/TaskDao.java diff --git a/bootdo/src/main/java/com/bootdo/common/domain/ColumnDO.java b/src/main/java/com/bootdo/common/domain/ColumnDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/domain/ColumnDO.java rename to src/main/java/com/bootdo/common/domain/ColumnDO.java diff --git a/bootdo/src/main/java/com/bootdo/common/domain/DictDO.java b/src/main/java/com/bootdo/common/domain/DictDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/domain/DictDO.java rename to src/main/java/com/bootdo/common/domain/DictDO.java diff --git a/bootdo/src/main/java/com/bootdo/common/domain/FileDO.java b/src/main/java/com/bootdo/common/domain/FileDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/domain/FileDO.java rename to src/main/java/com/bootdo/common/domain/FileDO.java diff --git a/bootdo/src/main/java/com/bootdo/common/domain/LogDO.java b/src/main/java/com/bootdo/common/domain/LogDO.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/common/domain/LogDO.java rename to src/main/java/com/bootdo/common/domain/LogDO.java index af99687a4f94a8c528a27f14500d60ecaddaa643..e7d1c6608176662eec28ff223fb50ed6259484e9 100644 --- a/bootdo/src/main/java/com/bootdo/common/domain/LogDO.java +++ b/src/main/java/com/bootdo/common/domain/LogDO.java @@ -1,112 +1,112 @@ -package com.bootdo.common.domain; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import java.util.Date; - -public class LogDO { - private Long id; - - private Long userId; - - private String username; - - private String operation; - - private Integer time; - - private String method; - - private String params; - - private String ip; - @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") - private Date gmtCreate; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username == null ? null : username.trim(); - } - - public String getOperation() { - return operation; - } - - public void setOperation(String operation) { - this.operation = operation == null ? null : operation.trim(); - } - - public Integer getTime() { - return time; - } - - public void setTime(Integer time) { - this.time = time; - } - - public String getMethod() { - return method; - } - - public void setMethod(String method) { - this.method = method == null ? null : method.trim(); - } - - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params == null ? null : params.trim(); - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip == null ? null : ip.trim(); - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - @Override - public String toString() { - return "LogDO{" + - "id=" + id + - ", userId=" + userId + - ", username='" + username + '\'' + - ", operation='" + operation + '\'' + - ", time=" + time + - ", method='" + method + '\'' + - ", params='" + params + '\'' + - ", ip='" + ip + '\'' + - ", gmtCreate=" + gmtCreate + - '}'; - } +package com.bootdo.common.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.util.Date; + +public class LogDO { + private Long id; + + private Long userId; + + private String username; + + private String operation; + + private Integer time; + + private String method; + + private String params; + + private String ip; + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + private Date gmtCreate; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username == null ? null : username.trim(); + } + + public String getOperation() { + return operation; + } + + public void setOperation(String operation) { + this.operation = operation == null ? null : operation.trim(); + } + + public Integer getTime() { + return time; + } + + public void setTime(Integer time) { + this.time = time; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method == null ? null : method.trim(); + } + + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params == null ? null : params.trim(); + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip == null ? null : ip.trim(); + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + @Override + public String toString() { + return "LogDO{" + + "id=" + id + + ", userId=" + userId + + ", username='" + username + '\'' + + ", operation='" + operation + '\'' + + ", time=" + time + + ", method='" + method + '\'' + + ", params='" + params + '\'' + + ", ip='" + ip + '\'' + + ", gmtCreate=" + gmtCreate + + '}'; + } } \ No newline at end of file diff --git a/bootdo/src/main/java/com/bootdo/common/domain/PageDO.java b/src/main/java/com/bootdo/common/domain/PageDO.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/common/domain/PageDO.java rename to src/main/java/com/bootdo/common/domain/PageDO.java index 8b0b265f7f9eb2e50f51d688e7bcfccd73dd7619..fe05337040ec54170b9ad2abb847d0cd0516842e 100644 --- a/bootdo/src/main/java/com/bootdo/common/domain/PageDO.java +++ b/src/main/java/com/bootdo/common/domain/PageDO.java @@ -1,86 +1,86 @@ -package com.bootdo.common.domain; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class PageDO { - - private int offset; - private int limit; - private int total; - private Map params; - private String param; - private List rows; - - public PageDO() { - super(); - this.offset = 0; - this.limit = 10; - this.total = 1; - this.params = new HashMap<>(); - this.param = ""; - this.rows = new ArrayList<>(); - } - - public int getOffset() { - return offset; - } - - public void setOffset(int offset) { - this.offset = offset; - } - - public int getLimit() { - return limit; - } - - public void setLimit(int limit) { - this.limit = limit; - } - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public Map getParams() { - return params; - } - - public void setParams(Map params) { - this.params = params; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public String getParam() { - return param; - } - - public void setParam(String param) { - this.param = param; - } - - @Override - public String toString() { - return "PageDO{" + - "offset=" + offset + - ", limit=" + limit + - ", total=" + total + - ", params=" + params + - ", param='" + param + '\'' + - ", rows=" + rows + - '}'; - } -} +package com.bootdo.common.domain; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PageDO { + + private int offset; + private int limit; + private int total; + private Map params; + private String param; + private List rows; + + public PageDO() { + super(); + this.offset = 0; + this.limit = 10; + this.total = 1; + this.params = new HashMap<>(); + this.param = ""; + this.rows = new ArrayList<>(); + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public Map getParams() { + return params; + } + + public void setParams(Map params) { + this.params = params; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public String getParam() { + return param; + } + + public void setParam(String param) { + this.param = param; + } + + @Override + public String toString() { + return "PageDO{" + + "offset=" + offset + + ", limit=" + limit + + ", total=" + total + + ", params=" + params + + ", param='" + param + '\'' + + ", rows=" + rows + + '}'; + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/domain/ScheduleJob.java b/src/main/java/com/bootdo/common/domain/ScheduleJob.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/common/domain/ScheduleJob.java rename to src/main/java/com/bootdo/common/domain/ScheduleJob.java index a6039a43314b490546347fb4725515129f33357a..98051548fac7c45495cd81ab09d550b0310675e9 100644 --- a/bootdo/src/main/java/com/bootdo/common/domain/ScheduleJob.java +++ b/src/main/java/com/bootdo/common/domain/ScheduleJob.java @@ -1,135 +1,135 @@ -package com.bootdo.common.domain; - -import java.io.Serializable; - -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -@SuppressWarnings("serial") -public class ScheduleJob implements Serializable ,Job { - - public static final String STATUS_RUNNING = "1"; - public static final String STATUS_NOT_RUNNING = "0"; - public static final String CONCURRENT_IS = "1"; - public static final String CONCURRENT_NOT = "0"; - - /** - * 任务名称 - */ - private String jobName; - /** - * 任务分组 - */ - private String jobGroup; - /** - * 任务状态 是否启动任务 - */ - private String jobStatus; - /** - * cron表达式 - */ - private String cronExpression; - /** - * 描述 - */ - private String description; - /** - * 任务执行时调用哪个类的方法 包名+类名 - */ - private String beanClass; - /** - * 任务是否有状态 - */ - private String isConcurrent; - - /** - * Spring bean - */ - private String springBean; - - /** - * 任务调用的方法名 - */ - private String methodName; - - public String getJobName() { - return jobName; - } - - public void setJobName(String jobName) { - this.jobName = jobName; - } - - public String getJobGroup() { - return jobGroup; - } - - public void setJobGroup(String jobGroup) { - this.jobGroup = jobGroup; - } - - public String getJobStatus() { - return jobStatus; - } - - public void setJobStatus(String jobStatus) { - this.jobStatus = jobStatus; - } - - public String getCronExpression() { - return cronExpression; - } - - public void setCronExpression(String cronExpression) { - this.cronExpression = cronExpression; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getBeanClass() { - return beanClass; - } - - public void setBeanClass(String beanClass) { - this.beanClass = beanClass; - } - - public String getIsConcurrent() { - return isConcurrent; - } - - public void setIsConcurrent(String isConcurrent) { - this.isConcurrent = isConcurrent; - } - - public String getMethodName() { - return methodName; - } - - public void setMethodName(String methodName) { - this.methodName = methodName; - } - - public String getSpringBean() { - return springBean; - } - - public void setSpringBean(String springBean) { - this.springBean = springBean; - } - - @Override - public void execute(JobExecutionContext context) throws JobExecutionException { - // TODO Auto-generated method stub - - } - - +package com.bootdo.common.domain; + +import java.io.Serializable; + +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +@SuppressWarnings("serial") +public class ScheduleJob implements Serializable ,Job { + + public static final String STATUS_RUNNING = "1"; + public static final String STATUS_NOT_RUNNING = "0"; + public static final String CONCURRENT_IS = "1"; + public static final String CONCURRENT_NOT = "0"; + + /** + * 任务名称 + */ + private String jobName; + /** + * 任务分组 + */ + private String jobGroup; + /** + * 任务状态 是否启动任务 + */ + private String jobStatus; + /** + * cron表达式 + */ + private String cronExpression; + /** + * 描述 + */ + private String description; + /** + * 任务执行时调用哪个类的方法 包名+类名 + */ + private String beanClass; + /** + * 任务是否有状态 + */ + private String isConcurrent; + + /** + * Spring bean + */ + private String springBean; + + /** + * 任务调用的方法名 + */ + private String methodName; + + public String getJobName() { + return jobName; + } + + public void setJobName(String jobName) { + this.jobName = jobName; + } + + public String getJobGroup() { + return jobGroup; + } + + public void setJobGroup(String jobGroup) { + this.jobGroup = jobGroup; + } + + public String getJobStatus() { + return jobStatus; + } + + public void setJobStatus(String jobStatus) { + this.jobStatus = jobStatus; + } + + public String getCronExpression() { + return cronExpression; + } + + public void setCronExpression(String cronExpression) { + this.cronExpression = cronExpression; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getBeanClass() { + return beanClass; + } + + public void setBeanClass(String beanClass) { + this.beanClass = beanClass; + } + + public String getIsConcurrent() { + return isConcurrent; + } + + public void setIsConcurrent(String isConcurrent) { + this.isConcurrent = isConcurrent; + } + + public String getMethodName() { + return methodName; + } + + public void setMethodName(String methodName) { + this.methodName = methodName; + } + + public String getSpringBean() { + return springBean; + } + + public void setSpringBean(String springBean) { + this.springBean = springBean; + } + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + // TODO Auto-generated method stub + + } + + } \ No newline at end of file diff --git a/bootdo/src/main/java/com/bootdo/common/domain/TableDO.java b/src/main/java/com/bootdo/common/domain/TableDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/domain/TableDO.java rename to src/main/java/com/bootdo/common/domain/TableDO.java diff --git a/bootdo/src/main/java/com/bootdo/common/domain/TaskDO.java b/src/main/java/com/bootdo/common/domain/TaskDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/domain/TaskDO.java rename to src/main/java/com/bootdo/common/domain/TaskDO.java diff --git a/bootdo/src/main/java/com/bootdo/common/domain/Tree.java b/src/main/java/com/bootdo/common/domain/Tree.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/common/domain/Tree.java rename to src/main/java/com/bootdo/common/domain/Tree.java index ae97a2e1dfb09136709033e984bf7e391b7a3123..19749a12fac91a7c0fa5f0dc0ca0be8173ec3230 100644 --- a/bootdo/src/main/java/com/bootdo/common/domain/Tree.java +++ b/src/main/java/com/bootdo/common/domain/Tree.java @@ -1,151 +1,151 @@ -package com.bootdo.common.domain; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.alibaba.fastjson.JSON; - -/** - * tree TODO
- * - * @author kangxu2 2017-1-7 - * - */ -public class Tree { - /** - * 节点ID - */ - private String id; - /** - * 显示节点文本 - */ - private String text; - /** - * 节点状态,open closed - */ - private Map state; - /** - * 节点是否被选中 true false - */ - private boolean checked = false; - /** - * 节点属性 - */ - private Map attributes; - - /** - * 节点的子节点 - */ - private List> children = new ArrayList>(); - - /** - * 父ID - */ - private String parentId; - /** - * 是否有父节点 - */ - private boolean hasParent = false; - /** - * 是否有子节点 - */ - private boolean hasChildren = false; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public Map getState() { - return state; - } - - public void setState(Map state) { - this.state = state; - } - - public boolean isChecked() { - return checked; - } - - public void setChecked(boolean checked) { - this.checked = checked; - } - - public Map getAttributes() { - return attributes; - } - - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - public List> getChildren() { - return children; - } - - public void setChildren(List> children) { - this.children = children; - } - - public boolean isHasParent() { - return hasParent; - } - - public void setHasParent(boolean isParent) { - this.hasParent = isParent; - } - - public boolean isHasChildren() { - return hasChildren; - } - - public void setChildren(boolean isChildren) { - this.hasChildren = isChildren; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public Tree(String id, String text, Map state, boolean checked, Map attributes, - List> children, boolean isParent, boolean isChildren, String parentID) { - super(); - this.id = id; - this.text = text; - this.state = state; - this.checked = checked; - this.attributes = attributes; - this.children = children; - this.hasParent = isParent; - this.hasChildren = isChildren; - this.parentId = parentID; - } - - public Tree() { - super(); - } - - @Override - public String toString() { - - return JSON.toJSONString(this); - } - +package com.bootdo.common.domain; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.alibaba.fastjson.JSON; + +/** + * tree TODO
+ * + * @author kangxu2 2017-1-7 + * + */ +public class Tree { + /** + * 节点ID + */ + private String id; + /** + * 显示节点文本 + */ + private String text; + /** + * 节点状态,open closed + */ + private Map state; + /** + * 节点是否被选中 true false + */ + private boolean checked = false; + /** + * 节点属性 + */ + private Map attributes; + + /** + * 节点的子节点 + */ + private List> children = new ArrayList>(); + + /** + * 父ID + */ + private String parentId; + /** + * 是否有父节点 + */ + private boolean hasParent = false; + /** + * 是否有子节点 + */ + private boolean hasChildren = false; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public Map getState() { + return state; + } + + public void setState(Map state) { + this.state = state; + } + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public Map getAttributes() { + return attributes; + } + + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + + public List> getChildren() { + return children; + } + + public void setChildren(List> children) { + this.children = children; + } + + public boolean isHasParent() { + return hasParent; + } + + public void setHasParent(boolean isParent) { + this.hasParent = isParent; + } + + public boolean isHasChildren() { + return hasChildren; + } + + public void setChildren(boolean isChildren) { + this.hasChildren = isChildren; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public Tree(String id, String text, Map state, boolean checked, Map attributes, + List> children, boolean isParent, boolean isChildren, String parentID) { + super(); + this.id = id; + this.text = text; + this.state = state; + this.checked = checked; + this.attributes = attributes; + this.children = children; + this.hasParent = isParent; + this.hasChildren = isChildren; + this.parentId = parentID; + } + + public Tree() { + super(); + } + + @Override + public String toString() { + + return JSON.toJSONString(this); + } + } \ No newline at end of file diff --git a/bootdo/src/main/java/com/bootdo/common/exception/BDException.java b/src/main/java/com/bootdo/common/exception/BDException.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/exception/BDException.java rename to src/main/java/com/bootdo/common/exception/BDException.java diff --git a/bootdo/src/main/java/com/bootdo/common/exception/BDExceptionHandler.java b/src/main/java/com/bootdo/common/exception/BDExceptionHandler.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/common/exception/BDExceptionHandler.java rename to src/main/java/com/bootdo/common/exception/BDExceptionHandler.java index 9842166ba2f4e957a189e19e66eb28e17c5db1dd..7d67fa19108ddf4463db594b161c93a0b20cd490 100644 --- a/bootdo/src/main/java/com/bootdo/common/exception/BDExceptionHandler.java +++ b/src/main/java/com/bootdo/common/exception/BDExceptionHandler.java @@ -1,87 +1,87 @@ -package com.bootdo.common.exception; - -import com.bootdo.common.config.Constant; -import com.bootdo.common.domain.LogDO; -import com.bootdo.common.service.LogService; -import com.bootdo.common.utils.ExceptionUtils; -import com.bootdo.common.utils.HttpServletUtils; -import com.bootdo.common.utils.R; -import com.bootdo.common.utils.ShiroUtils; -import com.bootdo.system.domain.UserDO; -import org.apache.shiro.authz.AuthorizationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DuplicateKeyException; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestControllerAdvice; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Date; - -/** - * 异常处理器 - */ -@RestControllerAdvice -public class BDExceptionHandler { - private Logger logger = LoggerFactory.getLogger(getClass()); - @Autowired - LogService logService; -// -// /** -// * 自定义异常 -// */ -// @ExceptionHandler(BDException.class) -// public R handleBDException(BDException e) { -// logger.error(e.getMessage(), e); -// R r = new R(); -// r.put("code", e.getCode()); -// r.put("msg", e.getMessage()); -// return r; -// } -// -// @ExceptionHandler(DuplicateKeyException.class) -// public R handleDuplicateKeyException(DuplicateKeyException e) { -// logger.error(e.getMessage(), e); -// return R.error("数据库中已存在该记录"); -// } -// -// @ExceptionHandler(org.springframework.web.servlet.NoHandlerFoundException.class) -// public R noHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException e) { -// logger.error(e.getMessage(), e); -// return R.error(404, "没找找到页面"); -// } - - @ExceptionHandler(AuthorizationException.class) - public Object handleAuthorizationException(AuthorizationException e, HttpServletRequest request) { - logger.error(e.getMessage(), e); - if (HttpServletUtils.jsAjax(request)) { - return R.error(403, "未授权"); - } - return new ModelAndView("error/403"); - } - - - @ExceptionHandler({Exception.class}) - public Object handleException(Exception e, HttpServletRequest request) { - LogDO logDO = new LogDO(); - logDO.setGmtCreate(new Date()); - logDO.setOperation(Constant.LOG_ERROR); - logDO.setMethod(request.getRequestURL().toString()); - logDO.setParams(e.toString()); - UserDO current = ShiroUtils.getUser(); - if(null!=current){ - logDO.setUserId(current.getUserId()); - logDO.setUsername(current.getUsername()); - } - logService.save(logDO); - logger.error(e.getMessage(), e); - if (HttpServletUtils.jsAjax(request)) { - return R.error(500, "服务器错误,请联系管理员"); - } - return new ModelAndView("error/500"); - } -} +package com.bootdo.common.exception; + +import com.bootdo.common.config.Constant; +import com.bootdo.common.domain.LogDO; +import com.bootdo.common.service.LogService; +import com.bootdo.common.utils.ExceptionUtils; +import com.bootdo.common.utils.HttpServletUtils; +import com.bootdo.common.utils.R; +import com.bootdo.common.utils.ShiroUtils; +import com.bootdo.system.domain.UserDO; +import org.apache.shiro.authz.AuthorizationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Date; + +/** + * 异常处理器 + */ +@RestControllerAdvice +public class BDExceptionHandler { + private Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired + LogService logService; +// +// /** +// * 自定义异常 +// */ +// @ExceptionHandler(BDException.class) +// public R handleBDException(BDException e) { +// logger.error(e.getMessage(), e); +// R r = new R(); +// r.put("code", e.getCode()); +// r.put("msg", e.getMessage()); +// return r; +// } +// +// @ExceptionHandler(DuplicateKeyException.class) +// public R handleDuplicateKeyException(DuplicateKeyException e) { +// logger.error(e.getMessage(), e); +// return R.error("数据库中已存在该记录"); +// } +// +// @ExceptionHandler(org.springframework.web.servlet.NoHandlerFoundException.class) +// public R noHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException e) { +// logger.error(e.getMessage(), e); +// return R.error(404, "没找找到页面"); +// } + + @ExceptionHandler(AuthorizationException.class) + public Object handleAuthorizationException(AuthorizationException e, HttpServletRequest request) { + logger.error(e.getMessage(), e); + if (HttpServletUtils.jsAjax(request)) { + return R.error(403, "未授权"); + } + return new ModelAndView("error/403"); + } + + + @ExceptionHandler({Exception.class}) + public Object handleException(Exception e, HttpServletRequest request) { + LogDO logDO = new LogDO(); + logDO.setGmtCreate(new Date()); + logDO.setOperation(Constant.LOG_ERROR); + logDO.setMethod(request.getRequestURL().toString()); + logDO.setParams(e.toString()); + UserDO current = ShiroUtils.getUser(); + if(null!=current){ + logDO.setUserId(current.getUserId()); + logDO.setUsername(current.getUsername()); + } + logService.save(logDO); + logger.error(e.getMessage(), e); + if (HttpServletUtils.jsAjax(request)) { + return R.error(500, "服务器错误,请联系管理员"); + } + return new ModelAndView("error/500"); + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/exception/MainsiteErrorController.java b/src/main/java/com/bootdo/common/exception/MainsiteErrorController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/exception/MainsiteErrorController.java rename to src/main/java/com/bootdo/common/exception/MainsiteErrorController.java diff --git a/src/main/java/com/bootdo/common/filter/RequestLogFilter.java b/src/main/java/com/bootdo/common/filter/RequestLogFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..853204a3eee717dcf245837538dec9a5fcff7759 --- /dev/null +++ b/src/main/java/com/bootdo/common/filter/RequestLogFilter.java @@ -0,0 +1,38 @@ +package com.bootdo.common.filter; + +import com.bootdo.common.wrapper.BodyReaderWrapper; +import org.apache.catalina.servlet4preview.http.HttpServletRequest; +import org.springframework.stereotype.Component; + +import javax.servlet.*; +import javax.servlet.annotation.WebFilter; +import java.io.IOException; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/8/23 0:10 + * @Desc: 请求日志过滤器 + * https://blog.csdn.net/panyongcsd/article/details/80990397 + **/ + +//@WebFilter(filterName = "requestLogFilter",urlPatterns = "/*") +public class RequestLogFilter implements Filter { + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + BodyReaderWrapper buffedRequest = new BodyReaderWrapper((HttpServletRequest) servletRequest); + String requetBody = buffedRequest.getBody(); + System.out.println(requetBody); + filterChain.doFilter(buffedRequest,servletResponse); + } + + @Override + public void destroy() { + + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/listenner/ScheduleJobInitListener.java b/src/main/java/com/bootdo/common/listenner/ScheduleJobInitListener.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/common/listenner/ScheduleJobInitListener.java rename to src/main/java/com/bootdo/common/listenner/ScheduleJobInitListener.java index 78bc1898f92f22e9df04674b907f8946c48d8fde..ee220f8ad38bdd26492b612f8a09d2af5befb302 100644 --- a/bootdo/src/main/java/com/bootdo/common/listenner/ScheduleJobInitListener.java +++ b/src/main/java/com/bootdo/common/listenner/ScheduleJobInitListener.java @@ -1,31 +1,31 @@ -package com.bootdo.common.listenner; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import com.bootdo.common.quartz.utils.QuartzManager; -import com.bootdo.common.service.JobService; - -@Component -@Order(value = 1) -public class ScheduleJobInitListener implements CommandLineRunner { - - @Autowired - JobService scheduleJobService; - - @Autowired - QuartzManager quartzManager; - - @Override - public void run(String... arg0) throws Exception { - try { - scheduleJobService.initSchedule(); - } catch (Exception e) { - e.printStackTrace(); - } - - } - +package com.bootdo.common.listenner; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import com.bootdo.common.quartz.utils.QuartzManager; +import com.bootdo.common.service.JobService; + +@Component +@Order(value = 1) +public class ScheduleJobInitListener implements CommandLineRunner { + + @Autowired + JobService scheduleJobService; + + @Autowired + QuartzManager quartzManager; + + @Override + public void run(String... arg0) throws Exception { + try { + scheduleJobService.initSchedule(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + } \ No newline at end of file diff --git a/bootdo/src/main/java/com/bootdo/common/quartz/factory/JobFactory.java b/src/main/java/com/bootdo/common/quartz/factory/JobFactory.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/quartz/factory/JobFactory.java rename to src/main/java/com/bootdo/common/quartz/factory/JobFactory.java diff --git a/bootdo/src/main/java/com/bootdo/common/quartz/utils/QuartzManager.java b/src/main/java/com/bootdo/common/quartz/utils/QuartzManager.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/quartz/utils/QuartzManager.java rename to src/main/java/com/bootdo/common/quartz/utils/QuartzManager.java diff --git a/bootdo/src/main/java/com/bootdo/common/redis/shiro/RedisCache.java b/src/main/java/com/bootdo/common/redis/shiro/RedisCache.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/redis/shiro/RedisCache.java rename to src/main/java/com/bootdo/common/redis/shiro/RedisCache.java diff --git a/bootdo/src/main/java/com/bootdo/common/redis/shiro/RedisCacheManager.java b/src/main/java/com/bootdo/common/redis/shiro/RedisCacheManager.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/redis/shiro/RedisCacheManager.java rename to src/main/java/com/bootdo/common/redis/shiro/RedisCacheManager.java diff --git a/bootdo/src/main/java/com/bootdo/common/redis/shiro/RedisManager.java b/src/main/java/com/bootdo/common/redis/shiro/RedisManager.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/redis/shiro/RedisManager.java rename to src/main/java/com/bootdo/common/redis/shiro/RedisManager.java diff --git a/bootdo/src/main/java/com/bootdo/common/redis/shiro/RedisSessionDAO.java b/src/main/java/com/bootdo/common/redis/shiro/RedisSessionDAO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/redis/shiro/RedisSessionDAO.java rename to src/main/java/com/bootdo/common/redis/shiro/RedisSessionDAO.java diff --git a/bootdo/src/main/java/com/bootdo/common/redis/shiro/SerializeUtils.java b/src/main/java/com/bootdo/common/redis/shiro/SerializeUtils.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/redis/shiro/SerializeUtils.java rename to src/main/java/com/bootdo/common/redis/shiro/SerializeUtils.java diff --git a/bootdo/src/main/java/com/bootdo/common/service/DictService.java b/src/main/java/com/bootdo/common/service/DictService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/service/DictService.java rename to src/main/java/com/bootdo/common/service/DictService.java diff --git a/bootdo/src/main/java/com/bootdo/common/service/FileService.java b/src/main/java/com/bootdo/common/service/FileService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/service/FileService.java rename to src/main/java/com/bootdo/common/service/FileService.java diff --git a/bootdo/src/main/java/com/bootdo/common/service/GeneratorService.java b/src/main/java/com/bootdo/common/service/GeneratorService.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/common/service/GeneratorService.java rename to src/main/java/com/bootdo/common/service/GeneratorService.java index 899c97cac32cae9e8ff2ec05a94721861c8bc1f6..fa10d1618e212c0a0ff191e8eb01c19c6a5aace6 100644 --- a/bootdo/src/main/java/com/bootdo/common/service/GeneratorService.java +++ b/src/main/java/com/bootdo/common/service/GeneratorService.java @@ -1,22 +1,22 @@ -/** - * - */ -package com.bootdo.common.service; - -import java.util.List; -import java.util.Map; - -import org.springframework.stereotype.Service; - -/** - * @author 1992lcg@163.com - * @Time 2017年9月6日 - * @description - * - */ -@Service -public interface GeneratorService { - List> list(); - - byte[] generatorCode(String[] tableNames); -} +/** + * + */ +package com.bootdo.common.service; + +import java.util.List; +import java.util.Map; + +import org.springframework.stereotype.Service; + +/** + * @author 1992lcg@163.com + * @Time 2017年9月6日 + * @description + * + */ +@Service +public interface GeneratorService { + List> list(); + + byte[] generatorCode(String[] tableNames); +} diff --git a/bootdo/src/main/java/com/bootdo/common/service/JobService.java b/src/main/java/com/bootdo/common/service/JobService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/service/JobService.java rename to src/main/java/com/bootdo/common/service/JobService.java diff --git a/bootdo/src/main/java/com/bootdo/common/service/LogService.java b/src/main/java/com/bootdo/common/service/LogService.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/common/service/LogService.java rename to src/main/java/com/bootdo/common/service/LogService.java index 2c8d2c13a9e489f7c8f11a5960ac079c3d8e0aea..2447e59fbed40241dc8a00ead79d293a29a1da94 100644 --- a/bootdo/src/main/java/com/bootdo/common/service/LogService.java +++ b/src/main/java/com/bootdo/common/service/LogService.java @@ -1,16 +1,16 @@ -package com.bootdo.common.service; - -import java.util.List; - -import org.springframework.stereotype.Service; - -import com.bootdo.common.domain.LogDO; -import com.bootdo.common.domain.PageDO; -import com.bootdo.common.utils.Query; -@Service -public interface LogService { - void save(LogDO logDO); - PageDO queryList(Query query); - int remove(Long id); - int batchRemove(Long[] ids); -} +package com.bootdo.common.service; + +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.bootdo.common.domain.LogDO; +import com.bootdo.common.domain.PageDO; +import com.bootdo.common.utils.Query; +@Service +public interface LogService { + void save(LogDO logDO); + PageDO queryList(Query query); + int remove(Long id); + int batchRemove(Long[] ids); +} diff --git a/bootdo/src/main/java/com/bootdo/common/service/impl/DictServiceImpl.java b/src/main/java/com/bootdo/common/service/impl/DictServiceImpl.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/common/service/impl/DictServiceImpl.java rename to src/main/java/com/bootdo/common/service/impl/DictServiceImpl.java index 12f20b4c7cf107c59186ab52591a5a91dff348ee..288cb4c7e4bf602018e9dd6928d4f07468f94083 100644 --- a/bootdo/src/main/java/com/bootdo/common/service/impl/DictServiceImpl.java +++ b/src/main/java/com/bootdo/common/service/impl/DictServiceImpl.java @@ -1,109 +1,109 @@ -package com.bootdo.common.service.impl; - -import com.bootdo.common.utils.StringUtils; -import com.bootdo.system.domain.UserDO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -import com.bootdo.common.dao.DictDao; -import com.bootdo.common.domain.DictDO; -import com.bootdo.common.service.DictService; - - -@Service -public class DictServiceImpl implements DictService { - @Autowired - private DictDao dictDao; - - @Override - public DictDO get(Long id) { - return dictDao.get(id); - } - - @Override - public List list(Map map) { - return dictDao.list(map); - } - - @Override - public int count(Map map) { - return dictDao.count(map); - } - - @Override - public int save(DictDO dict) { - return dictDao.save(dict); - } - - @Override - public int update(DictDO dict) { - return dictDao.update(dict); - } - - @Override - public int remove(Long id) { - return dictDao.remove(id); - } - - @Override - public int batchRemove(Long[] ids) { - return dictDao.batchRemove(ids); - } - - @Override - - public List listType() { - return dictDao.listType(); - } - - @Override - public String getName(String type, String value) { - Map param = new HashMap(16); - param.put("type", type); - param.put("value", value); - String rString = dictDao.list(param).get(0).getName(); - return rString; - } - - @Override - public List getHobbyList(UserDO userDO) { - Map param = new HashMap<>(16); - param.put("type", "hobby"); - List hobbyList = dictDao.list(param); - - if (StringUtils.isNotEmpty(userDO.getHobby())) { - String userHobbys[] = userDO.getHobby().split(";"); - for (String userHobby : userHobbys) { - for (DictDO hobby : hobbyList) { - if (!Objects.equals(userHobby, hobby.getId().toString())) { - continue; - } - hobby.setRemarks("true"); - break; - } - } - } - - return hobbyList; - } - - @Override - public List getSexList() { - Map param = new HashMap<>(16); - param.put("type", "sex"); - return dictDao.list(param); - } - - @Override - public List listByType(String type) { - Map param = new HashMap<>(16); - param.put("type", type); - return dictDao.list(param); - } - -} +package com.bootdo.common.service.impl; + +import com.bootdo.common.utils.StringUtils; +import com.bootdo.system.domain.UserDO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import com.bootdo.common.dao.DictDao; +import com.bootdo.common.domain.DictDO; +import com.bootdo.common.service.DictService; + + +@Service +public class DictServiceImpl implements DictService { + @Autowired + private DictDao dictDao; + + @Override + public DictDO get(Long id) { + return dictDao.get(id); + } + + @Override + public List list(Map map) { + return dictDao.list(map); + } + + @Override + public int count(Map map) { + return dictDao.count(map); + } + + @Override + public int save(DictDO dict) { + return dictDao.save(dict); + } + + @Override + public int update(DictDO dict) { + return dictDao.update(dict); + } + + @Override + public int remove(Long id) { + return dictDao.remove(id); + } + + @Override + public int batchRemove(Long[] ids) { + return dictDao.batchRemove(ids); + } + + @Override + + public List listType() { + return dictDao.listType(); + } + + @Override + public String getName(String type, String value) { + Map param = new HashMap(16); + param.put("type", type); + param.put("value", value); + String rString = dictDao.list(param).get(0).getName(); + return rString; + } + + @Override + public List getHobbyList(UserDO userDO) { + Map param = new HashMap<>(16); + param.put("type", "hobby"); + List hobbyList = dictDao.list(param); + + if (StringUtils.isNotEmpty(userDO.getHobby())) { + String userHobbys[] = userDO.getHobby().split(";"); + for (String userHobby : userHobbys) { + for (DictDO hobby : hobbyList) { + if (!Objects.equals(userHobby, hobby.getId().toString())) { + continue; + } + hobby.setRemarks("true"); + break; + } + } + } + + return hobbyList; + } + + @Override + public List getSexList() { + Map param = new HashMap<>(16); + param.put("type", "sex"); + return dictDao.list(param); + } + + @Override + public List listByType(String type) { + Map param = new HashMap<>(16); + param.put("type", type); + return dictDao.list(param); + } + +} diff --git a/bootdo/src/main/java/com/bootdo/common/service/impl/FileServiceImpl.java b/src/main/java/com/bootdo/common/service/impl/FileServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/service/impl/FileServiceImpl.java rename to src/main/java/com/bootdo/common/service/impl/FileServiceImpl.java diff --git a/bootdo/src/main/java/com/bootdo/common/service/impl/GeneratorServiceImpl.java b/src/main/java/com/bootdo/common/service/impl/GeneratorServiceImpl.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/common/service/impl/GeneratorServiceImpl.java rename to src/main/java/com/bootdo/common/service/impl/GeneratorServiceImpl.java index 212767e4230642b2e7ec2466bd989468aa3d92c7..352fa55065e49c278bbc7a1dd99ec576b0d6974e 100644 --- a/bootdo/src/main/java/com/bootdo/common/service/impl/GeneratorServiceImpl.java +++ b/src/main/java/com/bootdo/common/service/impl/GeneratorServiceImpl.java @@ -1,44 +1,44 @@ -package com.bootdo.common.service.impl; - -import java.io.ByteArrayOutputStream; -import java.util.List; -import java.util.Map; -import java.util.zip.ZipOutputStream; - -import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bootdo.common.dao.GeneratorMapper; -import com.bootdo.common.service.GeneratorService; -import com.bootdo.common.utils.GenUtils; - - -@Service -public class GeneratorServiceImpl implements GeneratorService { - @Autowired - GeneratorMapper generatorMapper; - - @Override - public List> list() { - List> list = generatorMapper.list(); - return list; - } - - @Override - public byte[] generatorCode(String[] tableNames) { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - for(String tableName : tableNames){ - //查询表信息 - Map table = generatorMapper.get(tableName); - //查询列信息 - List> columns = generatorMapper.listColumns(tableName); - //生成代码 - GenUtils.generatorCode(table, columns, zip); - } - IOUtils.closeQuietly(zip); - return outputStream.toByteArray(); - } - -} +package com.bootdo.common.service.impl; + +import java.io.ByteArrayOutputStream; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipOutputStream; + +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.bootdo.common.dao.GeneratorMapper; +import com.bootdo.common.service.GeneratorService; +import com.bootdo.common.utils.GenUtils; + + +@Service +public class GeneratorServiceImpl implements GeneratorService { + @Autowired + GeneratorMapper generatorMapper; + + @Override + public List> list() { + List> list = generatorMapper.list(); + return list; + } + + @Override + public byte[] generatorCode(String[] tableNames) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + ZipOutputStream zip = new ZipOutputStream(outputStream); + for(String tableName : tableNames){ + //查询表信息 + Map table = generatorMapper.get(tableName); + //查询列信息 + List> columns = generatorMapper.listColumns(tableName); + //生成代码 + GenUtils.generatorCode(table, columns, zip); + } + IOUtils.closeQuietly(zip); + return outputStream.toByteArray(); + } + +} diff --git a/bootdo/src/main/java/com/bootdo/common/service/impl/JobServiceImpl.java b/src/main/java/com/bootdo/common/service/impl/JobServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/service/impl/JobServiceImpl.java rename to src/main/java/com/bootdo/common/service/impl/JobServiceImpl.java diff --git a/bootdo/src/main/java/com/bootdo/common/service/impl/LogServiceImpl.java b/src/main/java/com/bootdo/common/service/impl/LogServiceImpl.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/common/service/impl/LogServiceImpl.java rename to src/main/java/com/bootdo/common/service/impl/LogServiceImpl.java index afbaa4311060e4b7b08c7f5c89bf559a642c7bd6..6714251e157726582e5de5f6162e07012228675f 100644 --- a/bootdo/src/main/java/com/bootdo/common/service/impl/LogServiceImpl.java +++ b/src/main/java/com/bootdo/common/service/impl/LogServiceImpl.java @@ -1,45 +1,45 @@ -package com.bootdo.common.service.impl; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; - -import com.bootdo.common.dao.LogDao; -import com.bootdo.common.domain.LogDO; -import com.bootdo.common.domain.PageDO; -import com.bootdo.common.service.LogService; -import com.bootdo.common.utils.Query; - -@Service -public class LogServiceImpl implements LogService { - @Autowired - LogDao logMapper; - - @Async - @Override - public void save(LogDO logDO) { - logMapper.save(logDO); - } - - @Override - public PageDO queryList(Query query) { - int total = logMapper.count(query); - List logs = logMapper.list(query); - PageDO page = new PageDO<>(); - page.setTotal(total); - page.setRows(logs); - return page; - } - - @Override - public int remove(Long id) { - int count = logMapper.remove(id); - return count; - } - - @Override - public int batchRemove(Long[] ids){ - return logMapper.batchRemove(ids); - } -} +package com.bootdo.common.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import com.bootdo.common.dao.LogDao; +import com.bootdo.common.domain.LogDO; +import com.bootdo.common.domain.PageDO; +import com.bootdo.common.service.LogService; +import com.bootdo.common.utils.Query; + +@Service +public class LogServiceImpl implements LogService { + @Autowired + LogDao logMapper; + + @Async + @Override + public void save(LogDO logDO) { + logMapper.save(logDO); + } + + @Override + public PageDO queryList(Query query) { + int total = logMapper.count(query); + List logs = logMapper.list(query); + PageDO page = new PageDO<>(); + page.setTotal(total); + page.setRows(logs); + return page; + } + + @Override + public int remove(Long id) { + int count = logMapper.remove(id); + return count; + } + + @Override + public int batchRemove(Long[] ids){ + return logMapper.batchRemove(ids); + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/task/WelcomeJob.java b/src/main/java/com/bootdo/common/task/WelcomeJob.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/task/WelcomeJob.java rename to src/main/java/com/bootdo/common/task/WelcomeJob.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/BDException.java b/src/main/java/com/bootdo/common/utils/BDException.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/BDException.java rename to src/main/java/com/bootdo/common/utils/BDException.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/Base64Utils.java b/src/main/java/com/bootdo/common/utils/Base64Utils.java similarity index 92% rename from bootdo/src/main/java/com/bootdo/common/utils/Base64Utils.java rename to src/main/java/com/bootdo/common/utils/Base64Utils.java index f1b33454d2a7337ce6e440b7195ee86fa2313fe9..1f11603835a64bb70fc316fc6685e27bd41d96e9 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/Base64Utils.java +++ b/src/main/java/com/bootdo/common/utils/Base64Utils.java @@ -1,5 +1,5 @@ -package com.bootdo.common.utils; - -public class Base64Utils { - -} +package com.bootdo.common.utils; + +public class Base64Utils { + +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/BuildTree.java b/src/main/java/com/bootdo/common/utils/BuildTree.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/common/utils/BuildTree.java rename to src/main/java/com/bootdo/common/utils/BuildTree.java index ca59ec352fd9bb196526431f5beae9153015a467..56e73889979a9bcd7fbbdbf8e14847e9cf96c2a4 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/BuildTree.java +++ b/src/main/java/com/bootdo/common/utils/BuildTree.java @@ -1,89 +1,89 @@ -package com.bootdo.common.utils; - -import com.bootdo.common.domain.Tree; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class BuildTree { - - public static Tree build(List> nodes) { - - if (nodes == null) { - return null; - } - List> topNodes = new ArrayList>(); - - for (Tree children : nodes) { - - String pid = children.getParentId(); - if (pid == null || "0".equals(pid)) { - topNodes.add(children); - - continue; - } - - for (Tree parent : nodes) { - String id = parent.getId(); - if (id != null && id.equals(pid)) { - parent.getChildren().add(children); - children.setHasParent(true); - parent.setChildren(true); - continue; - } - } - - } - - Tree root = new Tree(); - if (topNodes.size() == 1) { - root = topNodes.get(0); - } else { - root.setId("-1"); - root.setParentId(""); - root.setHasParent(false); - root.setChildren(true); - root.setChecked(true); - root.setChildren(topNodes); - root.setText("顶级节点"); - Map state = new HashMap<>(16); - state.put("opened", true); - root.setState(state); - } - - return root; - } - - public static List> buildList(List> nodes, String idParam) { - if (nodes == null) { - return null; - } - List> topNodes = new ArrayList>(); - - for (Tree children : nodes) { - - String pid = children.getParentId(); - if (pid == null || idParam.equals(pid)) { - topNodes.add(children); - - continue; - } - - for (Tree parent : nodes) { - String id = parent.getId(); - if (id != null && id.equals(pid)) { - parent.getChildren().add(children); - children.setHasParent(true); - parent.setChildren(true); - - continue; - } - } - - } - return topNodes; - } - +package com.bootdo.common.utils; + +import com.bootdo.common.domain.Tree; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BuildTree { + + public static Tree build(List> nodes) { + + if (nodes == null) { + return null; + } + List> topNodes = new ArrayList>(); + + for (Tree children : nodes) { + + String pid = children.getParentId(); + if (pid == null || "0".equals(pid)) { + topNodes.add(children); + + continue; + } + + for (Tree parent : nodes) { + String id = parent.getId(); + if (id != null && id.equals(pid)) { + parent.getChildren().add(children); + children.setHasParent(true); + parent.setChildren(true); + continue; + } + } + + } + + Tree root = new Tree(); + if (topNodes.size() == 1) { + root = topNodes.get(0); + } else { + root.setId("-1"); + root.setParentId(""); + root.setHasParent(false); + root.setChildren(true); + root.setChecked(true); + root.setChildren(topNodes); + root.setText("顶级节点"); + Map state = new HashMap<>(16); + state.put("opened", true); + root.setState(state); + } + + return root; + } + + public static List> buildList(List> nodes, String idParam) { + if (nodes == null) { + return null; + } + List> topNodes = new ArrayList>(); + + for (Tree children : nodes) { + + String pid = children.getParentId(); + if (pid == null || idParam.equals(pid)) { + topNodes.add(children); + + continue; + } + + for (Tree parent : nodes) { + String id = parent.getId(); + if (id != null && id.equals(pid)) { + parent.getChildren().add(children); + children.setHasParent(true); + parent.setChildren(true); + + continue; + } + } + + } + return topNodes; + } + } \ No newline at end of file diff --git a/bootdo/src/main/java/com/bootdo/common/utils/DateUtils.java b/src/main/java/com/bootdo/common/utils/DateUtils.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/DateUtils.java rename to src/main/java/com/bootdo/common/utils/DateUtils.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/ExceptionUtils.java b/src/main/java/com/bootdo/common/utils/ExceptionUtils.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/ExceptionUtils.java rename to src/main/java/com/bootdo/common/utils/ExceptionUtils.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/FileType.java b/src/main/java/com/bootdo/common/utils/FileType.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/common/utils/FileType.java rename to src/main/java/com/bootdo/common/utils/FileType.java index 139d5ccde9b81cccc8fc03bbd3a287b50839c636..3ca1c21584ef9a6ec82098e36248467210d1e21c 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/FileType.java +++ b/src/main/java/com/bootdo/common/utils/FileType.java @@ -1,55 +1,55 @@ -package com.bootdo.common.utils; - -/* author:zss - * 日期:2017年3月31日 - * 功能:根据文件名称判断类型 - * 接受参数类型:String - * 返回参数类型:String - * 备注:文件类型不完善,有需要的自行添加 - */ -public class FileType { - public static int fileType(String fileName) { - if (fileName == null) { - fileName = "文件名为空!"; - return 500; - - } else { - // 获取文件后缀名并转化为写,用于后续比较 - String fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()).toLowerCase(); - // 创建图片类型数组0 - String[] img = { "bmp", "jpg", "jpeg", "png", "tiff", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", - "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "wmf" }; - for (int i = 0; i < img.length; i++) { - if (img[i].equals(fileType)) { - return 0; - } - } - - // 创建文档类型数组1 - String[] document = { "txt", "doc", "docx", "xls", "htm", "html", "jsp", "rtf", "wpd", "pdf", "ppt" }; - for (int i = 0; i < document.length; i++) { - if (document[i].equals(fileType)) { - return 1; - } - } - // 创建视频类型数组2 - String[] video = { "mp4", "avi", "mov", "wmv", "asf", "navi", "3gp", "mkv", "f4v", "rmvb", "webm" }; - for (int i = 0; i < video.length; i++) { - if (video[i].equals(fileType)) { - return 2; - } - } - // 创建音乐类型数组3 - String[] music = { "mp3", "wma", "wav", "mod", "ra", "cd", "md", "asf", "aac", "vqf", "ape", "mid", "ogg", - "m4a", "vqf" }; - for (int i = 0; i < music.length; i++) { - if (music[i].equals(fileType)) { - return 3; - } - } - - } - //4 - return 99; - } +package com.bootdo.common.utils; + +/* author:zss + * 日期:2017年3月31日 + * 功能:根据文件名称判断类型 + * 接受参数类型:String + * 返回参数类型:String + * 备注:文件类型不完善,有需要的自行添加 + */ +public class FileType { + public static int fileType(String fileName) { + if (fileName == null) { + fileName = "文件名为空!"; + return 500; + + } else { + // 获取文件后缀名并转化为写,用于后续比较 + String fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()).toLowerCase(); + // 创建图片类型数组0 + String[] img = { "bmp", "jpg", "jpeg", "png", "tiff", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", + "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "wmf" }; + for (int i = 0; i < img.length; i++) { + if (img[i].equals(fileType)) { + return 0; + } + } + + // 创建文档类型数组1 + String[] document = { "txt", "doc", "docx", "xls", "htm", "html", "jsp", "rtf", "wpd", "pdf", "ppt" }; + for (int i = 0; i < document.length; i++) { + if (document[i].equals(fileType)) { + return 1; + } + } + // 创建视频类型数组2 + String[] video = { "mp4", "avi", "mov", "wmv", "asf", "navi", "3gp", "mkv", "f4v", "rmvb", "webm" }; + for (int i = 0; i < video.length; i++) { + if (video[i].equals(fileType)) { + return 2; + } + } + // 创建音乐类型数组3 + String[] music = { "mp3", "wma", "wav", "mod", "ra", "cd", "md", "asf", "aac", "vqf", "ape", "mid", "ogg", + "m4a", "vqf" }; + for (int i = 0; i < music.length; i++) { + if (music[i].equals(fileType)) { + return 3; + } + } + + } + //4 + return 99; + } } \ No newline at end of file diff --git a/bootdo/src/main/java/com/bootdo/common/utils/FileUtil.java b/src/main/java/com/bootdo/common/utils/FileUtil.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/common/utils/FileUtil.java rename to src/main/java/com/bootdo/common/utils/FileUtil.java index 6abf50e5c00af84a21f83546ecac8deac8115c29..b3adc9f96d0b900573c175234af2aa10eecd3e7f 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/FileUtil.java +++ b/src/main/java/com/bootdo/common/utils/FileUtil.java @@ -1,37 +1,37 @@ -package com.bootdo.common.utils; - -import java.io.File; -import java.io.FileOutputStream; -import java.util.UUID; - -public class FileUtil { - - public static void uploadFile(byte[] file, String filePath, String fileName) throws Exception { - File targetFile = new File(filePath); - if (!targetFile.exists()) { - targetFile.mkdirs(); - } - FileOutputStream out = new FileOutputStream(filePath + fileName); - out.write(file); - out.flush(); - out.close(); - } - - public static boolean deleteFile(String fileName) { - File file = new File(fileName); - // 如果文件路径所对应的文件存在,并且是一个文件,则直接删除 - if (file.exists() && file.isFile()) { - if (file.delete()) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - public static String renameToUUID(String fileName) { - return UUID.randomUUID() + "." + fileName.substring(fileName.lastIndexOf(".") + 1); - } -} +package com.bootdo.common.utils; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.UUID; + +public class FileUtil { + + public static void uploadFile(byte[] file, String filePath, String fileName) throws Exception { + File targetFile = new File(filePath); + if (!targetFile.exists()) { + targetFile.mkdirs(); + } + FileOutputStream out = new FileOutputStream(filePath + fileName); + out.write(file); + out.flush(); + out.close(); + } + + public static boolean deleteFile(String fileName) { + File file = new File(fileName); + // 如果文件路径所对应的文件存在,并且是一个文件,则直接删除 + if (file.exists() && file.isFile()) { + if (file.delete()) { + return true; + } else { + return false; + } + } else { + return false; + } + } + + public static String renameToUUID(String fileName) { + return UUID.randomUUID() + "." + fileName.substring(fileName.lastIndexOf(".") + 1); + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/GenUtils.java b/src/main/java/com/bootdo/common/utils/GenUtils.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/GenUtils.java rename to src/main/java/com/bootdo/common/utils/GenUtils.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/HttpContextUtils.java b/src/main/java/com/bootdo/common/utils/HttpContextUtils.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/common/utils/HttpContextUtils.java rename to src/main/java/com/bootdo/common/utils/HttpContextUtils.java index de30feff88675876275b632d791d22e7ae4e0ea2..3eaa6ec644ec3793fffc0f03e98bc721721aee12 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/HttpContextUtils.java +++ b/src/main/java/com/bootdo/common/utils/HttpContextUtils.java @@ -1,12 +1,12 @@ -package com.bootdo.common.utils; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -public class HttpContextUtils { - public static HttpServletRequest getHttpServletRequest() { - return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - } -} +package com.bootdo.common.utils; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +public class HttpContextUtils { + public static HttpServletRequest getHttpServletRequest() { + return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/HttpServletUtils.java b/src/main/java/com/bootdo/common/utils/HttpServletUtils.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/HttpServletUtils.java rename to src/main/java/com/bootdo/common/utils/HttpServletUtils.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/IPUtils.java b/src/main/java/com/bootdo/common/utils/IPUtils.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/common/utils/IPUtils.java rename to src/main/java/com/bootdo/common/utils/IPUtils.java index 2208ab79682223632d50a27c56ca5bb1a1cf3c92..49f2bd9379c8a5beada3c9face9b91a499aa98da 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/IPUtils.java +++ b/src/main/java/com/bootdo/common/utils/IPUtils.java @@ -1,32 +1,32 @@ -package com.bootdo.common.utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.http.HttpServletRequest; - -public class IPUtils { - private static Logger logger = LoggerFactory.getLogger(IPUtils.class); - - /** - * 获取IP地址 - * - * 使用Nginx等反向代理软件, 则不能通过request.getRemoteAddr()获取IP地址 - * 如果使用了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP地址,X-Forwarded-For中第一个非unknown的有效IP字符串,则为真实IP地址 - */ - public static String getIpAddr(HttpServletRequest request) { - - String ip = request.getHeader("x-forwarded-for"); - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); - } - return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip; - } - -} +package com.bootdo.common.utils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.http.HttpServletRequest; + +public class IPUtils { + private static Logger logger = LoggerFactory.getLogger(IPUtils.class); + + /** + * 获取IP地址 + * + * 使用Nginx等反向代理软件, 则不能通过request.getRemoteAddr()获取IP地址 + * 如果使用了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP地址,X-Forwarded-For中第一个非unknown的有效IP字符串,则为真实IP地址 + */ + public static String getIpAddr(HttpServletRequest request) { + + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip; + } + +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/ImageUtils.java b/src/main/java/com/bootdo/common/utils/ImageUtils.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/ImageUtils.java rename to src/main/java/com/bootdo/common/utils/ImageUtils.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/JSONUtils.java b/src/main/java/com/bootdo/common/utils/JSONUtils.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/common/utils/JSONUtils.java rename to src/main/java/com/bootdo/common/utils/JSONUtils.java index e120ea644d2f180d1b6617fee059b11e67456c32..2b7695027081088f70a2031bad25a3932a001945 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/JSONUtils.java +++ b/src/main/java/com/bootdo/common/utils/JSONUtils.java @@ -1,86 +1,86 @@ -package com.bootdo.common.utils; - -import com.alibaba.druid.util.StringUtils; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; - -import java.util.HashMap; -import java.util.Map; - -public class JSONUtils { - /** - * Bean对象转JSON - * - * @param object - * @param dataFormatString - * @return - */ - public static String beanToJson(Object object, String dataFormatString) { - if (object != null) { - if (StringUtils.isEmpty(dataFormatString)) { - return JSONObject.toJSONString(object); - } - return JSON.toJSONStringWithDateFormat(object, dataFormatString); - } else { - return null; - } - } - - /** - * Bean对象转JSON - * - * @param object - * @return - */ - public static String beanToJson(Object object) { - if (object != null) { - return JSON.toJSONString(object); - } else { - return null; - } - } - - /** - * String转JSON字符串 - * - * @param key - * @param value - * @return - */ - public static String stringToJsonByFastjson(String key, String value) { - if (StringUtils.isEmpty(key) || StringUtils.isEmpty(value)) { - return null; - } - Map map = new HashMap(16); - map.put(key, value); - return beanToJson(map, null); - } - - /** - * 将json字符串转换成对象 - * - * @param json - * @param clazz - * @return - */ - public static Object jsonToBean(String json, Object clazz) { - if (StringUtils.isEmpty(json) || clazz == null) { - return null; - } - return JSON.parseObject(json, clazz.getClass()); - } - - /** - * json字符串转map - * - * @param json - * @return - */ - @SuppressWarnings("unchecked") - public static Map jsonToMap(String json) { - if (StringUtils.isEmpty(json)) { - return null; - } - return JSON.parseObject(json, Map.class); - } -} +package com.bootdo.common.utils; + +import com.alibaba.druid.util.StringUtils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; + +import java.util.HashMap; +import java.util.Map; + +public class JSONUtils { + /** + * Bean对象转JSON + * + * @param object + * @param dataFormatString + * @return + */ + public static String beanToJson(Object object, String dataFormatString) { + if (object != null) { + if (StringUtils.isEmpty(dataFormatString)) { + return JSONObject.toJSONString(object); + } + return JSON.toJSONStringWithDateFormat(object, dataFormatString); + } else { + return null; + } + } + + /** + * Bean对象转JSON + * + * @param object + * @return + */ + public static String beanToJson(Object object) { + if (object != null) { + return JSON.toJSONString(object); + } else { + return null; + } + } + + /** + * String转JSON字符串 + * + * @param key + * @param value + * @return + */ + public static String stringToJsonByFastjson(String key, String value) { + if (StringUtils.isEmpty(key) || StringUtils.isEmpty(value)) { + return null; + } + Map map = new HashMap(16); + map.put(key, value); + return beanToJson(map, null); + } + + /** + * 将json字符串转换成对象 + * + * @param json + * @param clazz + * @return + */ + public static Object jsonToBean(String json, Object clazz) { + if (StringUtils.isEmpty(json) || clazz == null) { + return null; + } + return JSON.parseObject(json, clazz.getClass()); + } + + /** + * json字符串转map + * + * @param json + * @return + */ + @SuppressWarnings("unchecked") + public static Map jsonToMap(String json) { + if (StringUtils.isEmpty(json)) { + return null; + } + return JSON.parseObject(json, Map.class); + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/MD5Utils.java b/src/main/java/com/bootdo/common/utils/MD5Utils.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/common/utils/MD5Utils.java rename to src/main/java/com/bootdo/common/utils/MD5Utils.java index 0ad03d1c98a6d7436480a54801f971cf3deb9df6..abf42e146203c102978f9564eb85604f0463934a 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/MD5Utils.java +++ b/src/main/java/com/bootdo/common/utils/MD5Utils.java @@ -1,28 +1,28 @@ -package com.bootdo.common.utils; - -import org.apache.shiro.crypto.hash.SimpleHash; -import org.apache.shiro.util.ByteSource; - -public class MD5Utils { - private static final String SALT = "1qazxsw2"; - - private static final String ALGORITH_NAME = "md5"; - - private static final int HASH_ITERATIONS = 2; - - public static String encrypt(String pswd) { - String newPassword = new SimpleHash(ALGORITH_NAME, pswd, ByteSource.Util.bytes(SALT), HASH_ITERATIONS).toHex(); - return newPassword; - } - - public static String encrypt(String username, String pswd) { - String newPassword = new SimpleHash(ALGORITH_NAME, pswd, ByteSource.Util.bytes(username + SALT), - HASH_ITERATIONS).toHex(); - return newPassword; - } - public static void main(String[] args) { - - //System.out.println(MD5Utils.encrypt("admin", "1")); - } - -} +package com.bootdo.common.utils; + +import org.apache.shiro.crypto.hash.SimpleHash; +import org.apache.shiro.util.ByteSource; + +public class MD5Utils { + private static final String SALT = "1qazxsw2"; + + private static final String ALGORITH_NAME = "md5"; + + private static final int HASH_ITERATIONS = 2; + + public static String encrypt(String pswd) { + String newPassword = new SimpleHash(ALGORITH_NAME, pswd, ByteSource.Util.bytes(SALT), HASH_ITERATIONS).toHex(); + return newPassword; + } + + public static String encrypt(String username, String pswd) { + String newPassword = new SimpleHash(ALGORITH_NAME, pswd, ByteSource.Util.bytes(username + SALT), + HASH_ITERATIONS).toHex(); + return newPassword; + } + public static void main(String[] args) { + + //System.out.println(MD5Utils.encrypt("admin", "1")); + } + +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/PageUtils.java b/src/main/java/com/bootdo/common/utils/PageUtils.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/common/utils/PageUtils.java rename to src/main/java/com/bootdo/common/utils/PageUtils.java index 0c9d919a33b8ed3e553d4fddd9d21b085ebc4a1f..74b379afa751082c07946188b6b988f4b214d798 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/PageUtils.java +++ b/src/main/java/com/bootdo/common/utils/PageUtils.java @@ -1,35 +1,35 @@ -package com.bootdo.common.utils; - -import java.io.Serializable; -import java.util.List; - -/** - * @Author bootdo 1992lcg@163.com - */ -public class PageUtils implements Serializable { - private static final long serialVersionUID = 1L; - private int total; - private List rows; - - public PageUtils(List list, int total) { - this.rows = list; - this.total = total; - } - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - -} +package com.bootdo.common.utils; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author bootdo 1992lcg@163.com + */ +public class PageUtils implements Serializable { + private static final long serialVersionUID = 1L; + private int total; + private List rows; + + public PageUtils(List list, int total) { + this.rows = list; + this.total = total; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/Query.java b/src/main/java/com/bootdo/common/utils/Query.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/common/utils/Query.java rename to src/main/java/com/bootdo/common/utils/Query.java index 6f27e4f5401aa65c2bb03b8537b2b6bd12f43901..de074a2d825958b87ed3d2498d79a983b55d90ac 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/Query.java +++ b/src/main/java/com/bootdo/common/utils/Query.java @@ -1,41 +1,41 @@ -package com.bootdo.common.utils; - -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * 查询参数 - */ -public class Query extends LinkedHashMap { - private static final long serialVersionUID = 1L; - // - private int offset; - // 每页条数 - private int limit; - - public Query(Map params) { - this.putAll(params); - // 分页参数 - this.offset = Integer.parseInt(params.get("offset").toString()); - this.limit = Integer.parseInt(params.get("limit").toString()); - this.put("offset", offset); - this.put("page", offset / limit + 1); - this.put("limit", limit); - } - - public int getOffset() { - return offset; - } - - public void setOffset(int offset) { - this.put("offset", offset); - } - - public int getLimit() { - return limit; - } - - public void setLimit(int limit) { - this.limit = limit; - } -} +package com.bootdo.common.utils; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * 查询参数 + */ +public class Query extends LinkedHashMap { + private static final long serialVersionUID = 1L; + // + private int offset; + // 每页条数 + private int limit; + + public Query(Map params) { + this.putAll(params); + // 分页参数 + this.offset = Integer.parseInt(params.get("offset").toString()); + this.limit = Integer.parseInt(params.get("limit").toString()); + this.put("offset", offset); + this.put("page", offset / limit + 1); + this.put("limit", limit); + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.put("offset", offset); + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/R.java b/src/main/java/com/bootdo/common/utils/R.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/common/utils/R.java rename to src/main/java/com/bootdo/common/utils/R.java index 393daf198236c2d2591770350f2be733b139cd50..c02ccfb92aef2663e06427077f840bc395afcb4e 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/R.java +++ b/src/main/java/com/bootdo/common/utils/R.java @@ -1,50 +1,50 @@ -package com.bootdo.common.utils; - -import java.util.HashMap; -import java.util.Map; - -public class R extends HashMap { - private static final long serialVersionUID = 1L; - - public R() { - put("code", 0); - put("msg", "操作成功"); - } - - public static R error() { - return error(1, "操作失败"); - } - - public static R error(String msg) { - return error(500, msg); - } - - public static R error(int code, String msg) { - R r = new R(); - r.put("code", code); - r.put("msg", msg); - return r; - } - - public static R ok(String msg) { - R r = new R(); - r.put("msg", msg); - return r; - } - - public static R ok(Map map) { - R r = new R(); - r.putAll(map); - return r; - } - - public static R ok() { - return new R(); - } - - @Override - public R put(String key, Object value) { - super.put(key, value); - return this; - } -} +package com.bootdo.common.utils; + +import java.util.HashMap; +import java.util.Map; + +public class R extends HashMap { + private static final long serialVersionUID = 1L; + + public R() { + put("code", 0); + put("msg", "操作成功"); + } + + public static R error() { + return error(1, "操作失败"); + } + + public static R error(String msg) { + return error(500, msg); + } + + public static R error(int code, String msg) { + R r = new R(); + r.put("code", code); + r.put("msg", msg); + return r; + } + + public static R ok(String msg) { + R r = new R(); + r.put("msg", msg); + return r; + } + + public static R ok(Map map) { + R r = new R(); + r.putAll(map); + return r; + } + + public static R ok() { + return new R(); + } + + @Override + public R put(String key, Object value) { + super.put(key, value); + return this; + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/RandomValidateCodeUtil.java b/src/main/java/com/bootdo/common/utils/RandomValidateCodeUtil.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/RandomValidateCodeUtil.java rename to src/main/java/com/bootdo/common/utils/RandomValidateCodeUtil.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/ScheduleJobUtils.java b/src/main/java/com/bootdo/common/utils/ScheduleJobUtils.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/common/utils/ScheduleJobUtils.java rename to src/main/java/com/bootdo/common/utils/ScheduleJobUtils.java index 4fbc0d49a18512a51f7362a8b6487d9b3d9a37c2..246e7f62487c565474370049eabdbd929df92d91 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/ScheduleJobUtils.java +++ b/src/main/java/com/bootdo/common/utils/ScheduleJobUtils.java @@ -1,20 +1,20 @@ -package com.bootdo.common.utils; - -import com.bootdo.common.domain.ScheduleJob; -import com.bootdo.common.domain.TaskDO; - -public class ScheduleJobUtils { - public static ScheduleJob entityToData(TaskDO scheduleJobEntity) { - ScheduleJob scheduleJob = new ScheduleJob(); - scheduleJob.setBeanClass(scheduleJobEntity.getBeanClass()); - scheduleJob.setCronExpression(scheduleJobEntity.getCronExpression()); - scheduleJob.setDescription(scheduleJobEntity.getDescription()); - scheduleJob.setIsConcurrent(scheduleJobEntity.getIsConcurrent()); - scheduleJob.setJobName(scheduleJobEntity.getJobName()); - scheduleJob.setJobGroup(scheduleJobEntity.getJobGroup()); - scheduleJob.setJobStatus(scheduleJobEntity.getJobStatus()); - scheduleJob.setMethodName(scheduleJobEntity.getMethodName()); - scheduleJob.setSpringBean(scheduleJobEntity.getSpringBean()); - return scheduleJob; - } +package com.bootdo.common.utils; + +import com.bootdo.common.domain.ScheduleJob; +import com.bootdo.common.domain.TaskDO; + +public class ScheduleJobUtils { + public static ScheduleJob entityToData(TaskDO scheduleJobEntity) { + ScheduleJob scheduleJob = new ScheduleJob(); + scheduleJob.setBeanClass(scheduleJobEntity.getBeanClass()); + scheduleJob.setCronExpression(scheduleJobEntity.getCronExpression()); + scheduleJob.setDescription(scheduleJobEntity.getDescription()); + scheduleJob.setIsConcurrent(scheduleJobEntity.getIsConcurrent()); + scheduleJob.setJobName(scheduleJobEntity.getJobName()); + scheduleJob.setJobGroup(scheduleJobEntity.getJobGroup()); + scheduleJob.setJobStatus(scheduleJobEntity.getJobStatus()); + scheduleJob.setMethodName(scheduleJobEntity.getMethodName()); + scheduleJob.setSpringBean(scheduleJobEntity.getSpringBean()); + return scheduleJob; + } } \ No newline at end of file diff --git a/bootdo/src/main/java/com/bootdo/common/utils/ShiroUtils.java b/src/main/java/com/bootdo/common/utils/ShiroUtils.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/common/utils/ShiroUtils.java rename to src/main/java/com/bootdo/common/utils/ShiroUtils.java index 277eeae465ef40f31af0d4727bb453cc51d584ba..929bbd1b696c4c82f754428185bcf7fd1def6204 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/ShiroUtils.java +++ b/src/main/java/com/bootdo/common/utils/ShiroUtils.java @@ -1,41 +1,41 @@ -package com.bootdo.common.utils; - -import com.bootdo.system.domain.UserToken; -import org.apache.commons.beanutils.BeanUtils; -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.session.Session; -import org.apache.shiro.session.mgt.eis.SessionDAO; -import org.apache.shiro.subject.Subject; - -import com.bootdo.system.domain.UserDO; -import org.springframework.beans.factory.annotation.Autowired; - -import java.lang.reflect.InvocationTargetException; -import java.security.Principal; -import java.util.Collection; -import java.util.List; - -public class ShiroUtils { - @Autowired - private static SessionDAO sessionDAO; - - public static Subject getSubjct() { - return SecurityUtils.getSubject(); - } - public static UserDO getUser() { - Object object = getSubjct().getPrincipal(); - return (UserDO)object; - } - public static Long getUserId() { - return getUser().getUserId(); - } - public static void logout() { - getSubjct().logout(); - } - - public static List getPrinciples() { - List principals = null; - Collection sessions = sessionDAO.getActiveSessions(); - return principals; - } -} +package com.bootdo.common.utils; + +import com.bootdo.system.domain.UserToken; +import org.apache.commons.beanutils.BeanUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.session.Session; +import org.apache.shiro.session.mgt.eis.SessionDAO; +import org.apache.shiro.subject.Subject; + +import com.bootdo.system.domain.UserDO; +import org.springframework.beans.factory.annotation.Autowired; + +import java.lang.reflect.InvocationTargetException; +import java.security.Principal; +import java.util.Collection; +import java.util.List; + +public class ShiroUtils { + @Autowired + private static SessionDAO sessionDAO; + + public static Subject getSubjct() { + return SecurityUtils.getSubject(); + } + public static UserDO getUser() { + Object object = getSubjct().getPrincipal(); + return (UserDO)object; + } + public static Long getUserId() { + return getUser().getUserId(); + } + public static void logout() { + getSubjct().logout(); + } + + public static List getPrinciples() { + List principals = null; + Collection sessions = sessionDAO.getActiveSessions(); + return principals; + } +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/SpringContextHolder.java b/src/main/java/com/bootdo/common/utils/SpringContextHolder.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/SpringContextHolder.java rename to src/main/java/com/bootdo/common/utils/SpringContextHolder.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/StringUtils.java b/src/main/java/com/bootdo/common/utils/StringUtils.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/StringUtils.java rename to src/main/java/com/bootdo/common/utils/StringUtils.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/TimeUtils.java b/src/main/java/com/bootdo/common/utils/TimeUtils.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/TimeUtils.java rename to src/main/java/com/bootdo/common/utils/TimeUtils.java diff --git a/bootdo/src/main/java/com/bootdo/common/utils/UploadUtils.java b/src/main/java/com/bootdo/common/utils/UploadUtils.java similarity index 92% rename from bootdo/src/main/java/com/bootdo/common/utils/UploadUtils.java rename to src/main/java/com/bootdo/common/utils/UploadUtils.java index af89355090c31d8fe5e9fe73ce0c9100ec0ec157..df28392ae67b0d812455f42a74c59642c30f0456 100644 --- a/bootdo/src/main/java/com/bootdo/common/utils/UploadUtils.java +++ b/src/main/java/com/bootdo/common/utils/UploadUtils.java @@ -1,5 +1,5 @@ -package com.bootdo.common.utils; - -public class UploadUtils { - -} +package com.bootdo.common.utils; + +public class UploadUtils { + +} diff --git a/bootdo/src/main/java/com/bootdo/common/utils/xss/JsoupUtil.java b/src/main/java/com/bootdo/common/utils/xss/JsoupUtil.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/common/utils/xss/JsoupUtil.java rename to src/main/java/com/bootdo/common/utils/xss/JsoupUtil.java diff --git a/src/main/java/com/bootdo/common/wrapper/BodyReaderWrapper.java b/src/main/java/com/bootdo/common/wrapper/BodyReaderWrapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ae98c9c9465d4d3417e9a6749ab940155b792179 --- /dev/null +++ b/src/main/java/com/bootdo/common/wrapper/BodyReaderWrapper.java @@ -0,0 +1,123 @@ +package com.bootdo.common.wrapper; + +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import java.io.*; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/8/22 23:19 + * @Desc: 请求体包装类 + **/ +public class BodyReaderWrapper extends HttpServletRequestWrapper{ + + private final byte[] bytes; + + public BodyReaderWrapper(HttpServletRequest request) throws IOException { + super(request); + try (BufferedInputStream bis = new BufferedInputStream(request.getInputStream()); + ByteArrayOutputStream baos = new ByteArrayOutputStream()) { + byte[] buffer = new byte[1024]; + int len; + while ((len = bis.read(buffer)) > 0) { + baos.write(buffer, 0, len); + } + bytes = baos.toByteArray(); + } catch (IOException ex) { + throw ex; + } + } + + /** + * 获取请求体 + * @return + * @throws UnsupportedEncodingException + */ + public String getBody() throws UnsupportedEncodingException { + return new String(bytes,"UTF-8"); + } + + @Override + public ServletInputStream getInputStream() throws IOException { + final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); + return new ServletInputStream() { + @Override + public boolean isFinished() { + return false; + } + + @Override + public boolean isReady() { + return false; + } + + @Override + public void setReadListener(ReadListener readListener) { + + } + + public int read() throws IOException { + return byteArrayInputStream.read(); + } + }; + } + + @Override + public BufferedReader getReader() throws IOException { + return new BufferedReader(new InputStreamReader(this.getInputStream())); + } + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/bootdo/common/wrapper/RequestBodyWrapper.java b/src/main/java/com/bootdo/common/wrapper/RequestBodyWrapper.java new file mode 100644 index 0000000000000000000000000000000000000000..805db61b4fcdb46f34adac130e36cbd4c8e08fbf --- /dev/null +++ b/src/main/java/com/bootdo/common/wrapper/RequestBodyWrapper.java @@ -0,0 +1,149 @@ +package com.bootdo.common.wrapper; + +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletRequest; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; + +/** + * 请求Request包装类 + * 通过读取stream来获取request中的body内容 + * + * https://blog.csdn.net/dinggang007/article/details/78549878 + */ +public class RequestBodyWrapper extends HttpServletRequestWrapper{ + + private String requestBody = null; + + public RequestBodyWrapper(HttpServletRequest request) { + super(request); + } + + /** + * 从stream中拿到请求体 + * @param request + * @return + */ + private static String readBody(ServletRequest request){ + StringBuilder sb = new StringBuilder(); + String inputLine; + BufferedReader br = null; + + try { + br = request.getReader(); + while ((inputLine = br.readLine()) != null){ + sb.append(inputLine); + } + }catch (Exception e){ + throw new RuntimeException("Failed to read body.",e); + }finally { + if(br != null){ + try { + br.close(); + }catch (IOException e){ + + } + } + } + return sb.toString(); + } + + + /** + * 将字符串转换成字节数组输入流 + */ + private class CustomServletInputStream extends ServletInputStream{ + + private ByteArrayInputStream buffer; + + public CustomServletInputStream(String body) { + body = body == null ? "" : body; + this.buffer = new ByteArrayInputStream(body.getBytes()); + } + + @Override + public boolean isFinished() { + return buffer.available() == 0; + } + + @Override + public boolean isReady() { + return true; + } + + @Override + public void setReadListener(ReadListener readListener) { + throw new RuntimeException("Not Implemented"); + } + + @Override + public int read() throws IOException { + return buffer.read(); + } + } + + + + + + + + + + + + + + + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/bootdo/dataStructure/ArrayStack.java b/src/main/java/com/bootdo/dataStructure/ArrayStack.java new file mode 100644 index 0000000000000000000000000000000000000000..1eaf6133046b2d6088d92518b670b39efb8c45c0 --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/ArrayStack.java @@ -0,0 +1,134 @@ +package com.bootdo.dataStructure; + +import java.util.Arrays; +import java.util.EmptyStackException; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/10/24 0:01 + * @Desc: 增强的栈结构 + * 1. 支持任意数据结构 + * 2. 支持动态扩容 + **/ +public class ArrayStack { + + private Object[] elementData; + + private int top = -1; + + private int size; + + + public ArrayStack(int initialCapacity){ + if(initialCapacity < 0){ + throw new IllegalArgumentException("栈初始容量不能小于0: "+initialCapacity); + } + this.elementData = new Object[initialCapacity]; + this.size = initialCapacity; + } + + + //入栈 + public Object push(Object item){ + //先检查下如果新增元素,是不是空间就已经满了 + needGrow(top+1); + elementData[++top] = item; + return item; + } + + + //弹出栈顶元素 + public Object pop(){ + Object obj = peek(); + remove(); + return obj; + } + + + //获取栈顶元素 + public Object peek(){ + if (top == -1){ + throw new EmptyStackException(); + } + return elementData[top]; + } + + //删除栈顶元素 + public void remove(){ + //栈顶元素置为null + elementData[top--] = null; + } + + public boolean isEmpty(){ + return top == -1; + } + + /** + * 当前元素数量与总容量比较, 当前元素数量 >= 总容量 + * @param currentItems + * @return + */ + public void needGrow(int currentItems){ + int oldCapacity = size; + //当前元素数量 >= 原始容量 + if (currentItems >= oldCapacity){ + //扩容两倍 + int newCapacity = 0; + if ((size<<1) - Integer.MAX_VALUE > 0){ + newCapacity = Integer.MAX_VALUE; + }else { + newCapacity = size<<1; + } + this.size = newCapacity; + elementData = Arrays.copyOf(elementData,size); + } + } + + public static void main(String[] args) { + ArrayStack stack = new ArrayStack(1); + + //字符串逆序 + String str = "how are you"; + char[] chars = str.toCharArray(); + for (char c : chars){ + stack.push(c); + } + while (!stack.isEmpty()){ + System.out.print(stack.pop()); + } + + //判断分隔符是否匹配 + String str2 = "12"; + char[] chars1 = str2.toCharArray(); + for (char c : chars1){ + + switch (c){ + //左匹配符,入栈 + case '{': + case '[': + case '<': + stack.push(c); + break; + + //右匹配符,出栈并比较 + case '}': + case ']': + case '>': + if (!stack.isEmpty()){ + char ch = stack.pop().toString().toCharArray()[0]; + if (c=='}' && ch != '{' + || c==']' && ch != '[' + || c=='>' && ch != '<'){ + System.out.println("Error:"+ch+"-"+c); + } + } + break; + + default: + break; + } + + } + + } +} diff --git a/src/main/java/com/bootdo/dataStructure/BubbleSort.java b/src/main/java/com/bootdo/dataStructure/BubbleSort.java new file mode 100644 index 0000000000000000000000000000000000000000..06f809db6b36ae96407c19658e749681b5f7e1e2 --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/BubbleSort.java @@ -0,0 +1,44 @@ +package com.bootdo.dataStructure; + +import java.util.Arrays; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/10/23 0:06 + * @Desc: + **/ +public class BubbleSort { + + public static int[] sort(int[] array){ + + + + return null; + } + + + public static void main(String[] args) { + + int[] array = {5,4,3,2,1}; + // 4,3,2,1,5 第1次循环 交换4次 + // 3,2,1,4,5 第2次循环 交换3次 + // 2,1,3,4,5 第3次循环 交换2次 + // 1,2,3,4,5 第4次循环 交换1次 + + //第一层循环 共4次 + //第二层循环 数组长度 - 第一层循环的次数 + for (int i = 1; i < array.length; i++) { + //内部循环交换 + for (int j = 0; j < array.length - i; j++) { + if (array[j] > array[j+1]){ + int tmp = array[j]; + array[j] = array[j+1]; + array[j+1] = tmp; + } + } + + System.out.println("第"+ i +"次排序结束后的结果为:"+ Arrays.toString(array)); + } + + } +} diff --git a/src/main/java/com/bootdo/dataStructure/DoublePointLinkedList.java b/src/main/java/com/bootdo/dataStructure/DoublePointLinkedList.java new file mode 100644 index 0000000000000000000000000000000000000000..80b614a7d484be9dd5db298901bc9dcbe313562b --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/DoublePointLinkedList.java @@ -0,0 +1,123 @@ +package com.bootdo.dataStructure; + +/** + * 双端链表 + * 有一个标识来记录尾部 + */ +public class DoublePointLinkedList { + + //Node对象 + public class Node{ + Object data;//节点数据 + Node next;//下一个节点 + + public Node(Object data){ + this.data = data; + } + } + + //双端链表属性 + int size; + Node head; + Node tail; + + public DoublePointLinkedList(){ + this.size = 0; + this.head = null; + this.tail = null; + } + + + //头部添加Node + public void addHead(Object data){ + Node node = new Node(data); + if (size == 0){ + head = node; + tail = node; + size++; + }else { + node.next = head; + head = node; + size++; + } + } + + + //尾部添加Node + public void addTail(Object data){ + Node node = new Node(data); + if (size == 0){ + head = node; + tail = node; + size++; + }else { + tail.next = node; + tail = node; + size++; + } + } + + + //删除头部节点 + public boolean deleteHead(){ + if (isEmpty()) + return false; + + //只有一个节点 + if (size ==1){ + head = null; + tail = null; + }else { + head = head.next; + } + size--; + return true; + } + + + public boolean isEmpty(){ + return size == 0; + } + + + //显示节点信息 + public void display(){ + if (size == 0){ + System.out.println("[]"); + return; + } + if (size == 1){ + System.out.println("["+ head.data +"]"); + return; + } + //循环打印每个节点的值 + Node current = head; + int tmpSize = size; + while (tmpSize > 0){ + if (current.equals(head)){ + System.out.print("["+current.data+"->"); + }else if (current.equals(tail)){ + System.out.print(current.data+"]"); + }else { + System.out.print(current.data+"->"); + } + current = current.next; + tmpSize--; + } + } + + + + + public static void main(String[] args) { + DoublePointLinkedList link = new DoublePointLinkedList(); + link.addHead("a"); + //link.addTail("m"); + + /*link.deleteHead(); + link.deleteHead();*/ + + link.display(); + } + +} diff --git a/src/main/java/com/bootdo/dataStructure/FileUtil.java b/src/main/java/com/bootdo/dataStructure/FileUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..6c6c7c58e303d0c2e062c7b14d517028d2b37b3e --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/FileUtil.java @@ -0,0 +1,167 @@ +package com.bootdo.dataStructure; + +import cn.hutool.core.io.IoUtil; + +import java.io.*; +import java.util.Arrays; + +public class FileUtil { + + /** + * 列出所有的文件和文件夹 + * @param file + */ + public static void getFileList(File file){ + //第一级目录 + File[] files = file.listFiles(); + for (File f: + files) { + //打印目录和文件 + System.out.println(f); + if (f.isDirectory()){ + getFileList(f); + } + } + + } + + /** + * 向文件中写内容 + * @throws IOException + */ + public static void writeToFile() throws IOException { + File target = new File(File.separator + "a.txt"); + if (!target.exists()){ + target.createNewFile(); + } + FileOutputStream fos = new FileOutputStream(target, true); + fos.write(65); + fos.write("ABC".getBytes()); + fos.write("写入成功".getBytes()); + + fos.flush(); + fos.close(); + + } + + /** + * 读取文件内容 + * @throws IOException + */ + public static void readFromFile() throws IOException { + File target = new File(File.separator + "a.txt"); + FileInputStream fis = new FileInputStream(target); + + /*//读一个字节 + int data1 = fis.read(); + System.out.println(data1);*/ + + /*//一次性读10个字节 + byte[] buffer = new byte[10]; + fis.read(buffer); + System.out.println(Arrays.toString(buffer)); + System.out.println(new String(buffer));*/ + + /*//全部读取,但是中文会乱码 + byte[] buffer = new byte[2]; + int len = 0; + StringBuilder sb = new StringBuilder(); + while ((len = fis.read(buffer)) != -1){ + System.out.println(len); + sb.append(new String(buffer,0,len)); + } + System.out.println(sb.toString());*/ + + //读到缓冲流中 + BufferedInputStream bis = new BufferedInputStream(fis); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + byte[] buf = new byte[5]; + int len = 0; + StringBuffer stringBuffer = new StringBuffer(); + while ((len = bis.read(buf)) != -1){ + baos.write(buf,0,len); + } + byte[] buffer = baos.toByteArray(); + System.out.println(new String(buffer,"UTF-8")); + } + + + /** + * 将A文件内容 复制到 B文件中 + * @throws IOException + */ + public static void copyContent() throws IOException { + File source = new File(File.separator + "a.txt"); + File target = new File(File.separator + "b.txt"); + + try (FileInputStream fis = new FileInputStream(source); + FileOutputStream fos = new FileOutputStream(target)){ + //读A文件 + int len = -1; + byte[] buffer = new byte[5]; + while ((len = fis.read(buffer)) != -1){ + //存到B中 + fos.write(buffer,0,len); + } + } + } + + public static void fileWriter() throws IOException { + File srcFile = new File(File.separator + "a.txt"); + Writer out = new FileWriter(srcFile); + out.write(65); + out.write("电费".toCharArray()); + out.write("339ad".toCharArray(),0,2); + out.write("直接文字写入"); + out.flush(); + out.close(); + + } + + public static void fileReader() throws IOException { + File srcFile = new File(File.separator + "a.txt"); + Reader in = new FileReader(srcFile); + + //read 每次读一个字符 + int len = -1; + /*while ((len = in.read()) != -1){ + System.out.print((char)len); + }*/ + + //read(char[] buffer) 将字符读进字符数组 + char[] buffer = new char[5];//每次读取5个字符 + /*while ((len = in.read(buffer)) != -1){ + System.out.print(new String(buffer,0,len)); + }*/ + + + while ((len = in.read(buffer,0,10)) != -1){ + System.out.println(new String(buffer,0,len)); + } + + } + + + + + public static void main(String[] args) throws IOException { + File file = new File("C:" + File.separator + "workspace"+ File.separator +"bootdo" + File.separator + "src"); + //getFileList(file); + + //writeToFile(); + + //readFromFile(); + + //copyContent(); + + fileWriter(); + + fileReader(); + + /*for (int i = 13500; i < 40000; i++) { + System.out.print((char)i); + }*/ + + } +} diff --git a/src/main/java/com/bootdo/dataStructure/MyQueue.java b/src/main/java/com/bootdo/dataStructure/MyQueue.java new file mode 100644 index 0000000000000000000000000000000000000000..6a99dbbf10f856d7fb893b765db476c978a69229 --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/MyQueue.java @@ -0,0 +1,117 @@ +package com.bootdo.dataStructure; + +import java.io.Serializable; +import java.util.Arrays; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/10/19 14:58 + * @Desc: 单向循环队列 + * https://www.cnblogs.com/ysocean/p/7921930.html#_label0 + **/ +public class MyQueue implements Serializable { + + //数据存放到Object数组中 + private Object[] queArray; + + //队头 + private int front; + + //队尾 + private int rear; + + //最大容量 + private int maxSize; + + //队列中元素实际数目 + private int nItems = 1; + + + public MyQueue(int maxSize){ + this.maxSize = maxSize; + //初始化容量,空数组 + this.queArray = new Object[this.maxSize]; + this.front = 0; + this.rear = -1; + + } + + //判断队列是否已满 + public boolean isFull(){ + return nItems == maxSize; + } + + //判断队列是否为空 + public boolean isEmpty(){ + return nItems == 0; + } + + + //新增数据,插入到队尾 + public void insert(int value){ + if (isFull()){ + System.out.println("队列已满"); + }else { + //队列尾部指向顶了,那么循环回来, + if(rear == maxSize -1){ + rear = -1; + } + //第一个可放值位置放入 + queArray[++rear] = value; + nItems++; + } + } + + //删除数据,从队头开始删 + public Object remove(){ + Object removeValue = null; + if (!isEmpty()){ + removeValue = queArray[front]; + //队头位置置空,队头上移 + queArray[front++] = null; + if (front == maxSize){ + front = 0; + } + //元素总数目-1 + nItems--; + } + return removeValue; + } + + + //队头数据 + public Object peekFront(){ + return queArray[front]; + } + + //获取队列的大小(实际的元素数目) + public Object getSize(){ + return nItems; + } + + + @Override + public String toString() { + return Arrays.toString(queArray); + } + + + + //移除数据 + public static void main(String[] args) { + MyQueue myQueue = new MyQueue(3); + System.out.println("队列打印" + myQueue); + myQueue.insert(1); + myQueue.insert(2); + myQueue.insert(3); + System.out.println("队列打印" + myQueue); + myQueue.remove(); + myQueue.remove(); + myQueue.remove(); + myQueue.remove(); + System.out.println("队列打印" + myQueue); + } + + + +} diff --git a/src/main/java/com/bootdo/dataStructure/MyStack.java b/src/main/java/com/bootdo/dataStructure/MyStack.java new file mode 100644 index 0000000000000000000000000000000000000000..b3353b92baca659a2c10bb96d973d95dfa027f40 --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/MyStack.java @@ -0,0 +1,76 @@ +package com.bootdo.dataStructure; + +import java.util.Arrays; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/10/23 23:02 + * @Desc: 数据结构 -- 栈 + **/ +public class MyStack { + + //数组,用于存放内容 + private int[] arr; + + //栈顶位置 + private int top = -1; + + //总容量 + private int maxSize; + + + public MyStack(int maxSize){ + if (maxSize < 0){ + throw new IllegalArgumentException("初始容量不能小于0:"+ maxSize); + } + this.maxSize = maxSize; + arr = new int[maxSize]; + } + + //入栈 + public void push(int value){ + if (top < maxSize - 1){ + arr[++top] = value; + }else { + System.out.println("栈已满,入栈失败"); + } + } + + //弹出栈顶数据 + public int pop(){ + return arr[top--]; + } + + + //判断栈是否为空 + public boolean isEmpty(){ + return (top == -1); + } + + + //判断栈是否已满 + public boolean isFull(){ + return (top == maxSize-1); + } + + + @Override + public String toString() { + return Arrays.toString(arr); + } + + public static void main(String[] args) { + + MyStack myStack = new MyStack(3); + myStack.push(1); + myStack.push(2); + myStack.push(3); + myStack.push(4); + System.out.println(myStack); + + while (!myStack.isEmpty()){ + System.out.println(myStack.pop()); + } + + } +} diff --git a/src/main/java/com/bootdo/dataStructure/OrderLinkedList.java b/src/main/java/com/bootdo/dataStructure/OrderLinkedList.java new file mode 100644 index 0000000000000000000000000000000000000000..0f41a9c552612673942d62a6dc117442b52349d1 --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/OrderLinkedList.java @@ -0,0 +1,72 @@ +package com.bootdo.dataStructure; + +/** + * 有序链表,按顺序存放 + * 插入数据的时候,需要先排序,找到合适的位置再插入 + */ +public class OrderLinkedList { + + //定义单向节点 + public class Node{ + private int data; + private Node next; + + public Node(int data){ + this.data = data; + this.next = null; + } + } + + + private Node head; + private int size; + + public OrderLinkedList(){ + this.size = 0; + } + + //找到合适位置插入,从小到大 + public void insert(int data){ + Node node = new Node(data); + + //从head开始比较,head一定是最小的 + //当前Node、前一个Node + Node current = head; + Node pre = null; + + //只要没找到,就继续找 + while(current != null && data > current.data){ + //更换比较对象 + pre = current; + current = current.next; + } + + //找到了,插到current前面 + if (pre == null){ + //插到head前面 + head = node; + node.next = current; + }else { + pre.next = node; + node.next = current; + } + size++; + } + + //删除头节点 + public void deleteHead(){ + head = head.next; + size--; + + } + + public static void main(String[] args) { + OrderLinkedList link = new OrderLinkedList(); + link.insert(59); + link.insert(4); + link.insert(87); + link.insert(34); + link.insert(0); + link.insert(44); + } +} diff --git a/src/main/java/com/bootdo/dataStructure/PriorityQueue.java b/src/main/java/com/bootdo/dataStructure/PriorityQueue.java new file mode 100644 index 0000000000000000000000000000000000000000..51c2e3674d4e5eae8824d96e99d9b99bab980114 --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/PriorityQueue.java @@ -0,0 +1,79 @@ +package com.bootdo.dataStructure; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/10/19 16:09 + * @Desc: 优先级队列(有序队列) + * 数据项按照关键字排序,数据插入的时候回插入到合适的位置,以保证队列的有序 + **/ +public class PriorityQueue { + + //int数组 + private int[] priQueArray; + + private int maxSize; + + private int nItems; + + public PriorityQueue(int maxSize){ + this.maxSize = maxSize; + priQueArray = new int[this.maxSize]; + nItems = 0; + } + + //查找 + + //插入一个新元素 + private void insert(int value){ + int tmpIndex; + //空数组的时候,放到第一个 + if (nItems == 0){ + priQueArray[nItems++]= value; + }else { + tmpIndex = nItems - 1; + while (tmpIndex >= 0 && value < priQueArray[tmpIndex]){ + //当前值往后移 + priQueArray[tmpIndex+1] = priQueArray[tmpIndex]; + tmpIndex--; + } + priQueArray[tmpIndex+1] = value; + nItems++; + } + } + + + //删除(从上往下删) + public int remove(){ + int k = nItems - 1; + int value = priQueArray[k]; + priQueArray[k] = -1;//表示被移除了 + nItems--; + return value; + } + + //查看优先级最高的元素 + public int peekMin(){ + return priQueArray[nItems - 1]; + } + + + //判断是否为空 + public boolean isEmpty(){ + return nItems == 0; + } + + //判断是否已满 + public boolean isFull(){ + return nItems == maxSize; + } + + + public static void main(String[] args) { + PriorityQueue queue = new PriorityQueue(5); + queue.insert(2); + queue.insert(4); + queue.insert(6); + queue.insert(8); + queue.insert(7); + } +} diff --git a/src/main/java/com/bootdo/dataStructure/QueueLinkedList.java b/src/main/java/com/bootdo/dataStructure/QueueLinkedList.java new file mode 100644 index 0000000000000000000000000000000000000000..5323b70efe8206e61d8c6889adb8cc90f16309bc --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/QueueLinkedList.java @@ -0,0 +1,36 @@ +package com.bootdo.dataStructure; + +/** + * 双端链表实现队列 + * + * 消耗 --> deleteHead + * 插入 --> addTail + */ +public class QueueLinkedList { + + private DoublePointLinkedList link; + + public QueueLinkedList(){ + link = new DoublePointLinkedList(); + } + + //尾部插入 + public void inset(Object data){ + link.addTail(data); + } + + //头部删除 + public boolean delete(){ + return link.deleteHead(); + } + + + public boolean isEmpty(){ + return link.isEmpty(); + } + + public void display(){ + link.display(); + } + +} diff --git a/src/main/java/com/bootdo/dataStructure/Recursion.java b/src/main/java/com/bootdo/dataStructure/Recursion.java new file mode 100644 index 0000000000000000000000000000000000000000..f92346b14a4c256bc46638c05e4f1f5796da8279 --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/Recursion.java @@ -0,0 +1,141 @@ +package com.bootdo.dataStructure; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/11/10 16:40 + * @Desc: 递归 + **/ +public class Recursion { + + /** + * For循环实现阶乘 + * 3! = 3*(3-1)*(3-2) + * 0! = 1 + * 1!=1 + * 负数没有阶乘 + */ + + public static int getFactorialFor(int n){ + int tmp = 1; + if (n >= 0){ + for (int i = 1; i <= n; i++) { + tmp = tmp*i; + } + }else { + return -1; + } + + return tmp; + } + + + /** + * n! = n*(n-1)! + * + * 边界条件 : 碰到负数,返回-1 + * + * 归的条件: 0! = 1 + * 递的条件: n > 0 + * @param n + * @return + */ + public static int getFactorial(int n){ + if (n >= 0){ + if (n == 0){ + //归 + System.out.println(n+"!=1"); + return 1; + }else { + //递 + System.out.println(n); + int temp = n*getFactorial(n-1); + System.out.println(n+"!="+temp); + return temp; + } + } + //边界 + return -1; + } + + /** + * 二分法查找 -- 不用递归 + * 找到目标值,返回数组下标 + */ + public static int findTwoPoint(int[] array,int key){ + int start = 0; + int last = array.length - 1; + while (start <= last){ + //找到了,返回 + int mid = (last - start)/2 + start; + if (key == array[mid]){ + return mid; + } + //没找到,缩小范围 + if (key > array[mid]){ + start = mid+1; + } + if (key < array[mid]){ + last = mid - 1; + } + } + return -1; + } + + /** + * 二分法查找 -- 递归 + * + * 边界条件: start > last + * 归: key = arr[mid] + * 递:start <= last + * @param array + * @param key + * @return + */ + public static int search(int[] array,int key,int start,int last){ + //边界条件 + if(start <= last){ + int mid = (last - start)/2 + start; + //归 + if (array[mid] == key){ + return mid; + }else if(key > array[mid]){ + //递 + start = mid + 1; + return search(array,key,start,last); + }else if(key < array[mid]){ + //递 + last = mid - 1; + return search(array,key,start,last); + } + } + return -1; + } + + + /** + * 汉诺塔问题 + * @param dish 盘子个数(也表示名称) + * @param from 初始塔座 + * @param temp 中介塔座 + * @param to 目标塔座 + */ + public static void move(int dish,String from,String temp,String to){ + if(dish == 1){ + System.out.println("将盘子"+dish+"从塔座"+from+"移动到目标塔座"+to); + }else{ + move(dish-1,from,to,temp);//A为初始塔座,B为目标塔座,C为中介塔座 + System.out.println("将盘子"+dish+"从塔座"+from+"移动到目标塔座"+to); + move(dish-1,temp,from,to);//B为初始塔座,C为目标塔座,A为中介塔座 + } + } + + public static void main(String[] args) { + //getFactorial(9); + int[] arr = {1,3,5,7}; + System.out.println(findTwoPoint(arr,5)); + System.out.println(search(arr,5,0,3)); + + move(2,"A","B","C"); + } + +} diff --git a/src/main/java/com/bootdo/dataStructure/SerializableDemo.java b/src/main/java/com/bootdo/dataStructure/SerializableDemo.java new file mode 100644 index 0000000000000000000000000000000000000000..9bacae7b502d335048d53c3e04b1d8a2a707645e --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/SerializableDemo.java @@ -0,0 +1,24 @@ +package com.bootdo.dataStructure; + +import java.io.*; + +/** + * 试验序列化 和 反序列化 + */ +public class SerializableDemo { + + public static void main(String[] args) throws IOException, ClassNotFoundException { + //序列化到文件中 + FileOutputStream fos = new FileOutputStream(File.separator + "a.txt"); + ObjectOutputStream os = new ObjectOutputStream(fos); + os.writeObject(new MyQueue(1)); + os.close(); + + //从文件中反序列化 + FileInputStream fis = new FileInputStream(File.separator + "a.txt"); + ObjectInputStream ois = new ObjectInputStream(fis); + MyQueue myQueue = (MyQueue) ois.readObject(); + System.out.println(myQueue); + ois.close(); + } +} diff --git a/src/main/java/com/bootdo/dataStructure/SingleLinkedList.java b/src/main/java/com/bootdo/dataStructure/SingleLinkedList.java new file mode 100644 index 0000000000000000000000000000000000000000..ae2801447733fe5bf5acf4359fe70f2e0fd723ba --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/SingleLinkedList.java @@ -0,0 +1,186 @@ +package com.bootdo.dataStructure; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/11/4 23:20 + * @Desc: 链表 -- 单向链表 + **/ +public class SingleLinkedList { + + //链表的节点:1. data 2. 下一个节点的地址 + private class Node{ + private Object data;//每个节点的数据 + private Node next;//下一个节点 + + public Node(Object data){ + this.data = data; + } + } + + //链表节点的个数 + private int size; + + //头节点 + private Node head; + + + public SingleLinkedList(){ + this.size = 0; + this.head = null; + } + + //在链表中添加元素 + public Object addHead(Object data){ + //1. 构造一个Node + Node newNode = new Node(data); + + //2. 这个Node的Next是当前的head + newNode.next = this.head; + + //3. head指向这个Node + this.head = newNode; + + //4. size++ + this.size++; + + return data; + } + + //删链表的头元素 + public Object deleteHead(){ + Object obj = head.data; + + //1. head = next + head = head.next; + //2. size-- + this.size--; + + return obj; + } + + //查找指定元素,找到了返回节点Node,找不到返回Null + public Node find(Object object){ + //通过循环size,每次拿出一个Node来检查 + Node currentNode = head; + int tmpSize = size; + + //根据size来循环 + while (tmpSize > 0){ + if (object.equals(currentNode.data)){ + return currentNode; + }else { + currentNode = currentNode.next; + } + tmpSize--; + } + return null; + } + + + //删除指定的元素,删除成功返回true + public boolean delete(Object value){ + if (size == 0) + return false; + + //设立标志位: 当前节点、上一个节点,最开始都停留在head + Node current = head; + Node previous = head; + while (current.data != value){ + //最终没找到,结束 + if (current.next == null){ + return false; + }else { + current = current.next; + previous = current; + } + } + + //能到这里,表示找到了,对元素进行删除 + if (current == head){ + head = current.next; + }else { + previous.next = current.next; + } + size--; + + return true; + } + + //判断链表是否为空 + public boolean isEmpty(){ + return (size == 0); + } + + //显示节点信息 + public void display(){ + if (!isEmpty()){ + StringBuilder sb = new StringBuilder(); + Node current = head; + int tmpSize = size; + + //只有一个元素 + if (tmpSize == 1){ + System.out.println("["+ current.data +"]"); + return; + } + + //循环,然后再判断当前节点是头、中、尾 + while (tmpSize > 0){ + if (current.equals(head)){ + sb.append("["+ current.data +"->"); + }else if (current.next == null){ + sb.append(current.data+"]"); + }else { + sb.append(current.data+"->"); + } + current = current.next; + tmpSize--; + } + System.out.println(sb); + }else { + System.out.println("[]"); + } + + } + + + public static void main(String[] args) { + SingleLinkedList singleLinkedList = new SingleLinkedList(); + singleLinkedList.addHead("1"); + singleLinkedList.addHead("2"); + singleLinkedList.addHead("3"); + singleLinkedList.addHead("4"); + + //singleLinkedList.deleteHead(); + + Node node = singleLinkedList.find("3"); + + singleLinkedList.delete("4"); + singleLinkedList.display(); + } + + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/com/bootdo/dataStructure/StackSingleLink.java b/src/main/java/com/bootdo/dataStructure/StackSingleLink.java new file mode 100644 index 0000000000000000000000000000000000000000..3a669e58619c0bfb349db6a26f962e2bdc53e4e8 --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/StackSingleLink.java @@ -0,0 +1,46 @@ +package com.bootdo.dataStructure; + +/** + * 单向链表实现栈 + * pop --> deleteHead + * push --> addHead + */ +public class StackSingleLink { + + //具体操作交给单向链表 + SingleLinkedList link; + public StackSingleLink(){ + link = new SingleLinkedList(); + } + + //添加元素 + public void push(Object value){ + link.addHead(value); + } + + //移除栈顶元素 + public Object pop(){ + return link.deleteHead(); + } + + //是否为空 + public boolean isEmpty(){ + return link.isEmpty(); + } + + //打印栈内元素信息 + public void display(){ + link.display(); + } + + public static void main(String[] args) { + StackSingleLink stack = new StackSingleLink(); + stack.push("a"); + stack.push("b"); + stack.push("c"); + + System.out.println(stack.pop()); + + stack.display(); + } +} diff --git a/src/main/java/com/bootdo/dataStructure/StaticCodeBlock.java b/src/main/java/com/bootdo/dataStructure/StaticCodeBlock.java new file mode 100644 index 0000000000000000000000000000000000000000..f5329fff673c1eb07a24f4358acfaaebdab49a45 --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/StaticCodeBlock.java @@ -0,0 +1,34 @@ +package com.bootdo.dataStructure; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/11/19 22:17 + * @Desc: 静态代码块、构造代码块、构造函数、普通代码块 + **/ +public class StaticCodeBlock { + + static { + System.out.println("静态代码块"); + } + + { + System.out.println("构造代码块"); + } + + public StaticCodeBlock(){ + System.out.println("无参构造函数"); + } + + public void sayHello(){ + { + System.out.println("普通代码块"); + } + } + + public static void main(String[] args) { + System.out.println("main方法执行"); + new StaticCodeBlock().sayHello(); + System.out.println("--------------"); + new StaticCodeBlock().sayHello(); + } +} diff --git a/src/main/java/com/bootdo/dataStructure/TwoWayLinkedList.java b/src/main/java/com/bootdo/dataStructure/TwoWayLinkedList.java new file mode 100644 index 0000000000000000000000000000000000000000..11ea7ac4f13f2380565f38b0c9d706be6705b15b --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/TwoWayLinkedList.java @@ -0,0 +1,125 @@ +package com.bootdo.dataStructure; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/11/7 23:23 + * @Desc: 双向链表 + **/ +public class TwoWayLinkedList { + + //节点 + public class Node{ + + private Object data; + + private Node next; + + private Node prev; + + public Node(Object data){ + this.data = data; + } + } + + private Node head; + + private Node tail; + + private int size; + + public TwoWayLinkedList(){ + head = null; + tail = null; + size = 0; + } + + + //addHead + public void addHead(Object value){ + Node node = new Node(value); + if (size == 0){ + head = node; + tail = node; + size++; + }else { + node.next = head; + head = node; + size++; + } + } + + //addTail + public void addTail(Object value){ + Node node = new Node(value); + if (size == 0){ + head = node; + tail = node; + size++; + }else { + tail.next = node; + tail = node; + size++; + } + } + + //deleteHead + public Node deleteHead(){ + Node tmp = head; + if (size != 0){ + head = head.next; + head.prev = null; + size--; + } + return tmp; + } + + + //deleteTail + public Node deleteTail(){ + Node tmp = tail; + if (size != 0){ + tail = tail.prev; + tail.next = null; + size++; + } + return tmp; + } + + + //display + public void display(){ + if (size == 0){ + System.out.println("[]"); + return; + } + if (size == 1){ + System.out.println("["+ head.data +"]"); + return; + } + + Node current = head; + while (current != null){ + if (current.equals(head)){ + System.out.print("["+ current.data +"->"); + }else if (current.equals(tail)){ + System.out.print(current.data+"]"); + }else { + System.out.print(current.data+"->"); + } + current = current.next; + } + + } + + + + + + public static void main(String[] args) { + TwoWayLinkedList link = new TwoWayLinkedList(); + link.addTail("1"); + + + link.display(); + } +} diff --git a/src/main/java/com/bootdo/dataStructure/Verify.java b/src/main/java/com/bootdo/dataStructure/Verify.java new file mode 100644 index 0000000000000000000000000000000000000000..7fe21bdb7ebc316f8098b356eb29c09959a58eaf --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/Verify.java @@ -0,0 +1,33 @@ +package com.bootdo.dataStructure; + +public class Verify { + + //静态内部类 + public static class staticInner{ + static { + System.out.println("静态内部类 -- 静态代码块加载"); + } + + public void get(){ + System.out.println("静态内部类 -- get方法调用"); + } + } + + //普通内部类 + public class normalInner{ + public void get(){ + System.out.println("普通内部类 -- get方法调用"); + } + } + + public static void main(String[] args) { + //静态内部类实例化 + staticInner staticInner = new Verify.staticInner(); + staticInner.get(); + + //普通内部类实例化 + normalInner normalInner = new Verify().new normalInner(); + normalInner.get(); + } + +} diff --git a/src/main/java/com/bootdo/dataStructure/tree/BST.java b/src/main/java/com/bootdo/dataStructure/tree/BST.java new file mode 100644 index 0000000000000000000000000000000000000000..1ad97ab43117b09470c7cd03801540f06496963b --- /dev/null +++ b/src/main/java/com/bootdo/dataStructure/tree/BST.java @@ -0,0 +1,216 @@ +package com.bootdo.dataStructure.tree; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2020/1/1 23:23 + * @Desc: 二叉搜索树 BinarySearchTree + **/ +public class BST> { + + private class Node{ + public E e;//节点元素值 + public Node left,right;//左子树,右子树引用 + + public Node(E e){ + this.e = e; + left = null; + right = null; + } + } + + private Node root;//根节点 + private int size;//数组元素的个数 + + public BST(){ + root = null; + size = 0; + } + + public void add(E e){ + root = add(root,e); + } + + //添加节点(将e插入到给定的node中的合适位置,返回这个node) + private Node add(Node node,E e){ + //极端条件:空的,找到了合适的位置,返回 + if (node == null){ + size++; + return new Node(e); + } + //不是空的,那就找个位置给他放 + if (e.compareTo(node.e)<0){ + //放左边 + node.left = add(node.left,e); + }else if (e.compareTo(node.e)>0){ + //放右边 + node.right = add(node.right,e); + } + return node; + } + + + //添加节点(非递归方式) + public boolean insert(E e){ + Node newNode = new Node(e); + //当前为空树,没有任何节点 + if (root == null){ + root = newNode; + return true; + }else { + //不是空树,从root开始循环查找合适的空位置来放newNode + Node current = root; + Node parentNode = null; + while (current != null){ + //记住起始位置 + parentNode = current; + if (e.compareTo(current.e)<0){ + current = current.left; + //左边找到了空位置,插入到该节点 + if (current == null){ + parentNode.left = newNode; + return true; + } + }else if(e.compareTo(current.e)>0){ + current = current.right; + if (current == null){ + parentNode.right = newNode; + return true; + } + } + } + } + + return false; + } + + //遍历 + //中序遍历打印节点的值(该方法按左中右顺序打印给定Node的值) + public void infixOrder(Node current){ + if (current == null){ + return; + } + + //极端情况,树只有三个节点:左中有 + /*System.out.print(current.left.e); + System.out.print(current.e); + System.out.print(current.right.e);*/ + + //但是左边可能也是颗树,交给函数去打印 + infixOrder(current.left); + System.out.print(current.e); + //右边也可能是颗树 + infixOrder(current.right); + } + + + //查找最大值(给一棵树,当前函数返回这棵树的最大值) + public E findMax(Node node){ + if (node != null){ + if (node.right != null){ + return findMax(node.right); + }else { + return node.e; + } + } + return null; + } + + //查找最小值(给一颗树,当前函数返回这颗树的最小值) + public E findMin(Node node){ + if (node != null){ + if (node.left == null){ + return node.e; + }else { + return findMin(node.left); + } + } + return null; + } + + + //非递归查找最大值 + public E findMax(){ + //从root开始,并且假定当前节点就是最大的节点 + Node current = root; + Node maxNode = current; + //如果有右节点,继续找 + while (current != null && current.right != null){ + current = current.right; + maxNode = current; + } + + return maxNode.e; + } + + + //删除节点操作 + //该节点是叶节点 + + //该节点有两个子节点 + + + //该节点有两个子节点 + + + + + + + public static void main(String[] args) { + BST tree = new BST<>(); + tree.add(7); + tree.add(9); + tree.add(3); + tree.add(8); + tree.add(12); + /*tree.add(23); + tree.add(17); + tree.add(28);*/ + System.out.println(tree); + + System.out.println(tree.findMax(tree.root)); + System.out.println(tree.findMax()); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/Client.java b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/Client.java new file mode 100644 index 0000000000000000000000000000000000000000..631602515de00e0c2d8fe68f2595a6f4c51475e4 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/Client.java @@ -0,0 +1,45 @@ +package com.bootdo.designMode.chainOfResponsibilityMode; + +import java.math.BigDecimal; + +public class Client { + + public static void main(String[] args) { + //排队 + ConcreteHandler jm = new ConcreteHandler("贾母"); + + ConcreteHandler jby = new ConcreteHandler("贾宝玉"); + + ConcreteHandler ldy = new ConcreteHandler("林黛玉"); + + jm.setSuccessor(jby); + jby.setSuccessor(ldy); + + //往后传请求 + jm.handleRequest("",new BigDecimal(0)); + + + //设置审批链条 + Handler projectManager = new ProjectManager("项目经理"); + Handler dptManager = new DptManager("部门经理"); + Handler generalManager = new GeneralManager("总经理"); + + + projectManager.setSuccessor(dptManager); + dptManager.setSuccessor(generalManager); + + //发起报销 + projectManager.handleRequest("张三",new BigDecimal(400)); + + projectManager.handleRequest("张三",new BigDecimal(600)); + + projectManager.handleRequest("张三",new BigDecimal(800)); + + projectManager.handleRequest("张三",new BigDecimal(1000)); + + projectManager.handleRequest("张三",new BigDecimal(1300)); + + projectManager.handleRequest("张三",new BigDecimal(1600)); + + } +} diff --git a/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/ConcreteHandler.java b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/ConcreteHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..ab0230d7b27a31510990dad07b4880f3680ce3e7 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/ConcreteHandler.java @@ -0,0 +1,25 @@ +package com.bootdo.designMode.chainOfResponsibilityMode; + +import java.math.BigDecimal; +import java.util.Objects; + +/** + * 实际处理方法 + */ +public class ConcreteHandler extends Handler { + + public ConcreteHandler(String name) { + super(name); + } + + @Override + public void handleRequest(String user, BigDecimal fee) { + Handler successor = getSuccessor(); + if (Objects.isNull(successor)) { + System.out.println("我是" + this.getName() + ",后面没有继任者自己处理请求,不往下传递"); + } else { + System.out.println("我是" + this.getName() + ",后面有继任者" + successor.getName() + ",由继任者处理"); + successor.handleRequest(user,fee); + } + } +} diff --git a/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/DptManager.java b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/DptManager.java new file mode 100644 index 0000000000000000000000000000000000000000..fdfbe73d61c8d602e932ed6d71ea1c15e9467293 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/DptManager.java @@ -0,0 +1,26 @@ +package com.bootdo.designMode.chainOfResponsibilityMode; + +import java.math.BigDecimal; +import java.util.Objects; + +public class DptManager extends Handler{ + public DptManager(String name) { + super(name); + } + + @Override + public void handleRequest(String user, BigDecimal fee) { + BigDecimal target = new BigDecimal(1000); + System.out.println(getName()+"收到报销申请信息如下:"+ user +","+ fee +",审批结果如下:"); + if(fee.compareTo(target) == 1){ + if(Objects.isNull(getSuccessor())){ + System.out.println("失败: "+ user +" 申报金额 "+ fee +" 失败"); + }else { + System.out.println("跳过:金额过大,无法处理,需转交给更大领导审批"); + getSuccessor().handleRequest(user,fee); + } + }else { + System.out.println("成功: "+ user +" 申报金额 "+ fee +" 成功"); + } + } +} diff --git a/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/GeneralManager.java b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/GeneralManager.java new file mode 100644 index 0000000000000000000000000000000000000000..039cea6d37015660812b4b5d66d715516da734c9 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/GeneralManager.java @@ -0,0 +1,26 @@ +package com.bootdo.designMode.chainOfResponsibilityMode; + +import java.math.BigDecimal; +import java.util.Objects; + +public class GeneralManager extends Handler{ + public GeneralManager(String name) { + super(name); + } + + @Override + public void handleRequest(String user, BigDecimal fee) { + BigDecimal target = new BigDecimal(1500); + System.out.println(getName()+"收到报销申请信息如下:"+ user +","+ fee +",审批结果如下:"); + if(fee.compareTo(target) == 1){ + if(Objects.isNull(getSuccessor())){ + System.out.println("失败: "+ user +" 申报金额 "+ fee +" 失败"); + }else { + System.out.println("跳过:金额过大,无法处理,需转交给更大领导审批"); + getSuccessor().handleRequest(user,fee); + } + }else { + System.out.println("成功: "+ user +" 申报金额 "+ fee +" 成功"); + } + } +} diff --git a/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/Handler.java b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/Handler.java new file mode 100644 index 0000000000000000000000000000000000000000..f7414213777c3879cbff9eea4522999cd43e2dc8 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/Handler.java @@ -0,0 +1,34 @@ +package com.bootdo.designMode.chainOfResponsibilityMode; + +import java.math.BigDecimal; + +/** + * 抽象处理者 + */ +public abstract class Handler { + //处理者姓名 + private String name; + + //继任者 + protected Handler successor; + + //处理请求的模板方法,可以自己处理,也可以交给继任者 + public abstract void handleRequest(String user, BigDecimal fee); + + public Handler(String name){ + this.name = name; + } + + public void setSuccessor(Handler successor){ + this.successor = successor; + } + + public Handler getSuccessor(){ + return successor; + } + + public String getName() { + return name; + } + +} diff --git a/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/ProjectManager.java b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/ProjectManager.java new file mode 100644 index 0000000000000000000000000000000000000000..b51c7d019b01b128efe40c68449b9747fea137fc --- /dev/null +++ b/src/main/java/com/bootdo/designMode/chainOfResponsibilityMode/ProjectManager.java @@ -0,0 +1,26 @@ +package com.bootdo.designMode.chainOfResponsibilityMode; + +import java.math.BigDecimal; +import java.util.Objects; + +public class ProjectManager extends Handler{ + public ProjectManager(String name) { + super(name); + } + + @Override + public void handleRequest(String user, BigDecimal fee) { + BigDecimal target = new BigDecimal(500); + System.out.println(getName()+"收到报销申请信息如下:"+ user +","+ fee +",审批结果如下:"); + if(fee.compareTo(target) == 1){ + if(Objects.isNull(getSuccessor())){ + System.out.println("失败: "+ user +" 申报金额 "+ fee +" 失败"); + }else { + System.out.println("跳过:金额过大,无法处理,需转交给更大领导审批"); + getSuccessor().handleRequest(user,fee); + } + }else { + System.out.println("成功: "+ user +" 申报金额 "+ fee +" 成功"); + } + } +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/AudioPlayer.java b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/AudioPlayer.java new file mode 100644 index 0000000000000000000000000000000000000000..7f8350196eb9c1622696de9cd675898752374c08 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/AudioPlayer.java @@ -0,0 +1,21 @@ +package com.bootdo.designMode.commandMode.AudioPlayer; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/7 22:39 + * @Desc: 接收者 -- 实际操作 + **/ +public class AudioPlayer { + + public void play(){ + System.out.println("播放..."); + } + + public void rewind(){ + System.out.println("倒带"); + } + + public void stop(){ + System.out.println("停止"); + } +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/Command.java b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/Command.java new file mode 100644 index 0000000000000000000000000000000000000000..0c327fe4cbca81264b42e159d3287573e010a8b5 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/Command.java @@ -0,0 +1,14 @@ +package com.bootdo.designMode.commandMode.AudioPlayer; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/7 22:42 + * @Desc: 抽象命令角色 + **/ +public interface Command { + + /** + * 执行方法 + */ + public void execute(); +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/Julia.java b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/Julia.java new file mode 100644 index 0000000000000000000000000000000000000000..88767c84d961827676cca9aa0ac8938098c1230e --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/Julia.java @@ -0,0 +1,39 @@ +package com.bootdo.designMode.commandMode.AudioPlayer; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/7 23:29 + * @Desc: 客户端角色,由茱莉娅扮演 + **/ +public class Julia { + + public static void main(String[] args) { + //创建随时听 + AudioPlayer audioPlayer = new AudioPlayer(); + + //利用Command与随身听的功能配对 + PlayCommand playCommand = new PlayCommand(audioPlayer); + RewindCommand rewindCommand = new RewindCommand(audioPlayer); + StopCommand stopCommand = new StopCommand(audioPlayer); + + //创建控制面板,并与Command绑定 + Keypad keypad = new Keypad(); + keypad.setPlayComand(playCommand); + keypad.setRewindCommand(rewindCommand); + keypad.setStopCommand(stopCommand); + + //控制面板按键测试 + keypad.play(); + keypad.rewind(); + keypad.stop(); + + + MacroAudioCommand macroAudioCommand = new MacroAudioCommand(); + macroAudioCommand.add(playCommand); + macroAudioCommand.add(rewindCommand); + macroAudioCommand.add(stopCommand); + macroAudioCommand.execute(); + } + + +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/Keypad.java b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/Keypad.java new file mode 100644 index 0000000000000000000000000000000000000000..e1d607d0151db4e7bfec28e33f5acf6fc9c1cb2a --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/Keypad.java @@ -0,0 +1,74 @@ +package com.bootdo.designMode.commandMode.AudioPlayer; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/7 23:23 + * @Desc: 按键面板 + **/ +public class Keypad { + + private Command playComand; + + private Command rewindCommand; + + private Command stopCommand; + + public void setPlayComand(Command playComand) { + this.playComand = playComand; + } + + public void setRewindCommand(Command rewindCommand) { + this.rewindCommand = rewindCommand; + } + + public void setStopCommand(Command stopCommand) { + this.stopCommand = stopCommand; + } + + + /** + * 执行播放方法 + */ + public void play(){ + playComand.execute(); + } + + /** + * 执行倒带方法 + */ + public void rewind(){ + rewindCommand.execute(); + } + + /** + * 执行停止方法 + */ + public void stop(){ + stopCommand.execute(); + } + + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/MacroAudioCommand.java b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/MacroAudioCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..a4ec62c29706b9f735e84a546a20c1928f868864 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/MacroAudioCommand.java @@ -0,0 +1,30 @@ +package com.bootdo.designMode.commandMode.AudioPlayer; + +import java.util.ArrayList; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/8 22:52 + * @Desc: 宏命令实现类 + **/ +public class MacroAudioCommand implements MacroCommand{ + + private ArrayList commandList = new ArrayList(); + + @Override + public void add(Command command) { + commandList.add(command); + } + + @Override + public void remove(Command command) { + commandList.remove(command); + } + + @Override + public void execute() { + for(Command command : commandList){ + command.execute(); + } + } +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/MacroCommand.java b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/MacroCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..109be0debb8fe02a1a032e26cf3d5007bceb1588 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/MacroCommand.java @@ -0,0 +1,15 @@ +package com.bootdo.designMode.commandMode.AudioPlayer; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/8 22:51 + * @Desc: 宏命令 + **/ +public interface MacroCommand extends Command{ + + //添加命令 + public void add(Command command); + + //删除命令 + public void remove(Command command); +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/PlayCommand.java b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/PlayCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..1e2931a8a91c1671a845d461e119b1bb81f84b96 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/PlayCommand.java @@ -0,0 +1,21 @@ +package com.bootdo.designMode.commandMode.AudioPlayer; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/7 23:17 + * @Desc: 播放命令 + **/ +public class PlayCommand implements Command{ + + //引入具体的播放器 + private AudioPlayer myAudio; + + public PlayCommand(AudioPlayer audioPlayer){ + this.myAudio = audioPlayer; + } + + @Override + public void execute() { + myAudio.play(); + } +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/RewindCommand.java b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/RewindCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..e39f133d605de01dda763a75b7921be739fa8c6d --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/RewindCommand.java @@ -0,0 +1,21 @@ +package com.bootdo.designMode.commandMode.AudioPlayer; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/7 23:17 + * @Desc: 播放命令 + **/ +public class RewindCommand implements Command{ + + //引入具体的播放器 + private AudioPlayer myAudio; + + public RewindCommand(AudioPlayer audioPlayer){ + this.myAudio = audioPlayer; + } + + @Override + public void execute() { + myAudio.rewind(); + } +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/StopCommand.java b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/StopCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..69bf384f839f7c808a989f4758851f510b0efdcd --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/AudioPlayer/StopCommand.java @@ -0,0 +1,21 @@ +package com.bootdo.designMode.commandMode.AudioPlayer; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/7 23:17 + * @Desc: 播放命令 + **/ +public class StopCommand implements Command{ + + //引入具体的播放器 + private AudioPlayer myAudio; + + public StopCommand(AudioPlayer audioPlayer){ + this.myAudio = audioPlayer; + } + + @Override + public void execute() { + myAudio.stop(); + } +} diff --git a/src/main/java/com/bootdo/designMode/commandMode/a.java b/src/main/java/com/bootdo/designMode/commandMode/a.java new file mode 100644 index 0000000000000000000000000000000000000000..2f57620157f0ffddfffe1f0021f3009cb49b301d --- /dev/null +++ b/src/main/java/com/bootdo/designMode/commandMode/a.java @@ -0,0 +1,9 @@ +package com.bootdo.designMode.commandMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/7 22:37 + * @Desc: + **/ +public class a { +} diff --git a/src/main/java/com/bootdo/designMode/decoratorMode/Beverage.java b/src/main/java/com/bootdo/designMode/decoratorMode/Beverage.java new file mode 100644 index 0000000000000000000000000000000000000000..1ef9b7fd3cfa29ad1a7fb91b847912ef80aa3829 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/decoratorMode/Beverage.java @@ -0,0 +1,18 @@ +package com.bootdo.designMode.decoratorMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/10 22:51 + * @Desc: 饮料类 + **/ +public abstract class Beverage { + + String description = "Unknown Beverage"; + + public String getDescription() { + return description; + } + + public abstract double cost(); + +} diff --git a/src/main/java/com/bootdo/designMode/decoratorMode/CondimentDecorator.java b/src/main/java/com/bootdo/designMode/decoratorMode/CondimentDecorator.java new file mode 100644 index 0000000000000000000000000000000000000000..c58a495ef0750784126f0a9487306a61cd9312b1 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/decoratorMode/CondimentDecorator.java @@ -0,0 +1,13 @@ +package com.bootdo.designMode.decoratorMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/10 22:52 + * @Desc: 调料类 + **/ +public abstract class CondimentDecorator extends Beverage{ + + //重新实现 getDescription()方法 + public abstract String getDescription(); + +} diff --git a/src/main/java/com/bootdo/designMode/decoratorMode/DecoratorDebug.java b/src/main/java/com/bootdo/designMode/decoratorMode/DecoratorDebug.java new file mode 100644 index 0000000000000000000000000000000000000000..45df7330c22772cf321928b1edc235fe306f6f78 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/decoratorMode/DecoratorDebug.java @@ -0,0 +1,30 @@ +package com.bootdo.designMode.decoratorMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/10 23:11 + * @Desc: 装饰者调试 + **/ +public class DecoratorDebug { + + public static void main(String[] args) { + + //只要一杯Espresso + Espresso espresso = new Espresso(); + System.out.println(espresso.getDescription() + ",need money : " + espresso.cost()); + + //现在加两份 Mocha ,一份 Soy + Mocha mocha = new Mocha(espresso); + Mocha mocha1 = new Mocha(mocha); + Soy soy = new Soy(mocha1); + System.out.println(soy.getDescription() + ",need money : " + soy.cost()); + + //多态形式展现装饰者模式 + Beverage beverage = new Espresso(); + beverage = new Mocha(beverage); + beverage = new Soy(beverage); + + System.out.println(beverage.getDescription() + ",need money : " + beverage.cost()); + + } +} diff --git a/src/main/java/com/bootdo/designMode/decoratorMode/Espresso.java b/src/main/java/com/bootdo/designMode/decoratorMode/Espresso.java new file mode 100644 index 0000000000000000000000000000000000000000..7ab975bf8ef9b8e78db5e5384c0e9e33dd55e5c0 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/decoratorMode/Espresso.java @@ -0,0 +1,22 @@ +package com.bootdo.designMode.decoratorMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/10 22:56 + * @Desc: 浓缩咖啡 + **/ +public class Espresso extends Beverage{ + + public Espresso(){ + description = "Espresso"; + } + + /** + * 当前饮料价格 + * @return + */ + @Override + public double cost() { + return 0.9; + } +} diff --git a/src/main/java/com/bootdo/designMode/decoratorMode/HouseBlend.java b/src/main/java/com/bootdo/designMode/decoratorMode/HouseBlend.java new file mode 100644 index 0000000000000000000000000000000000000000..f735a1f058e28f7b5e7d4beef63c2d7e65c24127 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/decoratorMode/HouseBlend.java @@ -0,0 +1,22 @@ +package com.bootdo.designMode.decoratorMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/10 22:56 + * @Desc: 浓缩咖啡 + **/ +public class HouseBlend extends Beverage{ + + public HouseBlend(){ + description = "Espresso"; + } + + /** + * 当前饮料价格 + * @return + */ + @Override + public double cost() { + return 1.9; + } +} diff --git a/src/main/java/com/bootdo/designMode/decoratorMode/LowerCaseInputStream.java b/src/main/java/com/bootdo/designMode/decoratorMode/LowerCaseInputStream.java new file mode 100644 index 0000000000000000000000000000000000000000..764f2490dfed3bc172bb368800f530e97cc475a8 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/decoratorMode/LowerCaseInputStream.java @@ -0,0 +1,54 @@ +package com.bootdo.designMode.decoratorMode; + +import java.io.*; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/10 23:39 + * @Desc: 输入流装饰类,将输入流中的大写字母改成小写 + **/ +public class LowerCaseInputStream extends FilterInputStream { + /** + * Creates a FilterInputStream + * by assigning the argument in + * to the field this.in so as + * to remember it for later use. + * + * @param in the underlying input stream, or null if + * this instance is to be created without an underlying stream. + */ + public LowerCaseInputStream(InputStream in) { + super(in); + } + + public int read() throws IOException { + int c = super.read(); + return (c == -1 ? c : Character.toLowerCase((char) c)); + } + + public int read(byte[] b, int offset, int len) throws IOException { + int result = super.read(b, offset, len); + for (int i = offset; i < offset + result; i++) { + b[i] = (byte) Character.toLowerCase((char) b[i]); + } + + return result; + } + + public static void main(String[] args) { + + int c; + + try { + InputStream is = new LowerCaseInputStream(new BufferedInputStream(new FileInputStream("D:\\test.txt"))); + + while ((c = is.read()) >= 0){ + System.out.print((char)c); + } + is.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/src/main/java/com/bootdo/designMode/decoratorMode/Mocha.java b/src/main/java/com/bootdo/designMode/decoratorMode/Mocha.java new file mode 100644 index 0000000000000000000000000000000000000000..930c64b94dadfd2667ac13cb4834a5122c846265 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/decoratorMode/Mocha.java @@ -0,0 +1,26 @@ +package com.bootdo.designMode.decoratorMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/10 23:00 + * @Desc: 摩卡是一种调料 + **/ +public class Mocha extends CondimentDecorator{ + + //将Beverage组合进来,Mocha是来装饰它的 + Beverage beverage; + + public Mocha(Beverage beverage) { + this.beverage = beverage; + } + + @Override + public String getDescription() { + return beverage.getDescription() + ", Mocha"; + } + + @Override + public double cost() { + return beverage.cost() + 0.23; + } +} diff --git a/src/main/java/com/bootdo/designMode/decoratorMode/Soy.java b/src/main/java/com/bootdo/designMode/decoratorMode/Soy.java new file mode 100644 index 0000000000000000000000000000000000000000..429b0d7fba3177437ac5212b9e325386078c09c6 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/decoratorMode/Soy.java @@ -0,0 +1,26 @@ +package com.bootdo.designMode.decoratorMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/10 23:00 + * @Desc: Soy是一种调料 + **/ +public class Soy extends CondimentDecorator{ + + //将Beverage组合进来,Mocha是来装饰它的 + Beverage beverage; + + public Soy(Beverage beverage) { + this.beverage = beverage; + } + + @Override + public String getDescription() { + return beverage.getDescription() + ", Soy"; + } + + @Override + public double cost() { + return beverage.cost() + 0.43; + } +} diff --git a/src/main/java/com/bootdo/designMode/factoryMode/NYPizzaIngredientFactory.java b/src/main/java/com/bootdo/designMode/factoryMode/NYPizzaIngredientFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..03e4b04bca2ca5f8939b9edb654c548e50b6f1b4 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/factoryMode/NYPizzaIngredientFactory.java @@ -0,0 +1,20 @@ +package com.bootdo.designMode.factoryMode; + +import com.bootdo.designMode.factoryMode.baseDir.PizzaIngredientFactory; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/6 15:51 + * @Desc: 实际的原料工厂 + **/ +public class NYPizzaIngredientFactory implements PizzaIngredientFactory { + @Override + public String createDough() { + return "纽约原料工厂生产的面团"; + } + + @Override + public String createSauce() { + return "纽约原料工厂生产的酱料"; + } +} diff --git a/src/main/java/com/bootdo/designMode/factoryMode/NYPizzaStore.java b/src/main/java/com/bootdo/designMode/factoryMode/NYPizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..af63e1b3f7c30ac0ce73bc8e6194058188943e27 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/factoryMode/NYPizzaStore.java @@ -0,0 +1,28 @@ +package com.bootdo.designMode.factoryMode; + +import com.bootdo.designMode.factoryMode.baseDir.CheesePizza; +import com.bootdo.designMode.factoryMode.baseDir.Pizza; +import com.bootdo.designMode.factoryMode.baseDir.PizzaIngredientFactory; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/5 11:48 + * @Desc: 纽约披萨店 进行加盟,只需要自定义生产披萨 + **/ +public class NYPizzaStore extends PizzaStoreSp2{ + + @Override + Pizza createPizza(String type) { + Pizza pizza = null; + + PizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); + if(type.equals("cheese")){ + pizza = new CheesePizza(ingredientFactory); + pizza.setName("纽约风味披萨"); + }else{ + return null; + } + + return pizza; + } +} diff --git a/src/main/java/com/bootdo/designMode/factoryMode/PizzaStore.java b/src/main/java/com/bootdo/designMode/factoryMode/PizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..53ed4d988d5d71997aa8da06941e749cc914b2cd --- /dev/null +++ b/src/main/java/com/bootdo/designMode/factoryMode/PizzaStore.java @@ -0,0 +1,39 @@ +package com.bootdo.designMode.factoryMode; + +import com.bootdo.designMode.factoryMode.baseDir.CheesePizza; +import com.bootdo.designMode.factoryMode.baseDir.Pizza; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/4 23:52 + * @Desc: 披萨店 -- 通过工厂创建披萨 + **/ +public class PizzaStore { + //为商店添加上 factory 引用 + SimplePizzaFactory factory; + + //创建商店的时候,引入工厂 + public PizzaStore(SimplePizzaFactory factory){ + this.factory = factory; + } + + /** + * 订购披萨 + * @param type + * @return + */ + public Pizza orderPizza(String type){ + //直接创建披萨 + //Pizza pizza = new CheesePizza(); + + //利用工厂创建Pizza + Pizza pizza = factory.createPizza(type); + pizza.prepare(); + pizza.bake(); + pizza.cut(); + pizza.box(); + return pizza; + } + + +} diff --git a/src/main/java/com/bootdo/designMode/factoryMode/PizzaStoreSp2.java b/src/main/java/com/bootdo/designMode/factoryMode/PizzaStoreSp2.java new file mode 100644 index 0000000000000000000000000000000000000000..8388f88a27e24e3c69aa73b62045779076e63ab5 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/factoryMode/PizzaStoreSp2.java @@ -0,0 +1,29 @@ +package com.bootdo.designMode.factoryMode; + +import com.bootdo.designMode.factoryMode.baseDir.Pizza; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/5 11:24 + * @Desc: 披萨商店 -- 抽象超类来固定子类的范围 + **/ +public abstract class PizzaStoreSp2 { + + + /** + * 订购披萨 + * @param type + * @return + */ + public Pizza orderPizza(String type){ + Pizza pizza = createPizza(type); + pizza.prepare(); + pizza.bake(); + pizza.cut(); + pizza.box(); + return pizza; + } + + //模板方法,需要子类实现 + abstract Pizza createPizza(String type); +} diff --git a/src/main/java/com/bootdo/designMode/factoryMode/SimplePizzaFactory.java b/src/main/java/com/bootdo/designMode/factoryMode/SimplePizzaFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..a32dbbd697dc11ee92db3b1b71bd66de29143e27 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/factoryMode/SimplePizzaFactory.java @@ -0,0 +1,22 @@ +package com.bootdo.designMode.factoryMode; + +import com.bootdo.designMode.factoryMode.baseDir.CheesePizza; +import com.bootdo.designMode.factoryMode.baseDir.Pizza; +import com.bootdo.designMode.factoryMode.baseDir.PizzaIngredientFactory; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/4 23:43 + * @Desc: 简单披萨工厂 + **/ +public class SimplePizzaFactory { + + public Pizza createPizza(String type){ + Pizza pizza = null; + PizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory(); + if(type.equals("cheese")){ + pizza = new CheesePizza(ingredientFactory); + } + return pizza; + } +} diff --git a/src/main/java/com/bootdo/designMode/factoryMode/baseDir/CheesePizza.java b/src/main/java/com/bootdo/designMode/factoryMode/baseDir/CheesePizza.java new file mode 100644 index 0000000000000000000000000000000000000000..b36461740ea2e9f4e25f39354f42cf76b0b0644b --- /dev/null +++ b/src/main/java/com/bootdo/designMode/factoryMode/baseDir/CheesePizza.java @@ -0,0 +1,27 @@ +package com.bootdo.designMode.factoryMode.baseDir; + + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/4 23:45 + * @Desc: 芝士披萨 -- 由抽象原料工厂统一提供 + **/ +public class CheesePizza extends Pizza { + + PizzaIngredientFactory ingredientFactory; + + public CheesePizza(PizzaIngredientFactory ingredientFactory){ + this.ingredientFactory = ingredientFactory; + } + + @Override + public void prepare() { + dough = ingredientFactory.createDough(); + sauce = ingredientFactory.createSauce(); + } + + @Override + public void cut() { + System.out.println("Cutting the pizza into square slices"); + } +} diff --git a/src/main/java/com/bootdo/designMode/factoryMode/baseDir/Pizza.java b/src/main/java/com/bootdo/designMode/factoryMode/baseDir/Pizza.java new file mode 100644 index 0000000000000000000000000000000000000000..b492ab9f5d5f284a1f438b593f9b90888400e8d0 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/factoryMode/baseDir/Pizza.java @@ -0,0 +1,54 @@ +package com.bootdo.designMode.factoryMode.baseDir; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/4 23:34 + * @Desc: 披萨类 + **/ +public abstract class Pizza { + //名称 + String name; + //面团类型 + String dough; + //佐料 + String sauce; + + //子类准备原料 + public abstract void prepare(); + + public void bake(){ + System.out.println("Bake for 25 minutes at 350"); + } + + public void cut(){ + System.out.println("Cutting the pizza into diagonal slices"); + } + + public void box(){ + System.out.println("Place pizza in offical PizzaStore box"); + } + + public String getName(){ + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDough() { + return dough; + } + + public void setDough(String dough) { + this.dough = dough; + } + + public String getSauce() { + return sauce; + } + + public void setSauce(String sauce) { + this.sauce = sauce; + } +} diff --git a/src/main/java/com/bootdo/designMode/factoryMode/baseDir/PizzaIngredientFactory.java b/src/main/java/com/bootdo/designMode/factoryMode/baseDir/PizzaIngredientFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..a2df4c4de5e0802697218c29409666c6579d2c21 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/factoryMode/baseDir/PizzaIngredientFactory.java @@ -0,0 +1,14 @@ +package com.bootdo.designMode.factoryMode.baseDir; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/6 15:39 + * @Desc: 披萨原料厂 + **/ +public interface PizzaIngredientFactory { + + public String createDough(); + + public String createSauce(); + +} diff --git a/src/main/java/com/bootdo/designMode/factoryMode/factoryModeTest.java b/src/main/java/com/bootdo/designMode/factoryMode/factoryModeTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e96553472a7f25f54435aa2a7c3367b447208ad6 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/factoryMode/factoryModeTest.java @@ -0,0 +1,26 @@ +package com.bootdo.designMode.factoryMode; + +import com.bootdo.designMode.factoryMode.baseDir.Pizza; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/4/5 12:01 + * @Desc: 工厂模式测试类 + **/ +public class factoryModeTest { + + public static void main(String[] args) { + + //这个商店 提供订货功能,且自定义完成了披萨的生产 + NYPizzaStore nyPizzaStore = new NYPizzaStore(); + + //订货 + Pizza pizza = nyPizzaStore.orderPizza("cheese"); + + System.out.println("订货成功,披萨名称: "+ pizza.getName()); + System.out.println("订货成功,披萨的原料: "+ pizza.getDough()); + System.out.println("订货成功,披萨的原料: "+ pizza.getSauce()); + + + } +} diff --git a/src/main/java/com/bootdo/designMode/observerMode/CurrentConditionObserver.java b/src/main/java/com/bootdo/designMode/observerMode/CurrentConditionObserver.java new file mode 100644 index 0000000000000000000000000000000000000000..b199f17f4471bb045fe52814a34258f33ebea798 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/observerMode/CurrentConditionObserver.java @@ -0,0 +1,41 @@ +package com.bootdo.designMode.observerMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/4 23:33 + * @Desc: 观察者收到通知,显示当前实时天气信息 + **/ +public class CurrentConditionObserver extends Observer implements DisplayElement { + + private float temperature; + + private float humidity; + + private float pressure; + + //订阅主题 + public CurrentConditionObserver(Subject subject){ + super(subject); + } + + /** + * 取消订阅 + */ + public void unSubscribe(){ + subject.removeObserver(this); + } + + //收到消息之后的处理 + @Override + public void update(float temp, float humidity, float pressure) { + this.temperature = temp; + this.humidity = humidity; + this.pressure = pressure; + display(); + } + + public void display(){ + System.out.println("收到当前天气情况如下:temp = " + temperature + ",humidity = " + humidity + ",pressure = " + pressure); + } + +} diff --git a/src/main/java/com/bootdo/designMode/observerMode/DisplayElement.java b/src/main/java/com/bootdo/designMode/observerMode/DisplayElement.java new file mode 100644 index 0000000000000000000000000000000000000000..e6227c870031a314a8a7ba933a8557e408644485 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/observerMode/DisplayElement.java @@ -0,0 +1,12 @@ +package com.bootdo.designMode.observerMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/6 23:29 + * @Desc: 展示数据的通用接口 + **/ +public interface DisplayElement { + + void display(); + +} diff --git a/src/main/java/com/bootdo/designMode/observerMode/Observer.java b/src/main/java/com/bootdo/designMode/observerMode/Observer.java new file mode 100644 index 0000000000000000000000000000000000000000..ac494bb35f766fda6c2f79e8038f41b849422b0d --- /dev/null +++ b/src/main/java/com/bootdo/designMode/observerMode/Observer.java @@ -0,0 +1,21 @@ +package com.bootdo.designMode.observerMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/3 22:30 + * @Desc: 观察者类 + **/ +public abstract class Observer { + + //主题 + public Subject subject; + + //类创建时,需要知道主题,并订阅主题 + public Observer(Subject subject){ + this.subject = subject; + subject.registerObserver(this); + } + + //更新数据,所有观察者实现这个方法,就能够被主题通知到 + public abstract void update(float temp,float humidity,float pressure); +} diff --git a/src/main/java/com/bootdo/designMode/observerMode/Subject.java b/src/main/java/com/bootdo/designMode/observerMode/Subject.java new file mode 100644 index 0000000000000000000000000000000000000000..4c2e6ddf4c223dbff8978594f283fcea2a16dc5d --- /dev/null +++ b/src/main/java/com/bootdo/designMode/observerMode/Subject.java @@ -0,0 +1,28 @@ +package com.bootdo.designMode.observerMode; + +import java.util.ArrayList; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/3 22:28 + * @Desc: 主题类 + **/ +public abstract class Subject { + //存放观察者的容器 + public ArrayList observers; + + //初始化容器 + public Subject(){ + observers = new ArrayList(); + } + + //订阅主题 + public abstract void registerObserver(Observer observer); + + //退订主题 + public abstract void removeObserver(Observer observer); + + //通知所有订阅者 + public abstract void notifyObserver(); + +} diff --git a/src/main/java/com/bootdo/designMode/observerMode/WeatherDataSubject.java b/src/main/java/com/bootdo/designMode/observerMode/WeatherDataSubject.java new file mode 100644 index 0000000000000000000000000000000000000000..1b03829082953331c11b580646d7e7fa4baaf9b2 --- /dev/null +++ b/src/main/java/com/bootdo/designMode/observerMode/WeatherDataSubject.java @@ -0,0 +1,87 @@ +package com.bootdo.designMode.observerMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/4 23:07 + * @Desc: 天气预报节目 + **/ +public class WeatherDataSubject extends Subject{ + + private float temperature; + + private float humidity; + + private float pressure; + + public WeatherDataSubject(){ + super(); + } + + /** + * 订阅主题 + * @param observer + */ + @Override + public void registerObserver(Observer observer) { + observers.add(observer); + } + + /** + * 退订主题 + * @param observer + */ + @Override + public void removeObserver(Observer observer) { + int index = observers.indexOf(observer); + if (index >= 0){ + observers.remove(index); + } + } + + + public void setMeasurements(float temperature,float humidity,float pressure){ + this.temperature = (float) Math.random(); + this.humidity = (float) Math.random(); + this.pressure = (float) Math.random(); + triggerNotify(); + } + + //触发通知 + public void triggerNotify(){ + notifyObserver(); + } + + /** + * 通知观察者 + */ + @Override + public void notifyObserver() { + for (int i = 0; i < observers.size(); i++) { + Observer observer = (Observer)observers.get(i); + observer.update(temperature,humidity,pressure); + } + } + + public static void main(String[] args) { + //创建天气预报气象站 + WeatherDataSubject subject = new WeatherDataSubject(); + System.out.println("气象站创建完毕..."); + + //订阅实时天气预报 + CurrentConditionObserver observer = new CurrentConditionObserver(subject); + System.out.println("天气预报订阅完毕..."); + + //开始播放天气预报 + subject.setMeasurements(1f,1f,1f); + System.out.println("气象信息广播完毕..."); + + //取消订阅 + observer.unSubscribe(); + System.out.println("取消订阅天气预报成功..."); + + + subject.setMeasurements(1f,1f,1f); + System.out.println("气象信息广播完毕..."); + } + +} diff --git a/src/main/java/com/bootdo/designMode/observerMode/jdkObserverMode/DataCenter.java b/src/main/java/com/bootdo/designMode/observerMode/jdkObserverMode/DataCenter.java new file mode 100644 index 0000000000000000000000000000000000000000..a726835e4fb0813148001639b34796b0b3b4496a --- /dev/null +++ b/src/main/java/com/bootdo/designMode/observerMode/jdkObserverMode/DataCenter.java @@ -0,0 +1,45 @@ +package com.bootdo.designMode.observerMode.jdkObserverMode; + +import java.util.Observable; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/6 23:12 + * @Desc: 数据中心 -- 继承observable 成为一个主题 + **/ +public class DataCenter extends Observable { + + //父类已经完成了 注册、移除、通知的功能,子类只需要在数据变化的时候,通知观察者 + + private float temperature; + + private float humidity; + + private float pressure; + + public void setMeasurements(){ + this.temperature = (float) Math.random(); + this.humidity = (float) Math.random(); + this.pressure = (float) Math.random(); + triggerNotify(); + } + + //触发通知 + public void triggerNotify(){ + setChanged(); + //当前方式,需要观察者来 拉取数据 + notifyObservers(); + } + + public float getTemperature() { + return temperature; + } + + public float getHumidity() { + return humidity; + } + + public float getPressure() { + return pressure; + } +} diff --git a/src/main/java/com/bootdo/designMode/observerMode/jdkObserverMode/DataCenterDebug.java b/src/main/java/com/bootdo/designMode/observerMode/jdkObserverMode/DataCenterDebug.java new file mode 100644 index 0000000000000000000000000000000000000000..1721274a5ecdc4f13e80429d6c04dadde66229bb --- /dev/null +++ b/src/main/java/com/bootdo/designMode/observerMode/jdkObserverMode/DataCenterDebug.java @@ -0,0 +1,27 @@ +package com.bootdo.designMode.observerMode.jdkObserverMode; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/6 23:32 + * @Desc: + **/ +public class DataCenterDebug { + + public static void main(String[] args) { + //创建数据中心 + DataCenter dataCenter = new DataCenter(); + + //创建数据中心的观察者 + DataObserver dataObserver = new DataObserver(dataCenter); + + //数据中心发布数据 + dataCenter.setMeasurements(); + + //退订 + //dataCenter.deleteObserver(dataObserver); + + //数据中心发布数据 + dataCenter.setMeasurements(); + + } +} diff --git a/src/main/java/com/bootdo/designMode/observerMode/jdkObserverMode/DataObserver.java b/src/main/java/com/bootdo/designMode/observerMode/jdkObserverMode/DataObserver.java new file mode 100644 index 0000000000000000000000000000000000000000..d50fdf30354a29a8a136d4d189ec26b8c26d830b --- /dev/null +++ b/src/main/java/com/bootdo/designMode/observerMode/jdkObserverMode/DataObserver.java @@ -0,0 +1,48 @@ +package com.bootdo.designMode.observerMode.jdkObserverMode; + +import com.bootdo.designMode.observerMode.DisplayElement; + +import java.util.Objects; +import java.util.Observable; +import java.util.Observer; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2019/3/6 23:20 + * @Desc: 数据观察者,可接受推送,也可以主动去获取数据 + **/ +public class DataObserver implements Observer, DisplayElement { + + private Observable observable; + + private float temperature; + + private float humidity; + + private float pressure; + + //构造器,传入主题,以注册 + public DataObserver(Observable observable) { + this.observable = observable; + observable.addObserver(this); + } + + @Override + public void update(Observable o, Object arg) { + //拉取数据 + if(o instanceof DataCenter){ + DataCenter dataCenter = (DataCenter)o; + this.temperature = dataCenter.getTemperature(); + this.humidity = dataCenter.getHumidity(); + this.pressure = dataCenter.getPressure(); + display(); + } + + + } + + @Override + public void display() { + System.out.println("收到当前天气情况如下:temp = " + temperature + ",humidity = " + humidity + ",pressure = " + pressure); + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/ducks/Duck.java b/src/main/java/com/bootdo/headFirst/adapter/ducks/Duck.java new file mode 100644 index 0000000000000000000000000000000000000000..5832115925ce421cbbbc0a498827bc45c099ec0a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/ducks/Duck.java @@ -0,0 +1,6 @@ +package com.bootdo.headFirst.adapter.ducks; + +public interface Duck { + public void quack(); + public void fly(); +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/ducks/DuckAdapter.java b/src/main/java/com/bootdo/headFirst/adapter/ducks/DuckAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..3cd3d3c7a2fecf77a233bb1b257b6d4ede6f26a0 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/ducks/DuckAdapter.java @@ -0,0 +1,22 @@ +package com.bootdo.headFirst.adapter.ducks; +import java.util.Random; + +public class DuckAdapter implements Turkey { + Duck duck; + Random rand; + + public DuckAdapter(Duck duck) { + this.duck = duck; + rand = new Random(); + } + + public void gobble() { + duck.quack(); + } + + public void fly() { + if (rand.nextInt(5) == 0) { + duck.fly(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/ducks/DuckTestDrive.java b/src/main/java/com/bootdo/headFirst/adapter/ducks/DuckTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..09a96212d117ad8bfa0d46de8c9b500d476a1de7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/ducks/DuckTestDrive.java @@ -0,0 +1,25 @@ +package com.bootdo.headFirst.adapter.ducks; + +public class DuckTestDrive { + public static void main(String[] args) { + MallardDuck duck = new MallardDuck(); + + WildTurkey turkey = new WildTurkey(); + Duck turkeyAdapter = new TurkeyAdapter(turkey); + + System.out.println("The Turkey says..."); + turkey.gobble(); + turkey.fly(); + + System.out.println("\nThe Duck says..."); + testDuck(duck); + + System.out.println("\nThe TurkeyAdapter says..."); + testDuck(turkeyAdapter); + } + + static void testDuck(Duck duck) { + duck.quack(); + duck.fly(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/ducks/MallardDuck.java b/src/main/java/com/bootdo/headFirst/adapter/ducks/MallardDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..73ab53c3a7e95fe0ad9302a2e49a96ae95fc6230 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/ducks/MallardDuck.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.adapter.ducks; + +public class MallardDuck implements Duck { + public void quack() { + System.out.println("Quack"); + } + + public void fly() { + System.out.println("I'm flying"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/ducks/Turkey.java b/src/main/java/com/bootdo/headFirst/adapter/ducks/Turkey.java new file mode 100644 index 0000000000000000000000000000000000000000..1a831cf0e97cd448042b5421dcb96c87f1164f3e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/ducks/Turkey.java @@ -0,0 +1,6 @@ +package com.bootdo.headFirst.adapter.ducks; + +public interface Turkey { + public void gobble(); + public void fly(); +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/ducks/TurkeyAdapter.java b/src/main/java/com/bootdo/headFirst/adapter/ducks/TurkeyAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..5df7169418906e019f3d452e0a1031dd974562f0 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/ducks/TurkeyAdapter.java @@ -0,0 +1,19 @@ +package com.bootdo.headFirst.adapter.ducks; + +public class TurkeyAdapter implements Duck { + Turkey turkey; + + public TurkeyAdapter(Turkey turkey) { + this.turkey = turkey; + } + + public void quack() { + turkey.gobble(); + } + + public void fly() { + for(int i=0; i < 5; i++) { + turkey.fly(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/ducks/TurkeyTestDrive.java b/src/main/java/com/bootdo/headFirst/adapter/ducks/TurkeyTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..cc8e56ee7c5f34c0fb36e3c16dccbd93d2542a48 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/ducks/TurkeyTestDrive.java @@ -0,0 +1,14 @@ +package com.bootdo.headFirst.adapter.ducks; + +public class TurkeyTestDrive { + public static void main(String[] args) { + MallardDuck duck = new MallardDuck(); + Turkey duckAdapter = new DuckAdapter(duck); + + for(int i=0;i<10;i++) { + System.out.println("The DuckAdapter says..."); + duckAdapter.gobble(); + duckAdapter.fly(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/ducks/WildTurkey.java b/src/main/java/com/bootdo/headFirst/adapter/ducks/WildTurkey.java new file mode 100644 index 0000000000000000000000000000000000000000..b93d7f7a875c703768d5812ea74ee4dc7537f087 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/ducks/WildTurkey.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.adapter.ducks; + +public class WildTurkey implements Turkey { + public void gobble() { + System.out.println("Gobble gobble"); + } + + public void fly() { + System.out.println("I'm flying a short distance"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/iterenum/EI.java b/src/main/java/com/bootdo/headFirst/adapter/iterenum/EI.java new file mode 100644 index 0000000000000000000000000000000000000000..a314b237a4cfc705130ea047cc604f3196a3eb7a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/iterenum/EI.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.adapter.iterenum; + +import java.util.*; + +public class EI { + public static void main (String args[]) { + Vector v = new Vector(Arrays.asList(args)); + Enumeration enumeration = v.elements(); + while (enumeration.hasMoreElements()) { + System.out.println(enumeration.nextElement()); + } + Iterator iterator = v.iterator(); + while (iterator.hasNext()) { + System.out.println(iterator.next()); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/iterenum/EnumerationIterator.java b/src/main/java/com/bootdo/headFirst/adapter/iterenum/EnumerationIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..9ccc545e359ebcdbb8a86dde828eea9c5d8dfaeb --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/iterenum/EnumerationIterator.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.adapter.iterenum; + +import java.util.*; + +public class EnumerationIterator implements Iterator { + Enumeration enumeration; + + public EnumerationIterator(Enumeration enumeration) { + this.enumeration = enumeration; + } + + public boolean hasNext() { + return enumeration.hasMoreElements(); + } + + public Object next() { + return enumeration.nextElement(); + } + + public void remove() { + throw new UnsupportedOperationException(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/iterenum/EnumerationIteratorTestDrive.java b/src/main/java/com/bootdo/headFirst/adapter/iterenum/EnumerationIteratorTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..08805062c56dc15b9496dc12b40f0a9fa835d8a2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/iterenum/EnumerationIteratorTestDrive.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.adapter.iterenum; + +import java.util.*; + +public class EnumerationIteratorTestDrive { + public static void main (String args[]) { + Vector v = new Vector(Arrays.asList(args)); + Iterator iterator = new EnumerationIterator(v.elements()); + while (iterator.hasNext()) { + System.out.println(iterator.next()); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/iterenum/IteratorEnumeration.java b/src/main/java/com/bootdo/headFirst/adapter/iterenum/IteratorEnumeration.java new file mode 100644 index 0000000000000000000000000000000000000000..0b0da3b76d4238479dfc1fccec25e0176b792aeb --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/iterenum/IteratorEnumeration.java @@ -0,0 +1,19 @@ +package com.bootdo.headFirst.adapter.iterenum; + +import java.util.*; + +public class IteratorEnumeration implements Enumeration { + Iterator iterator; + + public IteratorEnumeration(Iterator iterator) { + this.iterator = iterator; + } + + public boolean hasMoreElements() { + return iterator.hasNext(); + } + + public Object nextElement() { + return iterator.next(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/adapter/iterenum/IteratorEnumerationTestDrive.java b/src/main/java/com/bootdo/headFirst/adapter/iterenum/IteratorEnumerationTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..50acf4ac0bd5d94aee4da6ffe4bad436bb9ad6c6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/adapter/iterenum/IteratorEnumerationTestDrive.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.adapter.iterenum; + +import java.util.*; + +public class IteratorEnumerationTestDrive { + public static void main (String args[]) { + ArrayList l = new ArrayList(Arrays.asList(args)); + Enumeration enumeration = new IteratorEnumeration(l.iterator()); + while (enumeration.hasMoreElements()) { + System.out.println(enumeration.nextElement()); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/BPMObserver.java b/src/main/java/com/bootdo/headFirst/combined/djview/BPMObserver.java new file mode 100644 index 0000000000000000000000000000000000000000..174d5f5e6fe5d6d0c0797d50f4cc5b30e05438e6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/BPMObserver.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.combined.djview; + +public interface BPMObserver { + void updateBPM(); +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/BeatBar.java b/src/main/java/com/bootdo/headFirst/combined/djview/BeatBar.java new file mode 100644 index 0000000000000000000000000000000000000000..5bbf9d6c717e823470a32f6e96dcbf11c19b5200 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/BeatBar.java @@ -0,0 +1,28 @@ +package com.bootdo.headFirst.combined.djview; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class BeatBar extends JProgressBar implements Runnable { + JProgressBar progressBar; + Thread thread; + + public BeatBar() { + thread = new Thread(this); + setMaximum(100); + thread.start(); + } + + public void run() { + for(;;) { + int value = getValue(); + value = (int)(value * .75); + setValue(value); + repaint(); + try { + Thread.sleep(50); + } catch (Exception e) {}; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/BeatController.java b/src/main/java/com/bootdo/headFirst/combined/djview/BeatController.java new file mode 100644 index 0000000000000000000000000000000000000000..b5d3c796084a35d9253bb2483d6f8bbe7f7cadbc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/BeatController.java @@ -0,0 +1,42 @@ +package com.bootdo.headFirst.combined.djview; + +public class BeatController implements ControllerInterface { + BeatModelInterface model; + DJView view; + + public BeatController(BeatModelInterface model) { + this.model = model; + view = new DJView(this, model); + view.createView(); + view.createControls(); + view.disableStopMenuItem(); + view.enableStartMenuItem(); + model.initialize(); + } + + public void start() { + model.on(); + view.disableStartMenuItem(); + view.enableStopMenuItem(); + } + + public void stop() { + model.off(); + view.disableStopMenuItem(); + view.enableStartMenuItem(); + } + + public void increaseBPM() { + int bpm = model.getBPM(); + model.setBPM(bpm + 1); + } + + public void decreaseBPM() { + int bpm = model.getBPM(); + model.setBPM(bpm - 1); + } + + public void setBPM(int bpm) { + model.setBPM(bpm); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/BeatModel.java b/src/main/java/com/bootdo/headFirst/combined/djview/BeatModel.java new file mode 100644 index 0000000000000000000000000000000000000000..9d2bb790920a258bc8dde9f587ef4224f6018485 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/BeatModel.java @@ -0,0 +1,144 @@ +package com.bootdo.headFirst.combined.djview; + +import javax.sound.midi.*; +import java.util.*; + +public class BeatModel implements BeatModelInterface, MetaEventListener { + Sequencer sequencer; + ArrayList beatObservers = new ArrayList(); + ArrayList bpmObservers = new ArrayList(); + int bpm = 90; + Sequence sequence; + Track track; + + public void initialize() { + setUpMidi(); + buildTrackAndStart(); + } + + public void on() { + sequencer.start(); + setBPM(90); + } + + public void off() { + setBPM(0); + sequencer.stop(); + } + + public void setBPM(int bpm) { + this.bpm = bpm; + sequencer.setTempoInBPM(getBPM()); + notifyBPMObservers(); + } + + public int getBPM() { + return bpm; + } + + void beatEvent() { + notifyBeatObservers(); + } + + + public void registerObserver(BeatObserver o) { + beatObservers.add(o); + } + + public void notifyBeatObservers() { + for(int i = 0; i < beatObservers.size(); i++) { + BeatObserver observer = (BeatObserver)beatObservers.get(i); + observer.updateBeat(); + } + } + + public void registerObserver(BPMObserver o) { + bpmObservers.add(o); + } + + public void notifyBPMObservers() { + for(int i = 0; i < bpmObservers.size(); i++) { + BPMObserver observer = (BPMObserver)bpmObservers.get(i); + observer.updateBPM(); + } + } + + + public void removeObserver(BeatObserver o) { + int i = beatObservers.indexOf(o); + if (i >= 0) { + beatObservers.remove(i); + } + } + + + + public void removeObserver(BPMObserver o) { + int i = bpmObservers.indexOf(o); + if (i >= 0) { + bpmObservers.remove(i); + } + } + + + public void meta(MetaMessage message) { + if (message.getType() == 47) { + beatEvent(); + sequencer.start(); + setBPM(getBPM()); + } + } + + public void setUpMidi() { + try { + sequencer = MidiSystem.getSequencer(); + sequencer.open(); + sequencer.addMetaEventListener(this); + sequence = new Sequence(Sequence.PPQ,4); + track = sequence.createTrack(); + sequencer.setTempoInBPM(getBPM()); + } catch(Exception e) { + e.printStackTrace(); + } + } + + public void buildTrackAndStart() { + int[] trackList = {35, 0, 46, 0}; + + sequence.deleteTrack(null); + track = sequence.createTrack(); + + makeTracks(trackList); + track.add(makeEvent(192,9,1,0,4)); + try { + sequencer.setSequence(sequence); + } catch(Exception e) { + e.printStackTrace(); + } + } + + public void makeTracks(int[] list) { + + for (int i = 0; i < list.length; i++) { + int key = list[i]; + + if (key != 0) { + track.add(makeEvent(144,9,key, 100, i)); + track.add(makeEvent(128,9,key, 100, i+1)); + } + } + } + + public MidiEvent makeEvent(int comd, int chan, int one, int two, int tick) { + MidiEvent event = null; + try { + ShortMessage a = new ShortMessage(); + a.setMessage(comd, chan, one, two); + event = new MidiEvent(a, tick); + + } catch(Exception e) { + e.printStackTrace(); + } + return event; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/BeatModelInterface.java b/src/main/java/com/bootdo/headFirst/combined/djview/BeatModelInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..55d80fce88a3d03fa2ce7d55693f26c14d62d08a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/BeatModelInterface.java @@ -0,0 +1,21 @@ +package com.bootdo.headFirst.combined.djview; + +public interface BeatModelInterface { + void initialize(); + + void on(); + + void off(); + + void setBPM(int bpm); + + int getBPM(); + + void registerObserver(BeatObserver o); + + void removeObserver(BeatObserver o); + + void registerObserver(BPMObserver o); + + void removeObserver(BPMObserver o); +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/BeatObserver.java b/src/main/java/com/bootdo/headFirst/combined/djview/BeatObserver.java new file mode 100644 index 0000000000000000000000000000000000000000..697c49d9c4ae383cf86214e678574284826e8058 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/BeatObserver.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.combined.djview; + +public interface BeatObserver { + void updateBeat(); +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/ControllerInterface.java b/src/main/java/com/bootdo/headFirst/combined/djview/ControllerInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..505a6b7049667a31403d8f180d4b73b1a9efc73a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/ControllerInterface.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.combined.djview; + +public interface ControllerInterface { + void start(); + void stop(); + void increaseBPM(); + void decreaseBPM(); + void setBPM(int bpm); +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/DJTestDrive.java b/src/main/java/com/bootdo/headFirst/combined/djview/DJTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..55a3eaece4f73b5294bf0d6761b74e2215536be3 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/DJTestDrive.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.combined.djview; + +public class DJTestDrive { + + public static void main (String[] args) { + BeatModelInterface model = new BeatModel(); + ControllerInterface controller = new BeatController(model); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/DJView.java b/src/main/java/com/bootdo/headFirst/combined/djview/DJView.java new file mode 100644 index 0000000000000000000000000000000000000000..10d697a086e6652cf1f27bfa18e89dcb02034809 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/DJView.java @@ -0,0 +1,169 @@ +package com.bootdo.headFirst.combined.djview; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class DJView implements ActionListener, BeatObserver, BPMObserver { + BeatModelInterface model; + ControllerInterface controller; + JFrame viewFrame; + JPanel viewPanel; + BeatBar beatBar; + JLabel bpmOutputLabel; + JFrame controlFrame; + JPanel controlPanel; + JLabel bpmLabel; + JTextField bpmTextField; + JButton setBPMButton; + JButton increaseBPMButton; + JButton decreaseBPMButton; + JMenuBar menuBar; + JMenu menu; + JMenuItem startMenuItem; + JMenuItem stopMenuItem; + + public DJView(ControllerInterface controller, BeatModelInterface model) { + this.controller = controller; + this.model = model; + model.registerObserver((BeatObserver)this); + model.registerObserver((BPMObserver)this); + } + + public void createView() { + // Create all Swing components here + viewPanel = new JPanel(new GridLayout(1, 2)); + viewFrame = new JFrame("View"); + viewFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + viewFrame.setSize(new Dimension(100, 80)); + bpmOutputLabel = new JLabel("offline", SwingConstants.CENTER); + beatBar = new BeatBar(); + beatBar.setValue(0); + JPanel bpmPanel = new JPanel(new GridLayout(2, 1)); + bpmPanel.add(beatBar); + bpmPanel.add(bpmOutputLabel); + viewPanel.add(bpmPanel); + viewFrame.getContentPane().add(viewPanel, BorderLayout.CENTER); + viewFrame.pack(); + viewFrame.setVisible(true); + } + + + public void createControls() { + // Create all Swing components here + JFrame.setDefaultLookAndFeelDecorated(true); + controlFrame = new JFrame("Control"); + controlFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + controlFrame.setSize(new Dimension(100, 80)); + + controlPanel = new JPanel(new GridLayout(1, 2)); + + menuBar = new JMenuBar(); + menu = new JMenu("DJ Control"); + startMenuItem = new JMenuItem("Start"); + menu.add(startMenuItem); + startMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + controller.start(); + } + }); + stopMenuItem = new JMenuItem("Stop"); + menu.add(stopMenuItem); + stopMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + controller.stop(); + } + }); + JMenuItem exit = new JMenuItem("Quit"); + exit.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + System.exit(0); + } + }); + + menu.add(exit); + menuBar.add(menu); + controlFrame.setJMenuBar(menuBar); + + bpmTextField = new JTextField(2); + bpmLabel = new JLabel("Enter BPM:", SwingConstants.RIGHT); + setBPMButton = new JButton("Set"); + setBPMButton.setSize(new Dimension(10,40)); + increaseBPMButton = new JButton(">>"); + decreaseBPMButton = new JButton("<<"); + setBPMButton.addActionListener(this); + increaseBPMButton.addActionListener(this); + decreaseBPMButton.addActionListener(this); + + JPanel buttonPanel = new JPanel(new GridLayout(1, 2)); + + buttonPanel.add(decreaseBPMButton); + buttonPanel.add(increaseBPMButton); + + JPanel enterPanel = new JPanel(new GridLayout(1, 2)); + enterPanel.add(bpmLabel); + enterPanel.add(bpmTextField); + JPanel insideControlPanel = new JPanel(new GridLayout(3, 1)); + insideControlPanel.add(enterPanel); + insideControlPanel.add(setBPMButton); + insideControlPanel.add(buttonPanel); + controlPanel.add(insideControlPanel); + + bpmLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); + bpmOutputLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); + + controlFrame.getRootPane().setDefaultButton(setBPMButton); + controlFrame.getContentPane().add(controlPanel, BorderLayout.CENTER); + + controlFrame.pack(); + controlFrame.setVisible(true); + } + + public void enableStopMenuItem() { + stopMenuItem.setEnabled(true); + } + + public void disableStopMenuItem() { + stopMenuItem.setEnabled(false); + } + + public void enableStartMenuItem() { + startMenuItem.setEnabled(true); + } + + public void disableStartMenuItem() { + startMenuItem.setEnabled(false); + } + + public void actionPerformed(ActionEvent event) { + if (event.getSource() == setBPMButton) { + int bpm = Integer.parseInt(bpmTextField.getText()); + controller.setBPM(bpm); + } else if (event.getSource() == increaseBPMButton) { + controller.increaseBPM(); + } else if (event.getSource() == decreaseBPMButton) { + controller.decreaseBPM(); + } + } + + public void updateBPM() { + if (model != null) { + int bpm = model.getBPM(); + if (bpm == 0) { + if (bpmOutputLabel != null) { + bpmOutputLabel.setText("offline"); + } + } else { + if (bpmOutputLabel != null) { + bpmOutputLabel.setText("Current BPM: " + model.getBPM()); + } + } + } + } + + public void updateBeat() { + if (beatBar != null) { + beatBar.setValue(100); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/HeartAdapter.java b/src/main/java/com/bootdo/headFirst/combined/djview/HeartAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..ed11744e6540af1726792574dfad4c157f33dc50 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/HeartAdapter.java @@ -0,0 +1,37 @@ +package com.bootdo.headFirst.combined.djview; + +public class HeartAdapter implements BeatModelInterface { + HeartModelInterface heart; + + public HeartAdapter(HeartModelInterface heart) { + this.heart = heart; + } + + public void initialize() {} + + public void on() {} + + public void off() {} + + public int getBPM() { + return heart.getHeartRate(); + } + + public void setBPM(int bpm) {} + + public void registerObserver(BeatObserver o) { + heart.registerObserver(o); + } + + public void removeObserver(BeatObserver o) { + heart.removeObserver(o); + } + + public void registerObserver(BPMObserver o) { + heart.registerObserver(o); + } + + public void removeObserver(BPMObserver o) { + heart.removeObserver(o); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/HeartController.java b/src/main/java/com/bootdo/headFirst/combined/djview/HeartController.java new file mode 100644 index 0000000000000000000000000000000000000000..325bf70a4fd6b8e32ec7a156d6560ddec69904fe --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/HeartController.java @@ -0,0 +1,28 @@ +package com.bootdo.headFirst.combined.djview; + +public class HeartController implements ControllerInterface { + HeartModelInterface model; + DJView view; + + public HeartController(HeartModelInterface model) { + this.model = model; + view = new DJView(this, new HeartAdapter(model)); + view.createView(); + view.createControls(); + view.disableStopMenuItem(); + view.disableStartMenuItem(); + } + + public void start() {} + + public void stop() {} + + public void increaseBPM() {} + + public void decreaseBPM() {} + + public void setBPM(int bpm) {} +} + + + diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/HeartModel.java b/src/main/java/com/bootdo/headFirst/combined/djview/HeartModel.java new file mode 100644 index 0000000000000000000000000000000000000000..11675164c54b636c768f79d95e1277741443f7da --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/HeartModel.java @@ -0,0 +1,79 @@ +package com.bootdo.headFirst.combined.djview; + +import java.util.*; + +public class HeartModel implements HeartModelInterface, Runnable { + ArrayList beatObservers = new ArrayList(); + ArrayList bpmObservers = new ArrayList(); + int time = 1000; + int bpm = 90; + Random random = new Random(System.currentTimeMillis()); + Thread thread; + + public HeartModel() { + thread = new Thread(this); + thread.start(); + } + + public void run() { + int lastrate = -1; + + for(;;) { + int change = random.nextInt(10); + if (random.nextInt(2) == 0) { + change = 0 - change; + } + int rate = 60000/(time + change); + if (rate < 120 && rate > 50) { + time += change; + notifyBeatObservers(); + if (rate != lastrate) { + lastrate = rate; + notifyBPMObservers(); + } + } + try { + Thread.sleep(time); + } catch (Exception e) {} + } + } + public int getHeartRate() { + return 60000/time; + } + + public void registerObserver(BeatObserver o) { + beatObservers.add(o); + } + + public void removeObserver(BeatObserver o) { + int i = beatObservers.indexOf(o); + if (i >= 0) { + beatObservers.remove(i); + } + } + + public void notifyBeatObservers() { + for(int i = 0; i < beatObservers.size(); i++) { + BeatObserver observer = (BeatObserver)beatObservers.get(i); + observer.updateBeat(); + } + } + + public void registerObserver(BPMObserver o) { + bpmObservers.add(o); + } + + public void removeObserver(BPMObserver o) { + int i = bpmObservers.indexOf(o); + if (i >= 0) { + bpmObservers.remove(i); + } + } + + public void notifyBPMObservers() { + for(int i = 0; i < bpmObservers.size(); i++) { + BPMObserver observer = (BPMObserver)bpmObservers.get(i); + observer.updateBPM(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/HeartModelInterface.java b/src/main/java/com/bootdo/headFirst/combined/djview/HeartModelInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..a394524e78eb20bb712823c7be2b8a92dd18d21e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/HeartModelInterface.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.combined.djview; + +public interface HeartModelInterface { + int getHeartRate(); + void registerObserver(BeatObserver o); + void removeObserver(BeatObserver o); + void registerObserver(BPMObserver o); + void removeObserver(BPMObserver o); +} diff --git a/src/main/java/com/bootdo/headFirst/combined/djview/HeartTestDrive.java b/src/main/java/com/bootdo/headFirst/combined/djview/HeartTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..6a211b70831eea3798aaf94e4f12dc20000236fd --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combined/djview/HeartTestDrive.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.combined.djview; + +public class HeartTestDrive { + + public static void main (String[] args) { + HeartModel heartModel = new HeartModel(); + ControllerInterface model = new HeartController(heartModel); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/adapter/DecoyDuck.java b/src/main/java/com/bootdo/headFirst/combining/adapter/DecoyDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..028c49843f215aec7cb64a39347589a9b839749c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/adapter/DecoyDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.adapter; + +public class DecoyDuck implements Quackable { + public void quack() { + System.out.println("<< Silence >>"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/adapter/DuckCall.java b/src/main/java/com/bootdo/headFirst/combining/adapter/DuckCall.java new file mode 100644 index 0000000000000000000000000000000000000000..7d2c000eecf370596e1cf9e65a259aded12f39da --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/adapter/DuckCall.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.adapter; + +public class DuckCall implements Quackable { + public void quack() { + System.out.println("Kwak"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/adapter/DuckSimulator.java b/src/main/java/com/bootdo/headFirst/combining/adapter/DuckSimulator.java new file mode 100644 index 0000000000000000000000000000000000000000..be9f1a2bab9bf89282055ffb1677a1b916faaca5 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/adapter/DuckSimulator.java @@ -0,0 +1,28 @@ +package com.bootdo.headFirst.combining.adapter; + +public class DuckSimulator { + public static void main(String[] args) { + DuckSimulator simulator = new DuckSimulator(); + simulator.simulate(); + } + + void simulate() { + Quackable mallardDuck = new MallardDuck(); + Quackable redheadDuck = new RedheadDuck(); + Quackable duckCall = new DuckCall(); + Quackable rubberDuck = new RubberDuck(); + Quackable gooseDuck = new GooseAdapter(new Goose()); + + System.out.println("\nDuck Simulator: With Goose Adapter"); + + simulate(mallardDuck); + simulate(redheadDuck); + simulate(duckCall); + simulate(rubberDuck); + simulate(gooseDuck); + } + + void simulate(Quackable duck) { + duck.quack(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/adapter/Goose.java b/src/main/java/com/bootdo/headFirst/combining/adapter/Goose.java new file mode 100644 index 0000000000000000000000000000000000000000..1c4f4917095e6fe92b96445bc52077128b8bd4e4 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/adapter/Goose.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.adapter; + +public class Goose { + public void honk() { + System.out.println("Honk"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/adapter/GooseAdapter.java b/src/main/java/com/bootdo/headFirst/combining/adapter/GooseAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..84c2a56b55f5097b2846af8d2f249f93cb6682a2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/adapter/GooseAdapter.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.combining.adapter; + +public class GooseAdapter implements Quackable { + Goose goose; + + public GooseAdapter(Goose goose) { + this.goose = goose; + } + + public void quack() { + goose.honk(); + } + + public String toString() { + return "Goose pretending to be a Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/adapter/MallardDuck.java b/src/main/java/com/bootdo/headFirst/combining/adapter/MallardDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..5b18e8be2ecee9760f21f5d74eb0d4e1303de2f6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/adapter/MallardDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.adapter; + +public class MallardDuck implements Quackable { + public void quack() { + System.out.println("Quack"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/adapter/Quackable.java b/src/main/java/com/bootdo/headFirst/combining/adapter/Quackable.java new file mode 100644 index 0000000000000000000000000000000000000000..539c13e08e11fabbe602b4ae1ad446edd391c227 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/adapter/Quackable.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.combining.adapter; + +public interface Quackable { + public void quack(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/adapter/RedheadDuck.java b/src/main/java/com/bootdo/headFirst/combining/adapter/RedheadDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..4ece7f11c412856a1b5e66a9d0c04054b9103c56 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/adapter/RedheadDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.adapter; + +public class RedheadDuck implements Quackable { + public void quack() { + System.out.println("Quack"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/adapter/RubberDuck.java b/src/main/java/com/bootdo/headFirst/combining/adapter/RubberDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..11afb1e5e4e047266271e45cdf2f21e7ba10a639 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/adapter/RubberDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.adapter; + +public class RubberDuck implements Quackable { + public void quack() { + System.out.println("Squeak"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/AbstractDuckFactory.java b/src/main/java/com/bootdo/headFirst/combining/composite/AbstractDuckFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..0456d6855db7ea12fb875149a60509d71a3c44bf --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/AbstractDuckFactory.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.combining.composite; + +public abstract class AbstractDuckFactory { + + public abstract Quackable createMallardDuck(); + public abstract Quackable createRedheadDuck(); + public abstract Quackable createDuckCall(); + public abstract Quackable createRubberDuck(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/CountingDuckFactory.java b/src/main/java/com/bootdo/headFirst/combining/composite/CountingDuckFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..c18e31c73768e3332ff58b11e4977749355ed1e0 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/CountingDuckFactory.java @@ -0,0 +1,20 @@ +package com.bootdo.headFirst.combining.composite; + +public class CountingDuckFactory extends AbstractDuckFactory { + + public Quackable createMallardDuck() { + return new QuackCounter(new MallardDuck()); + } + + public Quackable createRedheadDuck() { + return new QuackCounter(new RedheadDuck()); + } + + public Quackable createDuckCall() { + return new QuackCounter(new DuckCall()); + } + + public Quackable createRubberDuck() { + return new QuackCounter(new RubberDuck()); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/DecoyDuck.java b/src/main/java/com/bootdo/headFirst/combining/composite/DecoyDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..8958a314b48da00777f557ecc5770f53ee624d61 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/DecoyDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.composite; + +public class DecoyDuck implements Quackable { + + public void quack() { + System.out.println("<< Silence >>"); + } + + public String toString() { + return "Decoy Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/DuckCall.java b/src/main/java/com/bootdo/headFirst/combining/composite/DuckCall.java new file mode 100644 index 0000000000000000000000000000000000000000..ceb4b8d9e913f303e332d711de16b619cf525452 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/DuckCall.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.composite; + +public class DuckCall implements Quackable { + + public void quack() { + System.out.println("Kwak"); + } + + public String toString() { + return "Duck Call"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/DuckFactory.java b/src/main/java/com/bootdo/headFirst/combining/composite/DuckFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..e3de415c70b804c6cf35737c035ff4a6042c74c7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/DuckFactory.java @@ -0,0 +1,20 @@ +package com.bootdo.headFirst.combining.composite; + +public class DuckFactory extends AbstractDuckFactory { + + public Quackable createMallardDuck() { + return new MallardDuck(); + } + + public Quackable createRedheadDuck() { + return new RedheadDuck(); + } + + public Quackable createDuckCall() { + return new DuckCall(); + } + + public Quackable createRubberDuck() { + return new RubberDuck(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/DuckSimulator.java b/src/main/java/com/bootdo/headFirst/combining/composite/DuckSimulator.java new file mode 100644 index 0000000000000000000000000000000000000000..b60dc81d470e158b6a1e1e335064db9e03d07df0 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/DuckSimulator.java @@ -0,0 +1,55 @@ +package com.bootdo.headFirst.combining.composite; + +public class DuckSimulator { + + public static void main(String[] args) { + DuckSimulator simulator = new DuckSimulator(); + AbstractDuckFactory duckFactory = new CountingDuckFactory(); + + simulator.simulate(duckFactory); + } + + void simulate(AbstractDuckFactory duckFactory) { + Quackable redheadDuck = duckFactory.createRedheadDuck(); + Quackable duckCall = duckFactory.createDuckCall(); + Quackable rubberDuck = duckFactory.createRubberDuck(); + Quackable gooseDuck = new GooseAdapter(new Goose()); + + System.out.println("\nDuck Simulator: With Composite - Flocks"); + + Flock flockOfDucks = new Flock(); + + flockOfDucks.add(redheadDuck); + flockOfDucks.add(duckCall); + flockOfDucks.add(rubberDuck); + flockOfDucks.add(gooseDuck); + + Flock flockOfMallards = new Flock(); + + Quackable mallardOne = duckFactory.createMallardDuck(); + Quackable mallardTwo = duckFactory.createMallardDuck(); + Quackable mallardThree = duckFactory.createMallardDuck(); + Quackable mallardFour = duckFactory.createMallardDuck(); + + flockOfMallards.add(mallardOne); + flockOfMallards.add(mallardTwo); + flockOfMallards.add(mallardThree); + flockOfMallards.add(mallardFour); + + flockOfDucks.add(flockOfMallards); + + System.out.println("\nDuck Simulator: Whole Flock Simulation"); + simulate(flockOfDucks); + + System.out.println("\nDuck Simulator: Mallard Flock Simulation"); + simulate(flockOfMallards); + + System.out.println("\nThe ducks quacked " + + QuackCounter.getQuacks() + + " times"); + } + + void simulate(Quackable duck) { + duck.quack(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/Flock.java b/src/main/java/com/bootdo/headFirst/combining/composite/Flock.java new file mode 100644 index 0000000000000000000000000000000000000000..5004fb637eabdccaac9fcc8bc3701446072e1cae --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/Flock.java @@ -0,0 +1,24 @@ +package com.bootdo.headFirst.combining.composite; + +import java.util.Iterator; +import java.util.ArrayList; + +public class Flock implements Quackable { + ArrayList quackers = new ArrayList(); + + public void add(Quackable quacker) { + quackers.add(quacker); + } + + public void quack() { + Iterator iterator = quackers.iterator(); + while (iterator.hasNext()) { + Quackable quacker = (Quackable)iterator.next(); + quacker.quack(); + } + } + + public String toString() { + return "Flock of Quackers"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/Goose.java b/src/main/java/com/bootdo/headFirst/combining/composite/Goose.java new file mode 100644 index 0000000000000000000000000000000000000000..e86d36a517a8a08d3c2d1df29c27a02f22ca2153 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/Goose.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.combining.composite; + +public class Goose { + public void honk() { + System.out.println("Honk"); + } + + public String toString() { + return "Goose"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/GooseAdapter.java b/src/main/java/com/bootdo/headFirst/combining/composite/GooseAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..7219f1558e746dd9db12f6274483b465cb812b91 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/GooseAdapter.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.combining.composite; + +public class GooseAdapter implements Quackable { + Goose goose; + + public GooseAdapter(Goose goose) { + this.goose = goose; + } + + public void quack() { + goose.honk(); + } + + public String toString() { + return "Goose pretending to be a Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/MallardDuck.java b/src/main/java/com/bootdo/headFirst/combining/composite/MallardDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..8a85e298d0ee8862d9604d31fc4193183125fb17 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/MallardDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.composite; + +public class MallardDuck implements Quackable { + + public void quack() { + System.out.println("Quack"); + } + + public String toString() { + return "Mallard Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/QuackCounter.java b/src/main/java/com/bootdo/headFirst/combining/composite/QuackCounter.java new file mode 100644 index 0000000000000000000000000000000000000000..8911376c594f8d8e60f0d559800a0144dadf1a81 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/QuackCounter.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.combining.composite; + +public class QuackCounter implements Quackable { + Quackable duck; + static int numberOfQuacks; + + public QuackCounter(Quackable duck) { + this.duck = duck; + } + + public void quack() { + duck.quack(); + numberOfQuacks++; + } + + public static int getQuacks() { + return numberOfQuacks; + } + + public String toString() { + return duck.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/Quackable.java b/src/main/java/com/bootdo/headFirst/combining/composite/Quackable.java new file mode 100644 index 0000000000000000000000000000000000000000..ebfb650913a7684fee3e93926a78e58324e8204f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/Quackable.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.combining.composite; + +public interface Quackable { + public void quack(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/RedheadDuck.java b/src/main/java/com/bootdo/headFirst/combining/composite/RedheadDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..72729bf3058801d7d780752f417049967f0bca5b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/RedheadDuck.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.combining.composite; + +public class RedheadDuck implements Quackable { + public void quack() { + System.out.println("Quack"); + } + + public String toString() { + return "Redhead Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/composite/RubberDuck.java b/src/main/java/com/bootdo/headFirst/combining/composite/RubberDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..ef8dc26fe1217507d3fcf31bbb0b871db5c4da66 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/composite/RubberDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.composite; + +public class RubberDuck implements Quackable { + + public void quack() { + System.out.println("Squeak"); + } + + public String toString() { + return "Rubber Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/DecoyDuck.java b/src/main/java/com/bootdo/headFirst/combining/decorator/DecoyDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..e0acad2cda8a0de8dc773a4e5a740ade2159e595 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/DecoyDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.decorator; + +public class DecoyDuck implements Quackable { + + public void quack() { + System.out.println("<< Silence >>"); + } + + public String toString() { + return "Decoy Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/DuckCall.java b/src/main/java/com/bootdo/headFirst/combining/decorator/DuckCall.java new file mode 100644 index 0000000000000000000000000000000000000000..6237ef7330677ec88fac2655789649347b57629f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/DuckCall.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.decorator; + +public class DuckCall implements Quackable { + + public void quack() { + System.out.println("Kwak"); + } + + public String toString() { + return "Duck Call"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/DuckSimulator.java b/src/main/java/com/bootdo/headFirst/combining/decorator/DuckSimulator.java new file mode 100644 index 0000000000000000000000000000000000000000..f6f828f7d133b5a5cca78f254ce43f7a8e7a8277 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/DuckSimulator.java @@ -0,0 +1,31 @@ +package com.bootdo.headFirst.combining.decorator; + +public class DuckSimulator { + public static void main(String[] args) { + DuckSimulator simulator = new DuckSimulator(); + simulator.simulate(); + } + + void simulate() { + Quackable mallardDuck = new QuackCounter(new MallardDuck()); + Quackable redheadDuck = new QuackCounter(new RedheadDuck()); + Quackable duckCall = new QuackCounter(new DuckCall()); + Quackable rubberDuck = new QuackCounter(new RubberDuck()); + Quackable gooseDuck = new GooseAdapter(new Goose()); + + System.out.println("\nDuck Simulator: With Decorator"); + + simulate(mallardDuck); + simulate(redheadDuck); + simulate(duckCall); + simulate(rubberDuck); + simulate(gooseDuck); + + System.out.println("The ducks quacked " + + QuackCounter.getQuacks() + " times"); + } + + void simulate(Quackable duck) { + duck.quack(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/Goose.java b/src/main/java/com/bootdo/headFirst/combining/decorator/Goose.java new file mode 100644 index 0000000000000000000000000000000000000000..2d32e8b9c20d44727c66ef4a68fe5e69657db0c7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/Goose.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.combining.decorator; + +public class Goose { + public void honk() { + System.out.println("Honk"); + } + + public String toString() { + return "Goose"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/GooseAdapter.java b/src/main/java/com/bootdo/headFirst/combining/decorator/GooseAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..8395d738956622c3d6420c561ae1df801235766c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/GooseAdapter.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.combining.decorator; + +public class GooseAdapter implements Quackable { + Goose goose; + + public GooseAdapter(Goose goose) { + this.goose = goose; + } + + public void quack() { + goose.honk(); + } + + public String toString() { + return "Goose pretending to be a Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/MallardDuck.java b/src/main/java/com/bootdo/headFirst/combining/decorator/MallardDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..9d8d90d5ed0472902208c2e6c23291052fb18438 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/MallardDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.decorator; + +public class MallardDuck implements Quackable { + + public void quack() { + System.out.println("Quack"); + } + + public String toString() { + return "Mallard Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/QuackCounter.java b/src/main/java/com/bootdo/headFirst/combining/decorator/QuackCounter.java new file mode 100644 index 0000000000000000000000000000000000000000..a97c1ff4ad78a2c7057e0ee67207b1170a97bd32 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/QuackCounter.java @@ -0,0 +1,22 @@ +package com.bootdo.headFirst.combining.decorator; + +public class QuackCounter implements Quackable { + Quackable duck; + static int numberOfQuacks; + + public QuackCounter (Quackable duck) { + this.duck = duck; + } + + public void quack() { + duck.quack(); + numberOfQuacks++; + } + + public static int getQuacks() { + return numberOfQuacks; + } + public String toString() { + return duck.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/Quackable.java b/src/main/java/com/bootdo/headFirst/combining/decorator/Quackable.java new file mode 100644 index 0000000000000000000000000000000000000000..f8bda1c8e1b25a6f287250fa0104c9e6c075e8ae --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/Quackable.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.combining.decorator; + +public interface Quackable { + public void quack(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/RedheadDuck.java b/src/main/java/com/bootdo/headFirst/combining/decorator/RedheadDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..637bb69553cd37f2eb7e226b8165a8afd6521e6a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/RedheadDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.decorator; + +public class RedheadDuck implements Quackable { + public void quack() { + System.out.println("Quack"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/decorator/RubberDuck.java b/src/main/java/com/bootdo/headFirst/combining/decorator/RubberDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..b2d8bd2d1a6c6b1288095df1cd315cbd4d458a60 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/decorator/RubberDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.decorator; + +public class RubberDuck implements Quackable { + + public void quack() { + System.out.println("Squeak"); + } + + public String toString() { + return "Rubber Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/ducks/DecoyDuck.java b/src/main/java/com/bootdo/headFirst/combining/ducks/DecoyDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..164229aabc1c44cce31f0f501c0dc39ea4207bac --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/ducks/DecoyDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.ducks; + +public class DecoyDuck implements Quackable { + public void quack() { + System.out.println("<< Silence >>"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/ducks/DuckCall.java b/src/main/java/com/bootdo/headFirst/combining/ducks/DuckCall.java new file mode 100644 index 0000000000000000000000000000000000000000..df9815bf7b52527b949a927fb452cf3dbd189257 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/ducks/DuckCall.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.ducks; + +public class DuckCall implements Quackable { + public void quack() { + System.out.println("Kwak"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/ducks/DuckSimulator.java b/src/main/java/com/bootdo/headFirst/combining/ducks/DuckSimulator.java new file mode 100644 index 0000000000000000000000000000000000000000..b0303edab388ede84457b247c5973d873ed4b474 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/ducks/DuckSimulator.java @@ -0,0 +1,26 @@ +package com.bootdo.headFirst.combining.ducks; + +public class DuckSimulator { + public static void main(String[] args) { + DuckSimulator simulator = new DuckSimulator(); + simulator.simulate(); + } + + void simulate() { + Quackable mallardDuck = new MallardDuck(); + Quackable redheadDuck = new RedheadDuck(); + Quackable duckCall = new DuckCall(); + Quackable rubberDuck = new RubberDuck(); + + System.out.println("\nDuck Simulator"); + + simulate(mallardDuck); + simulate(redheadDuck); + simulate(duckCall); + simulate(rubberDuck); + } + + void simulate(Quackable duck) { + duck.quack(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/ducks/MallardDuck.java b/src/main/java/com/bootdo/headFirst/combining/ducks/MallardDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..dd8b552e1b23ea03a94ba892ddc35d9c64743b6f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/ducks/MallardDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.ducks; + +public class MallardDuck implements Quackable { + public void quack() { + System.out.println("Quack"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/ducks/Quackable.java b/src/main/java/com/bootdo/headFirst/combining/ducks/Quackable.java new file mode 100644 index 0000000000000000000000000000000000000000..53b9f9a10c6f4e49ff84c9e2e87de482f2e20d0f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/ducks/Quackable.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.combining.ducks; + +public interface Quackable { + public void quack(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/ducks/RedheadDuck.java b/src/main/java/com/bootdo/headFirst/combining/ducks/RedheadDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..d3ff47417c2a29f2b65d767f5e11d96334a41893 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/ducks/RedheadDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.ducks; + +public class RedheadDuck implements Quackable { + public void quack() { + System.out.println("Quack"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/ducks/RubberDuck.java b/src/main/java/com/bootdo/headFirst/combining/ducks/RubberDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..2e44d026f1bbf2063e8198a219a129504fe955b1 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/ducks/RubberDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.ducks; + +public class RubberDuck implements Quackable { + public void quack() { + System.out.println("Squeak"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/AbstractDuckFactory.java b/src/main/java/com/bootdo/headFirst/combining/factory/AbstractDuckFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..817ce478976d78764bb9e1246de80cfd449c28be --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/AbstractDuckFactory.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.combining.factory; + +public abstract class AbstractDuckFactory { + + public abstract Quackable createMallardDuck(); + public abstract Quackable createRedheadDuck(); + public abstract Quackable createDuckCall(); + public abstract Quackable createRubberDuck(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/CountingDuckFactory.java b/src/main/java/com/bootdo/headFirst/combining/factory/CountingDuckFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..63cafc100ed85211429f3ac88486ab4a0fbf078c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/CountingDuckFactory.java @@ -0,0 +1,20 @@ +package com.bootdo.headFirst.combining.factory; + +public class CountingDuckFactory extends AbstractDuckFactory { + + public Quackable createMallardDuck() { + return new QuackCounter(new MallardDuck()); + } + + public Quackable createRedheadDuck() { + return new QuackCounter(new RedheadDuck()); + } + + public Quackable createDuckCall() { + return new QuackCounter(new DuckCall()); + } + + public Quackable createRubberDuck() { + return new QuackCounter(new RubberDuck()); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/DecoyDuck.java b/src/main/java/com/bootdo/headFirst/combining/factory/DecoyDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..d70e382f3e2ef9e8588630bd8e3a2017237855a3 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/DecoyDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.factory; + +public class DecoyDuck implements Quackable { + + public void quack() { + System.out.println("<< Silence >>"); + } + + public String toString() { + return "Decoy Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/DuckCall.java b/src/main/java/com/bootdo/headFirst/combining/factory/DuckCall.java new file mode 100644 index 0000000000000000000000000000000000000000..d2deade286cadba5f945466fa03852a723523fb5 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/DuckCall.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.factory; + +public class DuckCall implements Quackable { + + public void quack() { + System.out.println("Kwak"); + } + + public String toString() { + return "Duck Call"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/DuckFactory.java b/src/main/java/com/bootdo/headFirst/combining/factory/DuckFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..24c239f5718a3b32e62963da8ac455785965dcbc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/DuckFactory.java @@ -0,0 +1,20 @@ +package com.bootdo.headFirst.combining.factory; + +public class DuckFactory extends AbstractDuckFactory { + + public Quackable createMallardDuck() { + return new MallardDuck(); + } + + public Quackable createRedheadDuck() { + return new RedheadDuck(); + } + + public Quackable createDuckCall() { + return new DuckCall(); + } + + public Quackable createRubberDuck() { + return new RubberDuck(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/DuckSimulator.java b/src/main/java/com/bootdo/headFirst/combining/factory/DuckSimulator.java new file mode 100644 index 0000000000000000000000000000000000000000..489465d9aad6ffa5562bc64992bfafdae2b69415 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/DuckSimulator.java @@ -0,0 +1,34 @@ +package com.bootdo.headFirst.combining.factory; + +public class DuckSimulator { + public static void main(String[] args) { + DuckSimulator simulator = new DuckSimulator(); + AbstractDuckFactory duckFactory = new CountingDuckFactory(); + + simulator.simulate(duckFactory); + } + + void simulate(AbstractDuckFactory duckFactory) { + Quackable mallardDuck = duckFactory.createMallardDuck(); + Quackable redheadDuck = duckFactory.createRedheadDuck(); + Quackable duckCall = duckFactory.createDuckCall(); + Quackable rubberDuck = duckFactory.createRubberDuck(); + Quackable gooseDuck = new GooseAdapter(new Goose()); + + System.out.println("\nDuck Simulator: With Abstract Factory"); + + simulate(mallardDuck); + simulate(redheadDuck); + simulate(duckCall); + simulate(rubberDuck); + simulate(gooseDuck); + + System.out.println("The ducks quacked " + + QuackCounter.getQuacks() + + " times"); + } + + void simulate(Quackable duck) { + duck.quack(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/Goose.java b/src/main/java/com/bootdo/headFirst/combining/factory/Goose.java new file mode 100644 index 0000000000000000000000000000000000000000..2bec65003b06219a6cc404ef667a8e37cdfec573 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/Goose.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.combining.factory; + +public class Goose { + public void honk() { + System.out.println("Honk"); + } + + public String toString() { + return "Goose"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/GooseAdapter.java b/src/main/java/com/bootdo/headFirst/combining/factory/GooseAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..9f166c07b4369797dec2d718f09daf363b85d3b8 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/GooseAdapter.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.combining.factory; + +public class GooseAdapter implements Quackable { + Goose goose; + + public GooseAdapter(Goose goose) { + this.goose = goose; + } + + public void quack() { + goose.honk(); + } + + public String toString() { + return "Goose pretending to be a Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/MallardDuck.java b/src/main/java/com/bootdo/headFirst/combining/factory/MallardDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..7bec78697c26c939b693b73b12784e5764e8a9cc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/MallardDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.factory; + +public class MallardDuck implements Quackable { + + public void quack() { + System.out.println("Quack"); + } + + public String toString() { + return "Mallard Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/QuackCounter.java b/src/main/java/com/bootdo/headFirst/combining/factory/QuackCounter.java new file mode 100644 index 0000000000000000000000000000000000000000..7a1777a52ac4ed3b493ea73b763e543778d324b8 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/QuackCounter.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.combining.factory; + +public class QuackCounter implements Quackable { + Quackable duck; + static int numberOfQuacks; + + public QuackCounter(Quackable duck) { + this.duck = duck; + } + + public void quack() { + duck.quack(); + numberOfQuacks++; + } + + public static int getQuacks() { + return numberOfQuacks; + } + + public String toString() { + return duck.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/Quackable.java b/src/main/java/com/bootdo/headFirst/combining/factory/Quackable.java new file mode 100644 index 0000000000000000000000000000000000000000..b7cdf3b0cefda75ba1c45be0da196dbafbc5e726 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/Quackable.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.combining.factory; + +public interface Quackable { + public void quack(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/RedheadDuck.java b/src/main/java/com/bootdo/headFirst/combining/factory/RedheadDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..b391121b3004194283faf186efb2d0de8ea9e754 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/RedheadDuck.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.combining.factory; + +public class RedheadDuck implements Quackable { + public void quack() { + System.out.println("Quack"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/factory/RubberDuck.java b/src/main/java/com/bootdo/headFirst/combining/factory/RubberDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..1ffe2f66c39a8ee9bcfc2eb23cdfa13b4a90edf6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/factory/RubberDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.factory; + +public class RubberDuck implements Quackable { + + public void quack() { + System.out.println("Squeak"); + } + + public String toString() { + return "Rubber Duck"; + } +} diff --git a/bootdo/src/main/resources/static/js/plugins/.DS_Store b/src/main/java/com/bootdo/headFirst/combining/observer/.QuackDecorator.java.swp similarity index 58% rename from bootdo/src/main/resources/static/js/plugins/.DS_Store rename to src/main/java/com/bootdo/headFirst/combining/observer/.QuackDecorator.java.swp index a5b9778b7509389dc2cfc04fb57cd9aca2a099b2..873837cff6bb8e239ca064d97d0ad692b20b99f3 100644 Binary files a/bootdo/src/main/resources/static/js/plugins/.DS_Store and b/src/main/java/com/bootdo/headFirst/combining/observer/.QuackDecorator.java.swp differ diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/AbstractDuckFactory.java b/src/main/java/com/bootdo/headFirst/combining/observer/AbstractDuckFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..8a384e0301709a3cd2ad081d56076d3ec734e292 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/AbstractDuckFactory.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.combining.observer; + +public abstract class AbstractDuckFactory { + + public abstract Quackable createMallardDuck(); + public abstract Quackable createRedheadDuck(); + public abstract Quackable createDuckCall(); + public abstract Quackable createRubberDuck(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/CountingDuckFactory.java b/src/main/java/com/bootdo/headFirst/combining/observer/CountingDuckFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..e89fc0d17a514602518dcbd7381ebe2f3f81e69d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/CountingDuckFactory.java @@ -0,0 +1,20 @@ +package com.bootdo.headFirst.combining.observer; + +public class CountingDuckFactory extends AbstractDuckFactory { + + public Quackable createMallardDuck() { + return new QuackCounter(new MallardDuck()); + } + + public Quackable createRedheadDuck() { + return new QuackCounter(new RedheadDuck()); + } + + public Quackable createDuckCall() { + return new QuackCounter(new DuckCall()); + } + + public Quackable createRubberDuck() { + return new QuackCounter(new RubberDuck()); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/DecoyDuck.java b/src/main/java/com/bootdo/headFirst/combining/observer/DecoyDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..21f77e68fb3d010a77e56a519e8d57f53f60e906 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/DecoyDuck.java @@ -0,0 +1,26 @@ +package com.bootdo.headFirst.combining.observer; + +public class DecoyDuck implements Quackable { + Observable observable; + + public DecoyDuck() { + observable = new Observable(this); + } + + public void quack() { + System.out.println("<< Silence >>"); + notifyObservers(); + } + + public void registerObserver(Observer observer) { + observable.registerObserver(observer); + } + + public void notifyObservers() { + observable.notifyObservers(); + } + + public String toString() { + return "Decoy Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/DuckCall.java b/src/main/java/com/bootdo/headFirst/combining/observer/DuckCall.java new file mode 100644 index 0000000000000000000000000000000000000000..c237260af233042f5ef805911d120c2e7f17e4bd --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/DuckCall.java @@ -0,0 +1,26 @@ +package com.bootdo.headFirst.combining.observer; + +public class DuckCall implements Quackable { + Observable observable; + + public DuckCall() { + observable = new Observable(this); + } + + public void quack() { + System.out.println("Kwak"); + notifyObservers(); + } + + public void registerObserver(Observer observer) { + observable.registerObserver(observer); + } + + public void notifyObservers() { + observable.notifyObservers(); + } + + public String toString() { + return "Duck Call"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/DuckFactory.java b/src/main/java/com/bootdo/headFirst/combining/observer/DuckFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..6066205ffa5e0d27de7978fe1f5bb3248a5a7d10 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/DuckFactory.java @@ -0,0 +1,20 @@ +package com.bootdo.headFirst.combining.observer; + +public class DuckFactory extends AbstractDuckFactory { + + public Quackable createMallardDuck() { + return new MallardDuck(); + } + + public Quackable createRedheadDuck() { + return new RedheadDuck(); + } + + public Quackable createDuckCall() { + return new DuckCall(); + } + + public Quackable createRubberDuck() { + return new RubberDuck(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/DuckSimulator.java b/src/main/java/com/bootdo/headFirst/combining/observer/DuckSimulator.java new file mode 100644 index 0000000000000000000000000000000000000000..c18f762a4812a6aeeb75da0ed2b939e6f35914f7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/DuckSimulator.java @@ -0,0 +1,54 @@ +package com.bootdo.headFirst.combining.observer; + +public class DuckSimulator { + public static void main(String[] args) { + DuckSimulator simulator = new DuckSimulator(); + AbstractDuckFactory duckFactory = new CountingDuckFactory(); + + simulator.simulate(duckFactory); + } + + void simulate(AbstractDuckFactory duckFactory) { + + Quackable redheadDuck = duckFactory.createRedheadDuck(); + Quackable duckCall = duckFactory.createDuckCall(); + Quackable rubberDuck = duckFactory.createRubberDuck(); + Quackable gooseDuck = new GooseAdapter(new Goose()); + + Flock flockOfDucks = new Flock(); + + flockOfDucks.add(redheadDuck); + flockOfDucks.add(duckCall); + flockOfDucks.add(rubberDuck); + flockOfDucks.add(gooseDuck); + + Flock flockOfMallards = new Flock(); + + Quackable mallardOne = duckFactory.createMallardDuck(); + Quackable mallardTwo = duckFactory.createMallardDuck(); + Quackable mallardThree = duckFactory.createMallardDuck(); + Quackable mallardFour = duckFactory.createMallardDuck(); + + flockOfMallards.add(mallardOne); + flockOfMallards.add(mallardTwo); + flockOfMallards.add(mallardThree); + flockOfMallards.add(mallardFour); + + flockOfDucks.add(flockOfMallards); + + System.out.println("\nDuck Simulator: With Observer"); + + Quackologist quackologist = new Quackologist(); + flockOfDucks.registerObserver(quackologist); + + simulate(flockOfDucks); + + System.out.println("\nThe ducks quacked " + + QuackCounter.getQuacks() + + " times"); + } + + void simulate(Quackable duck) { + duck.quack(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/Flock.java b/src/main/java/com/bootdo/headFirst/combining/observer/Flock.java new file mode 100644 index 0000000000000000000000000000000000000000..288466e4c4afdbebb76469549050a7d2b292b011 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/Flock.java @@ -0,0 +1,34 @@ +package com.bootdo.headFirst.combining.observer; + +import java.util.Iterator; +import java.util.ArrayList; + +public class Flock implements Quackable { + ArrayList ducks = new ArrayList(); + + public void add(Quackable duck) { + ducks.add(duck); + } + + public void quack() { + Iterator iterator = ducks.iterator(); + while (iterator.hasNext()) { + Quackable duck = (Quackable)iterator.next(); + duck.quack(); + } + } + + public void registerObserver(Observer observer) { + Iterator iterator = ducks.iterator(); + while (iterator.hasNext()) { + Quackable duck = (Quackable)iterator.next(); + duck.registerObserver(observer); + } + } + + public void notifyObservers() { } + + public String toString() { + return "Flock of Ducks"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/Goose.java b/src/main/java/com/bootdo/headFirst/combining/observer/Goose.java new file mode 100644 index 0000000000000000000000000000000000000000..c8d471345e4b20d139b512eac3a76cee89fbfc0e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/Goose.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.observer; + +public class Goose { + + public void honk() { + System.out.println("Honk"); + } + + public String toString() { + return "Goose"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/GooseAdapter.java b/src/main/java/com/bootdo/headFirst/combining/observer/GooseAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..8910b8f374f4da69bcab4d039339ad5d6278697c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/GooseAdapter.java @@ -0,0 +1,28 @@ +package com.bootdo.headFirst.combining.observer; + +public class GooseAdapter implements Quackable { + Goose goose; + Observable observable; + + public GooseAdapter(Goose goose) { + this.goose = goose; + observable = new Observable(this); + } + + public void quack() { + goose.honk(); + notifyObservers(); + } + + public void registerObserver(Observer observer) { + observable.registerObserver(observer); + } + + public void notifyObservers() { + observable.notifyObservers(); + } + + public String toString() { + return "Goose pretending to be a Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/MallardDuck.java b/src/main/java/com/bootdo/headFirst/combining/observer/MallardDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..baac589b63b1f230ad09ae45589998265d1486a7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/MallardDuck.java @@ -0,0 +1,26 @@ +package com.bootdo.headFirst.combining.observer; + +public class MallardDuck implements Quackable { + Observable observable; + + public MallardDuck() { + observable = new Observable(this); + } + + public void quack() { + System.out.println("Quack"); + notifyObservers(); + } + + public void registerObserver(Observer observer) { + observable.registerObserver(observer); + } + + public void notifyObservers() { + observable.notifyObservers(); + } + + public String toString() { + return "Mallard Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/Observable.java b/src/main/java/com/bootdo/headFirst/combining/observer/Observable.java new file mode 100644 index 0000000000000000000000000000000000000000..ac4c58c5c0b4e0aaf40d14d3e30b6cc20c158b65 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/Observable.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.combining.observer; + +import java.util.Iterator; +import java.util.ArrayList; + +public class Observable implements QuackObservable { + ArrayList observers = new ArrayList(); + QuackObservable duck; + + public Observable(QuackObservable duck) { + this.duck = duck; + } + + public void registerObserver(Observer observer) { + observers.add(observer); + } + + public void notifyObservers() { + Iterator iterator = observers.iterator(); + while (iterator.hasNext()) { + Observer observer = (Observer)iterator.next(); + observer.update(duck); + } + } + + public Iterator getObservers() { + return observers.iterator(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/Observer.java b/src/main/java/com/bootdo/headFirst/combining/observer/Observer.java new file mode 100644 index 0000000000000000000000000000000000000000..e0b4b92f23b2adfc7c89825512603a1cf623c2ae --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/Observer.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.combining.observer; + +public interface Observer { + public void update(QuackObservable duck); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/QuackCounter.java b/src/main/java/com/bootdo/headFirst/combining/observer/QuackCounter.java new file mode 100644 index 0000000000000000000000000000000000000000..2bca455b9f07abc28a66e85e4cd36b2df1711537 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/QuackCounter.java @@ -0,0 +1,31 @@ +package com.bootdo.headFirst.combining.observer; + +public class QuackCounter implements Quackable { + Quackable duck; + static int numberOfQuacks; + + public QuackCounter(Quackable duck) { + this.duck = duck; + } + + public void quack() { + duck.quack(); + numberOfQuacks++; + } + + public static int getQuacks() { + return numberOfQuacks; + } + + public void registerObserver(Observer observer) { + duck.registerObserver(observer); + } + + public void notifyObservers() { + duck.notifyObservers(); + } + + public String toString() { + return duck.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/QuackObservable.java b/src/main/java/com/bootdo/headFirst/combining/observer/QuackObservable.java new file mode 100644 index 0000000000000000000000000000000000000000..fa447d1d2acd1b2ed1cd4c50b9a410c0a347b774 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/QuackObservable.java @@ -0,0 +1,6 @@ +package com.bootdo.headFirst.combining.observer; + +public interface QuackObservable { + public void registerObserver(Observer observer); + public void notifyObservers(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/Quackable.java b/src/main/java/com/bootdo/headFirst/combining/observer/Quackable.java new file mode 100644 index 0000000000000000000000000000000000000000..5fa58cabd6de7a5ca539de7cc9d636dce3b56578 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/Quackable.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.combining.observer; + +public interface Quackable extends QuackObservable { + public void quack(); +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/Quackologist.java b/src/main/java/com/bootdo/headFirst/combining/observer/Quackologist.java new file mode 100644 index 0000000000000000000000000000000000000000..eaabd5eff0046070caea1a8217f32a16f28b0e85 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/Quackologist.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.combining.observer; + +public class Quackologist implements Observer { + + public void update(QuackObservable duck) { + System.out.println("Quackologist: " + duck + " just quacked."); + } + + public String toString() { + return "Quackologist"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/RedheadDuck.java b/src/main/java/com/bootdo/headFirst/combining/observer/RedheadDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..00dec11c150274691f81eb0ea98e2a673b40c31c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/RedheadDuck.java @@ -0,0 +1,26 @@ +package com.bootdo.headFirst.combining.observer; + +public class RedheadDuck implements Quackable { + Observable observable; + + public RedheadDuck() { + observable = new Observable(this); + } + + public void quack() { + System.out.println("Quack"); + notifyObservers(); + } + + public void registerObserver(Observer observer) { + observable.registerObserver(observer); + } + + public void notifyObservers() { + observable.notifyObservers(); + } + + public String toString() { + return "Redhead Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/combining/observer/RubberDuck.java b/src/main/java/com/bootdo/headFirst/combining/observer/RubberDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..5c28f337f5d28f58ee10f309b0b9dbe592d830ca --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/combining/observer/RubberDuck.java @@ -0,0 +1,26 @@ +package com.bootdo.headFirst.combining.observer; + +public class RubberDuck implements Quackable { + Observable observable; + + public RubberDuck() { + observable = new Observable(this); + } + + public void quack() { + System.out.println("Squeak"); + notifyObservers(); + } + + public void registerObserver(Observer observer) { + observable.registerObserver(observer); + } + + public void notifyObservers() { + observable.notifyObservers(); + } + + public String toString() { + return "Rubber Duck"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/CeilingFan.java b/src/main/java/com/bootdo/headFirst/command/party/CeilingFan.java new file mode 100644 index 0000000000000000000000000000000000000000..c564590d8be063bd0539ce22a1ebac32a10fdd45 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/CeilingFan.java @@ -0,0 +1,42 @@ +package com.bootdo.headFirst.command.party; + +public class CeilingFan { + public static final int HIGH = 3; + public static final int MEDIUM = 2; + public static final int LOW = 1; + public static final int OFF = 0; + String location; + int speed; + + public CeilingFan(String location) { + this.location = location; + } + + public void high() { + // turns the ceiling fan on to high + speed = HIGH; + System.out.println(location + " ceiling fan is on high"); + } + + public void medium() { + // turns the ceiling fan on to medium + speed = MEDIUM; + System.out.println(location + " ceiling fan is on medium"); + } + + public void low() { + // turns the ceiling fan on to low + speed = LOW; + System.out.println(location + " ceiling fan is on low"); + } + + public void off() { + // turns the ceiling fan off + speed = OFF; + System.out.println(location + " ceiling fan is off"); + } + + public int getSpeed() { + return speed; + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/CeilingFanHighCommand.java b/src/main/java/com/bootdo/headFirst/command/party/CeilingFanHighCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..4d6897f8d5cae984ed90e12ed21b3d2d06db37c2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/CeilingFanHighCommand.java @@ -0,0 +1,22 @@ +package com.bootdo.headFirst.command.party; + +public class CeilingFanHighCommand implements Command { + CeilingFan ceilingFan; + int prevSpeed; + + public CeilingFanHighCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + public void execute() { + prevSpeed = ceilingFan.getSpeed(); + ceilingFan.high(); + } + public void undo() { + switch (prevSpeed) { + case CeilingFan.HIGH: ceilingFan.high(); break; + case CeilingFan.MEDIUM: ceilingFan.medium(); break; + case CeilingFan.LOW: ceilingFan.low(); break; + default: ceilingFan.off(); break; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/CeilingFanMediumCommand.java b/src/main/java/com/bootdo/headFirst/command/party/CeilingFanMediumCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..b9ec24760bb478d879c24e3a0342edee9ca41777 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/CeilingFanMediumCommand.java @@ -0,0 +1,22 @@ +package com.bootdo.headFirst.command.party; + +public class CeilingFanMediumCommand implements Command { + CeilingFan ceilingFan; + int prevSpeed; + + public CeilingFanMediumCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + public void execute() { + prevSpeed = ceilingFan.getSpeed(); + ceilingFan.medium(); + } + public void undo() { + switch (prevSpeed) { + case CeilingFan.HIGH: ceilingFan.high(); break; + case CeilingFan.MEDIUM: ceilingFan.medium(); break; + case CeilingFan.LOW: ceilingFan.low(); break; + default: ceilingFan.off(); break; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/CeilingFanOffCommand.java b/src/main/java/com/bootdo/headFirst/command/party/CeilingFanOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..1bebd71f4e4b3ea34a66256ba849cd46da88fd8e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/CeilingFanOffCommand.java @@ -0,0 +1,22 @@ +package com.bootdo.headFirst.command.party; + +public class CeilingFanOffCommand implements Command { + CeilingFan ceilingFan; + int prevSpeed; + + public CeilingFanOffCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + public void execute() { + prevSpeed = ceilingFan.getSpeed(); + ceilingFan.off(); + } + public void undo() { + switch (prevSpeed) { + case CeilingFan.HIGH: ceilingFan.high(); break; + case CeilingFan.MEDIUM: ceilingFan.medium(); break; + case CeilingFan.LOW: ceilingFan.low(); break; + default: ceilingFan.off(); break; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/Command.java b/src/main/java/com/bootdo/headFirst/command/party/Command.java new file mode 100644 index 0000000000000000000000000000000000000000..4dd73477c3a2adcbc70c6f38855a5bc70af66a49 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/Command.java @@ -0,0 +1,6 @@ +package com.bootdo.headFirst.command.party; + +public interface Command { + public void execute(); + public void undo(); +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/Hottub.java b/src/main/java/com/bootdo/headFirst/command/party/Hottub.java new file mode 100644 index 0000000000000000000000000000000000000000..608e5fada16aa74f1da39bd53f3525f453b99b13 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/Hottub.java @@ -0,0 +1,45 @@ +package com.bootdo.headFirst.command.party; + +public class Hottub { + boolean on; + int temperature; + + public Hottub() { + } + + public void on() { + on = true; + } + + public void off() { + on = false; + } + + public void circulate() { + if (on) { + System.out.println("Hottub is bubbling!"); + } + } + + public void jetsOn() { + if (on) { + System.out.println("Hottub jets are on"); + } + } + + public void jetsOff() { + if (on) { + System.out.println("Hottub jets are off"); + } + } + + public void setTemperature(int temperature) { + if (temperature > this.temperature) { + System.out.println("Hottub is heating to a steaming " + temperature + " degrees"); + } + else { + System.out.println("Hottub is cooling to " + temperature + " degrees"); + } + this.temperature = temperature; + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/HottubOffCommand.java b/src/main/java/com/bootdo/headFirst/command/party/HottubOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..d51841992454ce88a36aeb1fc0c2b2f4bb8abe88 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/HottubOffCommand.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.party; + +public class HottubOffCommand implements Command { + Hottub hottub; + + public HottubOffCommand(Hottub hottub) { + this.hottub = hottub; + } + + public void execute() { + hottub.setTemperature(98); + hottub.off(); + } + public void undo() { + hottub.on(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/HottubOnCommand.java b/src/main/java/com/bootdo/headFirst/command/party/HottubOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..8f8d4c817a3fca5aae0a9b0cf05f5e6d156637ec --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/HottubOnCommand.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.party; + +public class HottubOnCommand implements Command { + Hottub hottub; + + public HottubOnCommand(Hottub hottub) { + this.hottub = hottub; + } + public void execute() { + hottub.on(); + hottub.setTemperature(104); + hottub.circulate(); + } + public void undo() { + hottub.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/Light.java b/src/main/java/com/bootdo/headFirst/command/party/Light.java new file mode 100644 index 0000000000000000000000000000000000000000..f815a9930cbed8f8bfcfd8b2113abe7ccdce32b6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/Light.java @@ -0,0 +1,34 @@ +package com.bootdo.headFirst.command.party; + +public class Light { + String location; + int level; + + public Light(String location) { + this.location = location; + } + + public void on() { + level = 100; + System.out.println("Light is on"); + } + + public void off() { + level = 0; + System.out.println("Light is off"); + } + + public void dim(int level) { + this.level = level; + if (level == 0) { + off(); + } + else { + System.out.println("Light is dimmed to " + level + "%"); + } + } + + public int getLevel() { + return level; + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/LightOffCommand.java b/src/main/java/com/bootdo/headFirst/command/party/LightOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..04bf88ce9ab8fe801429d85b2176c49a8dd7ed9f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/LightOffCommand.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.party; + +public class LightOffCommand implements Command { + Light light; + + public LightOffCommand(Light light) { + this.light = light; + } + + public void execute() { + light.off(); + } + + public void undo() { + light.on(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/LightOnCommand.java b/src/main/java/com/bootdo/headFirst/command/party/LightOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..f72eb84ea66d509a5e0e5b3bebe7340447a78615 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/LightOnCommand.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.party; + +public class LightOnCommand implements Command { + Light light; + + public LightOnCommand(Light light) { + this.light = light; + } + + public void execute() { + light.on(); + } + + public void undo() { + light.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/LivingroomLightOffCommand.java b/src/main/java/com/bootdo/headFirst/command/party/LivingroomLightOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..ead19a66b9464b9ee268e1a37404fe743d3bb2bb --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/LivingroomLightOffCommand.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.command.party; + +public class LivingroomLightOffCommand implements Command { + Light light; + + public LivingroomLightOffCommand(Light light) { + this.light = light; + } + public void execute() { + light.off(); + } + public void undo() { + light.on(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/LivingroomLightOnCommand.java b/src/main/java/com/bootdo/headFirst/command/party/LivingroomLightOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..ff3f32902b76aacb3cd94821ee4f19b36c6aee60 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/LivingroomLightOnCommand.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.command.party; + +public class LivingroomLightOnCommand implements Command { + Light light; + + public LivingroomLightOnCommand(Light light) { + this.light = light; + } + public void execute() { + light.on(); + } + public void undo() { + light.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/MacroCommand.java b/src/main/java/com/bootdo/headFirst/command/party/MacroCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..880cd4e31574f5d3e6554d79a94529c979288685 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/MacroCommand.java @@ -0,0 +1,22 @@ +package com.bootdo.headFirst.command.party; + +public class MacroCommand implements Command { + Command[] commands; + + public MacroCommand(Command[] commands) { + this.commands = commands; + } + + public void execute() { + for (int i = 0; i < commands.length; i++) { + commands[i].execute(); + } + } + + public void undo() { + for (int i = 0; i < commands.length; i++) { + commands[i].undo(); + } + } +} + diff --git a/src/main/java/com/bootdo/headFirst/command/party/NoCommand.java b/src/main/java/com/bootdo/headFirst/command/party/NoCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..1b66b4f7677e4cbf7cfa89a5131370d3e5bd225e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/NoCommand.java @@ -0,0 +1,6 @@ +package com.bootdo.headFirst.command.party; + +public class NoCommand implements Command { + public void execute() { } + public void undo() { } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/RemoteControl.java b/src/main/java/com/bootdo/headFirst/command/party/RemoteControl.java new file mode 100644 index 0000000000000000000000000000000000000000..992cd52c39bca197e1787f0642d1f65ffc9eb3d1 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/RemoteControl.java @@ -0,0 +1,54 @@ +package com.bootdo.headFirst.command.party; + +import java.util.*; + +// +// This is the invoker +// +public class RemoteControl { + Command[] onCommands; + Command[] offCommands; + Command undoCommand; + + public RemoteControl() { + onCommands = new Command[7]; + offCommands = new Command[7]; + + Command noCommand = new NoCommand(); + for(int i=0;i<7;i++) { + onCommands[i] = noCommand; + offCommands[i] = noCommand; + } + undoCommand = noCommand; + } + + public void setCommand(int slot, Command onCommand, Command offCommand) { + onCommands[slot] = onCommand; + offCommands[slot] = offCommand; + } + + public void onButtonWasPushed(int slot) { + onCommands[slot].execute(); + undoCommand = onCommands[slot]; + } + + public void offButtonWasPushed(int slot) { + offCommands[slot].execute(); + undoCommand = offCommands[slot]; + } + + public void undoButtonWasPushed() { + undoCommand.undo(); + } + + public String toString() { + StringBuffer stringBuff = new StringBuffer(); + stringBuff.append("\n------ Remote Control -------\n"); + for (int i = 0; i < onCommands.length; i++) { + stringBuff.append("[slot " + i + "] " + onCommands[i].getClass().getName() + + " " + offCommands[i].getClass().getName() + "\n"); + } + stringBuff.append("[undo] " + undoCommand.getClass().getName() + "\n"); + return stringBuff.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/RemoteLoader.java b/src/main/java/com/bootdo/headFirst/command/party/RemoteLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..32a1ac5c6b125191f4ea63debd4b8aefc6c06b5d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/RemoteLoader.java @@ -0,0 +1,37 @@ +package com.bootdo.headFirst.command.party; + +public class RemoteLoader { + + public static void main(String[] args) { + + RemoteControl remoteControl = new RemoteControl(); + + Light light = new Light("Living Room"); + TV tv = new TV("Living Room"); + Stereo stereo = new Stereo("Living Room"); + Hottub hottub = new Hottub(); + + LightOnCommand lightOn = new LightOnCommand(light); + StereoOnCommand stereoOn = new StereoOnCommand(stereo); + TVOnCommand tvOn = new TVOnCommand(tv); + HottubOnCommand hottubOn = new HottubOnCommand(hottub); + LightOffCommand lightOff = new LightOffCommand(light); + StereoOffCommand stereoOff = new StereoOffCommand(stereo); + TVOffCommand tvOff = new TVOffCommand(tv); + HottubOffCommand hottubOff = new HottubOffCommand(hottub); + + Command[] partyOn = { lightOn, stereoOn, tvOn, hottubOn}; + Command[] partyOff = { lightOff, stereoOff, tvOff, hottubOff}; + + MacroCommand partyOnMacro = new MacroCommand(partyOn); + MacroCommand partyOffMacro = new MacroCommand(partyOff); + + remoteControl.setCommand(0, partyOnMacro, partyOffMacro); + + System.out.println(remoteControl); + System.out.println("--- Pushing Macro On---"); + remoteControl.onButtonWasPushed(0); + System.out.println("--- Pushing Macro Off---"); + remoteControl.offButtonWasPushed(0); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/Stereo.java b/src/main/java/com/bootdo/headFirst/command/party/Stereo.java new file mode 100644 index 0000000000000000000000000000000000000000..a528757d4e785c902d3e2e38afe647c4fb73af7e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/Stereo.java @@ -0,0 +1,35 @@ +package com.bootdo.headFirst.command.party; + +public class Stereo { + String location; + + public Stereo(String location) { + this.location = location; + } + + public void on() { + System.out.println(location + " stereo is on"); + } + + public void off() { + System.out.println(location + " stereo is off"); + } + + public void setCD() { + System.out.println(location + " stereo is set for CD input"); + } + + public void setDVD() { + System.out.println(location + " stereo is set for DVD input"); + } + + public void setRadio() { + System.out.println(location + " stereo is set for Radio"); + } + + public void setVolume(int volume) { + // code to set the volume + // valid range: 1-11 (after all 11 is better than 10, right?) + System.out.println(location + " Stereo volume set to " + volume); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/StereoOffCommand.java b/src/main/java/com/bootdo/headFirst/command/party/StereoOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..e8fe5366bb5b7aae9e1e2318aa0864b02c42ee8c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/StereoOffCommand.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.party; + +public class StereoOffCommand implements Command { + Stereo stereo; + + public StereoOffCommand(Stereo stereo) { + this.stereo = stereo; + } + + public void execute() { + stereo.off(); + } + + public void undo() { + stereo.on(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/StereoOnCommand.java b/src/main/java/com/bootdo/headFirst/command/party/StereoOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..3daf2396de96d7725400efad56497c433b27c56d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/StereoOnCommand.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.party; + +public class StereoOnCommand implements Command { + Stereo stereo; + + public StereoOnCommand(Stereo stereo) { + this.stereo = stereo; + } + + public void execute() { + stereo.on(); + } + + public void undo() { + stereo.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/StereoOnWithCDCommand.java b/src/main/java/com/bootdo/headFirst/command/party/StereoOnWithCDCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..cd6e3b74c79b7e922b3d5de56a1b6e1405afbda0 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/StereoOnWithCDCommand.java @@ -0,0 +1,19 @@ +package com.bootdo.headFirst.command.party; + +public class StereoOnWithCDCommand implements Command { + Stereo stereo; + + public StereoOnWithCDCommand(Stereo stereo) { + this.stereo = stereo; + } + + public void execute() { + stereo.on(); + stereo.setCD(); + stereo.setVolume(11); + } + + public void undo() { + stereo.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/TV.java b/src/main/java/com/bootdo/headFirst/command/party/TV.java new file mode 100644 index 0000000000000000000000000000000000000000..59a9c35ca0006b0d2e8e15ff9e8305a989880a5c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/TV.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.command.party; + +public class TV { + String location; + int channel; + + public TV(String location) { + this.location = location; + } + + public void on() { + System.out.println(location + " TV is on"); + } + + public void off() { + System.out.println(location + " TV is off"); + } + + public void setInputChannel() { + this.channel = 3; + System.out.println(location + " TV channel is set for DVD"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/TVOffCommand.java b/src/main/java/com/bootdo/headFirst/command/party/TVOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..e14a70cd68f3554822c0f3fc15dd647b01b19dc6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/TVOffCommand.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.party; + +public class TVOffCommand implements Command { + TV tv; + + public TVOffCommand(TV tv) { + this.tv= tv; + } + + public void execute() { + tv.off(); + } + + public void undo() { + tv.on(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/party/TVOnCommand.java b/src/main/java/com/bootdo/headFirst/command/party/TVOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..29b5b9116265c983934fc93e3b626346fe98b9c2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/party/TVOnCommand.java @@ -0,0 +1,18 @@ +package com.bootdo.headFirst.command.party; + +public class TVOnCommand implements Command { + TV tv; + + public TVOnCommand(TV tv) { + this.tv= tv; + } + + public void execute() { + tv.on(); + tv.setInputChannel(); + } + + public void undo() { + tv.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/CeilingFan.java b/src/main/java/com/bootdo/headFirst/command/remote/CeilingFan.java new file mode 100644 index 0000000000000000000000000000000000000000..aaf1ae9fb16df5f514629a936f021964d57d1cb6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/CeilingFan.java @@ -0,0 +1,42 @@ +package com.bootdo.headFirst.command.remote; + +public class CeilingFan { + String location = ""; + int level; + public static final int HIGH = 2; + public static final int MEDIUM = 1; + public static final int LOW = 0; + + public CeilingFan(String location) { + this.location = location; + } + + public void high() { + // turns the ceiling fan on to high + level = HIGH; + System.out.println(location + " ceiling fan is on high"); + + } + + public void medium() { + // turns the ceiling fan on to medium + level = MEDIUM; + System.out.println(location + " ceiling fan is on medium"); + } + + public void low() { + // turns the ceiling fan on to low + level = LOW; + System.out.println(location + " ceiling fan is on low"); + } + + public void off() { + // turns the ceiling fan off + level = 0; + System.out.println(location + " ceiling fan is off"); + } + + public int getSpeed() { + return level; + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/CeilingFanOffCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/CeilingFanOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..bc5ad2d4a2af308d8df96c81905c4b50f535c82c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/CeilingFanOffCommand.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.command.remote; + +public class CeilingFanOffCommand implements Command { + CeilingFan ceilingFan; + + public CeilingFanOffCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + public void execute() { + ceilingFan.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/CeilingFanOnCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/CeilingFanOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..8c7dac02a7f91e208ab7f3704219eece6d6ebeb0 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/CeilingFanOnCommand.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.command.remote; + +public class CeilingFanOnCommand implements Command { + CeilingFan ceilingFan; + + public CeilingFanOnCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + public void execute() { + ceilingFan.high(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/Command.java b/src/main/java/com/bootdo/headFirst/command/remote/Command.java new file mode 100644 index 0000000000000000000000000000000000000000..7598f777f856d0aa884b71c2800a30c68e7d5c9f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/Command.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.command.remote; + +public interface Command { + public void execute(); +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/GarageDoor.java b/src/main/java/com/bootdo/headFirst/command/remote/GarageDoor.java new file mode 100644 index 0000000000000000000000000000000000000000..94ecdfab43d5456499238db61a8d89d88e3900dc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/GarageDoor.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.command.remote; + +public class GarageDoor { + String location; + + public GarageDoor(String location) { + this.location = location; + } + + public void up() { + System.out.println(location + " garage Door is Up"); + } + + public void down() { + System.out.println(location + " garage Door is Down"); + } + + public void stop() { + System.out.println(location + " garage Door is Stopped"); + } + + public void lightOn() { + System.out.println(location + " garage light is on"); + } + + public void lightOff() { + System.out.println(location + " garage light is off"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/GarageDoorDownCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/GarageDoorDownCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..05e4d2604e4c3343882ad2c3feaedffd73d2ce96 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/GarageDoorDownCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.remote; + +public class GarageDoorDownCommand implements Command { + GarageDoor garageDoor; + + public GarageDoorDownCommand(GarageDoor garageDoor) { + this.garageDoor = garageDoor; + } + + public void execute() { + garageDoor.up(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/GarageDoorUpCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/GarageDoorUpCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..712155cc326303382e9a644e31d6b8460e028464 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/GarageDoorUpCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.remote; + +public class GarageDoorUpCommand implements Command { + GarageDoor garageDoor; + + public GarageDoorUpCommand(GarageDoor garageDoor) { + this.garageDoor = garageDoor; + } + + public void execute() { + garageDoor.up(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/Hottub.java b/src/main/java/com/bootdo/headFirst/command/remote/Hottub.java new file mode 100644 index 0000000000000000000000000000000000000000..e06529a2fb470453f8b88ef84d389ae3832f1026 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/Hottub.java @@ -0,0 +1,56 @@ +package com.bootdo.headFirst.command.remote; + +public class Hottub { + boolean on; + int temperature; + + public Hottub() { + } + + public void on() { + on = true; + } + + public void off() { + on = false; + } + + public void bubblesOn() { + if (on) { + System.out.println("Hottub is bubbling!"); + } + } + + public void bubblesOff() { + if (on) { + System.out.println("Hottub is not bubbling"); + } + } + + public void jetsOn() { + if (on) { + System.out.println("Hottub jets are on"); + } + } + + public void jetsOff() { + if (on) { + System.out.println("Hottub jets are off"); + } + } + + public void setTemperature(int temperature) { + this.temperature = temperature; + } + + public void heat() { + temperature = 105; + System.out.println("Hottub is heating to a steaming 105 degrees"); + } + + public void cool() { + temperature = 98; + System.out.println("Hottub is cooling to 98 degrees"); + } + +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/HottubOffCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/HottubOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..203ce129948a9447e74da9ef98d20e915e74cc62 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/HottubOffCommand.java @@ -0,0 +1,14 @@ +package com.bootdo.headFirst.command.remote; + +public class HottubOffCommand implements Command { + Hottub hottub; + + public HottubOffCommand(Hottub hottub) { + this.hottub = hottub; + } + + public void execute() { + hottub.cool(); + hottub.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/HottubOnCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/HottubOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..3328ddf1042a65baabb211b4c6196588986e3a6b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/HottubOnCommand.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.command.remote; + +public class HottubOnCommand implements Command { + Hottub hottub; + + public HottubOnCommand(Hottub hottub) { + this.hottub = hottub; + } + + public void execute() { + hottub.on(); + hottub.heat(); + hottub.bubblesOn(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/Light.java b/src/main/java/com/bootdo/headFirst/command/remote/Light.java new file mode 100644 index 0000000000000000000000000000000000000000..9d0747b3a9a7aa0a7aa598b0111fea27b7ab25c6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/Light.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.remote; + +public class Light { + String location = ""; + + public Light(String location) { + this.location = location; + } + + public void on() { + System.out.println(location + " light is on"); + } + + public void off() { + System.out.println(location + " light is off"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/LightOffCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/LightOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..c76ed9e9d01c08905f68121cbaa4a59af0a7f4b7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/LightOffCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.remote; + +public class LightOffCommand implements Command { + Light light; + + public LightOffCommand(Light light) { + this.light = light; + } + + public void execute() { + light.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/LightOnCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/LightOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..5a976198b99eb4e1eb85c52c29e701e0652e00f7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/LightOnCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.remote; + +public class LightOnCommand implements Command { + Light light; + + public LightOnCommand(Light light) { + this.light = light; + } + + public void execute() { + light.on(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/LivingroomLightOffCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/LivingroomLightOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..ff7cf745b14fa27f483eec19af74b9894ac942c2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/LivingroomLightOffCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.remote; + +public class LivingroomLightOffCommand implements Command { + Light light; + + public LivingroomLightOffCommand(Light light) { + this.light = light; + } + + public void execute() { + light.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/LivingroomLightOnCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/LivingroomLightOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..4740810910b8c2c90e5cdb856bd01067bc70b7f7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/LivingroomLightOnCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.remote; + +public class LivingroomLightOnCommand implements Command { + Light light; + + public LivingroomLightOnCommand(Light light) { + this.light = light; + } + + public void execute() { + light.on(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/NoCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/NoCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..90b6630b81663eac713fa38f8462ce3b4ff04c4f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/NoCommand.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.command.remote; + +public class NoCommand implements Command { + public void execute() { } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/RemoteControl.java b/src/main/java/com/bootdo/headFirst/command/remote/RemoteControl.java new file mode 100644 index 0000000000000000000000000000000000000000..706495137a100fccbe3f815f3f3bed5f62aafd2a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/RemoteControl.java @@ -0,0 +1,45 @@ +package com.bootdo.headFirst.command.remote; + +import java.util.*; + +// +// This is the invoker +// +public class RemoteControl { + Command[] onCommands; + Command[] offCommands; + + public RemoteControl() { + onCommands = new Command[7]; + offCommands = new Command[7]; + + Command noCommand = new NoCommand(); + for (int i = 0; i < 7; i++) { + onCommands[i] = noCommand; + offCommands[i] = noCommand; + } + } + + public void setCommand(int slot, Command onCommand, Command offCommand) { + onCommands[slot] = onCommand; + offCommands[slot] = offCommand; + } + + public void onButtonWasPushed(int slot) { + onCommands[slot].execute(); + } + + public void offButtonWasPushed(int slot) { + offCommands[slot].execute(); + } + + public String toString() { + StringBuffer stringBuff = new StringBuffer(); + stringBuff.append("\n------ Remote Control -------\n"); + for (int i = 0; i < onCommands.length; i++) { + stringBuff.append("[slot " + i + "] " + onCommands[i].getClass().getName() + + " " + offCommands[i].getClass().getName() + "\n"); + } + return stringBuff.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/RemoteLoader.java b/src/main/java/com/bootdo/headFirst/command/remote/RemoteLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..2f08aeb88af960b5899903c4cc33d30519519c02 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/RemoteLoader.java @@ -0,0 +1,54 @@ +package com.bootdo.headFirst.command.remote; + +public class RemoteLoader { + + public static void main(String[] args) { + RemoteControl remoteControl = new RemoteControl(); + + Light livingRoomLight = new Light("Living Room"); + Light kitchenLight = new Light("Kitchen"); + CeilingFan ceilingFan= new CeilingFan("Living Room"); + GarageDoor garageDoor = new GarageDoor(""); + Stereo stereo = new Stereo("Living Room"); + + LightOnCommand livingRoomLightOn = + new LightOnCommand(livingRoomLight); + LightOffCommand livingRoomLightOff = + new LightOffCommand(livingRoomLight); + LightOnCommand kitchenLightOn = + new LightOnCommand(kitchenLight); + LightOffCommand kitchenLightOff = + new LightOffCommand(kitchenLight); + + CeilingFanOnCommand ceilingFanOn = + new CeilingFanOnCommand(ceilingFan); + CeilingFanOffCommand ceilingFanOff = + new CeilingFanOffCommand(ceilingFan); + + GarageDoorUpCommand garageDoorUp = + new GarageDoorUpCommand(garageDoor); + GarageDoorDownCommand garageDoorDown = + new GarageDoorDownCommand(garageDoor); + + StereoOnWithCDCommand stereoOnWithCD = + new StereoOnWithCDCommand(stereo); + StereoOffCommand stereoOff = + new StereoOffCommand(stereo); + + remoteControl.setCommand(0, livingRoomLightOn, livingRoomLightOff); + remoteControl.setCommand(1, kitchenLightOn, kitchenLightOff); + remoteControl.setCommand(2, ceilingFanOn, ceilingFanOff); + remoteControl.setCommand(3, stereoOnWithCD, stereoOff); + + System.out.println(remoteControl); + + remoteControl.onButtonWasPushed(0); + remoteControl.offButtonWasPushed(0); + remoteControl.onButtonWasPushed(1); + remoteControl.offButtonWasPushed(1); + remoteControl.onButtonWasPushed(2); + remoteControl.offButtonWasPushed(2); + remoteControl.onButtonWasPushed(3); + remoteControl.offButtonWasPushed(3); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/Stereo.java b/src/main/java/com/bootdo/headFirst/command/remote/Stereo.java new file mode 100644 index 0000000000000000000000000000000000000000..34d70e13c6267b3218b8c57a504fb698fee78325 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/Stereo.java @@ -0,0 +1,35 @@ +package com.bootdo.headFirst.command.remote; + +public class Stereo { + String location; + + public Stereo(String location) { + this.location = location; + } + + public void on() { + System.out.println(location + " stereo is on"); + } + + public void off() { + System.out.println(location + " stereo is off"); + } + + public void setCD() { + System.out.println(location + " stereo is set for CD input"); + } + + public void setDVD() { + System.out.println(location + " stereo is set for DVD input"); + } + + public void setRadio() { + System.out.println(location + " stereo is set for Radio"); + } + + public void setVolume(int volume) { + // code to set the volume + // valid range: 1-11 (after all 11 is better than 10, right?) + System.out.println(location + " Stereo volume set to " + volume); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/StereoOffCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/StereoOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..9bbb7c88ece50fbe1b8c0add3f2a3dd98c79c9d4 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/StereoOffCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.remote; + +public class StereoOffCommand implements Command { + Stereo stereo; + + public StereoOffCommand(Stereo stereo) { + this.stereo = stereo; + } + + public void execute() { + stereo.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/StereoOnWithCDCommand.java b/src/main/java/com/bootdo/headFirst/command/remote/StereoOnWithCDCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..b5696a07ec8df17d976d86a2b625f6677b52194d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/StereoOnWithCDCommand.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.command.remote; + +public class StereoOnWithCDCommand implements Command { + Stereo stereo; + + public StereoOnWithCDCommand(Stereo stereo) { + this.stereo = stereo; + } + + public void execute() { + stereo.on(); + stereo.setCD(); + stereo.setVolume(11); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/remote/TV.java b/src/main/java/com/bootdo/headFirst/command/remote/TV.java new file mode 100644 index 0000000000000000000000000000000000000000..79106e17c6eb1f93a1d0167b5dce38ecf7afec54 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/remote/TV.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.command.remote; + +public class TV { + String location; + int channel; + + public TV(String location) { + this.location = location; + } + + public void on() { + System.out.println("TV is on"); + } + + public void off() { + System.out.println("TV is off"); + } + + public void setInputChannel() { + this.channel = 3; + System.out.println("Channel is set for VCR"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/simpleremote/Command.java b/src/main/java/com/bootdo/headFirst/command/simpleremote/Command.java new file mode 100644 index 0000000000000000000000000000000000000000..0f05dc3acf8af8a0caaade3eb3ee27a928e0c92f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/simpleremote/Command.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.command.simpleremote; + +public interface Command { + public void execute(); +} diff --git a/src/main/java/com/bootdo/headFirst/command/simpleremote/GarageDoor.java b/src/main/java/com/bootdo/headFirst/command/simpleremote/GarageDoor.java new file mode 100644 index 0000000000000000000000000000000000000000..dbd32ca3b044c71b01a2d713d9561f9250580cb4 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/simpleremote/GarageDoor.java @@ -0,0 +1,27 @@ +package com.bootdo.headFirst.command.simpleremote; + +public class GarageDoor { + + public GarageDoor() { + } + + public void up() { + System.out.println("Garage Door is Open"); + } + + public void down() { + System.out.println("Garage Door is Closed"); + } + + public void stop() { + System.out.println("Garage Door is Stopped"); + } + + public void lightOn() { + System.out.println("Garage light is on"); + } + + public void lightOff() { + System.out.println("Garage light is off"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/simpleremote/GarageDoorOpenCommand.java b/src/main/java/com/bootdo/headFirst/command/simpleremote/GarageDoorOpenCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..21d4ce3be0b2954d9e826f9cf595b85d672166b6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/simpleremote/GarageDoorOpenCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.simpleremote; + +public class GarageDoorOpenCommand implements Command { + GarageDoor garageDoor; + + public GarageDoorOpenCommand(GarageDoor garageDoor) { + this.garageDoor = garageDoor; + } + + public void execute() { + garageDoor.up(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/simpleremote/Light.java b/src/main/java/com/bootdo/headFirst/command/simpleremote/Light.java new file mode 100644 index 0000000000000000000000000000000000000000..416ea2e90137cc339574a6e5dfc2f86026640cd7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/simpleremote/Light.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.command.simpleremote; + +public class Light { + + public Light() { + } + + public void on() { + System.out.println("Light is on"); + } + + public void off() { + System.out.println("Light is off"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/simpleremote/LightOffCommand.java b/src/main/java/com/bootdo/headFirst/command/simpleremote/LightOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..9a59c8e061aeec522786ee442171dccf25745779 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/simpleremote/LightOffCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.simpleremote; + +public class LightOffCommand implements Command { + Light light; + + public LightOffCommand(Light light) { + this.light = light; + } + + public void execute() { + light.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/simpleremote/LightOnCommand.java b/src/main/java/com/bootdo/headFirst/command/simpleremote/LightOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..3257c53a869dd657255795f1c7c78b8c7e122ceb --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/simpleremote/LightOnCommand.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.command.simpleremote; + +public class LightOnCommand implements Command { + Light light; + + public LightOnCommand(Light light) { + this.light = light; + } + + public void execute() { + light.on(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/simpleremote/RemoteControlTest.java b/src/main/java/com/bootdo/headFirst/command/simpleremote/RemoteControlTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3e8b52bb1962bdb4c2ccbcdbf45a213a4a32ca05 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/simpleremote/RemoteControlTest.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.simpleremote; + +public class RemoteControlTest { + public static void main(String[] args) { + SimpleRemoteControl remote = new SimpleRemoteControl(); + Light light = new Light(); + GarageDoor garageDoor = new GarageDoor(); + LightOnCommand lightOn = new LightOnCommand(light); + GarageDoorOpenCommand garageOpen = + new GarageDoorOpenCommand(garageDoor); + + remote.setCommand(lightOn); + remote.buttonWasPressed(); + remote.setCommand(garageOpen); + remote.buttonWasPressed(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/simpleremote/SimpleRemoteControl.java b/src/main/java/com/bootdo/headFirst/command/simpleremote/SimpleRemoteControl.java new file mode 100644 index 0000000000000000000000000000000000000000..82034a646907c5c59bb67a0ff882874ef611c549 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/simpleremote/SimpleRemoteControl.java @@ -0,0 +1,20 @@ +package com.bootdo.headFirst.command.simpleremote; + +import java.util.*; + +// +// This is the invoker +// +public class SimpleRemoteControl { + Command slot; + + public SimpleRemoteControl() {} + + public void setCommand(Command command) { + slot = command; + } + + public void buttonWasPressed() { + slot.execute(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/CeilingFan.java b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFan.java new file mode 100644 index 0000000000000000000000000000000000000000..666f76dbb83a3eab1e1198d6d4ae562131e3ddbb --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFan.java @@ -0,0 +1,39 @@ +package com.bootdo.headFirst.command.undo; + +public class CeilingFan { + public static final int HIGH = 3; + public static final int MEDIUM = 2; + public static final int LOW = 1; + public static final int OFF = 0; + String location; + int speed; + + public CeilingFan(String location) { + this.location = location; + speed = OFF; + } + + public void high() { + speed = HIGH; + System.out.println(location + " ceiling fan is on high"); + } + + public void medium() { + speed = MEDIUM; + System.out.println(location + " ceiling fan is on medium"); + } + + public void low() { + speed = LOW; + System.out.println(location + " ceiling fan is on low"); + } + + public void off() { + speed = OFF; + System.out.println(location + " ceiling fan is off"); + } + + public int getSpeed() { + return speed; + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanHighCommand.java b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanHighCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..27eecc83a568c2e9fc0fbbde0731a57648795696 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanHighCommand.java @@ -0,0 +1,27 @@ +package com.bootdo.headFirst.command.undo; + +public class CeilingFanHighCommand implements Command { + CeilingFan ceilingFan; + int prevSpeed; + + public CeilingFanHighCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + + public void execute() { + prevSpeed = ceilingFan.getSpeed(); + ceilingFan.high(); + } + + public void undo() { + if (prevSpeed == CeilingFan.HIGH) { + ceilingFan.high(); + } else if (prevSpeed == CeilingFan.MEDIUM) { + ceilingFan.medium(); + } else if (prevSpeed == CeilingFan.LOW) { + ceilingFan.low(); + } else if (prevSpeed == CeilingFan.OFF) { + ceilingFan.off(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanLowCommand.java b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanLowCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..e587f03fce3c3b42d85de03ab82334a73b2a0f10 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanLowCommand.java @@ -0,0 +1,27 @@ +package com.bootdo.headFirst.command.undo; + +public class CeilingFanLowCommand implements Command { + CeilingFan ceilingFan; + int prevSpeed; + + public CeilingFanLowCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + + public void execute() { + prevSpeed = ceilingFan.getSpeed(); + ceilingFan.low(); + } + + public void undo() { + if (prevSpeed == CeilingFan.HIGH) { + ceilingFan.high(); + } else if (prevSpeed == CeilingFan.MEDIUM) { + ceilingFan.medium(); + } else if (prevSpeed == CeilingFan.LOW) { + ceilingFan.low(); + } else if (prevSpeed == CeilingFan.OFF) { + ceilingFan.off(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanMediumCommand.java b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanMediumCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..8f1a3d67a56d086c077cb073843078ad0c4bf3be --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanMediumCommand.java @@ -0,0 +1,27 @@ +package com.bootdo.headFirst.command.undo; + +public class CeilingFanMediumCommand implements Command { + CeilingFan ceilingFan; + int prevSpeed; + + public CeilingFanMediumCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + + public void execute() { + prevSpeed = ceilingFan.getSpeed(); + ceilingFan.medium(); + } + + public void undo() { + if (prevSpeed == CeilingFan.HIGH) { + ceilingFan.high(); + } else if (prevSpeed == CeilingFan.MEDIUM) { + ceilingFan.medium(); + } else if (prevSpeed == CeilingFan.LOW) { + ceilingFan.low(); + } else if (prevSpeed == CeilingFan.OFF) { + ceilingFan.off(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanOffCommand.java b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..995b32ddb2719c7c68b621195bbfd365e8a1459f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanOffCommand.java @@ -0,0 +1,27 @@ +package com.bootdo.headFirst.command.undo; + +public class CeilingFanOffCommand implements Command { + CeilingFan ceilingFan; + int prevSpeed; + + public CeilingFanOffCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + + public void execute() { + prevSpeed = ceilingFan.getSpeed(); + ceilingFan.off(); + } + + public void undo() { + if (prevSpeed == CeilingFan.HIGH) { + ceilingFan.high(); + } else if (prevSpeed == CeilingFan.MEDIUM) { + ceilingFan.medium(); + } else if (prevSpeed == CeilingFan.LOW) { + ceilingFan.low(); + } else if (prevSpeed == CeilingFan.OFF) { + ceilingFan.off(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanOnCommand.bak b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanOnCommand.bak new file mode 100644 index 0000000000000000000000000000000000000000..d575c74347e174b805692c3f53e4e5ccb888ef7c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/CeilingFanOnCommand.bak @@ -0,0 +1,15 @@ +package headfirst.command.undo; + +public class CeilingFanOnCommand implements Command { + CeilingFan ceilingFan; + + public CeilingFanOnCommand(CeilingFan ceilingFan) { + this.ceilingFan = ceilingFan; + } + public void execute() { + ceilingFan.high(); + } + public void undo() { + ceilingFan.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/Command.java b/src/main/java/com/bootdo/headFirst/command/undo/Command.java new file mode 100644 index 0000000000000000000000000000000000000000..e658e21964ec2af706d80327f86f7f7015dcc69c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/Command.java @@ -0,0 +1,6 @@ +package com.bootdo.headFirst.command.undo; + +public interface Command { + public void execute(); + public void undo(); +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/DimmerLightOffCommand.java b/src/main/java/com/bootdo/headFirst/command/undo/DimmerLightOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..c8366c81cead25b2674fb19714290f116218f5e1 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/DimmerLightOffCommand.java @@ -0,0 +1,20 @@ +package com.bootdo.headFirst.command.undo; + +public class DimmerLightOffCommand implements Command { + Light light; + int prevLevel; + + public DimmerLightOffCommand(Light light) { + this.light = light; + prevLevel = 100; + } + + public void execute() { + prevLevel = light.getLevel(); + light.off(); + } + + public void undo() { + light.dim(prevLevel); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/DimmerLightOnCommand.java b/src/main/java/com/bootdo/headFirst/command/undo/DimmerLightOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..1e9426e496a377e4f1054745181ffb237c1d743d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/DimmerLightOnCommand.java @@ -0,0 +1,19 @@ +package com.bootdo.headFirst.command.undo; + +public class DimmerLightOnCommand implements Command { + Light light; + int prevLevel; + + public DimmerLightOnCommand(Light light) { + this.light = light; + } + + public void execute() { + prevLevel = light.getLevel(); + light.dim(75); + } + + public void undo() { + light.dim(prevLevel); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/Light.java b/src/main/java/com/bootdo/headFirst/command/undo/Light.java new file mode 100644 index 0000000000000000000000000000000000000000..a94ffd35051a6945130ef57837cd428617a34188 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/Light.java @@ -0,0 +1,34 @@ +package com.bootdo.headFirst.command.undo; + +public class Light { + String location; + int level; + + public Light(String location) { + this.location = location; + } + + public void on() { + level = 100; + System.out.println("Light is on"); + } + + public void off() { + level = 0; + System.out.println("Light is off"); + } + + public void dim(int level) { + this.level = level; + if (level == 0) { + off(); + } + else { + System.out.println("Light is dimmed to " + level + "%"); + } + } + + public int getLevel() { + return level; + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/LightOffCommand.java b/src/main/java/com/bootdo/headFirst/command/undo/LightOffCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..6d07a5ff641003615df8bc2459997cafc44f7807 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/LightOffCommand.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.undo; + +public class LightOffCommand implements Command { + Light light; + + public LightOffCommand(Light light) { + this.light = light; + } + + public void execute() { + light.off(); + } + + public void undo() { + light.on(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/LightOnCommand.java b/src/main/java/com/bootdo/headFirst/command/undo/LightOnCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..ddd7b8ae8b1df50de039dcd0542197a7860700ba --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/LightOnCommand.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.command.undo; + +public class LightOnCommand implements Command { + Light light; + + public LightOnCommand(Light light) { + this.light = light; + } + + public void execute() { + light.on(); + } + + public void undo() { + light.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/NoCommand.java b/src/main/java/com/bootdo/headFirst/command/undo/NoCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..0a9634a1fe7358e4bdfd41e6211262fb5ef4281f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/NoCommand.java @@ -0,0 +1,6 @@ +package com.bootdo.headFirst.command.undo; + +public class NoCommand implements Command { + public void execute() { } + public void undo() { } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/RemoteControlWithUndo.java b/src/main/java/com/bootdo/headFirst/command/undo/RemoteControlWithUndo.java new file mode 100644 index 0000000000000000000000000000000000000000..56379e1827de67d087e9ea8fed8803d1774de5ce --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/RemoteControlWithUndo.java @@ -0,0 +1,54 @@ +package com.bootdo.headFirst.command.undo; + +import java.util.*; + +// +// This is the invoker +// +public class RemoteControlWithUndo { + Command[] onCommands; + Command[] offCommands; + Command undoCommand; + + public RemoteControlWithUndo() { + onCommands = new Command[7]; + offCommands = new Command[7]; + + Command noCommand = new NoCommand(); + for(int i=0;i<7;i++) { + onCommands[i] = noCommand; + offCommands[i] = noCommand; + } + undoCommand = noCommand; + } + + public void setCommand(int slot, Command onCommand, Command offCommand) { + onCommands[slot] = onCommand; + offCommands[slot] = offCommand; + } + + public void onButtonWasPushed(int slot) { + onCommands[slot].execute(); + undoCommand = onCommands[slot]; + } + + public void offButtonWasPushed(int slot) { + offCommands[slot].execute(); + undoCommand = offCommands[slot]; + } + + public void undoButtonWasPushed() { + undoCommand.undo(); + } + + public String toString() { + StringBuffer stringBuff = new StringBuffer(); + stringBuff.append("\n------ Remote Control -------\n"); + for (int i = 0; i < onCommands.length; i++) { + stringBuff.append("[slot " + i + "] " + onCommands[i].getClass().getName() + + " " + offCommands[i].getClass().getName() + "\n"); + } + stringBuff.append("[undo] " + undoCommand.getClass().getName() + "\n"); + return stringBuff.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/command/undo/RemoteLoader.java b/src/main/java/com/bootdo/headFirst/command/undo/RemoteLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..91a06d62e683f45649301cf34bf554b0ef7d281f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/command/undo/RemoteLoader.java @@ -0,0 +1,47 @@ +package com.bootdo.headFirst.command.undo; + +public class RemoteLoader { + + public static void main(String[] args) { + RemoteControlWithUndo remoteControl = new RemoteControlWithUndo(); + + Light livingRoomLight = new Light("Living Room"); + + LightOnCommand livingRoomLightOn = + new LightOnCommand(livingRoomLight); + LightOffCommand livingRoomLightOff = + new LightOffCommand(livingRoomLight); + + remoteControl.setCommand(0, livingRoomLightOn, livingRoomLightOff); + + remoteControl.onButtonWasPushed(0); + remoteControl.offButtonWasPushed(0); + System.out.println(remoteControl); + remoteControl.undoButtonWasPushed(); + remoteControl.offButtonWasPushed(0); + remoteControl.onButtonWasPushed(0); + System.out.println(remoteControl); + remoteControl.undoButtonWasPushed(); + + CeilingFan ceilingFan = new CeilingFan("Living Room"); + + CeilingFanMediumCommand ceilingFanMedium = + new CeilingFanMediumCommand(ceilingFan); + CeilingFanHighCommand ceilingFanHigh = + new CeilingFanHighCommand(ceilingFan); + CeilingFanOffCommand ceilingFanOff = + new CeilingFanOffCommand(ceilingFan); + + remoteControl.setCommand(0, ceilingFanMedium, ceilingFanOff); + remoteControl.setCommand(1, ceilingFanHigh, ceilingFanOff); + + remoteControl.onButtonWasPushed(0); + remoteControl.offButtonWasPushed(0); + System.out.println(remoteControl); + remoteControl.undoButtonWasPushed(); + + remoteControl.onButtonWasPushed(1); + System.out.println(remoteControl); + remoteControl.undoButtonWasPushed(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menu/Menu.java b/src/main/java/com/bootdo/headFirst/composite/menu/Menu.java new file mode 100644 index 0000000000000000000000000000000000000000..985780bcc94a282a86c655454e274e3ffc66e178 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menu/Menu.java @@ -0,0 +1,48 @@ +package com.bootdo.headFirst.composite.menu; + +import java.util.Iterator; +import java.util.ArrayList; + +public class Menu extends MenuComponent { + ArrayList menuComponents = new ArrayList(); + String name; + String description; + + public Menu(String name, String description) { + this.name = name; + this.description = description; + } + + public void add(MenuComponent menuComponent) { + menuComponents.add(menuComponent); + } + + public void remove(MenuComponent menuComponent) { + menuComponents.remove(menuComponent); + } + + public MenuComponent getChild(int i) { + return (MenuComponent)menuComponents.get(i); + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public void print() { + System.out.print("\n" + getName()); + System.out.println(", " + getDescription()); + System.out.println("---------------------"); + + Iterator iterator = menuComponents.iterator(); + while (iterator.hasNext()) { + MenuComponent menuComponent = + (MenuComponent)iterator.next(); + menuComponent.print(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menu/MenuComponent.java b/src/main/java/com/bootdo/headFirst/composite/menu/MenuComponent.java new file mode 100644 index 0000000000000000000000000000000000000000..849059e523c0f5f940ea12182faec7e2a9f8a29b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menu/MenuComponent.java @@ -0,0 +1,33 @@ +package com.bootdo.headFirst.composite.menu; + +import java.util.*; + +public abstract class MenuComponent { + + public void add(MenuComponent menuComponent) { + throw new UnsupportedOperationException(); + } + public void remove(MenuComponent menuComponent) { + throw new UnsupportedOperationException(); + } + public MenuComponent getChild(int i) { + throw new UnsupportedOperationException(); + } + + public String getName() { + throw new UnsupportedOperationException(); + } + public String getDescription() { + throw new UnsupportedOperationException(); + } + public double getPrice() { + throw new UnsupportedOperationException(); + } + public boolean isVegetarian() { + throw new UnsupportedOperationException(); + } + + public void print() { + throw new UnsupportedOperationException(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menu/MenuItem.java b/src/main/java/com/bootdo/headFirst/composite/menu/MenuItem.java new file mode 100644 index 0000000000000000000000000000000000000000..65e6faa52d1d5adb030c21e548a9333f54ee2614 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menu/MenuItem.java @@ -0,0 +1,47 @@ +package com.bootdo.headFirst.composite.menu; + +import java.util.Iterator; +import java.util.ArrayList; + +public class MenuItem extends MenuComponent { + String name; + String description; + boolean vegetarian; + double price; + + public MenuItem(String name, + String description, + boolean vegetarian, + double price) + { + this.name = name; + this.description = description; + this.vegetarian = vegetarian; + this.price = price; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public double getPrice() { + return price; + } + + public boolean isVegetarian() { + return vegetarian; + } + + public void print() { + System.out.print(" " + getName()); + if (isVegetarian()) { + System.out.print("(v)"); + } + System.out.println(", " + getPrice()); + System.out.println(" -- " + getDescription()); + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menu/MenuTestDrive.java b/src/main/java/com/bootdo/headFirst/composite/menu/MenuTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..806d03737c46bd931eee13c93689a174ba169a14 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menu/MenuTestDrive.java @@ -0,0 +1,133 @@ +package com.bootdo.headFirst.composite.menu; + +import java.util.*; + +public class MenuTestDrive { + public static void main(String args[]) { + MenuComponent pancakeHouseMenu = + new Menu("PANCAKE HOUSE MENU", "Breakfast"); + MenuComponent dinerMenu = + new Menu("DINER MENU", "Lunch"); + MenuComponent cafeMenu = + new Menu("CAFE MENU", "Dinner"); + MenuComponent dessertMenu = + new Menu("DESSERT MENU", "Dessert of course!"); + MenuComponent coffeeMenu = new Menu("COFFEE MENU", "Stuff to go with your afternoon coffee"); + + MenuComponent allMenus = new Menu("ALL MENUS", "All menus combined"); + + allMenus.add(pancakeHouseMenu); + allMenus.add(dinerMenu); + allMenus.add(cafeMenu); + + pancakeHouseMenu.add(new MenuItem( + "K&B's Pancake Breakfast", + "Pancakes with scrambled eggs, and toast", + true, + 2.99)); + pancakeHouseMenu.add(new MenuItem( + "Regular Pancake Breakfast", + "Pancakes with fried eggs, sausage", + false, + 2.99)); + pancakeHouseMenu.add(new MenuItem( + "Blueberry Pancakes", + "Pancakes made with fresh blueberries, and blueberry syrup", + true, + 3.49)); + pancakeHouseMenu.add(new MenuItem( + "Waffles", + "Waffles, with your choice of blueberries or strawberries", + true, + 3.59)); + + dinerMenu.add(new MenuItem( + "Vegetarian BLT", + "(Fakin') Bacon with lettuce & tomato on whole wheat", + true, + 2.99)); + dinerMenu.add(new MenuItem( + "BLT", + "Bacon with lettuce & tomato on whole wheat", + false, + 2.99)); + dinerMenu.add(new MenuItem( + "Soup of the day", + "A bowl of the soup of the day, with a side of potato salad", + false, + 3.29)); + dinerMenu.add(new MenuItem( + "Hotdog", + "A hot dog, with saurkraut, relish, onions, topped with cheese", + false, + 3.05)); + dinerMenu.add(new MenuItem( + "Steamed Veggies and Brown Rice", + "Steamed vegetables over brown rice", + true, + 3.99)); + + dinerMenu.add(new MenuItem( + "Pasta", + "Spaghetti with Marinara Sauce, and a slice of sourdough bread", + true, + 3.89)); + + dinerMenu.add(dessertMenu); + + dessertMenu.add(new MenuItem( + "Apple Pie", + "Apple pie with a flakey crust, topped with vanilla icecream", + true, + 1.59)); + + dessertMenu.add(new MenuItem( + "Cheesecake", + "Creamy New York cheesecake, with a chocolate graham crust", + true, + 1.99)); + dessertMenu.add(new MenuItem( + "Sorbet", + "A scoop of raspberry and a scoop of lime", + true, + 1.89)); + + cafeMenu.add(new MenuItem( + "Veggie Burger and Air Fries", + "Veggie burger on a whole wheat bun, lettuce, tomato, and fries", + true, + 3.99)); + cafeMenu.add(new MenuItem( + "Soup of the day", + "A cup of the soup of the day, with a side salad", + false, + 3.69)); + cafeMenu.add(new MenuItem( + "Burrito", + "A large burrito, with whole pinto beans, salsa, guacamole", + true, + 4.29)); + + cafeMenu.add(coffeeMenu); + + coffeeMenu.add(new MenuItem( + "Coffee Cake", + "Crumbly cake topped with cinnamon and walnuts", + true, + 1.59)); + coffeeMenu.add(new MenuItem( + "Bagel", + "Flavors include sesame, poppyseed, cinnamon raisin, pumpkin", + false, + 0.69)); + coffeeMenu.add(new MenuItem( + "Biscotti", + "Three almond or hazelnut biscotti cookies", + true, + 0.89)); + + Waitress waitress = new Waitress(allMenus); + + waitress.printMenu(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menu/Waitress.java b/src/main/java/com/bootdo/headFirst/composite/menu/Waitress.java new file mode 100644 index 0000000000000000000000000000000000000000..ce1a89e30d2ff4a939f334cdf723ad12a8476378 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menu/Waitress.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.composite.menu; + +import java.util.Iterator; + +public class Waitress { + MenuComponent allMenus; + + public Waitress(MenuComponent allMenus) { + this.allMenus = allMenus; + } + + public void printMenu() { + allMenus.print(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menuiterator/CompositeIterator.java b/src/main/java/com/bootdo/headFirst/composite/menuiterator/CompositeIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..60b78faab89b060f60886a2759899bf18c88a828 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menuiterator/CompositeIterator.java @@ -0,0 +1,45 @@ +package com.bootdo.headFirst.composite.menuiterator; + + +import java.util.*; + +public class CompositeIterator implements Iterator { + Stack stack = new Stack(); + + public CompositeIterator(Iterator iterator) { + stack.push(iterator); + } + + public Object next() { + if (hasNext()) { + Iterator iterator = (Iterator) stack.peek(); + MenuComponent component = (MenuComponent) iterator.next(); + if (component instanceof Menu) { + stack.push(component.createIterator()); + } + return component; + } else { + return null; + } + } + + public boolean hasNext() { + if (stack.empty()) { + return false; + } else { + Iterator iterator = (Iterator) stack.peek(); + if (!iterator.hasNext()) { + stack.pop(); + return hasNext(); + } else { + return true; + } + } + } + + public void remove() { + throw new UnsupportedOperationException(); + } +} + + diff --git a/src/main/java/com/bootdo/headFirst/composite/menuiterator/Menu.java b/src/main/java/com/bootdo/headFirst/composite/menuiterator/Menu.java new file mode 100644 index 0000000000000000000000000000000000000000..bc14bfbada0f0bb19d8e9f429d004b5c86116677 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menuiterator/Menu.java @@ -0,0 +1,55 @@ +package com.bootdo.headFirst.composite.menuiterator; + +import java.util.Iterator; +import java.util.ArrayList; + +public class Menu extends MenuComponent { + + ArrayList menuComponents = new ArrayList(); + String name; + String description; + + public Menu(String name, String description) { + this.name = name; + this.description = description; + } + + public void add(MenuComponent menuComponent) { + menuComponents.add(menuComponent); + } + + public void remove(MenuComponent menuComponent) { + menuComponents.remove(menuComponent); + } + + public MenuComponent getChild(int i) { + return (MenuComponent)menuComponents.get(i); + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + + public Iterator createIterator() { + return new CompositeIterator(menuComponents.iterator()); + } + + + public void print() { + System.out.print("\n" + getName()); + System.out.println(", " + getDescription()); + System.out.println("---------------------"); + + Iterator iterator = menuComponents.iterator(); + while (iterator.hasNext()) { + MenuComponent menuComponent = + (MenuComponent)iterator.next(); + menuComponent.print(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menuiterator/MenuComponent.java b/src/main/java/com/bootdo/headFirst/composite/menuiterator/MenuComponent.java new file mode 100644 index 0000000000000000000000000000000000000000..a2e5c68aaf47b0384e7002d87f28b3c6c414f23a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menuiterator/MenuComponent.java @@ -0,0 +1,35 @@ +package com.bootdo.headFirst.composite.menuiterator; + +import java.util.*; + +public abstract class MenuComponent { + + public void add(MenuComponent menuComponent) { + throw new UnsupportedOperationException(); + } + public void remove(MenuComponent menuComponent) { + throw new UnsupportedOperationException(); + } + public MenuComponent getChild(int i) { + throw new UnsupportedOperationException(); + } + + public String getName() { + throw new UnsupportedOperationException(); + } + public String getDescription() { + throw new UnsupportedOperationException(); + } + public double getPrice() { + throw new UnsupportedOperationException(); + } + public boolean isVegetarian() { + throw new UnsupportedOperationException(); + } + + public abstract Iterator createIterator(); + + public void print() { + throw new UnsupportedOperationException(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menuiterator/MenuItem.java b/src/main/java/com/bootdo/headFirst/composite/menuiterator/MenuItem.java new file mode 100644 index 0000000000000000000000000000000000000000..e1227c6ff5931c3fbee120c8e7152428ef6edc69 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menuiterator/MenuItem.java @@ -0,0 +1,55 @@ +package com.bootdo.headFirst.composite.menuiterator; + +import java.util.Iterator; +import java.util.ArrayList; + +public class MenuItem extends MenuComponent { + + String name; + String description; + boolean vegetarian; + double price; + + public MenuItem(String name, + String description, + boolean vegetarian, + double price) + { + this.name = name; + this.description = description; + this.vegetarian = vegetarian; + this.price = price; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public double getPrice() { + return price; + } + + public boolean isVegetarian() { + return vegetarian; + } + + public Iterator createIterator() { + return new NullIterator(); + } + + public void print() { + System.out.print(" " + getName()); + if (isVegetarian()) { + System.out.print("(v)"); + } + System.out.println(", " + getPrice()); + System.out.println(" -- " + getDescription()); + } +//vv MenuItemCompositeV2Main +} +//^^ MenuItemCompositeV2Main +//^^ MenuItemCompositeV2 diff --git a/src/main/java/com/bootdo/headFirst/composite/menuiterator/MenuTestDrive.java b/src/main/java/com/bootdo/headFirst/composite/menuiterator/MenuTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..9230a87f3421916d19ed0251cbdfc8accfa3fa11 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menuiterator/MenuTestDrive.java @@ -0,0 +1,115 @@ +package com.bootdo.headFirst.composite.menuiterator; + +import java.util.*; + +public class MenuTestDrive { + public static void main(String args[]) { + + MenuComponent pancakeHouseMenu = + new Menu("PANCAKE HOUSE MENU", "Breakfast"); + MenuComponent dinerMenu = + new Menu("DINER MENU", "Lunch"); + MenuComponent cafeMenu = + new Menu("CAFE MENU", "Dinner"); + MenuComponent dessertMenu = + new Menu("DESSERT MENU", "Dessert of course!"); + + MenuComponent allMenus = new Menu("ALL MENUS", "All menus combined"); + + allMenus.add(pancakeHouseMenu); + allMenus.add(dinerMenu); + allMenus.add(cafeMenu); + + pancakeHouseMenu.add(new MenuItem( + "K&B's Pancake Breakfast", + "Pancakes with scrambled eggs, and toast", + true, + 2.99)); + pancakeHouseMenu.add(new MenuItem( + "Regular Pancake Breakfast", + "Pancakes with fried eggs, sausage", + false, + 2.99)); + pancakeHouseMenu.add(new MenuItem( + "Blueberry Pancakes", + "Pancakes made with fresh blueberries, and blueberry syrup", + true, + 3.49)); + pancakeHouseMenu.add(new MenuItem( + "Waffles", + "Waffles, with your choice of blueberries or strawberries", + true, + 3.59)); + + dinerMenu.add(new MenuItem( + "Vegetarian BLT", + "(Fakin') Bacon with lettuce & tomato on whole wheat", + true, + 2.99)); + dinerMenu.add(new MenuItem( + "BLT", + "Bacon with lettuce & tomato on whole wheat", + false, + 2.99)); + dinerMenu.add(new MenuItem( + "Soup of the day", + "A bowl of the soup of the day, with a side of potato salad", + false, + 3.29)); + dinerMenu.add(new MenuItem( + "Hotdog", + "A hot dog, with saurkraut, relish, onions, topped with cheese", + false, + 3.05)); + dinerMenu.add(new MenuItem( + "Steamed Veggies and Brown Rice", + "A medly of steamed vegetables over brown rice", + true, + 3.99)); + + dinerMenu.add(new MenuItem( + "Pasta", + "Spaghetti with Marinara Sauce, and a slice of sourdough bread", + true, + 3.89)); + + dinerMenu.add(dessertMenu); + + dessertMenu.add(new MenuItem( + "Apple Pie", + "Apple pie with a flakey crust, topped with vanilla icecream", + true, + 1.59)); + dessertMenu.add(new MenuItem( + "Cheesecake", + "Creamy New York cheesecake, with a chocolate graham crust", + true, + 1.99)); + dessertMenu.add(new MenuItem( + "Sorbet", + "A scoop of raspberry and a scoop of lime", + true, + 1.89)); + + cafeMenu.add(new MenuItem( + "Veggie Burger and Air Fries", + "Veggie burger on a whole wheat bun, lettuce, tomato, and fries", + true, + 3.99)); + cafeMenu.add(new MenuItem( + "Soup of the day", + "A cup of the soup of the day, with a side salad", + false, + 3.69)); + cafeMenu.add(new MenuItem( + "Burrito", + "A large burrito, with whole pinto beans, salsa, guacamole", + true, + 4.29)); + + Waitress waitress = new Waitress(allMenus); + + waitress.printVegetarianMenu(); + + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menuiterator/NullIterator.java b/src/main/java/com/bootdo/headFirst/composite/menuiterator/NullIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..747055ee0fa9a4cf8e24f79e39144788d847113b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menuiterator/NullIterator.java @@ -0,0 +1,18 @@ +package com.bootdo.headFirst.composite.menuiterator; + +import java.util.Iterator; + +public class NullIterator implements Iterator { + + public Object next() { + return null; + } + + public boolean hasNext() { + return false; + } + + public void remove() { + throw new UnsupportedOperationException(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/composite/menuiterator/Waitress.java b/src/main/java/com/bootdo/headFirst/composite/menuiterator/Waitress.java new file mode 100644 index 0000000000000000000000000000000000000000..44c41784f897ba6a84b11f27fb26e782952da997 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/composite/menuiterator/Waitress.java @@ -0,0 +1,30 @@ +package com.bootdo.headFirst.composite.menuiterator; + +import java.util.Iterator; + +public class Waitress { + MenuComponent allMenus; + + public Waitress(MenuComponent allMenus) { + this.allMenus = allMenus; + } + + public void printMenu() { + allMenus.print(); + } + + public void printVegetarianMenu() { + Iterator iterator = allMenus.createIterator(); + + System.out.println("\nVEGETARIAN MENU\n----"); + while (iterator.hasNext()) { + MenuComponent menuComponent = + (MenuComponent)iterator.next(); + try { + if (menuComponent.isVegetarian()) { + menuComponent.print(); + } + } catch (UnsupportedOperationException e) {} + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/decorator/io/InputTest.java b/src/main/java/com/bootdo/headFirst/decorator/io/InputTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d3d6d80fbdcbb281c2a6958021b9c39ac29664c6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/io/InputTest.java @@ -0,0 +1,24 @@ +package com.bootdo.headFirst.decorator.io; + +import java.io.*; + +public class InputTest { + public static void main(String[] args) throws IOException { + int c; + + try { + InputStream in = + new LowerCaseInputStream( + new BufferedInputStream( + new FileInputStream("test.txt"))); + + while((c = in.read()) >= 0) { + System.out.print((char)c); + } + + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/decorator/io/LowerCaseInputStream.java b/src/main/java/com/bootdo/headFirst/decorator/io/LowerCaseInputStream.java new file mode 100644 index 0000000000000000000000000000000000000000..32b2208d327cb716f1e20bcf45ea5417022b1bd7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/io/LowerCaseInputStream.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.decorator.io; + +import java.io.*; + +public class LowerCaseInputStream extends FilterInputStream { + + public LowerCaseInputStream(InputStream in) { + super(in); + } + + public int read() throws IOException { + int c = super.read(); + return (c == -1 ? c : Character.toLowerCase((char)c)); + } + + public int read(byte[] b, int offset, int len) throws IOException { + int result = super.read(b, offset, len); + for (int i = offset; i < offset+result; i++) { + b[i] = (byte)Character.toLowerCase((char)b[i]); + } + return result; + } +} diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Beverage.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Beverage.java new file mode 100644 index 0000000000000000000000000000000000000000..e7b8aa67516e606d56917f605d286626ea07b170 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Beverage.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public abstract class Beverage { + String description = "Unknown Beverage"; + + public String getDescription() { + return description; + } + + public abstract double cost(); +} diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/CondimentDecorator.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/CondimentDecorator.java new file mode 100644 index 0000000000000000000000000000000000000000..4bef19949e6ea826475a4b8c9593daa2d21feb5e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/CondimentDecorator.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public abstract class CondimentDecorator extends Beverage { + public abstract String getDescription(); +} diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/DarkRoast.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/DarkRoast.java new file mode 100644 index 0000000000000000000000000000000000000000..877ef2ba9480383f3093b27bf11a5b91c8adcf48 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/DarkRoast.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public class DarkRoast extends Beverage { + public DarkRoast() { + description = "Dark Roast Coffee"; + } + + public double cost() { + return .99; + } +} + diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Decaf.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Decaf.java new file mode 100644 index 0000000000000000000000000000000000000000..587609e680a231897984e49ad0f75f504aa92681 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Decaf.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public class Decaf extends Beverage { + public Decaf() { + description = "Decaf Coffee"; + } + + public double cost() { + return 1.05; + } +} + diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Espresso.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Espresso.java new file mode 100644 index 0000000000000000000000000000000000000000..2905c1949aac6819a86165a31d383e69d3d96baa --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Espresso.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public class Espresso extends Beverage { + + public Espresso() { + description = "Espresso"; + } + + public double cost() { + return 1.99; + } +} + diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/HouseBlend.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/HouseBlend.java new file mode 100644 index 0000000000000000000000000000000000000000..019e9af0ffe6b610d75061dc5200e9b62b3e6789 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/HouseBlend.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public class HouseBlend extends Beverage { + public HouseBlend() { + description = "House Blend Coffee"; + } + + public double cost() { + return .89; + } +} + diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Milk.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Milk.java new file mode 100644 index 0000000000000000000000000000000000000000..bd7babb67854702164f28a0b2cc741c180dccfa2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Milk.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public class Milk extends CondimentDecorator { + Beverage beverage; + + public Milk(Beverage beverage) { + this.beverage = beverage; + } + + public String getDescription() { + return beverage.getDescription() + ", Milk"; + } + + public double cost() { + return .10 + beverage.cost(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Mocha.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Mocha.java new file mode 100644 index 0000000000000000000000000000000000000000..5d6b128a1921590a6d6c229b0f961f97b76bf758 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Mocha.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public class Mocha extends CondimentDecorator { + Beverage beverage; + + public Mocha(Beverage beverage) { + this.beverage = beverage; + } + + public String getDescription() { + return beverage.getDescription() + ", Mocha"; + } + + public double cost() { + return .20 + beverage.cost(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Soy.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Soy.java new file mode 100644 index 0000000000000000000000000000000000000000..68bd492ee22bfec8dc60e3286ca9bcf683b49c56 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Soy.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public class Soy extends CondimentDecorator { + Beverage beverage; + + public Soy(Beverage beverage) { + this.beverage = beverage; + } + + public String getDescription() { + return beverage.getDescription() + ", Soy"; + } + + public double cost() { + return .15 + beverage.cost(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/StarbuzzCoffee.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/StarbuzzCoffee.java new file mode 100644 index 0000000000000000000000000000000000000000..3888f3eb6750be2309554261664f06d534a6df1a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/StarbuzzCoffee.java @@ -0,0 +1,24 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public class StarbuzzCoffee { + + public static void main(String args[]) { + Beverage beverage = new Espresso(); + System.out.println(beverage.getDescription() + + " $" + beverage.cost()); + + Beverage beverage2 = new DarkRoast(); + beverage2 = new Mocha(beverage2); + beverage2 = new Mocha(beverage2); + beverage2 = new Whip(beverage2); + System.out.println(beverage2.getDescription() + + " $" + beverage2.cost()); + + Beverage beverage3 = new HouseBlend(); + beverage3 = new Soy(beverage3); + beverage3 = new Mocha(beverage3); + beverage3 = new Whip(beverage3); + System.out.println(beverage3.getDescription() + + " $" + beverage3.cost()); + } +} diff --git a/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Whip.java b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Whip.java new file mode 100644 index 0000000000000000000000000000000000000000..87fc0773b88b2360b0930f4b8d1e2ca5c2902634 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/decorator/starbuzz/Whip.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.decorator.starbuzz; + +public class Whip extends CondimentDecorator { + Beverage beverage; + + public Whip(Beverage beverage) { + this.beverage = beverage; + } + + public String getDescription() { + return beverage.getDescription() + ", Whip"; + } + + public double cost() { + return .10 + beverage.cost(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/Amplifier.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/Amplifier.java new file mode 100644 index 0000000000000000000000000000000000000000..8dd4c5991a246481124f9e7c430dc48c72b03142 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/Amplifier.java @@ -0,0 +1,51 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class Amplifier { + String description; + Tuner tuner; + DvdPlayer dvd; + CdPlayer cd; + + public Amplifier(String description) { + this.description = description; + } + + public void on() { + System.out.println(description + " on"); + } + + public void off() { + System.out.println(description + " off"); + } + + public void setStereoSound() { + System.out.println(description + " stereo mode on"); + } + + public void setSurroundSound() { + System.out.println(description + " surround sound on (5 speakers, 1 subwoofer)"); + } + + public void setVolume(int level) { + System.out.println(description + " setting volume to " + level); + } + + public void setTuner(Tuner tuner) { + System.out.println(description + " setting tuner to " + dvd); + this.tuner = tuner; + } + + public void setDvd(DvdPlayer dvd) { + System.out.println(description + " setting DVD player to " + dvd); + this.dvd = dvd; + } + + public void setCd(CdPlayer cd) { + System.out.println(description + " setting CD player to " + cd); + this.cd = cd; + } + + public String toString() { + return description; + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/CdPlayer.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/CdPlayer.java new file mode 100644 index 0000000000000000000000000000000000000000..e07694c6cc072415f2859950160035b8da52ea2e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/CdPlayer.java @@ -0,0 +1,55 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class CdPlayer { + String description; + int currentTrack; + Amplifier amplifier; + String title; + + public CdPlayer(String description, Amplifier amplifier) { + this.description = description; + this.amplifier = amplifier; + } + + public void on() { + System.out.println(description + " on"); + } + + public void off() { + System.out.println(description + " off"); + } + + public void eject() { + title = null; + System.out.println(description + " eject"); + } + + public void play(String title) { + this.title = title; + currentTrack = 0; + System.out.println(description + " playing \"" + title + "\""); + } + + public void play(int track) { + if (title == null) { + System.out.println(description + " can't play track " + currentTrack + + ", no cd inserted"); + } else { + currentTrack = track; + System.out.println(description + " playing track " + currentTrack); + } + } + + public void stop() { + currentTrack = 0; + System.out.println(description + " stopped"); + } + + public void pause() { + System.out.println(description + " paused \"" + title + "\""); + } + + public String toString() { + return description; + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/DvdPlayer.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/DvdPlayer.java new file mode 100644 index 0000000000000000000000000000000000000000..21915d04dadd5c409829870eb3821c441bffb27d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/DvdPlayer.java @@ -0,0 +1,62 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class DvdPlayer { + String description; + int currentTrack; + Amplifier amplifier; + String movie; + + public DvdPlayer(String description, Amplifier amplifier) { + this.description = description; + this.amplifier = amplifier; + } + + public void on() { + System.out.println(description + " on"); + } + + public void off() { + System.out.println(description + " off"); + } + + public void eject() { + movie = null; + System.out.println(description + " eject"); + } + + public void play(String movie) { + this.movie = movie; + currentTrack = 0; + System.out.println(description + " playing \"" + movie + "\""); + } + + public void play(int track) { + if (movie == null) { + System.out.println(description + " can't play track " + track + " no dvd inserted"); + } else { + currentTrack = track; + System.out.println(description + " playing track " + currentTrack + " of \"" + movie + "\""); + } + } + + public void stop() { + currentTrack = 0; + System.out.println(description + " stopped \"" + movie + "\""); + } + + public void pause() { + System.out.println(description + " paused \"" + movie + "\""); + } + + public void setTwoChannelAudio() { + System.out.println(description + " set two channel audio"); + } + + public void setSurroundAudio() { + System.out.println(description + " set surround audio"); + } + + public String toString() { + return description; + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/HomeTheaterFacade.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/HomeTheaterFacade.java new file mode 100644 index 0000000000000000000000000000000000000000..f487b00912978260c728a3d551e6a71484b4c38e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/HomeTheaterFacade.java @@ -0,0 +1,94 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class HomeTheaterFacade { + Amplifier amp; + Tuner tuner; + DvdPlayer dvd; + CdPlayer cd; + Projector projector; + TheaterLights lights; + Screen screen; + PopcornPopper popper; + + public HomeTheaterFacade(Amplifier amp, + Tuner tuner, + DvdPlayer dvd, + CdPlayer cd, + Projector projector, + Screen screen, + TheaterLights lights, + PopcornPopper popper) { + + this.amp = amp; + this.tuner = tuner; + this.dvd = dvd; + this.cd = cd; + this.projector = projector; + this.screen = screen; + this.lights = lights; + this.popper = popper; + } + + public void watchMovie(String movie) { + System.out.println("Get ready to watch a movie..."); + popper.on(); + popper.pop(); + lights.dim(10); + screen.down(); + projector.on(); + projector.wideScreenMode(); + amp.on(); + amp.setDvd(dvd); + amp.setSurroundSound(); + amp.setVolume(5); + dvd.on(); + dvd.play(movie); + } + + + public void endMovie() { + System.out.println("Shutting movie theater down..."); + popper.off(); + lights.on(); + screen.up(); + projector.off(); + amp.off(); + dvd.stop(); + dvd.eject(); + dvd.off(); + } + + public void listenToCd(String cdTitle) { + System.out.println("Get ready for an audiopile experence..."); + lights.on(); + amp.on(); + amp.setVolume(5); + amp.setCd(cd); + amp.setStereoSound(); + cd.on(); + cd.play(cdTitle); + } + + public void endCd() { + System.out.println("Shutting down CD..."); + amp.off(); + amp.setCd(cd); + cd.eject(); + cd.off(); + } + + public void listenToRadio(double frequency) { + System.out.println("Tuning in the airwaves..."); + tuner.on(); + tuner.setFrequency(frequency); + amp.on(); + amp.setVolume(5); + amp.setTuner(tuner); + } + + public void endRadio() { + System.out.println("Shutting down the tuner..."); + tuner.off(); + amp.off(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/HomeTheaterTestDrive.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/HomeTheaterTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..3cbb9480b611821b2c12d7432ac661a9bb535f7d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/HomeTheaterTestDrive.java @@ -0,0 +1,21 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class HomeTheaterTestDrive { + public static void main(String[] args) { + Amplifier amp = new Amplifier("Top-O-Line Amplifier"); + Tuner tuner = new Tuner("Top-O-Line AM/FM Tuner", amp); + DvdPlayer dvd = new DvdPlayer("Top-O-Line DVD Player", amp); + CdPlayer cd = new CdPlayer("Top-O-Line CD Player", amp); + Projector projector = new Projector("Top-O-Line Projector", dvd); + TheaterLights lights = new TheaterLights("Theater Ceiling Lights"); + Screen screen = new Screen("Theater Screen"); + PopcornPopper popper = new PopcornPopper("Popcorn Popper"); + + HomeTheaterFacade homeTheater = + new HomeTheaterFacade(amp, tuner, dvd, cd, + projector, screen, lights, popper); + + homeTheater.watchMovie("Raiders of the Lost Ark"); + homeTheater.endMovie(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/PopcornPopper.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/PopcornPopper.java new file mode 100644 index 0000000000000000000000000000000000000000..b4e6a5d7e92d454c270e571345790c86c6b4d811 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/PopcornPopper.java @@ -0,0 +1,26 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class PopcornPopper { + String description; + + public PopcornPopper(String description) { + this.description = description; + } + + public void on() { + System.out.println(description + " on"); + } + + public void off() { + System.out.println(description + " off"); + } + + public void pop() { + System.out.println(description + " popping popcorn!"); + } + + + public String toString() { + return description; + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/Projector.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/Projector.java new file mode 100644 index 0000000000000000000000000000000000000000..ff703ec002f5db44c55a7c9d22935abffe4bf7d2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/Projector.java @@ -0,0 +1,31 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class Projector { + String description; + DvdPlayer dvdPlayer; + + public Projector(String description, DvdPlayer dvdPlayer) { + this.description = description; + this.dvdPlayer = dvdPlayer; + } + + public void on() { + System.out.println(description + " on"); + } + + public void off() { + System.out.println(description + " off"); + } + + public void wideScreenMode() { + System.out.println(description + " in widescreen mode (16x9 aspect ratio)"); + } + + public void tvMode() { + System.out.println(description + " in tv mode (4x3 aspect ratio)"); + } + + public String toString() { + return description; + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/Screen.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/Screen.java new file mode 100644 index 0000000000000000000000000000000000000000..bd3b482a4e7e39802e0be484d73cbe58331e3f3a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/Screen.java @@ -0,0 +1,22 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class Screen { + String description; + + public Screen(String description) { + this.description = description; + } + + public void up() { + System.out.println(description + " going up"); + } + + public void down() { + System.out.println(description + " going down"); + } + + + public String toString() { + return description; + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/TheaterLights.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/TheaterLights.java new file mode 100644 index 0000000000000000000000000000000000000000..6479e73520df13a52a2bd11b697dd9c0ca8d1fa2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/TheaterLights.java @@ -0,0 +1,25 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class TheaterLights { + String description; + + public TheaterLights(String description) { + this.description = description; + } + + public void on() { + System.out.println(description + " on"); + } + + public void off() { + System.out.println(description + " off"); + } + + public void dim(int level) { + System.out.println(description + " dimming to " + level + "%"); + } + + public String toString() { + return description; + } +} diff --git a/src/main/java/com/bootdo/headFirst/facade/hometheater/Tuner.java b/src/main/java/com/bootdo/headFirst/facade/hometheater/Tuner.java new file mode 100644 index 0000000000000000000000000000000000000000..96d6c37320217247f9f051f391d6fd5effeb2dc0 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/facade/hometheater/Tuner.java @@ -0,0 +1,36 @@ +package com.bootdo.headFirst.facade.hometheater; + +public class Tuner { + String description; + Amplifier amplifier; + double frequency; + + public Tuner(String description, Amplifier amplifier) { + this.description = description; + } + + public void on() { + System.out.println(description + " on"); + } + + public void off() { + System.out.println(description + " off"); + } + + public void setFrequency(double frequency) { + System.out.println(description + " setting frequency to " + frequency); + this.frequency = frequency; + } + + public void setAm() { + System.out.println(description + " setting AM mode"); + } + + public void setFm() { + System.out.println(description + " setting FM mode"); + } + + public String toString() { + return description; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/BlackOlives.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/BlackOlives.java new file mode 100644 index 0000000000000000000000000000000000000000..9186b1b975bfc505f684a2323d9b308c701deab6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/BlackOlives.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class BlackOlives implements Veggies { + + public String toString() { + return "Black Olives"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Cheese.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Cheese.java new file mode 100644 index 0000000000000000000000000000000000000000..dc3f87062294876d9a402b3f7c974e922a9ad820 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Cheese.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public interface Cheese { + public String toString(); +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/CheesePizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/CheesePizza.java new file mode 100644 index 0000000000000000000000000000000000000000..34d4090f03702f1a543f91c77ba05376041f57a0 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/CheesePizza.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class CheesePizza extends Pizza { + PizzaIngredientFactory ingredientFactory; + + public CheesePizza(PizzaIngredientFactory ingredientFactory) { + this.ingredientFactory = ingredientFactory; + } + + void prepare() { + System.out.println("Preparing " + name); + dough = ingredientFactory.createDough(); + sauce = ingredientFactory.createSauce(); + cheese = ingredientFactory.createCheese(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ChicagoPizzaIngredientFactory.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ChicagoPizzaIngredientFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..7d6e2f02b4fd5da2de491fcd4ee45c27069e03fe --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ChicagoPizzaIngredientFactory.java @@ -0,0 +1,33 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class ChicagoPizzaIngredientFactory + implements PizzaIngredientFactory +{ + + public Dough createDough() { + return new ThickCrustDough(); + } + + public Sauce createSauce() { + return new PlumTomatoSauce(); + } + + public Cheese createCheese() { + return new MozzarellaCheese(); + } + + public Veggies[] createVeggies() { + Veggies veggies[] = { new BlackOlives(), + new Spinach(), + new Eggplant() }; + return veggies; + } + + public Pepperoni createPepperoni() { + return new SlicedPepperoni(); + } + + public Clams createClam() { + return new FrozenClams(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ChicagoPizzaStore.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ChicagoPizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..8c326c6d882e9591fda50c17ea23dd31163e3680 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ChicagoPizzaStore.java @@ -0,0 +1,33 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class ChicagoPizzaStore extends PizzaStore { + + protected Pizza createPizza(String item) { + Pizza pizza = null; + PizzaIngredientFactory ingredientFactory = + new ChicagoPizzaIngredientFactory(); + + if (item.equals("cheese")) { + + pizza = new CheesePizza(ingredientFactory); + pizza.setName("Chicago Style Cheese Pizza"); + + } else if (item.equals("veggie")) { + + pizza = new VeggiePizza(ingredientFactory); + pizza.setName("Chicago Style Veggie Pizza"); + + } else if (item.equals("clam")) { + + pizza = new ClamPizza(ingredientFactory); + pizza.setName("Chicago Style Clam Pizza"); + + } else if (item.equals("pepperoni")) { + + pizza = new PepperoniPizza(ingredientFactory); + pizza.setName("Chicago Style Pepperoni Pizza"); + + } + return pizza; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ClamPizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ClamPizza.java new file mode 100644 index 0000000000000000000000000000000000000000..c510de70a5f09858b1b0c7025bf54a0f6966c13a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ClamPizza.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class ClamPizza extends Pizza { + PizzaIngredientFactory ingredientFactory; + + public ClamPizza(PizzaIngredientFactory ingredientFactory) { + this.ingredientFactory = ingredientFactory; + } + + void prepare() { + System.out.println("Preparing " + name); + dough = ingredientFactory.createDough(); + sauce = ingredientFactory.createSauce(); + cheese = ingredientFactory.createCheese(); + clam = ingredientFactory.createClam(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Clams.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Clams.java new file mode 100644 index 0000000000000000000000000000000000000000..c2b2f09ca81df6c8775cb02f60aef4c31f76d444 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Clams.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public interface Clams { + public String toString(); +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Dough.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Dough.java new file mode 100644 index 0000000000000000000000000000000000000000..1df29e086e4ec0eb5548c4deaa261996950c694b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Dough.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public interface Dough { + public String toString(); +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Eggplant.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Eggplant.java new file mode 100644 index 0000000000000000000000000000000000000000..3e03b33092fd443d479d3061e507df53f5b79eff --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Eggplant.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class Eggplant implements Veggies { + + public String toString() { + return "Eggplant"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/FreshClams.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/FreshClams.java new file mode 100644 index 0000000000000000000000000000000000000000..3483687abe9a219760cbd1b6c2ac441d043da36f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/FreshClams.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class FreshClams implements Clams { + + public String toString() { + return "Fresh Clams from Long Island Sound"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/FrozenClams.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/FrozenClams.java new file mode 100644 index 0000000000000000000000000000000000000000..897e87b8768e9f8b4b19bccd99863beedcbe502d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/FrozenClams.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class FrozenClams implements Clams { + + public String toString() { + return "Frozen Clams from Chesapeake Bay"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Garlic.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Garlic.java new file mode 100644 index 0000000000000000000000000000000000000000..62b9100749731705902d9a2abcf34886d6a2d829 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Garlic.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class Garlic implements Veggies { + + public String toString() { + return "Garlic"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/MarinaraSauce.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/MarinaraSauce.java new file mode 100644 index 0000000000000000000000000000000000000000..3050815bbaa2adba464db5af2988a8b147ead122 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/MarinaraSauce.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class MarinaraSauce implements Sauce { + public String toString() { + return "Marinara Sauce"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/MozzarellaCheese.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/MozzarellaCheese.java new file mode 100644 index 0000000000000000000000000000000000000000..ef7b8878ea177c42de65b5b01790c3e96c9010b1 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/MozzarellaCheese.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class MozzarellaCheese implements Cheese { + + public String toString() { + return "Shredded Mozzarella"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Mushroom.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Mushroom.java new file mode 100644 index 0000000000000000000000000000000000000000..5a070df16356b9c172e076efbec463f74575e4ab --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Mushroom.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class Mushroom implements Veggies { + + public String toString() { + return "Mushrooms"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/NYPizzaIngredientFactory.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/NYPizzaIngredientFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..fef25ce189d84a375b71fb6c0646e6aa25af619b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/NYPizzaIngredientFactory.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class NYPizzaIngredientFactory implements PizzaIngredientFactory { + + public Dough createDough() { + return new ThinCrustDough(); + } + + public Sauce createSauce() { + return new MarinaraSauce(); + } + + public Cheese createCheese() { + return new ReggianoCheese(); + } + + public Veggies[] createVeggies() { + Veggies veggies[] = { new Garlic(), new Onion(), new Mushroom(), new RedPepper() }; + return veggies; + } + + public Pepperoni createPepperoni() { + return new SlicedPepperoni(); + } + + public Clams createClam() { + return new FreshClams(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/NYPizzaStore.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/NYPizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..3d3f655935042f9022bdee62b5d804c9bb83cb1c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/NYPizzaStore.java @@ -0,0 +1,33 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class NYPizzaStore extends PizzaStore { + + protected Pizza createPizza(String item) { + Pizza pizza = null; + PizzaIngredientFactory ingredientFactory = + new NYPizzaIngredientFactory(); + + if (item.equals("cheese")) { + + pizza = new CheesePizza(ingredientFactory); + pizza.setName("New York Style Cheese Pizza"); + + } else if (item.equals("veggie")) { + + pizza = new VeggiePizza(ingredientFactory); + pizza.setName("New York Style Veggie Pizza"); + + } else if (item.equals("clam")) { + + pizza = new ClamPizza(ingredientFactory); + pizza.setName("New York Style Clam Pizza"); + + } else if (item.equals("pepperoni")) { + + pizza = new PepperoniPizza(ingredientFactory); + pizza.setName("New York Style Pepperoni Pizza"); + + } + return pizza; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Onion.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Onion.java new file mode 100644 index 0000000000000000000000000000000000000000..e1e060ff2316fee4a7b7ebbdaf600120eb892455 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Onion.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class Onion implements Veggies { + + public String toString() { + return "Onion"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ParmesanCheese.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ParmesanCheese.java new file mode 100644 index 0000000000000000000000000000000000000000..e5eec25d93c74f077d7a6bb63081e89ff4cda3b9 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ParmesanCheese.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class ParmesanCheese implements Cheese { + + public String toString() { + return "Shredded Parmesan"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Pepperoni.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Pepperoni.java new file mode 100644 index 0000000000000000000000000000000000000000..5995f1929572df0738a4ed6db82384948b4701e8 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Pepperoni.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public interface Pepperoni { + public String toString(); +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PepperoniPizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PepperoniPizza.java new file mode 100644 index 0000000000000000000000000000000000000000..bf003b35070f72ad7aab0df17579f1604f29f0b9 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PepperoniPizza.java @@ -0,0 +1,18 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class PepperoniPizza extends Pizza { + PizzaIngredientFactory ingredientFactory; + + public PepperoniPizza(PizzaIngredientFactory ingredientFactory) { + this.ingredientFactory = ingredientFactory; + } + + void prepare() { + System.out.println("Preparing " + name); + dough = ingredientFactory.createDough(); + sauce = ingredientFactory.createSauce(); + cheese = ingredientFactory.createCheese(); + veggies = ingredientFactory.createVeggies(); + pepperoni = ingredientFactory.createPepperoni(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Pizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Pizza.java new file mode 100644 index 0000000000000000000000000000000000000000..b20eddfde4663b96c43e7f397fdba564e033d7d7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Pizza.java @@ -0,0 +1,69 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public abstract class Pizza { + String name; + + Dough dough; + Sauce sauce; + Veggies veggies[]; + Cheese cheese; + Pepperoni pepperoni; + Clams clam; + + abstract void prepare(); + + void bake() { + System.out.println("Bake for 25 minutes at 350"); + } + + void cut() { + System.out.println("Cutting the pizza into diagonal slices"); + } + + void box() { + System.out.println("Place pizza in official PizzaStore box"); + } + + void setName(String name) { + this.name = name; + } + + String getName() { + return name; + } + + public String toString() { + StringBuffer result = new StringBuffer(); + result.append("---- " + name + " ----\n"); + if (dough != null) { + result.append(dough); + result.append("\n"); + } + if (sauce != null) { + result.append(sauce); + result.append("\n"); + } + if (cheese != null) { + result.append(cheese); + result.append("\n"); + } + if (veggies != null) { + for (int i = 0; i < veggies.length; i++) { + result.append(veggies[i]); + if (i < veggies.length-1) { + result.append(", "); + } + } + result.append("\n"); + } + if (clam != null) { + result.append(clam); + result.append("\n"); + } + if (pepperoni != null) { + result.append(pepperoni); + result.append("\n"); + } + return result.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PizzaIngredientFactory.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PizzaIngredientFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..ef9cd04c8d25dc430e504f3508bb78bb068ccdfb --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PizzaIngredientFactory.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public interface PizzaIngredientFactory { + + public Dough createDough(); + public Sauce createSauce(); + public Cheese createCheese(); + public Veggies[] createVeggies(); + public Pepperoni createPepperoni(); + public Clams createClam(); + +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PizzaStore.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..7734328071dd8edb1aaae12a455b955b3dee83be --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PizzaStore.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public abstract class PizzaStore { + + protected abstract Pizza createPizza(String item); + + public Pizza orderPizza(String type) { + Pizza pizza = createPizza(type); + System.out.println("--- Making a " + pizza.getName() + " ---"); + pizza.prepare(); + pizza.bake(); + pizza.cut(); + pizza.box(); + return pizza; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PizzaTestDrive.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PizzaTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..98fd241b2d49646ff046fa6e0fb8595dab7148cc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PizzaTestDrive.java @@ -0,0 +1,33 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class PizzaTestDrive { + + public static void main(String[] args) { + PizzaStore nyStore = new NYPizzaStore(); + PizzaStore chicagoStore = new ChicagoPizzaStore(); + + Pizza pizza = nyStore.orderPizza("cheese"); + System.out.println("Ethan ordered a " + pizza + "\n"); + + pizza = chicagoStore.orderPizza("cheese"); + System.out.println("Joel ordered a " + pizza + "\n"); + + pizza = nyStore.orderPizza("clam"); + System.out.println("Ethan ordered a " + pizza + "\n"); + + pizza = chicagoStore.orderPizza("clam"); + System.out.println("Joel ordered a " + pizza + "\n"); + + pizza = nyStore.orderPizza("pepperoni"); + System.out.println("Ethan ordered a " + pizza + "\n"); + + pizza = chicagoStore.orderPizza("pepperoni"); + System.out.println("Joel ordered a " + pizza + "\n"); + + pizza = nyStore.orderPizza("veggie"); + System.out.println("Ethan ordered a " + pizza + "\n"); + + pizza = chicagoStore.orderPizza("veggie"); + System.out.println("Joel ordered a " + pizza + "\n"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PlumTomatoSauce.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PlumTomatoSauce.java new file mode 100644 index 0000000000000000000000000000000000000000..4cee74ce552634f8121989ad50afa9d0c0bf7d3f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/PlumTomatoSauce.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class PlumTomatoSauce implements Sauce { + public String toString() { + return "Tomato sauce with plum tomatoes"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/RedPepper.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/RedPepper.java new file mode 100644 index 0000000000000000000000000000000000000000..4490546bb579b1e1897916e0faf437787edcb1fe --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/RedPepper.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class RedPepper implements Veggies { + + public String toString() { + return "Red Pepper"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ReggianoCheese.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ReggianoCheese.java new file mode 100644 index 0000000000000000000000000000000000000000..24e44b3b45896dba9c47ac87594da7ae2f45a594 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ReggianoCheese.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class ReggianoCheese implements Cheese { + + public String toString() { + return "Reggiano Cheese"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Sauce.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Sauce.java new file mode 100644 index 0000000000000000000000000000000000000000..ea48c996905747f09923aba48501d790c82baa07 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Sauce.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public interface Sauce { + public String toString(); +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/SlicedPepperoni.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/SlicedPepperoni.java new file mode 100644 index 0000000000000000000000000000000000000000..5fd8c262feeb29ce7b77d4aa640149e915f27d81 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/SlicedPepperoni.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class SlicedPepperoni implements Pepperoni { + + public String toString() { + return "Sliced Pepperoni"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Spinach.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Spinach.java new file mode 100644 index 0000000000000000000000000000000000000000..081ee5c50d53066f010d041b6a6e485160a1140a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Spinach.java @@ -0,0 +1,8 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class Spinach implements Veggies { + + public String toString() { + return "Spinach"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ThickCrustDough.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ThickCrustDough.java new file mode 100644 index 0000000000000000000000000000000000000000..7d0ab50a221a80b6b6fa98f6fae7de4973dc4f86 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ThickCrustDough.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class ThickCrustDough implements Dough { + public String toString() { + return "ThickCrust style extra thick crust dough"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ThinCrustDough.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ThinCrustDough.java new file mode 100644 index 0000000000000000000000000000000000000000..96875360b5c1212bbd91c55877a6331e80be8972 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/ThinCrustDough.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class ThinCrustDough implements Dough { + public String toString() { + return "Thin Crust Dough"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/VeggiePizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/VeggiePizza.java new file mode 100644 index 0000000000000000000000000000000000000000..5529ccececf58fd56c9d7027b18f9e1fcdca1f34 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/VeggiePizza.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public class VeggiePizza extends Pizza { + PizzaIngredientFactory ingredientFactory; + + public VeggiePizza(PizzaIngredientFactory ingredientFactory) { + this.ingredientFactory = ingredientFactory; + } + + void prepare() { + System.out.println("Preparing " + name); + dough = ingredientFactory.createDough(); + sauce = ingredientFactory.createSauce(); + cheese = ingredientFactory.createCheese(); + veggies = ingredientFactory.createVeggies(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Veggies.java b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Veggies.java new file mode 100644 index 0000000000000000000000000000000000000000..9867c0222a7f68a96817cf28a71649dc0be6b36c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzaaf/Veggies.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.factory.pizzaaf; + +public interface Veggies { + public String toString(); +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoPizzaStore.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoPizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..b38d8a8802468896779dee640a3222d9c041a1d1 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoPizzaStore.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class ChicagoPizzaStore extends PizzaStore { + + Pizza createPizza(String item) { + if (item.equals("cheese")) { + return new ChicagoStyleCheesePizza(); + } else if (item.equals("veggie")) { + return new ChicagoStyleVeggiePizza(); + } else if (item.equals("clam")) { + return new ChicagoStyleClamPizza(); + } else if (item.equals("pepperoni")) { + return new ChicagoStylePepperoniPizza(); + } else return null; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStyleCheesePizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStyleCheesePizza.java new file mode 100644 index 0000000000000000000000000000000000000000..1ce2900d92d3230f2479fd62a5131f9518b16d88 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStyleCheesePizza.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class ChicagoStyleCheesePizza extends Pizza { + + public ChicagoStyleCheesePizza() { + name = "Chicago Style Deep Dish Cheese Pizza"; + dough = "Extra Thick Crust Dough"; + sauce = "Plum Tomato Sauce"; + + toppings.add("Shredded Mozzarella Cheese"); + } + + void cut() { + System.out.println("Cutting the pizza into square slices"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStyleClamPizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStyleClamPizza.java new file mode 100644 index 0000000000000000000000000000000000000000..af5c4755c9e8aa01af2f01de65780782e3364422 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStyleClamPizza.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class ChicagoStyleClamPizza extends Pizza { + public ChicagoStyleClamPizza() { + name = "Chicago Style Clam Pizza"; + dough = "Extra Thick Crust Dough"; + sauce = "Plum Tomato Sauce"; + + toppings.add("Shredded Mozzarella Cheese"); + toppings.add("Frozen Clams from Chesapeake Bay"); + } + + void cut() { + System.out.println("Cutting the pizza into square slices"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStylePepperoniPizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStylePepperoniPizza.java new file mode 100644 index 0000000000000000000000000000000000000000..9003a0619aef679e68b1d3a592f7e7240f34a486 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStylePepperoniPizza.java @@ -0,0 +1,19 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class ChicagoStylePepperoniPizza extends Pizza { + public ChicagoStylePepperoniPizza() { + name = "Chicago Style Pepperoni Pizza"; + dough = "Extra Thick Crust Dough"; + sauce = "Plum Tomato Sauce"; + + toppings.add("Shredded Mozzarella Cheese"); + toppings.add("Black Olives"); + toppings.add("Spinach"); + toppings.add("Eggplant"); + toppings.add("Sliced Pepperoni"); + } + + void cut() { + System.out.println("Cutting the pizza into square slices"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStyleVeggiePizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStyleVeggiePizza.java new file mode 100644 index 0000000000000000000000000000000000000000..6c79389a195f7a16ca9ce45b7ca8d973be050355 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/ChicagoStyleVeggiePizza.java @@ -0,0 +1,18 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class ChicagoStyleVeggiePizza extends Pizza { + public ChicagoStyleVeggiePizza() { + name = "Chicago Deep Dish Veggie Pizza"; + dough = "Extra Thick Crust Dough"; + sauce = "Plum Tomato Sauce"; + + toppings.add("Shredded Mozzarella Cheese"); + toppings.add("Black Olives"); + toppings.add("Spinach"); + toppings.add("Eggplant"); + } + + void cut() { + System.out.println("Cutting the pizza into square slices"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/DependentPizzaStore.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/DependentPizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..656c4bbee4a5b72a473349d2e4f8eea33bc70396 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/DependentPizzaStore.java @@ -0,0 +1,37 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class DependentPizzaStore { + + public Pizza createPizza(String style, String type) { + Pizza pizza = null; + if (style.equals("NY")) { + if (type.equals("cheese")) { + pizza = new NYStyleCheesePizza(); + } else if (type.equals("veggie")) { + pizza = new NYStyleVeggiePizza(); + } else if (type.equals("clam")) { + pizza = new NYStyleClamPizza(); + } else if (type.equals("pepperoni")) { + pizza = new NYStylePepperoniPizza(); + } + } else if (style.equals("Chicago")) { + if (type.equals("cheese")) { + pizza = new ChicagoStyleCheesePizza(); + } else if (type.equals("veggie")) { + pizza = new ChicagoStyleVeggiePizza(); + } else if (type.equals("clam")) { + pizza = new ChicagoStyleClamPizza(); + } else if (type.equals("pepperoni")) { + pizza = new ChicagoStylePepperoniPizza(); + } + } else { + System.out.println("Error: invalid type of pizza"); + return null; + } + pizza.prepare(); + pizza.bake(); + pizza.cut(); + pizza.box(); + return pizza; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYPizzaStore.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYPizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..8567c161e3eff1121e23c994e6f21fb1a2b2ec1c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYPizzaStore.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class NYPizzaStore extends PizzaStore { + + Pizza createPizza(String item) { + if (item.equals("cheese")) { + return new NYStyleCheesePizza(); + } else if (item.equals("veggie")) { + return new NYStyleVeggiePizza(); + } else if (item.equals("clam")) { + return new NYStyleClamPizza(); + } else if (item.equals("pepperoni")) { + return new NYStylePepperoniPizza(); + } else return null; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStyleCheesePizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStyleCheesePizza.java new file mode 100644 index 0000000000000000000000000000000000000000..20f6d0e50d651614babb98385956cf8300824bab --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStyleCheesePizza.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class NYStyleCheesePizza extends Pizza { + + public NYStyleCheesePizza() { + name = "NY Style Sauce and Cheese Pizza"; + dough = "Thin Crust Dough"; + sauce = "Marinara Sauce"; + + toppings.add("Grated Reggiano Cheese"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStyleClamPizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStyleClamPizza.java new file mode 100644 index 0000000000000000000000000000000000000000..30cc64544aefa87dc7aa82a15046c3eea7b43b4a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStyleClamPizza.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class NYStyleClamPizza extends Pizza { + + public NYStyleClamPizza() { + name = "NY Style Clam Pizza"; + dough = "Thin Crust Dough"; + sauce = "Marinara Sauce"; + + toppings.add("Grated Reggiano Cheese"); + toppings.add("Fresh Clams from Long Island Sound"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStylePepperoniPizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStylePepperoniPizza.java new file mode 100644 index 0000000000000000000000000000000000000000..7e14b8c45c26e16826991de5f8b41821cfff3daf --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStylePepperoniPizza.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class NYStylePepperoniPizza extends Pizza { + + public NYStylePepperoniPizza() { + name = "NY Style Pepperoni Pizza"; + dough = "Thin Crust Dough"; + sauce = "Marinara Sauce"; + + toppings.add("Grated Reggiano Cheese"); + toppings.add("Sliced Pepperoni"); + toppings.add("Garlic"); + toppings.add("Onion"); + toppings.add("Mushrooms"); + toppings.add("Red Pepper"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStyleVeggiePizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStyleVeggiePizza.java new file mode 100644 index 0000000000000000000000000000000000000000..4008a1021bb6cc8698403410389b39a8b84ec76e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/NYStyleVeggiePizza.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class NYStyleVeggiePizza extends Pizza { + + public NYStyleVeggiePizza() { + name = "NY Style Veggie Pizza"; + dough = "Thin Crust Dough"; + sauce = "Marinara Sauce"; + + toppings.add("Grated Reggiano Cheese"); + toppings.add("Garlic"); + toppings.add("Onion"); + toppings.add("Mushrooms"); + toppings.add("Red Pepper"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/Pizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/Pizza.java new file mode 100644 index 0000000000000000000000000000000000000000..ef84ce15bcfc2cd50836e12b5fcfb390b232cb27 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/Pizza.java @@ -0,0 +1,50 @@ +package com.bootdo.headFirst.factory.pizzafm; + +import java.util.ArrayList; + +public abstract class Pizza { + String name; + String dough; + String sauce; + ArrayList toppings = new ArrayList(); + + void prepare() { + System.out.println("Preparing " + name); + System.out.println("Tossing dough..."); + System.out.println("Adding sauce..."); + System.out.println("Adding toppings: "); + for (int i = 0; i < toppings.size(); i++) { + System.out.println(" " + toppings.get(i)); + } + } + + void bake() { + System.out.println("Bake for 25 minutes at 350"); + } + + void cut() { + System.out.println("Cutting the pizza into diagonal slices"); + } + + void box() { + System.out.println("Place pizza in official PizzaStore box"); + } + + public String getName() { + return name; + } + + public String toString() { + StringBuffer display = new StringBuffer(); + display.append("---- " + name + " ----\n"); + display.append(dough + "\n"); + display.append(sauce + "\n"); + for (int i = 0; i < toppings.size(); i++) { + display.append((String )toppings.get(i) + "\n"); + } + return display.toString(); + } +} + + + diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/PizzaStore.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/PizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..79695633587dd3059b8f37dfcfa10bafd85636c6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/PizzaStore.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public abstract class PizzaStore { + + abstract Pizza createPizza(String item); + + public Pizza orderPizza(String type) { + Pizza pizza = createPizza(type); + System.out.println("--- Making a " + pizza.getName() + " ---"); + pizza.prepare(); + pizza.bake(); + pizza.cut(); + pizza.box(); + return pizza; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzafm/PizzaTestDrive.java b/src/main/java/com/bootdo/headFirst/factory/pizzafm/PizzaTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..7246a4700dfb034f22845765322ea12472159ab4 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzafm/PizzaTestDrive.java @@ -0,0 +1,33 @@ +package com.bootdo.headFirst.factory.pizzafm; + +public class PizzaTestDrive { + + public static void main(String[] args) { + PizzaStore nyStore = new NYPizzaStore(); + PizzaStore chicagoStore = new ChicagoPizzaStore(); + + Pizza pizza = nyStore.orderPizza("cheese"); + System.out.println("Ethan ordered a " + pizza.getName() + "\n"); + + pizza = chicagoStore.orderPizza("cheese"); + System.out.println("Joel ordered a " + pizza.getName() + "\n"); + + pizza = nyStore.orderPizza("clam"); + System.out.println("Ethan ordered a " + pizza.getName() + "\n"); + + pizza = chicagoStore.orderPizza("clam"); + System.out.println("Joel ordered a " + pizza.getName() + "\n"); + + pizza = nyStore.orderPizza("pepperoni"); + System.out.println("Ethan ordered a " + pizza.getName() + "\n"); + + pizza = chicagoStore.orderPizza("pepperoni"); + System.out.println("Joel ordered a " + pizza.getName() + "\n"); + + pizza = nyStore.orderPizza("veggie"); + System.out.println("Ethan ordered a " + pizza.getName() + "\n"); + + pizza = chicagoStore.orderPizza("veggie"); + System.out.println("Joel ordered a " + pizza.getName() + "\n"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzas/CheesePizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzas/CheesePizza.java new file mode 100644 index 0000000000000000000000000000000000000000..43a739155fec00d8a7c131e739286f1c39cd1f4b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzas/CheesePizza.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.factory.pizzas; + +public class CheesePizza extends Pizza { + public CheesePizza() { + name = "Cheese Pizza"; + dough = "Regular Crust"; + sauce = "Marinara Pizza Sauce"; + toppings.add("Fresh Mozzarella"); + toppings.add("Parmesan"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzas/ClamPizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzas/ClamPizza.java new file mode 100644 index 0000000000000000000000000000000000000000..708ea7b23845fb85d2cc359ca00f4779b044f931 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzas/ClamPizza.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.factory.pizzas; + +public class ClamPizza extends Pizza { + public ClamPizza() { + name = "Clam Pizza"; + dough = "Thin crust"; + sauce = "White garlic sauce"; + toppings.add("Clams"); + toppings.add("Grated parmesan cheese"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzas/PepperoniPizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzas/PepperoniPizza.java new file mode 100644 index 0000000000000000000000000000000000000000..3bf1f61b898e18fb5b47620ccce334cfe8b07275 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzas/PepperoniPizza.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.factory.pizzas; + +public class PepperoniPizza extends Pizza { + public PepperoniPizza() { + name = "Pepperoni Pizza"; + dough = "Crust"; + sauce = "Marinara sauce"; + toppings.add("Sliced Pepperoni"); + toppings.add("Sliced Onion"); + toppings.add("Grated parmesan cheese"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzas/Pizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzas/Pizza.java new file mode 100644 index 0000000000000000000000000000000000000000..f4957f07515d32c297d8724b697b0ea7484236dc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzas/Pizza.java @@ -0,0 +1,43 @@ +package com.bootdo.headFirst.factory.pizzas; + +import java.util.ArrayList; + +abstract public class Pizza { + String name; + String dough; + String sauce; + ArrayList toppings = new ArrayList(); + + public String getName() { + return name; + } + + public void prepare() { + System.out.println("Preparing " + name); + } + + public void bake() { + System.out.println("Baking " + name); + } + + public void cut() { + System.out.println("Cutting " + name); + } + + public void box() { + System.out.println("Boxing " + name); + } + + public String toString() { + // code to display pizza name and ingredients + StringBuffer display = new StringBuffer(); + display.append("---- " + name + " ----\n"); + display.append(dough + "\n"); + display.append(sauce + "\n"); + for (int i = 0; i < toppings.size(); i++) { + display.append((String )toppings.get(i) + "\n"); + } + return display.toString(); + } +} + diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzas/PizzaStore.java b/src/main/java/com/bootdo/headFirst/factory/pizzas/PizzaStore.java new file mode 100644 index 0000000000000000000000000000000000000000..697c7ad8c5cb8f58180c71239b2ff6881c5728de --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzas/PizzaStore.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.factory.pizzas; + +public class PizzaStore { + SimplePizzaFactory factory; + + public PizzaStore(SimplePizzaFactory factory) { + this.factory = factory; + } + + public Pizza orderPizza(String type) { + Pizza pizza; + + pizza = factory.createPizza(type); + + pizza.prepare(); + pizza.bake(); + pizza.cut(); + pizza.box(); + + return pizza; + } + +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzas/PizzaTestDrive.java b/src/main/java/com/bootdo/headFirst/factory/pizzas/PizzaTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..1fd501f1a94993b26d5904535469a3cd2424d270 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzas/PizzaTestDrive.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.factory.pizzas; + +public class PizzaTestDrive { + + public static void main(String[] args) { + SimplePizzaFactory factory = new SimplePizzaFactory(); + PizzaStore store = new PizzaStore(factory); + + Pizza pizza = store.orderPizza("cheese"); + System.out.println("We ordered a " + pizza.getName() + "\n"); + + pizza = store.orderPizza("veggie"); + System.out.println("We ordered a " + pizza.getName() + "\n"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzas/SimplePizzaFactory.java b/src/main/java/com/bootdo/headFirst/factory/pizzas/SimplePizzaFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..69988fb9ad3a34c7439deb004d48c68d9647760b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzas/SimplePizzaFactory.java @@ -0,0 +1,19 @@ +package com.bootdo.headFirst.factory.pizzas; + +public class SimplePizzaFactory { + + public Pizza createPizza(String type) { + Pizza pizza = null; + + if (type.equals("cheese")) { + pizza = new CheesePizza(); + } else if (type.equals("pepperoni")) { + pizza = new PepperoniPizza(); + } else if (type.equals("clam")) { + pizza = new ClamPizza(); + } else if (type.equals("veggie")) { + pizza = new VeggiePizza(); + } + return pizza; + } +} diff --git a/src/main/java/com/bootdo/headFirst/factory/pizzas/VeggiePizza.java b/src/main/java/com/bootdo/headFirst/factory/pizzas/VeggiePizza.java new file mode 100644 index 0000000000000000000000000000000000000000..2114fb8de23b63d3610f47f6300389b31a5c92ea --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/factory/pizzas/VeggiePizza.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.factory.pizzas; + +public class VeggiePizza extends Pizza { + public VeggiePizza() { + name = "Veggie Pizza"; + dough = "Crust"; + sauce = "Marinara sauce"; + toppings.add("Shredded mozzarella"); + toppings.add("Grated parmesan"); + toppings.add("Diced onion"); + toppings.add("Sliced mushrooms"); + toppings.add("Sliced red pepper"); + toppings.add("Sliced black olives"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/AlternatingDinerMenuIterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/AlternatingDinerMenuIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..9ea2887e1e195ab789d246e8e745761b6117738d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/AlternatingDinerMenuIterator.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +import java.util.Calendar; + +public class AlternatingDinerMenuIterator implements Iterator { + MenuItem[] list; + int position; + + public AlternatingDinerMenuIterator(MenuItem[] list) { + this.list = list; + Calendar rightNow = Calendar.getInstance(); + position = rightNow.DAY_OF_WEEK % 2; + } + public Object next() { + MenuItem menuItem = list[position]; + position = position + 2; + return menuItem; + } + public boolean hasNext() { + if (position >= list.length || list[position] == null) { + return false; + } else { + return true; + } + } + public String toString() { + return "Alternating Diner Menu Iterator"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/ArrayIterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/ArrayIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..424e79551b657f2cc38829da0400ee1e7009d62c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/ArrayIterator.java @@ -0,0 +1,24 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +public class ArrayIterator implements Iterator { + MenuItem[] items; + int position = 0; + + public ArrayIterator(MenuItem[] items) { + this.items = items; + } + + public Object next() { + MenuItem menuItem = items[position]; + position = position + 1; + return menuItem; + } + + public boolean hasNext() { + if (position >= items.length || items[position] == null) { + return false; + } else { + return true; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/ArrayListIterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/ArrayListIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..9e46ac519d68e33b49e9b983203d7b12ba3286ce --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/ArrayListIterator.java @@ -0,0 +1,26 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +import java.util.ArrayList; + +public class ArrayListIterator implements Iterator { + ArrayList items; + int position = 0; + + public ArrayListIterator(ArrayList items) { + this.items = items; + } + + public Object next() { + Object object = items.get(position); + position = position + 1; + return object; + } + + public boolean hasNext() { + if (position >= items.size()) { + return false; + } else { + return true; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/DinerMenu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/DinerMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..29a95bad46ce33cde83593120c2b4598df00cd31 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/DinerMenu.java @@ -0,0 +1,48 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +public class DinerMenu implements Menu { + static final int MAX_ITEMS = 6; + int numberOfItems = 0; + MenuItem[] menuItems; + + public DinerMenu() { + menuItems = new MenuItem[MAX_ITEMS]; + + addItem("Vegetarian BLT", + "(Fakin') Bacon with lettuce & tomato on whole wheat", true, 2.99); + addItem("BLT", + "Bacon with lettuce & tomato on whole wheat", false, 2.99); + addItem("Soup of the day", + "Soup of the day, with a side of potato salad", false, 3.29); + addItem("Hotdog", + "A hot dog, with saurkraut, relish, onions, topped with cheese", + false, 3.05); + addItem("Steamed Veggies and Brown Rice", + "Steamed vegetables over brown rice", true, 3.99); + addItem("Pasta", + "Spaghetti with Marinara Sauce, and a slice of sourdough bread", + true, 3.89); + } + + public void addItem(String name, String description, + boolean vegetarian, double price) + { + MenuItem menuItem = new MenuItem(name, description, vegetarian, price); + if (numberOfItems >= MAX_ITEMS) { + System.err.println("Sorry, menu is full! Can't add item to menu"); + } else { + menuItems[numberOfItems] = menuItem; + numberOfItems = numberOfItems + 1; + } + } + + public MenuItem[] getMenuItems() { + return menuItems; + } + + public Iterator createIterator() { + return new DinerMenuIterator(menuItems); + } + + // other menu methods here +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/DinerMenuIterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/DinerMenuIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..b74a6a5641e804024f20de825f96fdf8a0b91629 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/DinerMenuIterator.java @@ -0,0 +1,24 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +public class DinerMenuIterator implements Iterator { + MenuItem[] items; + int position = 0; + + public DinerMenuIterator(MenuItem[] items) { + this.items = items; + } + + public Object next() { + MenuItem menuItem = items[position]; + position = position + 1; + return menuItem; + } + + public boolean hasNext() { + if (position >= items.length || items[position] == null) { + return false; + } else { + return true; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/Iterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/Iterator.java new file mode 100644 index 0000000000000000000000000000000000000000..b1ba60ff761dc80b3f3f87ad2a397ae425655f93 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/Iterator.java @@ -0,0 +1,6 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +public interface Iterator { + boolean hasNext(); + Object next(); +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/Menu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/Menu.java new file mode 100644 index 0000000000000000000000000000000000000000..e700827d631df1b71004a655d63d02252c7ddbb5 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/Menu.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +public interface Menu { + public Iterator createIterator(); +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/MenuItem.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/MenuItem.java new file mode 100644 index 0000000000000000000000000000000000000000..b5c61b2151bc9b1fed7ccd245bfc5329ee6da736 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/MenuItem.java @@ -0,0 +1,38 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +public class MenuItem { + String name; + String description; + boolean vegetarian; + double price; + + public MenuItem(String name, + String description, + boolean vegetarian, + double price) + { + this.name = name; + this.description = description; + this.vegetarian = vegetarian; + this.price = price; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public double getPrice() { + return price; + } + + public boolean isVegetarian() { + return vegetarian; + } + public String toString() { + return (name + ", $" + price + "\n " + description); + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/MenuTestDrive.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/MenuTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..1ca74b40f0d3ff10972f8fa63e3d92fab1d154e5 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/MenuTestDrive.java @@ -0,0 +1,37 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +import java.util.*; + +public class MenuTestDrive { + public static void main(String args[]) { + PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu(); + DinerMenu dinerMenu = new DinerMenu(); + + Waitress waitress = new Waitress(pancakeHouseMenu, dinerMenu); + + waitress.printMenu(); + } + + public static void printMenu() { + PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu(); + DinerMenu dinerMenu = new DinerMenu(); + + ArrayList breakfastItems = pancakeHouseMenu.getMenuItems(); + + for (int i = 0; i < breakfastItems.size(); i++) { + MenuItem menuItem = (MenuItem)breakfastItems.get(i); + System.out.print(menuItem.getName()); + System.out.println("\t\t" + menuItem.getPrice()); + System.out.println("\t" + menuItem.getDescription()); + } + + MenuItem[] lunchItems = dinerMenu.getMenuItems(); + + for (int i = 0; i < lunchItems.length; i++) { + MenuItem menuItem = lunchItems[i]; + System.out.print(menuItem.getName()); + System.out.println("\t\t" + menuItem.getPrice()); + System.out.println("\t" + menuItem.getDescription()); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/PancakeHouseMenu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/PancakeHouseMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..2696456cfc523c6e669989e653ea4bf51095838c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/PancakeHouseMenu.java @@ -0,0 +1,52 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +import java.util.ArrayList; + +public class PancakeHouseMenu implements Menu { + ArrayList menuItems; + + public PancakeHouseMenu() { + menuItems = new ArrayList(); + + addItem("K&B's Pancake Breakfast", + "Pancakes with scrambled eggs, and toast", + true, + 2.99); + + addItem("Regular Pancake Breakfast", + "Pancakes with fried eggs, sausage", + false, + 2.99); + + addItem("Blueberry Pancakes", + "Pancakes made with fresh blueberries", + true, + 3.49); + + addItem("Waffles", + "Waffles, with your choice of blueberries or strawberries", + true, + 3.59); + } + + public void addItem(String name, String description, + boolean vegetarian, double price) + { + MenuItem menuItem = new MenuItem(name, description, vegetarian, price); + menuItems.add(menuItem); + } + + public ArrayList getMenuItems() { + return menuItems; + } + + public Iterator createIterator() { + return new PancakeHouseMenuIterator(menuItems); + } + + public String toString() { + return "Objectville Pancake House Menu"; + } + + // other menu methods here +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/PancakeHouseMenuIterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/PancakeHouseMenuIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..d8bac5230a0ed02c106b7bc4bdf13de8fad2768c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/PancakeHouseMenuIterator.java @@ -0,0 +1,26 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +import java.util.ArrayList; + +public class PancakeHouseMenuIterator implements Iterator { + ArrayList items; + int position = 0; + + public PancakeHouseMenuIterator(ArrayList items) { + this.items = items; + } + + public Object next() { + Object object = items.get(position); + position = position + 1; + return object; + } + + public boolean hasNext() { + if (position >= items.size()) { + return false; + } else { + return true; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermerger/Waitress.java b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/Waitress.java new file mode 100644 index 0000000000000000000000000000000000000000..a4caceca1cc5f1f3e964d59b2e741e96ad94c529 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermerger/Waitress.java @@ -0,0 +1,71 @@ +package com.bootdo.headFirst.iterator.dinermerger; + +public class Waitress { + PancakeHouseMenu pancakeHouseMenu; + DinerMenu dinerMenu; + + public Waitress(PancakeHouseMenu pancakeHouseMenu, DinerMenu dinerMenu) { + this.pancakeHouseMenu = pancakeHouseMenu; + this.dinerMenu = dinerMenu; + } + + public void printMenu() { + Iterator pancakeIterator = pancakeHouseMenu.createIterator(); + Iterator dinerIterator = dinerMenu.createIterator(); + + System.out.println("MENU\n----\nBREAKFAST"); + printMenu(pancakeIterator); + System.out.println("\nLUNCH"); + printMenu(dinerIterator); + } + + private void printMenu(Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + System.out.print(menuItem.getName() + ", "); + System.out.print(menuItem.getPrice() + " -- "); + System.out.println(menuItem.getDescription()); + } + } + + public void printVegetarianMenu() { + printVegetarianMenu(pancakeHouseMenu.createIterator()); + printVegetarianMenu(dinerMenu.createIterator()); + } + + public boolean isItemVegetarian(String name) { + Iterator breakfastIterator = pancakeHouseMenu.createIterator(); + if (isVegetarian(name, breakfastIterator)) { + return true; + } + Iterator dinnerIterator = dinerMenu.createIterator(); + if (isVegetarian(name, dinnerIterator)) { + return true; + } + return false; + } + + + private void printVegetarianMenu(Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + if (menuItem.isVegetarian()) { + System.out.print(menuItem.getName()); + System.out.println("\t\t" + menuItem.getPrice()); + System.out.println("\t" + menuItem.getDescription()); + } + } + } + + private boolean isVegetarian(String name, Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + if (menuItem.getName().equals(name)) { + if (menuItem.isVegetarian()) { + return true; + } + } + } + return false; + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/AlternatingDinerMenuIterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/AlternatingDinerMenuIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..324216bca8c5a436356669f448a5d3693b0a8312 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/AlternatingDinerMenuIterator.java @@ -0,0 +1,31 @@ +package com.bootdo.headFirst.iterator.dinermergercafe; + +import java.util.Iterator; +import java.util.Calendar; + +public class AlternatingDinerMenuIterator implements Iterator { + MenuItem[] items; + int position; + + public AlternatingDinerMenuIterator(MenuItem[] items) { + this.items = items; + Calendar rightNow = Calendar.getInstance(); + position = rightNow.DAY_OF_WEEK % 2; + } + public Object next() { + MenuItem menuItem = items[position]; + position = position + 2; + return menuItem; + } + public boolean hasNext() { + if (position >= items.length || items[position] == null) { + return false; + } else { + return true; + } + } + public void remove() { + throw new UnsupportedOperationException( + "Alternating Diner Menu Iterator does not support remove()"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/CafeMenu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/CafeMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..7745488faea14b2cf2ef54390a598ecedc747a0b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/CafeMenu.java @@ -0,0 +1,34 @@ +package com.bootdo.headFirst.iterator.dinermergercafe; + +import java.util.*; + +public class CafeMenu implements Menu { + Hashtable menuItems = new Hashtable(); + + public CafeMenu() { + addItem("Veggie Burger and Air Fries", + "Veggie burger on a whole wheat bun, lettuce, tomato, and fries", + true, 3.99); + addItem("Soup of the day", + "A cup of the soup of the day, with a side salad", + false, 3.69); + addItem("Burrito", + "A large burrito, with whole pinto beans, salsa, guacamole", + true, 4.29); + } + + public void addItem(String name, String description, + boolean vegetarian, double price) + { + MenuItem menuItem = new MenuItem(name, description, vegetarian, price); + menuItems.put(menuItem.getName(), menuItem); + } + + public Hashtable getItems() { + return menuItems; + } + + public Iterator createIterator() { + return menuItems.values().iterator(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/DinerMenu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/DinerMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..df2e8519241cb06e44f10b554bc2c7a505819986 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/DinerMenu.java @@ -0,0 +1,51 @@ +package com.bootdo.headFirst.iterator.dinermergercafe; + +import java.util.Iterator; + +public class DinerMenu implements Menu { + static final int MAX_ITEMS = 6; + int numberOfItems = 0; + MenuItem[] menuItems; + + public DinerMenu() { + menuItems = new MenuItem[MAX_ITEMS]; + + addItem("Vegetarian BLT", + "(Fakin') Bacon with lettuce & tomato on whole wheat", true, 2.99); + addItem("BLT", + "Bacon with lettuce & tomato on whole wheat", false, 2.99); + addItem("Soup of the day", + "Soup of the day, with a side of potato salad", false, 3.29); + addItem("Hotdog", + "A hot dog, with saurkraut, relish, onions, topped with cheese", + false, 3.05); + addItem("Steamed Veggies and Brown Rice", + "A medly of steamed vegetables over brown rice", true, 3.99); + addItem("Pasta", + "Spaghetti with Marinara Sauce, and a slice of sourdough bread", + true, 3.89); + } + + public void addItem(String name, String description, + boolean vegetarian, double price) + { + MenuItem menuItem = new MenuItem(name, description, vegetarian, price); + if (numberOfItems >= MAX_ITEMS) { + System.err.println("Sorry, menu is full! Can't add item to menu"); + } else { + menuItems[numberOfItems] = menuItem; + numberOfItems = numberOfItems + 1; + } + } + + public MenuItem[] getMenuItems() { + return menuItems; + } + + public Iterator createIterator() { + return new DinerMenuIterator(menuItems); + //return new AlternatingDinerMenuIterator(menuItems); + } + + // other menu methods here +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/DinerMenuIterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/DinerMenuIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..610d5b9ac10c1c7710ef5af61289f60e05041247 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/DinerMenuIterator.java @@ -0,0 +1,39 @@ +package com.bootdo.headFirst.iterator.dinermergercafe; + +import java.util.Iterator; + +public class DinerMenuIterator implements Iterator { + MenuItem[] list; + int position = 0; + + public DinerMenuIterator(MenuItem[] list) { + this.list = list; + } + + public Object next() { + MenuItem menuItem = list[position]; + position = position + 1; + return menuItem; + } + + public boolean hasNext() { + if (position >= list.length || list[position] == null) { + return false; + } else { + return true; + } + } + + public void remove() { + if (position <= 0) { + throw new IllegalStateException + ("You can't remove an item until you've done at least one next()"); + } + if (list[position-1] != null) { + for (int i = position-1; i < (list.length-1); i++) { + list[i] = list[i+1]; + } + list[list.length-1] = null; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/Menu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/Menu.java new file mode 100644 index 0000000000000000000000000000000000000000..9f416be14cc4fea8d6a89b04e0362099d440c2bc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/Menu.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.iterator.dinermergercafe; + +import java.util.Iterator; + +public interface Menu { + public Iterator createIterator(); +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/MenuItem.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/MenuItem.java new file mode 100644 index 0000000000000000000000000000000000000000..b40eb84bebebf6a80bdaa922c2ec235a549aa947 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/MenuItem.java @@ -0,0 +1,35 @@ +package com.bootdo.headFirst.iterator.dinermergercafe; + +public class MenuItem { + String name; + String description; + boolean vegetarian; + double price; + + public MenuItem(String name, + String description, + boolean vegetarian, + double price) + { + this.name = name; + this.description = description; + this.vegetarian = vegetarian; + this.price = price; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public double getPrice() { + return price; + } + + public boolean isVegetarian() { + return vegetarian; + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/MenuTestDrive.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/MenuTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..10029be40284a4a5ccb25c3524c1dc2e65e1c645 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/MenuTestDrive.java @@ -0,0 +1,31 @@ +package com.bootdo.headFirst.iterator.dinermergercafe; + +import java.util.*; + +public class MenuTestDrive { + public static void main(String args[]) { + PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu(); + DinerMenu dinerMenu = new DinerMenu(); + CafeMenu cafeMenu = new CafeMenu(); + + Waitress waitress = new Waitress(pancakeHouseMenu, dinerMenu, cafeMenu); + + waitress.printMenu(); + waitress.printVegetarianMenu(); + + System.out.println("\nCustomer asks, is the Hotdog vegetarian?"); + System.out.print("Waitress says: "); + if (waitress.isItemVegetarian("Hotdog")) { + System.out.println("Yes"); + } else { + System.out.println("No"); + } + System.out.println("\nCustomer asks, are the Waffles vegetarian?"); + System.out.print("Waitress says: "); + if (waitress.isItemVegetarian("Waffles")) { + System.out.println("Yes"); + } else { + System.out.println("No"); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/PancakeHouseMenu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/PancakeHouseMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..e916669a3a3dd75bfef0bb8b147ccce3751df986 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/PancakeHouseMenu.java @@ -0,0 +1,49 @@ +package com.bootdo.headFirst.iterator.dinermergercafe; + +import java.util.ArrayList; +import java.util.Iterator; + +public class PancakeHouseMenu implements Menu { + ArrayList menuItems; + + public PancakeHouseMenu() { + menuItems = new ArrayList(); + + addItem("K&B's Pancake Breakfast", + "Pancakes with scrambled eggs, and toast", + true, + 2.99); + + addItem("Regular Pancake Breakfast", + "Pancakes with fried eggs, sausage", + false, + 2.99); + + addItem("Blueberry Pancakes", + "Pancakes made with fresh blueberries, and blueberry syrup", + true, + 3.49); + + addItem("Waffles", + "Waffles, with your choice of blueberries or strawberries", + true, + 3.59); + } + + public void addItem(String name, String description, + boolean vegetarian, double price) + { + MenuItem menuItem = new MenuItem(name, description, vegetarian, price); + menuItems.add(menuItem); + } + + public ArrayList getMenuItems() { + return menuItems; + } + + public Iterator createIterator() { + return menuItems.iterator(); + } + + // other menu methods here +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/Waitress.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/Waitress.java new file mode 100644 index 0000000000000000000000000000000000000000..037af82a802576db5e1e97e88284d7defa26f854 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergercafe/Waitress.java @@ -0,0 +1,86 @@ +package com.bootdo.headFirst.iterator.dinermergercafe; + +import java.util.Iterator; + +public class Waitress { + Menu pancakeHouseMenu; + Menu dinerMenu; + Menu cafeMenu; + + public Waitress(Menu pancakeHouseMenu, Menu dinerMenu, Menu cafeMenu) { + this.pancakeHouseMenu = pancakeHouseMenu; + this.dinerMenu = dinerMenu; + this.cafeMenu = cafeMenu; + } + + public void printMenu() { + Iterator pancakeIterator = pancakeHouseMenu.createIterator(); + Iterator dinerIterator = dinerMenu.createIterator(); + Iterator cafeIterator = cafeMenu.createIterator(); + + System.out.println("MENU\n----\nBREAKFAST"); + printMenu(pancakeIterator); + System.out.println("\nLUNCH"); + printMenu(dinerIterator); + System.out.println("\nDINNER"); + printMenu(cafeIterator); + } + + private void printMenu(Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + System.out.print(menuItem.getName() + ", "); + System.out.print(menuItem.getPrice() + " -- "); + System.out.println(menuItem.getDescription()); + } + } + + public void printVegetarianMenu() { + System.out.println("\nVEGETARIAN MENU\n---------------"); + printVegetarianMenu(pancakeHouseMenu.createIterator()); + printVegetarianMenu(dinerMenu.createIterator()); + printVegetarianMenu(cafeMenu.createIterator()); + } + + public boolean isItemVegetarian(String name) { + Iterator pancakeIterator = pancakeHouseMenu.createIterator(); + if (isVegetarian(name, pancakeIterator)) { + return true; + } + Iterator dinerIterator = dinerMenu.createIterator(); + if (isVegetarian(name, dinerIterator)) { + return true; + } + Iterator cafeIterator = cafeMenu.createIterator(); + if (isVegetarian(name, cafeIterator)) { + return true; + } + return false; + } + + + private void printVegetarianMenu(Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + if (menuItem.isVegetarian()) { + System.out.print(menuItem.getName() + ", "); + System.out.print(menuItem.getPrice() + " -- "); + System.out.println(menuItem.getDescription()); + } + } + } + + private boolean isVegetarian(String name, Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + if (menuItem.getName().equals(name)) { + if (menuItem.isVegetarian()) { + return true; + } + } + } + return false; + } +} +//^^ WaitressCafeMain +//^^ WaitressCafe diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/AlternatingDinerMenuIterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/AlternatingDinerMenuIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..7898803b5fcf7d5a52f052b8fa71cafe812c3763 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/AlternatingDinerMenuIterator.java @@ -0,0 +1,31 @@ +package com.bootdo.headFirst.iterator.dinermergeri; + +import java.util.Iterator; +import java.util.Calendar; + +public class AlternatingDinerMenuIterator implements Iterator { + MenuItem[] items; + int position; + + public AlternatingDinerMenuIterator(MenuItem[] items) { + this.items = items; + Calendar rightNow = Calendar.getInstance(); + position = rightNow.DAY_OF_WEEK % 2; + } + public Object next() { + MenuItem menuItem = items[position]; + position = position + 2; + return menuItem; + } + public boolean hasNext() { + if (position >= items.length || items[position] == null) { + return false; + } else { + return true; + } + } + public void remove() { + throw new UnsupportedOperationException( + "Alternating Diner Menu Iterator does not support remove()"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/DinerMenu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/DinerMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..fc5e21400aad0686637214da1e6e22ca460b71e9 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/DinerMenu.java @@ -0,0 +1,51 @@ +package com.bootdo.headFirst.iterator.dinermergeri; + +import java.util.Iterator; + +public class DinerMenu implements Menu { + static final int MAX_ITEMS = 6; + int numberOfItems = 0; + MenuItem[] menuItems; + + public DinerMenu() { + menuItems = new MenuItem[MAX_ITEMS]; + + addItem("Vegetarian BLT", + "(Fakin') Bacon with lettuce & tomato on whole wheat", true, 2.99); + addItem("BLT", + "Bacon with lettuce & tomato on whole wheat", false, 2.99); + addItem("Soup of the day", + "Soup of the day, with a side of potato salad", false, 3.29); + addItem("Hotdog", + "A hot dog, with saurkraut, relish, onions, topped with cheese", + false, 3.05); + addItem("Steamed Veggies and Brown Rice", + "Steamed vegetables over brown rice", true, 3.99); + addItem("Pasta", + "Spaghetti with Marinara Sauce, and a slice of sourdough bread", + true, 3.89); + } + + public void addItem(String name, String description, + boolean vegetarian, double price) + { + MenuItem menuItem = new MenuItem(name, description, vegetarian, price); + if (numberOfItems >= MAX_ITEMS) { + System.err.println("Sorry, menu is full! Can't add item to menu"); + } else { + menuItems[numberOfItems] = menuItem; + numberOfItems = numberOfItems + 1; + } + } + + public MenuItem[] getMenuItems() { + return menuItems; + } + + public Iterator createIterator() { + return new DinerMenuIterator(menuItems); + //return new AlternatingDinerMenuIterator(menuItems); + } + + // other menu methods here +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/DinerMenuIterator.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/DinerMenuIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..2b75c44b535e4949c5b34e90a780200d9d36a42c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/DinerMenuIterator.java @@ -0,0 +1,39 @@ +package com.bootdo.headFirst.iterator.dinermergeri; + +import java.util.Iterator; + +public class DinerMenuIterator implements Iterator { + MenuItem[] list; + int position = 0; + + public DinerMenuIterator(MenuItem[] list) { + this.list = list; + } + + public Object next() { + MenuItem menuItem = list[position]; + position = position + 1; + return menuItem; + } + + public boolean hasNext() { + if (position >= list.length || list[position] == null) { + return false; + } else { + return true; + } + } + + public void remove() { + if (position <= 0) { + throw new IllegalStateException + ("You can't remove an item until you've done at least one next()"); + } + if (list[position-1] != null) { + for (int i = position-1; i < (list.length-1); i++) { + list[i] = list[i+1]; + } + list[list.length-1] = null; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/Menu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/Menu.java new file mode 100644 index 0000000000000000000000000000000000000000..66dd80ee1e4c828a6311874a4e813d99abd0a538 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/Menu.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.iterator.dinermergeri; + +import java.util.Iterator; + +public interface Menu { + public Iterator createIterator(); +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/MenuItem.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/MenuItem.java new file mode 100644 index 0000000000000000000000000000000000000000..c8249a0c26e1cbfa8189b3d8b1bb716b19ab4799 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/MenuItem.java @@ -0,0 +1,35 @@ +package com.bootdo.headFirst.iterator.dinermergeri; + +public class MenuItem { + String name; + String description; + boolean vegetarian; + double price; + + public MenuItem(String name, + String description, + boolean vegetarian, + double price) + { + this.name = name; + this.description = description; + this.vegetarian = vegetarian; + this.price = price; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public double getPrice() { + return price; + } + + public boolean isVegetarian() { + return vegetarian; + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/MenuTestDrive.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/MenuTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..02eb430c10fad4923ec40a436704bff7c53892dd --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/MenuTestDrive.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.iterator.dinermergeri; + +import java.util.*; + +public class MenuTestDrive { + public static void main(String args[]) { + PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu(); + DinerMenu dinerMenu = new DinerMenu(); + Waitress waitress = new Waitress(pancakeHouseMenu, dinerMenu); + waitress.printMenu(); + waitress.printVegetarianMenu(); + + System.out.println("\nCustomer asks, is the Hotdog vegetarian?"); + System.out.print("Waitress says: "); + if (waitress.isItemVegetarian("Hotdog")) { + System.out.println("Yes"); + } else { + System.out.println("No"); + } + System.out.println("\nCustomer asks, are the Waffles vegetarian?"); + System.out.print("Waitress says: "); + if (waitress.isItemVegetarian("Waffles")) { + System.out.println("Yes"); + } else { + System.out.println("No"); + } + + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/PancakeHouseMenu.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/PancakeHouseMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..e8998324319cdb8316a8d03fb95bfe21842114eb --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/PancakeHouseMenu.java @@ -0,0 +1,49 @@ +package com.bootdo.headFirst.iterator.dinermergeri; + +import java.util.ArrayList; +import java.util.Iterator; + +public class PancakeHouseMenu implements Menu { + ArrayList menuItems; + + public PancakeHouseMenu() { + menuItems = new ArrayList(); + + addItem("K&B's Pancake Breakfast", + "Pancakes with scrambled eggs, and toast", + true, + 2.99); + + addItem("Regular Pancake Breakfast", + "Pancakes with fried eggs, sausage", + false, + 2.99); + + addItem("Blueberry Pancakes", + "Pancakes made with fresh blueberries, and blueberry syrup", + true, + 3.49); + + addItem("Waffles", + "Waffles, with your choice of blueberries or strawberries", + true, + 3.59); + } + + public void addItem(String name, String description, + boolean vegetarian, double price) + { + MenuItem menuItem = new MenuItem(name, description, vegetarian, price); + menuItems.add(menuItem); + } + + public ArrayList getMenuItems() { + return menuItems; + } + + public Iterator createIterator() { + return menuItems.iterator(); + } + + // other menu methods here +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/Waitress.java b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/Waitress.java new file mode 100644 index 0000000000000000000000000000000000000000..5584693bca9a1db70bf6f2a9c224ceacd9ca0d2c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/dinermergeri/Waitress.java @@ -0,0 +1,76 @@ +package com.bootdo.headFirst.iterator.dinermergeri; + +import java.util.Iterator; + + +public class Waitress { + Menu pancakeHouseMenu; + Menu dinerMenu; + + public Waitress(Menu pancakeHouseMenu, Menu dinerMenu) { + this.pancakeHouseMenu = pancakeHouseMenu; + this.dinerMenu = dinerMenu; + } + + public void printMenu() { + Iterator pancakeIterator = pancakeHouseMenu.createIterator(); + Iterator dinerIterator = dinerMenu.createIterator(); + + System.out.println("MENU\n----\nBREAKFAST"); + printMenu(pancakeIterator); + System.out.println("\nLUNCH"); + printMenu(dinerIterator); + } + + private void printMenu(Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + System.out.print(menuItem.getName() + ", "); + System.out.print(menuItem.getPrice() + " -- "); + System.out.println(menuItem.getDescription()); + } + } + + public void printVegetarianMenu() { + System.out.println("\nVEGETARIAN MENU\n----\nBREAKFAST"); + printVegetarianMenu(pancakeHouseMenu.createIterator()); + System.out.println("\nLUNCH"); + printVegetarianMenu(dinerMenu.createIterator()); + } + + public boolean isItemVegetarian(String name) { + Iterator pancakeIterator = pancakeHouseMenu.createIterator(); + if (isVegetarian(name, pancakeIterator)) { + return true; + } + Iterator dinerIterator = dinerMenu.createIterator(); + if (isVegetarian(name, dinerIterator)) { + return true; + } + return false; + } + + + private void printVegetarianMenu(Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + if (menuItem.isVegetarian()) { + System.out.print(menuItem.getName()); + System.out.println("\t\t" + menuItem.getPrice()); + System.out.println("\t" + menuItem.getDescription()); + } + } + } + + private boolean isVegetarian(String name, Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + if (menuItem.getName().equals(name)) { + if (menuItem.isVegetarian()) { + return true; + } + } + } + return false; + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/transition/Menu.java b/src/main/java/com/bootdo/headFirst/iterator/transition/Menu.java new file mode 100644 index 0000000000000000000000000000000000000000..ea05f804094edd11ab8cf8beca359d523772db2e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/transition/Menu.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.iterator.transition; + +import java.util.Iterator; + +public interface Menu { + public Iterator createIterator(); +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/transition/MenuItem.java b/src/main/java/com/bootdo/headFirst/iterator/transition/MenuItem.java new file mode 100644 index 0000000000000000000000000000000000000000..39aa798dc06e1daef1835cde9bd7881f70f6ffa7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/transition/MenuItem.java @@ -0,0 +1,35 @@ +package com.bootdo.headFirst.iterator.transition; + +public class MenuItem { + String name; + String description; + boolean vegetarian; + double price; + + public MenuItem(String name, + String description, + boolean vegetarian, + double price) + { + this.name = name; + this.description = description; + this.vegetarian = vegetarian; + this.price = price; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public double getPrice() { + return price; + } + + public boolean isVegetarian() { + return vegetarian; + } +} diff --git a/src/main/java/com/bootdo/headFirst/iterator/transition/Waitress.java b/src/main/java/com/bootdo/headFirst/iterator/transition/Waitress.java new file mode 100644 index 0000000000000000000000000000000000000000..a751295af496ea6866651c400c1a499d269532b3 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/iterator/transition/Waitress.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.iterator.transition; +import java.util.*; + + +public class Waitress { + ArrayList menus; + + + public Waitress(ArrayList menus) { + this.menus = menus; + } + + public void printMenu() { + Iterator menuIterator = menus.iterator(); + while(menuIterator.hasNext()) { + Menu menu = (Menu)menuIterator.next(); + printMenu(menu.createIterator()); + } + } + + void printMenu(Iterator iterator) { + while (iterator.hasNext()) { + MenuItem menuItem = (MenuItem)iterator.next(); + System.out.print(menuItem.getName() + ", "); + System.out.print(menuItem.getPrice() + " -- "); + System.out.println(menuItem.getDescription()); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/Swing/SwingObserverExample.java b/src/main/java/com/bootdo/headFirst/observer/Swing/SwingObserverExample.java new file mode 100644 index 0000000000000000000000000000000000000000..3c2f801fbf187f9f1c4ea2f6ac87c6e7a8a60239 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/Swing/SwingObserverExample.java @@ -0,0 +1,42 @@ +package com.bootdo.headFirst.observer.Swing; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +public class SwingObserverExample { + JFrame frame; + + public static void main(String[] args) { + SwingObserverExample example = new SwingObserverExample(); + example.go(); + } + + public void go() { + frame = new JFrame(); + + JButton button = new JButton("Should I do it?"); + button.addActionListener(new AngelListener()); + button.addActionListener(new DevilListener()); + frame.getContentPane().add(BorderLayout.CENTER, button); + + // Set frame properties + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.getContentPane().add(BorderLayout.CENTER, button); + frame.setSize(300,300); + frame.setVisible(true); + } + + class AngelListener implements ActionListener { + public void actionPerformed(ActionEvent event) { + System.out.println("Don't do it, you might regret it!"); + } + } + + class DevilListener implements ActionListener { + public void actionPerformed(ActionEvent event) { + System.out.println("Come on, do it!"); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/CurrentConditionsDisplay.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/CurrentConditionsDisplay.java new file mode 100644 index 0000000000000000000000000000000000000000..39ede7dceff80d3934ebc09df236175d43ab2a60 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/CurrentConditionsDisplay.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.observer.WeatherStation; + +public class CurrentConditionsDisplay implements Observer, DisplayElement { + private float temperature; + private float humidity; + private Subject weatherData; + + public CurrentConditionsDisplay(Subject weatherData) { + this.weatherData = weatherData; + weatherData.registerObserver(this); + } + + public void update(float temperature, float humidity, float pressure) { + this.temperature = temperature; + this.humidity = humidity; + display(); + } + + public void display() { + System.out.println("Current conditions: " + temperature + + "F degrees and " + humidity + "% humidity"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/DisplayElement.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/DisplayElement.java new file mode 100644 index 0000000000000000000000000000000000000000..887a44559e75d144554b696cf85b4696177d19bc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/DisplayElement.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.observer.WeatherStation; + +public interface DisplayElement { + public void display(); +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/ForecastDisplay.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/ForecastDisplay.java new file mode 100644 index 0000000000000000000000000000000000000000..afeca144301d828f4e24965e93b2bef9e93cf2c8 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/ForecastDisplay.java @@ -0,0 +1,31 @@ +package com.bootdo.headFirst.observer.WeatherStation; + + +public class ForecastDisplay implements Observer, DisplayElement { + private float currentPressure = 29.92f; + private float lastPressure; + private WeatherData weatherData; + + public ForecastDisplay(WeatherData weatherData) { + this.weatherData = weatherData; + weatherData.registerObserver(this); + } + + public void update(float temp, float humidity, float pressure) { + lastPressure = currentPressure; + currentPressure = pressure; + + display(); + } + + public void display() { + System.out.print("Forecast: "); + if (currentPressure > lastPressure) { + System.out.println("Improving weather on the way!"); + } else if (currentPressure == lastPressure) { + System.out.println("More of the same"); + } else if (currentPressure < lastPressure) { + System.out.println("Watch out for cooler, rainy weather"); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/HeatIndexDisplay.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/HeatIndexDisplay.java new file mode 100644 index 0000000000000000000000000000000000000000..bac407673a37d2fcde2d1e77d6c04deb6fb0688b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/HeatIndexDisplay.java @@ -0,0 +1,32 @@ +package com.bootdo.headFirst.observer.WeatherStation; + +public class HeatIndexDisplay implements Observer, DisplayElement { + float heatIndex = 0.0f; + private WeatherData weatherData; + + public HeatIndexDisplay(WeatherData weatherData) { + this.weatherData = weatherData; + weatherData.registerObserver(this); + } + + public void update(float t, float rh, float pressure) { + heatIndex = computeHeatIndex(t, rh); + display(); + } + + private float computeHeatIndex(float t, float rh) { + float index = (float)((16.923 + (0.185212 * t) + (5.37941 * rh) - (0.100254 * t * rh) + + (0.00941695 * (t * t)) + (0.00728898 * (rh * rh)) + + (0.000345372 * (t * t * rh)) - (0.000814971 * (t * rh * rh)) + + (0.0000102102 * (t * t * rh * rh)) - (0.000038646 * (t * t * t)) + (0.0000291583 * + (rh * rh * rh)) + (0.00000142721 * (t * t * t * rh)) + + (0.000000197483 * (t * rh * rh * rh)) - (0.0000000218429 * (t * t * t * rh * rh)) + + 0.000000000843296 * (t * t * rh * rh * rh)) - + (0.0000000000481975 * (t * t * t * rh * rh * rh))); + return index; + } + + public void display() { + System.out.println("Heat index is " + heatIndex); + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/Observer.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/Observer.java new file mode 100644 index 0000000000000000000000000000000000000000..4499b9c6c2b21fbf0ed92454bddb972b8e3bf2ad --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/Observer.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.observer.WeatherStation; + +public interface Observer { + public void update(float temp, float humidity, float pressure); +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/StatisticsDisplay.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/StatisticsDisplay.java new file mode 100644 index 0000000000000000000000000000000000000000..f8fede1e4e176e526711874225fc02d0f81be97c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/StatisticsDisplay.java @@ -0,0 +1,35 @@ +package com.bootdo.headFirst.observer.WeatherStation; + + +public class StatisticsDisplay implements Observer, DisplayElement { + private float maxTemp = 0.0f; + private float minTemp = 200; + private float tempSum= 0.0f; + private int numReadings; + private WeatherData weatherData; + + public StatisticsDisplay(WeatherData weatherData) { + this.weatherData = weatherData; + weatherData.registerObserver(this); + } + + public void update(float temp, float humidity, float pressure) { + tempSum += temp; + numReadings++; + + if (temp > maxTemp) { + maxTemp = temp; + } + + if (temp < minTemp) { + minTemp = temp; + } + + display(); + } + + public void display() { + System.out.println("Avg/Max/Min temperature = " + (tempSum / numReadings) + + "/" + maxTemp + "/" + minTemp); + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/Subject.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/Subject.java new file mode 100644 index 0000000000000000000000000000000000000000..0f350b1a32e2ef1fce0430b2b764b5b1d874da98 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/Subject.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.observer.WeatherStation; + +public interface Subject { + public void registerObserver(Observer o); + public void removeObserver(Observer o); + public void notifyObservers(); +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/WeatherData.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/WeatherData.java new file mode 100644 index 0000000000000000000000000000000000000000..088ab080ba6dffa72aa168e97d74158c8f69fa90 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/WeatherData.java @@ -0,0 +1,64 @@ +package com.bootdo.headFirst.observer.WeatherStation; + + +import java.util.ArrayList; + +public class WeatherData implements Subject { + private ArrayList observers; + private float temperature; + private float humidity; + private float pressure; + + public WeatherData() { + observers = new ArrayList(); + } + + public void registerObserver(Observer o) { + observers.add(o); + } + + @Override + public void removeObserver(Observer o) { + + } + + public void removeObserver(java.util.Observer o) { + int i = observers.indexOf(o); + if (i >= 0) { + observers.remove(i); + } + } + + + public void notifyObservers() { + for (int i = 0; i < observers.size(); i++) { + Observer observer = (Observer)observers.get(i); + observer.update(temperature, humidity, pressure); + } + } + + public void measurementsChanged() { + notifyObservers(); + } + + public void setMeasurements(float temperature, float humidity, float pressure) { + this.temperature = temperature; + this.humidity = humidity; + this.pressure = pressure; + measurementsChanged(); + } + + // other WeatherData methods here + + public float getTemperature() { + return temperature; + } + + public float getHumidity() { + return humidity; + } + + public float getPressure() { + return pressure; + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/WeatherStation.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/WeatherStation.java new file mode 100644 index 0000000000000000000000000000000000000000..1607e8a98816eaef9377eebad2a84a2a01d6b440 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/WeatherStation.java @@ -0,0 +1,19 @@ +package com.bootdo.headFirst.observer.WeatherStation; + +import java.util.*; + +public class WeatherStation { + + public static void main(String[] args) { + WeatherData weatherData = new WeatherData(); + + CurrentConditionsDisplay currentDisplay = + new CurrentConditionsDisplay(weatherData); + StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData); + ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData); + + weatherData.setMeasurements(80, 65, 30.4f); + weatherData.setMeasurements(82, 70, 29.2f); + weatherData.setMeasurements(78, 90, 29.2f); + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStation/WeatherStationHeatIndex.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/WeatherStationHeatIndex.java new file mode 100644 index 0000000000000000000000000000000000000000..d89ab730b4ba5718c0fbcb82bcf4137498497aa5 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStation/WeatherStationHeatIndex.java @@ -0,0 +1,18 @@ +package com.bootdo.headFirst.observer.WeatherStation; + +import java.util.*; + +public class WeatherStationHeatIndex { + + public static void main(String[] args) { + WeatherData weatherData = new WeatherData(); + CurrentConditionsDisplay currentDisplay = new CurrentConditionsDisplay(weatherData); + StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData); + ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData); + HeatIndexDisplay heatIndexDisplay = new HeatIndexDisplay(weatherData); + + weatherData.setMeasurements(80, 65, 30.4f); + weatherData.setMeasurements(82, 70, 29.2f); + weatherData.setMeasurements(78, 90, 29.2f); + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/CurrentConditionsDisplay.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/CurrentConditionsDisplay.java new file mode 100644 index 0000000000000000000000000000000000000000..b2c8e7de3f711338575bdfb8c042697b77edf1e5 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/CurrentConditionsDisplay.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.observer.WeatherStationObservable; + +import java.util.Observable; +import java.util.Observer; + +public class CurrentConditionsDisplay implements Observer, DisplayElement { + Observable observable; + private float temperature; + private float humidity; + + public CurrentConditionsDisplay(Observable observable) { + this.observable = observable; + observable.addObserver(this); + } + + public void update(Observable obs, Object arg) { + if (obs instanceof WeatherData) { + WeatherData weatherData = (WeatherData)obs; + this.temperature = weatherData.getTemperature(); + this.humidity = weatherData.getHumidity(); + display(); + } + } + + public void display() { + System.out.println("Current conditions: " + temperature + + "F degrees and " + humidity + "% humidity"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/DisplayElement.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/DisplayElement.java new file mode 100644 index 0000000000000000000000000000000000000000..0550b0864b3627d7299caf919fc2e88158a89897 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/DisplayElement.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.observer.WeatherStationObservable; + +public interface DisplayElement { + public void display(); +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/ForecastDisplay.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/ForecastDisplay.java new file mode 100644 index 0000000000000000000000000000000000000000..6c752874173ceb6c4177a5f1e06d176a79ab1efc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/ForecastDisplay.java @@ -0,0 +1,33 @@ +package com.bootdo.headFirst.observer.WeatherStationObservable; + +import java.util.Observable; +import java.util.Observer; + +public class ForecastDisplay implements Observer, DisplayElement { + private float currentPressure = 29.92f; + private float lastPressure; + + public ForecastDisplay(Observable observable) { + observable.addObserver(this); + } + + public void update(Observable observable, Object arg) { + if (observable instanceof WeatherData) { + WeatherData weatherData = (WeatherData)observable; + lastPressure = currentPressure; + currentPressure = weatherData.getPressure(); + display(); + } + } + + public void display() { + System.out.print("Forecast: "); + if (currentPressure > lastPressure) { + System.out.println("Improving weather on the way!"); + } else if (currentPressure == lastPressure) { + System.out.println("More of the same"); + } else if (currentPressure < lastPressure) { + System.out.println("Watch out for cooler, rainy weather"); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/HeatIndexDisplay.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/HeatIndexDisplay.java new file mode 100644 index 0000000000000000000000000000000000000000..6add3306402d5c12c7d71ce9ba48df634cb35ae8 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/HeatIndexDisplay.java @@ -0,0 +1,42 @@ +package com.bootdo.headFirst.observer.WeatherStationObservable; + +import java.util.Observable; +import java.util.Observer; + +public class HeatIndexDisplay implements Observer, DisplayElement { + float heatIndex = 0.0f; + + public HeatIndexDisplay(Observable observable) { + observable.addObserver(this); + } + + public void update(Observable observable, Object arg) { + if (observable instanceof WeatherData) { + WeatherData weatherData = (WeatherData)observable; + float t = weatherData.getTemperature(); + float rh = weatherData.getHumidity(); + heatIndex = (float) + ( + (16.923 + (0.185212 * t)) + + (5.37941 * rh) - + (0.100254 * t * rh) + + (0.00941695 * (t * t)) + + (0.00728898 * (rh * rh)) + + (0.000345372 * (t * t * rh)) - + (0.000814971 * (t * rh * rh)) + + (0.0000102102 * (t * t * rh * rh)) - + (0.000038646 * (t * t * t)) + + (0.0000291583 * (rh * rh * rh)) + + (0.00000142721 * (t * t * t * rh)) + + (0.000000197483 * (t * rh * rh * rh)) - + (0.0000000218429 * (t * t * t * rh * rh)) + + (0.000000000843296 * (t * t * rh * rh * rh)) - + (0.0000000000481975 * (t * t * t * rh * rh * rh))); + display(); + } + } + + public void display() { + System.out.println("Heat index is " + heatIndex); + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/StatisticsDisplay.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/StatisticsDisplay.java new file mode 100644 index 0000000000000000000000000000000000000000..8ddb750b6bd09a368604f60b8c71f412782ff52a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/StatisticsDisplay.java @@ -0,0 +1,39 @@ +package com.bootdo.headFirst.observer.WeatherStationObservable; + +import java.util.Observable; +import java.util.Observer; + +public class StatisticsDisplay implements Observer, DisplayElement { + private float maxTemp = 0.0f; + private float minTemp = 200; + private float tempSum= 0.0f; + private int numReadings; + + public StatisticsDisplay(Observable observable) { + observable.addObserver(this); + } + + public void update(Observable observable, Object arg) { + if (observable instanceof WeatherData) { + WeatherData weatherData = (WeatherData)observable; + float temp = weatherData.getTemperature(); + tempSum += temp; + numReadings++; + + if (temp > maxTemp) { + maxTemp = temp; + } + + if (temp < minTemp) { + minTemp = temp; + } + + display(); + } + } + + public void display() { + System.out.println("Avg/Max/Min temperature = " + (tempSum / numReadings) + + "/" + maxTemp + "/" + minTemp); + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/WeatherData.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/WeatherData.java new file mode 100644 index 0000000000000000000000000000000000000000..380828f0410e557a772bda56a7a4b1023ecc8d42 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/WeatherData.java @@ -0,0 +1,36 @@ +package com.bootdo.headFirst.observer.WeatherStationObservable; + +import java.util.Observable; +import java.util.Observer; + +public class WeatherData extends Observable { + private float temperature; + private float humidity; + private float pressure; + + public WeatherData() { } + + public void measurementsChanged() { + setChanged(); + notifyObservers(); + } + + public void setMeasurements(float temperature, float humidity, float pressure) { + this.temperature = temperature; + this.humidity = humidity; + this.pressure = pressure; + measurementsChanged(); + } + + public float getTemperature() { + return temperature; + } + + public float getHumidity() { + return humidity; + } + + public float getPressure() { + return pressure; + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/WeatherStation.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/WeatherStation.java new file mode 100644 index 0000000000000000000000000000000000000000..c405fa341240e1f3d581b91e56a7a2a84a28355e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/WeatherStation.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.observer.WeatherStationObservable; + +public class WeatherStation { + + public static void main(String[] args) { + WeatherData weatherData = new WeatherData(); + CurrentConditionsDisplay currentConditions = new CurrentConditionsDisplay(weatherData); + StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData); + ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData); + + weatherData.setMeasurements(80, 65, 30.4f); + weatherData.setMeasurements(82, 70, 29.2f); + weatherData.setMeasurements(78, 90, 29.2f); + } +} diff --git a/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/WeatherStationHeatIndex.java b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/WeatherStationHeatIndex.java new file mode 100644 index 0000000000000000000000000000000000000000..92b7d0684a547fb32c559ab248336755be6f152a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/observer/WeatherStationObservable/WeatherStationHeatIndex.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.observer.WeatherStationObservable; + +public class WeatherStationHeatIndex { + + public static void main(String[] args) { + WeatherData weatherData = new WeatherData(); + CurrentConditionsDisplay currentConditions = new CurrentConditionsDisplay(weatherData); + StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData); + ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData); + HeatIndexDisplay heatIndexDisplay = new HeatIndexDisplay(weatherData); + + weatherData.setMeasurements(80, 65, 30.4f); + weatherData.setMeasurements(82, 70, 29.2f); + weatherData.setMeasurements(78, 90, 29.2f); + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMachine.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMachine.java new file mode 100644 index 0000000000000000000000000000000000000000..5a08d7119206bb0b030aa4839299f162017a1d91 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMachine.java @@ -0,0 +1,107 @@ +package com.bootdo.headFirst.proxy.gumball; + +import java.rmi.*; +import java.rmi.server.*; + +public class GumballMachine + extends UnicastRemoteObject implements GumballMachineRemote +{ + State soldOutState; + State noQuarterState; + State hasQuarterState; + State soldState; + State winnerState; + + State state = soldOutState; + int count = 0; + String location; + + public GumballMachine(String location, int numberGumballs) throws RemoteException { + soldOutState = new SoldOutState(this); + noQuarterState = new NoQuarterState(this); + hasQuarterState = new HasQuarterState(this); + soldState = new SoldState(this); + winnerState = new WinnerState(this); + + this.count = numberGumballs; + if (numberGumballs > 0) { + state = noQuarterState; + } + this.location = location; + } + + + public void insertQuarter() { + state.insertQuarter(); + } + + public void ejectQuarter() { + state.ejectQuarter(); + } + + public void turnCrank() { + state.turnCrank(); + state.dispense(); + } + + void setState(State state) { + this.state = state; + } + + void releaseBall() { + System.out.println("A gumball comes rolling out the slot..."); + if (count != 0) { + count = count - 1; + } + } + + public void refill(int count) { + this.count = count; + state = noQuarterState; + } + + public int getCount() { + return count; + } + + public State getState() { + return state; + } + + public String getLocation() { + return location; + } + + public State getSoldOutState() { + return soldOutState; + } + + public State getNoQuarterState() { + return noQuarterState; + } + + public State getHasQuarterState() { + return hasQuarterState; + } + + public State getSoldState() { + return soldState; + } + + public State getWinnerState() { + return winnerState; + } + + public String toString() { + StringBuffer result = new StringBuffer(); + result.append("\nMighty Gumball, Inc."); + result.append("\nJava-enabled Standing Gumball Model #2004"); + result.append("\nInventory: " + count + " gumball"); + if (count != 1) { + result.append("s"); + } + result.append("\n"); + result.append("Machine is " + state + "\n"); + return result.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMachineRemote.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMachineRemote.java new file mode 100644 index 0000000000000000000000000000000000000000..33dcf96ba0cb1ad4736e813ef286ea1f7b1aa322 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMachineRemote.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.proxy.gumball; + +import java.rmi.*; + +public interface GumballMachineRemote extends Remote { + public int getCount() throws RemoteException; + public String getLocation() throws RemoteException; + public State getState() throws RemoteException; +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMachineTestDrive.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMachineTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..83c828caca65e8ff8a17def4fddbcedcfc0c77fc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMachineTestDrive.java @@ -0,0 +1,25 @@ +package com.bootdo.headFirst.proxy.gumball; +import java.rmi.*; + +public class GumballMachineTestDrive { + + public static void main(String[] args) { + GumballMachineRemote gumballMachine = null; + int count; + + if (args.length < 2) { + System.out.println("GumballMachine "); + System.exit(1); + } + + try { + count = Integer.parseInt(args[1]); + + gumballMachine = + new GumballMachine(args[0], count); + Naming.rebind("//" + args[0] + "/gumballmachine", gumballMachine); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMonitor.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMonitor.java new file mode 100644 index 0000000000000000000000000000000000000000..d900a16239b2239b8b701ed81b68d3ebc474a20d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMonitor.java @@ -0,0 +1,21 @@ +package com.bootdo.headFirst.proxy.gumball; + +import java.rmi.*; + +public class GumballMonitor { + GumballMachineRemote machine; + + public GumballMonitor(GumballMachineRemote machine) { + this.machine = machine; + } + + public void report() { + try { + System.out.println("Gumball Machine: " + machine.getLocation()); + System.out.println("Current inventory: " + machine.getCount() + " gumballs"); + System.out.println("Current state: " + machine.getState()); + } catch (RemoteException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMonitorTestDrive.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMonitorTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..8a92dc9e8028c096c5353e7f0cbdbbf2a78c498c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/GumballMonitorTestDrive.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.proxy.gumball; + +import java.rmi.*; + +public class GumballMonitorTestDrive { + + public static void main(String[] args) { + String[] location = {"rmi://santafe.mightygumball.com/gumballmachine", + "rmi://boulder.mightygumball.com/gumballmachine", + "rmi://seattle.mightygumball.com/gumballmachine"}; + + GumballMonitor[] monitor = new GumballMonitor[location.length]; + + for (int i=0;i < location.length; i++) { + try { + GumballMachineRemote machine = + (GumballMachineRemote) Naming.lookup(location[i]); + monitor[i] = new GumballMonitor(machine); + System.out.println(monitor[i]); + } catch (Exception e) { + e.printStackTrace(); + } + } + + for(int i=0; i < monitor.length; i++) { + monitor[i].report(); + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/HasQuarterState.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/HasQuarterState.java new file mode 100644 index 0000000000000000000000000000000000000000..b1cfeb0b1dd3a9981d619d2120b6fbd188f710c6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/HasQuarterState.java @@ -0,0 +1,39 @@ +package com.bootdo.headFirst.proxy.gumball; + +import java.util.Random; + +public class HasQuarterState implements State { + Random randomWinner = new Random(System.currentTimeMillis()); + transient GumballMachine gumballMachine; + + public HasQuarterState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You can't insert another quarter"); + } + + public void ejectQuarter() { + System.out.println("Quarter returned"); + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } + + public void turnCrank() { + System.out.println("You turned..."); + int winner = randomWinner.nextInt(10); + if (winner == 0) { + gumballMachine.setState(gumballMachine.getWinnerState()); + } else { + gumballMachine.setState(gumballMachine.getSoldState()); + } + } + + public void dispense() { + System.out.println("No gumball dispensed"); + } + + public String toString() { + return "waiting for turn of crank"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/NoQuarterState.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/NoQuarterState.java new file mode 100644 index 0000000000000000000000000000000000000000..39cfac176b829ada08082a59b927e9ac8e9c5ceb --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/NoQuarterState.java @@ -0,0 +1,30 @@ +package com.bootdo.headFirst.proxy.gumball; + +public class NoQuarterState implements State { + transient GumballMachine gumballMachine; + + public NoQuarterState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You inserted a quarter"); + gumballMachine.setState(gumballMachine.getHasQuarterState()); + } + + public void ejectQuarter() { + System.out.println("You haven't inserted a quarter"); + } + + public void turnCrank() { + System.out.println("You turned, but there's no quarter"); + } + + public void dispense() { + System.out.println("You need to pay first"); + } + + public String toString() { + return "waiting for quarter"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/SoldOutState.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/SoldOutState.java new file mode 100644 index 0000000000000000000000000000000000000000..19cb32c10b5a90293857aaaa4d1ebd3b4ee2a7a5 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/SoldOutState.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.proxy.gumball; + +public class SoldOutState implements State { + transient GumballMachine gumballMachine; + + public SoldOutState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You can't insert a quarter, the machine is sold out"); + } + + public void ejectQuarter() { + System.out.println("You can't eject, you haven't inserted a quarter yet"); + } + + public void turnCrank() { + System.out.println("You turned, but there are no gumballs"); + } + + public void dispense() { + System.out.println("No gumball dispensed"); + } + + public String toString() { + return "sold out"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/SoldState.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/SoldState.java new file mode 100644 index 0000000000000000000000000000000000000000..f2bc81d82645a0d45bf111f05476844ba6300b09 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/SoldState.java @@ -0,0 +1,35 @@ +package com.bootdo.headFirst.proxy.gumball; + +public class SoldState implements State { + transient GumballMachine gumballMachine; + + public SoldState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("Please wait, we're already giving you a gumball"); + } + + public void ejectQuarter() { + System.out.println("Sorry, you already turned the crank"); + } + + public void turnCrank() { + System.out.println("Turning twice doesn't get you another gumball!"); + } + + public void dispense() { + gumballMachine.releaseBall(); + if (gumballMachine.getCount() > 0) { + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } else { + System.out.println("Oops, out of gumballs!"); + gumballMachine.setState(gumballMachine.getSoldOutState()); + } + } + + public String toString() { + return "dispensing a gumball"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/State.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/State.java new file mode 100644 index 0000000000000000000000000000000000000000..902956c9fca1fa826b9b015d0732a71d54c9987c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/State.java @@ -0,0 +1,10 @@ +package com.bootdo.headFirst.proxy.gumball; + +import java.io.*; + +public interface State extends Serializable { + public void insertQuarter(); + public void ejectQuarter(); + public void turnCrank(); + public void dispense(); +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumball/WinnerState.java b/src/main/java/com/bootdo/headFirst/proxy/gumball/WinnerState.java new file mode 100644 index 0000000000000000000000000000000000000000..3c4718baa17eec94e11e45afac3ffcee92ad06c4 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumball/WinnerState.java @@ -0,0 +1,41 @@ +package com.bootdo.headFirst.proxy.gumball; + +public class WinnerState implements State { + transient GumballMachine gumballMachine; + + public WinnerState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("Please wait, we're already giving you a Gumball"); + } + + public void ejectQuarter() { + System.out.println("Please wait, we're already giving you a Gumball"); + } + + public void turnCrank() { + System.out.println("Turning again doesn't get you another gumball!"); + } + + public void dispense() { + System.out.println("YOU'RE A WINNER! You get two gumballs for your quarter"); + gumballMachine.releaseBall(); + if (gumballMachine.getCount() == 0) { + gumballMachine.setState(gumballMachine.getSoldOutState()); + } else { + gumballMachine.releaseBall(); + if (gumballMachine.getCount() > 0) { + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } else { + System.out.println("Oops, out of gumballs!"); + gumballMachine.setState(gumballMachine.getSoldOutState()); + } + } + } + + public String toString() { + return "despensing two gumballs for your quarter, because YOU'RE A WINNER!"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/GumballMachine.java b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/GumballMachine.java new file mode 100644 index 0000000000000000000000000000000000000000..205f8fbbb2710772be3f3cc5bace46551f01c762 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/GumballMachine.java @@ -0,0 +1,101 @@ +package com.bootdo.headFirst.proxy.gumballmonitor; + +public class GumballMachine { + State soldOutState; + State noQuarterState; + State hasQuarterState; + State soldState; + State winnerState; + + State state = soldOutState; + int count = 0; + String location; + + public GumballMachine(String location, int count) { + soldOutState = new SoldOutState(this); + noQuarterState = new NoQuarterState(this); + hasQuarterState = new HasQuarterState(this); + soldState = new SoldState(this); + winnerState = new WinnerState(this); + + this.count = count; + if (count > 0) { + state = noQuarterState; + } + this.location = location; + } + + public void insertQuarter() { + state.insertQuarter(); + } + + public void ejectQuarter() { + state.ejectQuarter(); + } + + public void turnCrank() { + state.turnCrank(); + state.dispense(); + } + + void setState(State state) { + this.state = state; + } + + void releaseBall() { + System.out.println("A gumball comes rolling out the slot..."); + if (count != 0) { + count = count - 1; + } + } + + public int getCount() { + return count; + } + + public void refill(int count) { + this.count = count; + state = noQuarterState; + } + + public State getState() { + return state; + } + + public String getLocation() { + return location; + } + + public State getSoldOutState() { + return soldOutState; + } + + public State getNoQuarterState() { + return noQuarterState; + } + + public State getHasQuarterState() { + return hasQuarterState; + } + + public State getSoldState() { + return soldState; + } + + public State getWinnerState() { + return winnerState; + } + + public String toString() { + StringBuffer result = new StringBuffer(); + result.append("\nMighty Gumball, Inc."); + result.append("\nJava-enabled Standing Gumball Model #2004"); + result.append("\nInventory: " + count + " gumball"); + if (count != 1) { + result.append("s"); + } + result.append("\n"); + result.append("Machine is " + state + "\n"); + return result.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/GumballMachineTestDrive.java b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/GumballMachineTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..e6e0b1a2c318412d8ef8773dd63dde387c7a61ff --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/GumballMachineTestDrive.java @@ -0,0 +1,63 @@ +package com.bootdo.headFirst.proxy.gumballmonitor; + +public class GumballMachineTestDrive { + + public static void main(String[] args) { + int count = 0; + + if (args.length < 2) { + System.out.println("GumballMachine "); + System.exit(1); + } + + try { + count = Integer.parseInt(args[1]); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + GumballMachine gumballMachine = new GumballMachine(args[0], count); + + GumballMonitor monitor = new GumballMonitor(gumballMachine); + + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + monitor.report(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/GumballMonitor.java b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/GumballMonitor.java new file mode 100644 index 0000000000000000000000000000000000000000..a5d6628024ffd47519610b00101b6b5b58cd8aa8 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/GumballMonitor.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.proxy.gumballmonitor; + +public class GumballMonitor { + GumballMachine machine; + + public GumballMonitor(GumballMachine machine) { + this.machine = machine; + } + + public void report() { + System.out.println("Gumball Machine: " + machine.getLocation()); + System.out.println("Current inventory: " + machine.getCount() + " gumballs"); + System.out.println("Current state: " + machine.getState()); + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/HasQuarterState.java b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/HasQuarterState.java new file mode 100644 index 0000000000000000000000000000000000000000..fa02a6b30a589b34f96f82d957890ed1bbbb12f8 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/HasQuarterState.java @@ -0,0 +1,40 @@ +package com.bootdo.headFirst.proxy.gumballmonitor; + + +import java.util.Random; + +public class HasQuarterState implements State { + Random randomWinner = new Random(System.currentTimeMillis()); + GumballMachine gumballMachine; + + public HasQuarterState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You can't insert another quarter"); + } + + public void ejectQuarter() { + System.out.println("Quarter returned"); + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } + + public void turnCrank() { + System.out.println("You turned..."); + int winner = randomWinner.nextInt(10); + if (winner == 0) { + gumballMachine.setState(gumballMachine.getWinnerState()); + } else { + gumballMachine.setState(gumballMachine.getSoldState()); + } + } + + public void dispense() { + System.out.println("No gumball dispensed"); + } + + public String toString() { + return "waiting for turn of crank"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/NoQuarterState.java b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/NoQuarterState.java new file mode 100644 index 0000000000000000000000000000000000000000..32643b0f317d653556bcc909f84bafcf43e5721d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/NoQuarterState.java @@ -0,0 +1,30 @@ +package com.bootdo.headFirst.proxy.gumballmonitor; + +public class NoQuarterState implements State { + GumballMachine gumballMachine; + + public NoQuarterState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You inserted a quarter"); + gumballMachine.setState(gumballMachine.getHasQuarterState()); + } + + public void ejectQuarter() { + System.out.println("You haven't inserted a quarter"); + } + + public void turnCrank() { + System.out.println("You turned, but there's no quarter"); + } + + public void dispense() { + System.out.println("You need to pay first"); + } + + public String toString() { + return "waiting for quarter"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/SoldOutState.java b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/SoldOutState.java new file mode 100644 index 0000000000000000000000000000000000000000..15404a7f8a481dec1930a5e539a1d3fd5f019709 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/SoldOutState.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.proxy.gumballmonitor; + +public class SoldOutState implements State { + GumballMachine gumballMachine; + + public SoldOutState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You can't insert a quarter, the machine is sold out"); + } + + public void ejectQuarter() { + System.out.println("You can't eject, you haven't inserted a quarter yet"); + } + + public void turnCrank() { + System.out.println("You turned, but there are no gumballs"); + } + + public void dispense() { + System.out.println("No gumball dispensed"); + } + + public String toString() { + return "sold out"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/SoldState.java b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/SoldState.java new file mode 100644 index 0000000000000000000000000000000000000000..7f991df829b56458b8720aeee3e22ac60ef7a9e9 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/SoldState.java @@ -0,0 +1,39 @@ +package com.bootdo.headFirst.proxy.gumballmonitor; + +public class SoldState implements State { + GumballMachine gumballMachine; + + public SoldState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("Please wait, we're already giving you a gumball"); + } + + public void ejectQuarter() { + System.out.println("Sorry, you already turned the crank"); + } + + public void turnCrank() { + System.out.println("Turning twice doesn't get you another gumball!"); + } + + public void dispense() { + gumballMachine.releaseBall(); + try { + if (gumballMachine.getCount() > 0) { + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } else { + System.out.println("Oops, out of gumballs!"); + gumballMachine.setState(gumballMachine.getSoldOutState()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public String toString() { + return "dispensing a gumball"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/State.java b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/State.java new file mode 100644 index 0000000000000000000000000000000000000000..6168abbd58ec0be88ca752b17750032c4405fcf4 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/State.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.proxy.gumballmonitor; + +import java.io.*; + +public interface State extends Serializable { + + public void insertQuarter(); + public void ejectQuarter(); + public void turnCrank(); + public void dispense(); +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/WinnerState.java b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/WinnerState.java new file mode 100644 index 0000000000000000000000000000000000000000..534e0c44a4cb840a173e0e17b8b8400cad265a2f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/gumballmonitor/WinnerState.java @@ -0,0 +1,45 @@ +package com.bootdo.headFirst.proxy.gumballmonitor; + +public class WinnerState implements State { + GumballMachine gumballMachine; + + public WinnerState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("Please wait, we're already giving you a Gumball"); + } + + public void ejectQuarter() { + System.out.println("Please wait, we're already giving you a Gumball"); + } + + public void turnCrank() { + System.out.println("Turning again doesn't get you another gumball!"); + } + + public void dispense() { + System.out.println("YOU'RE A WINNER! You get two gumballs for your quarter"); + try { + gumballMachine.releaseBall(); + if (gumballMachine.getCount() == 0) { + gumballMachine.setState(gumballMachine.getSoldOutState()); + } else { + gumballMachine.releaseBall(); + if (gumballMachine.getCount() > 0) { + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } else { + System.out.println("Oops, out of gumballs!"); + gumballMachine.setState(gumballMachine.getSoldOutState()); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public String toString() { + return "despensing two gumballs for your quarter, because YOU'RE A WINNER!"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/javaproxy/MatchMakingTestDrive.java b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/MatchMakingTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..03f4a901812570f49526151ea71a3ac46933e3a4 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/MatchMakingTestDrive.java @@ -0,0 +1,76 @@ +package com.bootdo.headFirst.proxy.javaproxy; + +import java.lang.reflect.*; +import java.util.*; + +public class MatchMakingTestDrive { + Hashtable datingDB = new Hashtable(); + + public static void main(String[] args) { + MatchMakingTestDrive test = new MatchMakingTestDrive(); + test.drive(); + } + + public MatchMakingTestDrive() { + initializeDatabase(); + } + + public void drive() { + PersonBean joe = getPersonFromDatabase("Joe Javabean"); + PersonBean ownerProxy = getOwnerProxy(joe); + System.out.println("Name is " + ownerProxy.getName()); + ownerProxy.setInterests("bowling, Go"); + System.out.println("Interests set from owner proxy"); + try { + ownerProxy.setHotOrNotRating(10); + } catch (Exception e) { + System.out.println("Can't set rating from owner proxy"); + } + System.out.println("Rating is " + ownerProxy.getHotOrNotRating()); + + PersonBean nonOwnerProxy = getNonOwnerProxy(joe); + System.out.println("Name is " + nonOwnerProxy.getName()); + try { + nonOwnerProxy.setInterests("bowling, Go"); + } catch (Exception e) { + System.out.println("Can't set interests from non owner proxy"); + } + nonOwnerProxy.setHotOrNotRating(3); + System.out.println("Rating set from non owner proxy"); + System.out.println("Rating is " + nonOwnerProxy.getHotOrNotRating()); + } + + PersonBean getOwnerProxy(PersonBean person) { + + return (PersonBean) Proxy.newProxyInstance( + person.getClass().getClassLoader(), + person.getClass().getInterfaces(), + new OwnerInvocationHandler(person)); + } + + PersonBean getNonOwnerProxy(PersonBean person) { + + return (PersonBean) Proxy.newProxyInstance( + person.getClass().getClassLoader(), + person.getClass().getInterfaces(), + new NonOwnerInvocationHandler(person)); + } + + PersonBean getPersonFromDatabase(String name) { + return (PersonBean)datingDB.get(name); + } + + void initializeDatabase() { + PersonBean joe = new PersonBeanImpl(); + joe.setName("Joe Javabean"); + joe.setInterests("cars, computers, music"); + joe.setHotOrNotRating(7); + datingDB.put(joe.getName(), joe); + + PersonBean kelly = new PersonBeanImpl(); + kelly.setName("Kelly Klosure"); + kelly.setInterests("ebay, movies, music"); + kelly.setHotOrNotRating(6); + datingDB.put(kelly.getName(), kelly); + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/javaproxy/NonOwnerInvocationHandler.java b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/NonOwnerInvocationHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..c9cc133d335fc2585a02f111b94b623eff4267b2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/NonOwnerInvocationHandler.java @@ -0,0 +1,28 @@ +package com.bootdo.headFirst.proxy.javaproxy; + +import java.lang.reflect.*; + +public class NonOwnerInvocationHandler implements InvocationHandler { + PersonBean person; + + public NonOwnerInvocationHandler(PersonBean person) { + this.person = person; + } + + public Object invoke(Object proxy, Method method, Object[] args) + throws IllegalAccessException { + + try { + if (method.getName().startsWith("get")) { + return method.invoke(person, args); + } else if (method.getName().equals("setHotOrNotRating")) { + return method.invoke(person, args); + } else if (method.getName().startsWith("set")) { + throw new IllegalAccessException(); + } + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/javaproxy/OwnerInvocationHandler.java b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/OwnerInvocationHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..a2baea88dde12c95ab63f21bb9edb74e77700b04 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/OwnerInvocationHandler.java @@ -0,0 +1,28 @@ +package com.bootdo.headFirst.proxy.javaproxy; + +import java.lang.reflect.*; + +public class OwnerInvocationHandler implements InvocationHandler { + PersonBean person; + + public OwnerInvocationHandler(PersonBean person) { + this.person = person; + } + + public Object invoke(Object proxy, Method method, Object[] args) + throws IllegalAccessException { + + try { + if (method.getName().startsWith("get")) { + return method.invoke(person, args); + } else if (method.getName().equals("setHotOrNotRating")) { + throw new IllegalAccessException(); + } else if (method.getName().startsWith("set")) { + return method.invoke(person, args); + } + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/javaproxy/PersonBean.java b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/PersonBean.java new file mode 100644 index 0000000000000000000000000000000000000000..b8ab150588142cd045fdef75621c2deb2768262f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/PersonBean.java @@ -0,0 +1,15 @@ +package com.bootdo.headFirst.proxy.javaproxy; + +public interface PersonBean { + + String getName(); + String getGender(); + String getInterests(); + int getHotOrNotRating(); + + void setName(String name); + void setGender(String gender); + void setInterests(String interests); + void setHotOrNotRating(int rating); + +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/javaproxy/PersonBeanImpl.java b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/PersonBeanImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..138750a6eef00dcf7a8ec0fa655afed70a9d9205 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/javaproxy/PersonBeanImpl.java @@ -0,0 +1,44 @@ +package com.bootdo.headFirst.proxy.javaproxy; + +public class PersonBeanImpl implements PersonBean { + String name; + String gender; + String interests; + int rating; + int ratingCount = 0; + + public String getName() { + return name; + } + + public String getGender() { + return gender; + } + + public String getInterests() { + return interests; + } + + public int getHotOrNotRating() { + if (ratingCount == 0) return 0; + return (rating/ratingCount); + } + + + public void setName(String name) { + this.name = name; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public void setInterests(String interests) { + this.interests = interests; + } + + public void setHotOrNotRating(int rating) { + this.rating += rating; + ratingCount++; + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/virtualproxy/ImageComponent.java b/src/main/java/com/bootdo/headFirst/proxy/virtualproxy/ImageComponent.java new file mode 100644 index 0000000000000000000000000000000000000000..271a65a88d179db27dcc8153f4a00420ccfe06b3 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/virtualproxy/ImageComponent.java @@ -0,0 +1,25 @@ +package com.bootdo.headFirst.proxy.virtualproxy; + +import java.awt.*; +import javax.swing.*; + +class ImageComponent extends JComponent { + private Icon icon; + + public ImageComponent(Icon icon) { + this.icon = icon; + } + + public void setIcon(Icon icon) { + this.icon = icon; + } + + public void paintComponent(Graphics g) { + super.paintComponent(g); + int w = icon.getIconWidth(); + int h = icon.getIconHeight(); + int x = (800 - w)/2; + int y = (600 - h)/2; + icon.paintIcon(this, g, x, y); + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/virtualproxy/ImageProxy.java b/src/main/java/com/bootdo/headFirst/proxy/virtualproxy/ImageProxy.java new file mode 100644 index 0000000000000000000000000000000000000000..499335727fc962929572b9276c827f167861ba6d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/virtualproxy/ImageProxy.java @@ -0,0 +1,54 @@ +package com.bootdo.headFirst.proxy.virtualproxy; + +import java.net.*; +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +class ImageProxy implements Icon { + ImageIcon imageIcon; + URL imageURL; + Thread retrievalThread; + boolean retrieving = false; + + public ImageProxy(URL url) { imageURL = url; } + + public int getIconWidth() { + if (imageIcon != null) { + return imageIcon.getIconWidth(); + } else { + return 800; + } + } + + public int getIconHeight() { + if (imageIcon != null) { + return imageIcon.getIconHeight(); + } else { + return 600; + } + } + + public void paintIcon(final Component c, Graphics g, int x, int y) { + if (imageIcon != null) { + imageIcon.paintIcon(c, g, x, y); + } else { + g.drawString("Loading CD cover, please wait...", x+300, y+190); + if (!retrieving) { + retrieving = true; + + retrievalThread = new Thread(new Runnable() { + public void run() { + try { + imageIcon = new ImageIcon(imageURL, "CD Cover"); + c.repaint(); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + retrievalThread.start(); + } + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/proxy/virtualproxy/ImageProxyTestDrive.java b/src/main/java/com/bootdo/headFirst/proxy/virtualproxy/ImageProxyTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..b4cb0466d906ffbe42904187c2e54b72c424c23f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/proxy/virtualproxy/ImageProxyTestDrive.java @@ -0,0 +1,66 @@ +package com.bootdo.headFirst.proxy.virtualproxy; + +import java.net.*; +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.*; + +public class ImageProxyTestDrive { + ImageComponent imageComponent; + JFrame frame = new JFrame("CD Cover Viewer"); + JMenuBar menuBar; + JMenu menu; + Hashtable cds = new Hashtable(); + + public static void main (String[] args) throws Exception { + ImageProxyTestDrive testDrive = new ImageProxyTestDrive(); + } + + public ImageProxyTestDrive() throws Exception{ + cds.put("Ambient: Music for Airports","http://images.amazon.com/images/P/B000003S2K.01.LZZZZZZZ.jpg"); + cds.put("Buddha Bar","http://images.amazon.com/images/P/B00009XBYK.01.LZZZZZZZ.jpg"); + cds.put("Ima","http://images.amazon.com/images/P/B000005IRM.01.LZZZZZZZ.jpg"); + cds.put("Karma","http://images.amazon.com/images/P/B000005DCB.01.LZZZZZZZ.gif"); + cds.put("MCMXC A.D.","http://images.amazon.com/images/P/B000002URV.01.LZZZZZZZ.jpg"); + cds.put("Northern Exposure","http://images.amazon.com/images/P/B000003SFN.01.LZZZZZZZ.jpg"); + cds.put("Selected Ambient Works, Vol. 2","http://images.amazon.com/images/P/B000002MNZ.01.LZZZZZZZ.jpg"); + + URL initialURL = new URL((String)cds.get("Selected Ambient Works, Vol. 2")); + menuBar = new JMenuBar(); + menu = new JMenu("Favorite CDs"); + menuBar.add(menu); + frame.setJMenuBar(menuBar); + + for(Enumeration e = cds.keys(); e.hasMoreElements();) { + String name = (String)e.nextElement(); + JMenuItem menuItem = new JMenuItem(name); + menu.add(menuItem); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + imageComponent.setIcon(new ImageProxy(getCDUrl(event.getActionCommand()))); + frame.repaint(); + } + }); + } + + // set up frame and menus + + Icon icon = new ImageProxy(initialURL); + imageComponent = new ImageComponent(icon); + frame.getContentPane().add(imageComponent); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(800,600); + frame.setVisible(true); + + } + + URL getCDUrl(String name) { + try { + return new URL((String)cds.get(name)); + } catch (MalformedURLException e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/chocolate/ChocolateBoiler.java b/src/main/java/com/bootdo/headFirst/singleton/chocolate/ChocolateBoiler.java new file mode 100644 index 0000000000000000000000000000000000000000..b3cb06b866fc9fe6d9eee9ae68f4afb50835a1e9 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/chocolate/ChocolateBoiler.java @@ -0,0 +1,51 @@ +package com.bootdo.headFirst.singleton.chocolate; + +public class ChocolateBoiler { + private boolean empty; + private boolean boiled; + private static ChocolateBoiler uniqueInstance; + + private ChocolateBoiler() { + empty = true; + boiled = false; + } + + public static ChocolateBoiler getInstance() { + if (uniqueInstance == null) { + System.out.println("Creating unique instance of Chocolate Boiler"); + uniqueInstance = new ChocolateBoiler(); + } + System.out.println("Returning instance of Chocolate Boiler"); + return uniqueInstance; + } + + public void fill() { + if (isEmpty()) { + empty = false; + boiled = false; + // fill the boiler with a milk/chocolate mixture + } + } + + public void drain() { + if (!isEmpty() && isBoiled()) { + // drain the boiled milk and chocolate + empty = true; + } + } + + public void boil() { + if (!isEmpty() && !isBoiled()) { + // bring the contents to a boil + boiled = true; + } + } + + public boolean isEmpty() { + return empty; + } + + public boolean isBoiled() { + return boiled; + } +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/chocolate/ChocolateController.java b/src/main/java/com/bootdo/headFirst/singleton/chocolate/ChocolateController.java new file mode 100644 index 0000000000000000000000000000000000000000..d15a9f88e32dd51d258b76dc18f2fd635a0dce85 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/chocolate/ChocolateController.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.singleton.chocolate; + +public class ChocolateController { + public static void main(String args[]) { + ChocolateBoiler boiler = ChocolateBoiler.getInstance(); + boiler.fill(); + boiler.boil(); + boiler.drain(); + + // will return the existing instance + ChocolateBoiler boiler2 = ChocolateBoiler.getInstance(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/classic/Singleton.java b/src/main/java/com/bootdo/headFirst/singleton/classic/Singleton.java new file mode 100644 index 0000000000000000000000000000000000000000..3c101acf26f00781de5874904f141bdb2be50494 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/classic/Singleton.java @@ -0,0 +1,20 @@ +package com.bootdo.headFirst.singleton.classic; + +// NOTE: This is not thread safe! + +public class Singleton { + private static Singleton uniqueInstance; + + // other useful instance variables here + + private Singleton() {} + + public static Singleton getInstance() { + if (uniqueInstance == null) { + uniqueInstance = new Singleton(); + } + return uniqueInstance; + } + + // other useful methods here +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/dcl/Singleton.java b/src/main/java/com/bootdo/headFirst/singleton/dcl/Singleton.java new file mode 100644 index 0000000000000000000000000000000000000000..c4726e66b5a4909656048fd444b10dadb8971c4f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/dcl/Singleton.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.singleton.dcl; + +// +// Danger! This implementation of Singleton not +// guaranteed to work prior to Java 5 +// + +public class Singleton { + private volatile static Singleton uniqueInstance; + + private Singleton() {} + + public static Singleton getInstance() { + if (uniqueInstance == null) { + synchronized (Singleton.class) { + if (uniqueInstance == null) { + uniqueInstance = new Singleton(); + } + } + } + return uniqueInstance; + } +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/dcl/SingletonClient.java b/src/main/java/com/bootdo/headFirst/singleton/dcl/SingletonClient.java new file mode 100644 index 0000000000000000000000000000000000000000..33cb0fabdde5e45e4e5fd1757c9af42b3e8c240c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/dcl/SingletonClient.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.singleton.dcl; + +public class SingletonClient { + public static void main(String[] args) { + Singleton singleton = Singleton.getInstance(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/stat/Singleton.java b/src/main/java/com/bootdo/headFirst/singleton/stat/Singleton.java new file mode 100644 index 0000000000000000000000000000000000000000..94c2ad1de120382f8211fe51f76657c72d80bf65 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/stat/Singleton.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.singleton.stat; + +public class Singleton { + private static Singleton uniqueInstance = new Singleton(); + + private Singleton() {} + + public static Singleton getInstance() { + return uniqueInstance; + } +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/stat/SingletonClient.java b/src/main/java/com/bootdo/headFirst/singleton/stat/SingletonClient.java new file mode 100644 index 0000000000000000000000000000000000000000..7e50e1e275b7697b8363ea4436bafd5a4074bd73 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/stat/SingletonClient.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.singleton.stat; + +public class SingletonClient { + public static void main(String[] args) { + Singleton singleton = Singleton.getInstance(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/subclass/CoolerSingleton.java b/src/main/java/com/bootdo/headFirst/singleton/subclass/CoolerSingleton.java new file mode 100644 index 0000000000000000000000000000000000000000..46dd710707cbea4ef4abef97661d2af6ced21b71 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/subclass/CoolerSingleton.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.singleton.subclass; + +public class CoolerSingleton extends Singleton { + // useful instance variables here + protected static Singleton uniqueInstance; + + private CoolerSingleton() { + super(); + } + + // useful methods here +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/subclass/HotterSingleton.java b/src/main/java/com/bootdo/headFirst/singleton/subclass/HotterSingleton.java new file mode 100644 index 0000000000000000000000000000000000000000..12ce80ec8c142d1fbdfac9e446236939595980ba --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/subclass/HotterSingleton.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.singleton.subclass; + +public class HotterSingleton extends Singleton { + // useful instance variables here + + private HotterSingleton() { + super(); + } + + // useful methods here +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/subclass/Singleton.java b/src/main/java/com/bootdo/headFirst/singleton/subclass/Singleton.java new file mode 100644 index 0000000000000000000000000000000000000000..6e1ff9ccc70be094d899f26f16c0eb5adab7937c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/subclass/Singleton.java @@ -0,0 +1,18 @@ +package com.bootdo.headFirst.singleton.subclass; + +public class Singleton { + protected static Singleton uniqueInstance; + + // other useful instance variables here + + protected Singleton() {} + + public static synchronized Singleton getInstance() { + if (uniqueInstance == null) { + uniqueInstance = new Singleton(); + } + return uniqueInstance; + } + + // other useful methods here +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/subclass/SingletonTestDrive.java b/src/main/java/com/bootdo/headFirst/singleton/subclass/SingletonTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..b900b29af320a33182771e6f87c733a632a8095c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/subclass/SingletonTestDrive.java @@ -0,0 +1,10 @@ +package com.bootdo.headFirst.singleton.subclass; + +public class SingletonTestDrive { + public static void main(String[] args) { + Singleton foo = CoolerSingleton.getInstance(); + Singleton bar = HotterSingleton.getInstance(); + System.out.println(foo); + System.out.println(bar); + } +} diff --git a/src/main/java/com/bootdo/headFirst/singleton/threadsafe/Singleton.java b/src/main/java/com/bootdo/headFirst/singleton/threadsafe/Singleton.java new file mode 100644 index 0000000000000000000000000000000000000000..5ea05e34fb7dc27e08d65d1b7250aeafbf2ccf1f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/singleton/threadsafe/Singleton.java @@ -0,0 +1,18 @@ +package com.bootdo.headFirst.singleton.threadsafe; + +public class Singleton { + private static Singleton uniqueInstance; + + // other useful instance variables here + + private Singleton() {} + + public static synchronized Singleton getInstance() { + if (uniqueInstance == null) { + uniqueInstance = new Singleton(); + } + return uniqueInstance; + } + + // other useful methods here +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumball/GumballMachine.java b/src/main/java/com/bootdo/headFirst/state/gumball/GumballMachine.java new file mode 100644 index 0000000000000000000000000000000000000000..806ae258ec9228af9b74611c21ba2efe624d1f2a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumball/GumballMachine.java @@ -0,0 +1,110 @@ +package com.bootdo.headFirst.state.gumball; + +public class GumballMachine { + + final static int SOLD_OUT = 0; + final static int NO_QUARTER = 1; + final static int HAS_QUARTER = 2; + final static int SOLD = 3; + + int state = SOLD_OUT; + int count = 0; + + public GumballMachine(int count) { + this.count = count; + if (count > 0) { + state = NO_QUARTER; + } + } + + public void insertQuarter() { + if (state == HAS_QUARTER) { + System.out.println("You can't insert another quarter"); + } else if (state == NO_QUARTER) { + state = HAS_QUARTER; + System.out.println("You inserted a quarter"); + } else if (state == SOLD_OUT) { + System.out.println("You can't insert a quarter, the machine is sold out"); + } else if (state == SOLD) { + System.out.println("Please wait, we're already giving you a gumball"); + } + } + + public void ejectQuarter() { + if (state == HAS_QUARTER) { + System.out.println("Quarter returned"); + state = NO_QUARTER; + } else if (state == NO_QUARTER) { + System.out.println("You haven't inserted a quarter"); + } else if (state == SOLD) { + System.out.println("Sorry, you already turned the crank"); + } else if (state == SOLD_OUT) { + System.out.println("You can't eject, you haven't inserted a quarter yet"); + } + } + + + + + public void turnCrank() { + if (state == SOLD) { + System.out.println("Turning twice doesn't get you another gumball!"); + } else if (state == NO_QUARTER) { + System.out.println("You turned but there's no quarter"); + } else if (state == SOLD_OUT) { + System.out.println("You turned, but there are no gumballs"); + } else if (state == HAS_QUARTER) { + System.out.println("You turned..."); + state = SOLD; + dispense(); + } + } + + public void dispense() { + if (state == SOLD) { + System.out.println("A gumball comes rolling out the slot"); + count = count - 1; + if (count == 0) { + System.out.println("Oops, out of gumballs!"); + state = SOLD_OUT; + } else { + state = NO_QUARTER; + } + } else if (state == NO_QUARTER) { + System.out.println("You need to pay first"); + } else if (state == SOLD_OUT) { + System.out.println("No gumball dispensed"); + } else if (state == HAS_QUARTER) { + System.out.println("No gumball dispensed"); + } + } + + public void refill(int numGumBalls) { + this.count = numGumBalls; + state = NO_QUARTER; + } + + public String toString() { + StringBuffer result = new StringBuffer(); + result.append("\nMighty Gumball, Inc."); + result.append("\nJava-enabled Standing Gumball Model #2004\n"); + result.append("Inventory: " + count + " gumball"); + if (count != 1) { + result.append("s"); + } + result.append("\nMachine is "); + if (state == SOLD_OUT) { + result.append("sold out"); + } else if (state == NO_QUARTER) { + result.append("waiting for quarter"); + } else if (state == HAS_QUARTER) { + result.append("waiting for turn of crank"); + } else if (state == SOLD) { + result.append("delivering a gumball"); + } + result.append("\n"); + return result.toString(); + } +} + + diff --git a/src/main/java/com/bootdo/headFirst/state/gumball/GumballMachineTestDrive.java b/src/main/java/com/bootdo/headFirst/state/gumball/GumballMachineTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..e594f2ae07d55e3551db40ce17faa7e51120799e --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumball/GumballMachineTestDrive.java @@ -0,0 +1,39 @@ +package com.bootdo.headFirst.state.gumball; + +public class GumballMachineTestDrive { + + public static void main(String[] args) { + GumballMachine gumballMachine = new GumballMachine(5); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.ejectQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.ejectQuarter(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstate/GumballMachine.java b/src/main/java/com/bootdo/headFirst/state/gumballstate/GumballMachine.java new file mode 100644 index 0000000000000000000000000000000000000000..d385f07a4d43dbbd8dc402d5878973f021cafe96 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstate/GumballMachine.java @@ -0,0 +1,90 @@ +package com.bootdo.headFirst.state.gumballstate; + +public class GumballMachine { + + State soldOutState; + State noQuarterState; + State hasQuarterState; + State soldState; + + State state = soldOutState; + int count = 0; + + public GumballMachine(int numberGumballs) { + soldOutState = new SoldOutState(this); + noQuarterState = new NoQuarterState(this); + hasQuarterState = new HasQuarterState(this); + soldState = new SoldState(this); + + this.count = numberGumballs; + if (numberGumballs > 0) { + state = noQuarterState; + } + } + + public void insertQuarter() { + state.insertQuarter(); + } + + public void ejectQuarter() { + state.ejectQuarter(); + } + + public void turnCrank() { + state.turnCrank(); + state.dispense(); + } + + void setState(State state) { + this.state = state; + } + + void releaseBall() { + System.out.println("A gumball comes rolling out the slot..."); + if (count != 0) { + count = count - 1; + } + } + + int getCount() { + return count; + } + + void refill(int count) { + this.count = count; + state = noQuarterState; + } + + public State getState() { + return state; + } + + public State getSoldOutState() { + return soldOutState; + } + + public State getNoQuarterState() { + return noQuarterState; + } + + public State getHasQuarterState() { + return hasQuarterState; + } + + public State getSoldState() { + return soldState; + } + + public String toString() { + StringBuffer result = new StringBuffer(); + result.append("\nMighty Gumball, Inc."); + result.append("\nJava-enabled Standing Gumball Model #2004"); + result.append("\nInventory: " + count + " gumball"); + if (count != 1) { + result.append("s"); + } + result.append("\n"); + result.append("Machine is " + state + "\n"); + return result.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstate/GumballMachineTestDrive.java b/src/main/java/com/bootdo/headFirst/state/gumballstate/GumballMachineTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..007cb96b92461a78208bb6413d5047aeb3395d4d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstate/GumballMachineTestDrive.java @@ -0,0 +1,22 @@ +package com.bootdo.headFirst.state.gumballstate; + +public class GumballMachineTestDrive { + + public static void main(String[] args) { + GumballMachine gumballMachine = new GumballMachine(5); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstate/HasQuarterState.java b/src/main/java/com/bootdo/headFirst/state/gumballstate/HasQuarterState.java new file mode 100644 index 0000000000000000000000000000000000000000..66a745731c308e0e60e148e481be88682a28ac8f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstate/HasQuarterState.java @@ -0,0 +1,33 @@ +package com.bootdo.headFirst.state.gumballstate; + +import java.util.Random; + +public class HasQuarterState implements State { + GumballMachine gumballMachine; + + public HasQuarterState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You can't insert another quarter"); + } + + public void ejectQuarter() { + System.out.println("Quarter returned"); + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } + + public void turnCrank() { + System.out.println("You turned..."); + gumballMachine.setState(gumballMachine.getSoldState()); + } + + public void dispense() { + System.out.println("No gumball dispensed"); + } + + public String toString() { + return "waiting for turn of crank"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstate/NoQuarterState.java b/src/main/java/com/bootdo/headFirst/state/gumballstate/NoQuarterState.java new file mode 100644 index 0000000000000000000000000000000000000000..7d69d24d96b68be9fe6d3bf53dd25af698ada5d2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstate/NoQuarterState.java @@ -0,0 +1,30 @@ +package com.bootdo.headFirst.state.gumballstate; + +public class NoQuarterState implements State { + GumballMachine gumballMachine; + + public NoQuarterState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You inserted a quarter"); + gumballMachine.setState(gumballMachine.getHasQuarterState()); + } + + public void ejectQuarter() { + System.out.println("You haven't inserted a quarter"); + } + + public void turnCrank() { + System.out.println("You turned, but there's no quarter"); + } + + public void dispense() { + System.out.println("You need to pay first"); + } + + public String toString() { + return "waiting for quarter"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstate/SoldOutState.java b/src/main/java/com/bootdo/headFirst/state/gumballstate/SoldOutState.java new file mode 100644 index 0000000000000000000000000000000000000000..cd5fc70e78b45f3244abe5d73834aaed07f27146 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstate/SoldOutState.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.state.gumballstate; + +public class SoldOutState implements State { + GumballMachine gumballMachine; + + public SoldOutState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You can't insert a quarter, the machine is sold out"); + } + + public void ejectQuarter() { + System.out.println("You can't eject, you haven't inserted a quarter yet"); + } + + public void turnCrank() { + System.out.println("You turned, but there are no gumballs"); + } + + public void dispense() { + System.out.println("No gumball dispensed"); + } + + public String toString() { + return "sold out"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstate/SoldState.java b/src/main/java/com/bootdo/headFirst/state/gumballstate/SoldState.java new file mode 100644 index 0000000000000000000000000000000000000000..69dbf16b4b21f46a3d442df07c3c4d5941b69ec6 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstate/SoldState.java @@ -0,0 +1,38 @@ +package com.bootdo.headFirst.state.gumballstate; + +public class SoldState implements State { + + GumballMachine gumballMachine; + + public SoldState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("Please wait, we're already giving you a gumball"); + } + + public void ejectQuarter() { + System.out.println("Sorry, you already turned the crank"); + } + + public void turnCrank() { + System.out.println("Turning twice doesn't get you another gumball!"); + } + + public void dispense() { + gumballMachine.releaseBall(); + if (gumballMachine.getCount() > 0) { + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } else { + System.out.println("Oops, out of gumballs!"); + gumballMachine.setState(gumballMachine.getSoldOutState()); + } + } + + public String toString() { + return "dispensing a gumball"; + } +} + + diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstate/State.java b/src/main/java/com/bootdo/headFirst/state/gumballstate/State.java new file mode 100644 index 0000000000000000000000000000000000000000..1e82026280d8b81fcbc1b94d7a5bd676fc6e5711 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstate/State.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.state.gumballstate; + +public interface State { + + public void insertQuarter(); + public void ejectQuarter(); + public void turnCrank(); + public void dispense(); +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/GumballMachine.java b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/GumballMachine.java new file mode 100644 index 0000000000000000000000000000000000000000..fcc3f3022c89c081140a4240f292d9e0bcc1bd8d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/GumballMachine.java @@ -0,0 +1,96 @@ +package com.bootdo.headFirst.state.gumballstatewinner; + +public class GumballMachine { + + State soldOutState; + State noQuarterState; + State hasQuarterState; + State soldState; + State winnerState; + + State state = soldOutState; + int count = 0; + + public GumballMachine(int numberGumballs) { + soldOutState = new SoldOutState(this); + noQuarterState = new NoQuarterState(this); + hasQuarterState = new HasQuarterState(this); + soldState = new SoldState(this); + winnerState = new WinnerState(this); + + this.count = numberGumballs; + if (numberGumballs > 0) { + state = noQuarterState; + } + } + + public void insertQuarter() { + state.insertQuarter(); + } + + public void ejectQuarter() { + state.ejectQuarter(); + } + + public void turnCrank() { + state.turnCrank(); + state.dispense(); + } + + void setState(State state) { + this.state = state; + } + + void releaseBall() { + System.out.println("A gumball comes rolling out the slot..."); + if (count != 0) { + count = count - 1; + } + } + + int getCount() { + return count; + } + + void refill(int count) { + this.count = count; + state = noQuarterState; + } + + public State getState() { + return state; + } + + public State getSoldOutState() { + return soldOutState; + } + + public State getNoQuarterState() { + return noQuarterState; + } + + public State getHasQuarterState() { + return hasQuarterState; + } + + public State getSoldState() { + return soldState; + } + + public State getWinnerState() { + return winnerState; + } + + public String toString() { + StringBuffer result = new StringBuffer(); + result.append("\nMighty Gumball, Inc."); + result.append("\nJava-enabled Standing Gumball Model #2004"); + result.append("\nInventory: " + count + " gumball"); + if (count != 1) { + result.append("s"); + } + result.append("\n"); + result.append("Machine is " + state + "\n"); + return result.toString(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/GumballMachineTestDrive.java b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/GumballMachineTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..889d2cdb8b61ec14114279cf04dfa01e60a9411c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/GumballMachineTestDrive.java @@ -0,0 +1,46 @@ +package com.bootdo.headFirst.state.gumballstatewinner; + +public class GumballMachineTestDrive { + + public static void main(String[] args) { + GumballMachine gumballMachine = + new GumballMachine(10); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + gumballMachine.insertQuarter(); + gumballMachine.turnCrank(); + + System.out.println(gumballMachine); + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/HasQuarterState.java b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/HasQuarterState.java new file mode 100644 index 0000000000000000000000000000000000000000..d9dc7bb792e9b39739412cb80005f70e55e6947f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/HasQuarterState.java @@ -0,0 +1,39 @@ +package com.bootdo.headFirst.state.gumballstatewinner; + +import java.util.Random; + +public class HasQuarterState implements State { + Random randomWinner = new Random(System.currentTimeMillis()); + GumballMachine gumballMachine; + + public HasQuarterState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You can't insert another quarter"); + } + + public void ejectQuarter() { + System.out.println("Quarter returned"); + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } + + public void turnCrank() { + System.out.println("You turned..."); + int winner = randomWinner.nextInt(10); + if ((winner == 0) && (gumballMachine.getCount() > 1)) { + gumballMachine.setState(gumballMachine.getWinnerState()); + } else { + gumballMachine.setState(gumballMachine.getSoldState()); + } + } + + public void dispense() { + System.out.println("No gumball dispensed"); + } + + public String toString() { + return "waiting for turn of crank"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/NoQuarterState.java b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/NoQuarterState.java new file mode 100644 index 0000000000000000000000000000000000000000..dbd19d3f689dcb0d75955a74242b5917600b13ed --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/NoQuarterState.java @@ -0,0 +1,30 @@ +package com.bootdo.headFirst.state.gumballstatewinner; + +public class NoQuarterState implements State { + GumballMachine gumballMachine; + + public NoQuarterState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You inserted a quarter"); + gumballMachine.setState(gumballMachine.getHasQuarterState()); + } + + public void ejectQuarter() { + System.out.println("You haven't inserted a quarter"); + } + + public void turnCrank() { + System.out.println("You turned, but there's no quarter"); + } + + public void dispense() { + System.out.println("You need to pay first"); + } + + public String toString() { + return "waiting for quarter"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/SoldOutState.java b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/SoldOutState.java new file mode 100644 index 0000000000000000000000000000000000000000..0750a3f4b38644e5abe262a11a23c67e69d666ae --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/SoldOutState.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.state.gumballstatewinner; + +public class SoldOutState implements State { + GumballMachine gumballMachine; + + public SoldOutState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("You can't insert a quarter, the machine is sold out"); + } + + public void ejectQuarter() { + System.out.println("You can't eject, you haven't inserted a quarter yet"); + } + + public void turnCrank() { + System.out.println("You turned, but there are no gumballs"); + } + + public void dispense() { + System.out.println("No gumball dispensed"); + } + + public String toString() { + return "sold out"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/SoldState.java b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/SoldState.java new file mode 100644 index 0000000000000000000000000000000000000000..4812a956c5fc115c4b8e5a21f0077a4820df946d --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/SoldState.java @@ -0,0 +1,35 @@ +package com.bootdo.headFirst.state.gumballstatewinner; + +public class SoldState implements State { + GumballMachine gumballMachine; + + public SoldState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("Please wait, we're already giving you a gumball"); + } + + public void ejectQuarter() { + System.out.println("Sorry, you already turned the crank"); + } + + public void turnCrank() { + System.out.println("Turning twice doesn't get you another gumball!"); + } + + public void dispense() { + gumballMachine.releaseBall(); + if (gumballMachine.getCount() > 0) { + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } else { + System.out.println("Oops, out of gumballs!"); + gumballMachine.setState(gumballMachine.getSoldOutState()); + } + } + + public String toString() { + return "dispensing a gumball"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/State.java b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/State.java new file mode 100644 index 0000000000000000000000000000000000000000..47f8d77ee1916675fa836693e45b42002799824c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/State.java @@ -0,0 +1,9 @@ +package com.bootdo.headFirst.state.gumballstatewinner; + +public interface State { + + public void insertQuarter(); + public void ejectQuarter(); + public void turnCrank(); + public void dispense(); +} diff --git a/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/WinnerState.java b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/WinnerState.java new file mode 100644 index 0000000000000000000000000000000000000000..061dc30189467296a3c324766d603a1de275c5f2 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/state/gumballstatewinner/WinnerState.java @@ -0,0 +1,41 @@ +package com.bootdo.headFirst.state.gumballstatewinner; + +public class WinnerState implements State { + GumballMachine gumballMachine; + + public WinnerState(GumballMachine gumballMachine) { + this.gumballMachine = gumballMachine; + } + + public void insertQuarter() { + System.out.println("Please wait, we're already giving you a Gumball"); + } + + public void ejectQuarter() { + System.out.println("Please wait, we're already giving you a Gumball"); + } + + public void turnCrank() { + System.out.println("Turning again doesn't get you another gumball!"); + } + + public void dispense() { + System.out.println("YOU'RE A WINNER! You get two gumballs for your quarter"); + gumballMachine.releaseBall(); + if (gumballMachine.getCount() == 0) { + gumballMachine.setState(gumballMachine.getSoldOutState()); + } else { + gumballMachine.releaseBall(); + if (gumballMachine.getCount() > 0) { + gumballMachine.setState(gumballMachine.getNoQuarterState()); + } else { + System.out.println("Oops, out of gumballs!"); + gumballMachine.setState(gumballMachine.getSoldOutState()); + } + } + } + + public String toString() { + return "despensing two gumballs for your quarter, because YOU'RE A WINNER!"; + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/DecoyDuck.java b/src/main/java/com/bootdo/headFirst/strategy/DecoyDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..ff2c584798154d09d5f6f605bbccc554336aebf4 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/DecoyDuck.java @@ -0,0 +1,11 @@ +package com.bootdo.headFirst.strategy; + +public class DecoyDuck extends Duck { + public DecoyDuck() { + setFlyBehavior(new FlyNoWay()); + setQuackBehavior(new MuteQuack()); + } + public void display() { + System.out.println("I'm a duck Decoy"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/Duck.java b/src/main/java/com/bootdo/headFirst/strategy/Duck.java new file mode 100644 index 0000000000000000000000000000000000000000..51bd4575a74489791b8b897eb8cc6fb737b76a27 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/Duck.java @@ -0,0 +1,31 @@ +package com.bootdo.headFirst.strategy; + +public abstract class Duck { + FlyBehavior flyBehavior; + QuackBehavior quackBehavior; + + public Duck() { + } + + public void setFlyBehavior (FlyBehavior fb) { + flyBehavior = fb; + } + + public void setQuackBehavior(QuackBehavior qb) { + quackBehavior = qb; + } + + abstract void display(); + + public void performFly() { + flyBehavior.fly(); + } + + public void performQuack() { + quackBehavior.quack(); + } + + public void swim() { + System.out.println("All ducks float, even decoys!"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/FakeQuack.java b/src/main/java/com/bootdo/headFirst/strategy/FakeQuack.java new file mode 100644 index 0000000000000000000000000000000000000000..2a1561991cf1741a23856f857d5d7f728f96d5b1 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/FakeQuack.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.strategy; + +public class FakeQuack implements QuackBehavior { + public void quack() { + System.out.println("Qwak"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/FlyBehavior.java b/src/main/java/com/bootdo/headFirst/strategy/FlyBehavior.java new file mode 100644 index 0000000000000000000000000000000000000000..86d1d0a1b8127d691defc0ce3d0b9d8a50bb98bb --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/FlyBehavior.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.strategy; + +public interface FlyBehavior { + public void fly(); +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/FlyNoWay.java b/src/main/java/com/bootdo/headFirst/strategy/FlyNoWay.java new file mode 100644 index 0000000000000000000000000000000000000000..5061a15f0f924233e0cccf1b9cd7d67fc404bc04 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/FlyNoWay.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.strategy; + +public class FlyNoWay implements FlyBehavior { + public void fly() { + System.out.println("I can't fly"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/FlyRocketPowered.java b/src/main/java/com/bootdo/headFirst/strategy/FlyRocketPowered.java new file mode 100644 index 0000000000000000000000000000000000000000..b7b5329db0a4b437e84ad6fa36d899bc298a215a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/FlyRocketPowered.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.strategy; + +public class FlyRocketPowered implements FlyBehavior { + public void fly() { + System.out.println("I'm flying with a rocket"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/FlyWithWings.java b/src/main/java/com/bootdo/headFirst/strategy/FlyWithWings.java new file mode 100644 index 0000000000000000000000000000000000000000..ccff0399e040630f9249495c2263540260b5827c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/FlyWithWings.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.strategy; + +public class FlyWithWings implements FlyBehavior { + public void fly() { + System.out.println("I'm flying!!"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/MallardDuck.java b/src/main/java/com/bootdo/headFirst/strategy/MallardDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..a8154431a98f8db48543ce2afa0b4237437d5fbc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/MallardDuck.java @@ -0,0 +1,16 @@ +package com.bootdo.headFirst.strategy; + +public class MallardDuck extends Duck { + + public MallardDuck() { + + quackBehavior = new Quack(); + flyBehavior = new FlyWithWings(); + + + } + + public void display() { + System.out.println("I'm a real Mallard duck"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/MiniDuckSimulator.java b/src/main/java/com/bootdo/headFirst/strategy/MiniDuckSimulator.java new file mode 100644 index 0000000000000000000000000000000000000000..7d89c2d57a7424a4713d4d22512f77d5d40f7f60 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/MiniDuckSimulator.java @@ -0,0 +1,21 @@ +package com.bootdo.headFirst.strategy; + +public class MiniDuckSimulator { + + public static void main(String[] args) { + + MallardDuck mallard = new MallardDuck(); + RubberDuck rubberDuckie = new RubberDuck(); + DecoyDuck decoy = new DecoyDuck(); + + ModelDuck model = new ModelDuck(); + + mallard.performQuack(); + rubberDuckie.performQuack(); + decoy.performQuack(); + + model.performFly(); + model.setFlyBehavior(new FlyRocketPowered()); + model.performFly(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/MiniDuckSimulator1.java b/src/main/java/com/bootdo/headFirst/strategy/MiniDuckSimulator1.java new file mode 100644 index 0000000000000000000000000000000000000000..1db33dd70607a1a89b9f245460bc01f60d730768 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/MiniDuckSimulator1.java @@ -0,0 +1,17 @@ +package com.bootdo.headFirst.strategy; + +public class MiniDuckSimulator1 { + + public static void main(String[] args) { + + Duck mallard = new MallardDuck(); + mallard.performQuack(); + mallard.performFly(); + + Duck model = new ModelDuck(); + model.performFly(); + model.setFlyBehavior(new FlyRocketPowered()); + model.performFly(); + + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/ModelDuck.java b/src/main/java/com/bootdo/headFirst/strategy/ModelDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..f5a5f182c51e333b7877000bc9346a134f063390 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/ModelDuck.java @@ -0,0 +1,12 @@ +package com.bootdo.headFirst.strategy; + +public class ModelDuck extends Duck { + public ModelDuck() { + flyBehavior = new FlyNoWay(); + quackBehavior = new Quack(); + } + + public void display() { + System.out.println("I'm a model duck"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/MuteQuack.java b/src/main/java/com/bootdo/headFirst/strategy/MuteQuack.java new file mode 100644 index 0000000000000000000000000000000000000000..295c46bef3583382e4e8ec92b43e63ec0250c34b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/MuteQuack.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.strategy; + +public class MuteQuack implements QuackBehavior { + public void quack() { + System.out.println("<< Silence >>"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/Quack.java b/src/main/java/com/bootdo/headFirst/strategy/Quack.java new file mode 100644 index 0000000000000000000000000000000000000000..bbc05fef3e0f7cf12d619bdb2ba0d3e3d2d0337c --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/Quack.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.strategy; + +public class Quack implements QuackBehavior { + public void quack() { + System.out.println("Quack"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/QuackBehavior.java b/src/main/java/com/bootdo/headFirst/strategy/QuackBehavior.java new file mode 100644 index 0000000000000000000000000000000000000000..5ae5a24070d7f3f8f9e56cba3c9e6ad9971d1eda --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/QuackBehavior.java @@ -0,0 +1,5 @@ +package com.bootdo.headFirst.strategy; + +public interface QuackBehavior { + public void quack(); +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/RedHeadDuck.java b/src/main/java/com/bootdo/headFirst/strategy/RedHeadDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..1d08191e4f36b1686af8cb7e81c20d6806bf10e8 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/RedHeadDuck.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.strategy; + +public class RedHeadDuck extends Duck { + + public RedHeadDuck() { + flyBehavior = new FlyWithWings(); + quackBehavior = new Quack(); + } + + public void display() { + System.out.println("I'm a real Red Headed duck"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/RubberDuck.java b/src/main/java/com/bootdo/headFirst/strategy/RubberDuck.java new file mode 100644 index 0000000000000000000000000000000000000000..31450dc8960783bbbe5894fefba2420d82de0ddc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/RubberDuck.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.strategy; + +public class RubberDuck extends Duck { + + public RubberDuck() { + flyBehavior = new FlyNoWay(); + quackBehavior = new Squeak(); + } + + public void display() { + System.out.println("I'm a rubber duckie"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/strategy/Squeak.java b/src/main/java/com/bootdo/headFirst/strategy/Squeak.java new file mode 100644 index 0000000000000000000000000000000000000000..75c8d4802daa3f6b47f2b4b07b5484adc05c3dca --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/strategy/Squeak.java @@ -0,0 +1,7 @@ +package com.bootdo.headFirst.strategy; + +public class Squeak implements QuackBehavior { + public void quack() { + System.out.println("Squeak"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/applet/AppletSource.txt b/src/main/java/com/bootdo/headFirst/templatemethod/applet/AppletSource.txt new file mode 100644 index 0000000000000000000000000000000000000000..347e22188ed854abff68ec1fc5af6a90d0d94e50 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/applet/AppletSource.txt @@ -0,0 +1,102 @@ +package java.applet; + +import java.awt.*; +import java.awt.image.ColorModel; +import java.net.URL; +import java.net.MalformedURLException; +import java.util.Hashtable; +import java.util.Locale; + +public class Applet extends Panel { + transient private AppletStub stub; + public final void setStub(AppletStub stub) { + this.stub = (AppletStub)stub; + } + public boolean isActive() { + if (stub != null) { + return stub.isActive(); + } else { // If stub field not filled in, applet never active + return false; + } + } + public URL getDocumentBase() { + return stub.getDocumentBase(); + } + public URL getCodeBase() { + return stub.getCodeBase(); + } + public String getParameter(String name) { + return stub.getParameter(name); + } + public AppletContext getAppletContext() { + return stub.getAppletContext(); + } + public void resize(int width, int height) { + Dimension d = size(); + if ((d.width != width) || (d.height != height)) { + super.resize(width, height); + if (stub != null) { + stub.appletResize(width, height); + } + } + } + public void resize(Dimension d) { + resize(d.width, d.height); + } + public void showStatus(String msg) { + getAppletContext().showStatus(msg); + } + public Image getImage(URL url) { + return getAppletContext().getImage(url); + } + public Image getImage(URL url, String name) { + try { + return getImage(new URL(url, name)); + } catch (MalformedURLException e) { + return null; + } + } + public AudioClip getAudioClip(URL url) { + return getAppletContext().getAudioClip(url); + } + public AudioClip getAudioClip(URL url, String name) { + try { + return getAudioClip(new URL(url, name)); + } catch (MalformedURLException e) { + return null; + } + } + public String getAppletInfo() { + return null; + } + public Locale getLocale() { + Locale locale = super.getLocale(); + if (locale == null) { + return Locale.getDefault(); + } + return locale; + } + public String[][] getParameterInfo() { + return null; + public void play(URL url) { + AudioClip clip = getAudioClip(url); + if (clip != null) { + clip.play(); + } + } + public void play(URL url, String name) { + AudioClip clip = getAudioClip(url, name); + if (clip != null) { + clip.play(); + } + } + public void init() { + } + public void start() { + } + public void stop() { + } + public void destroy() { +} +} + diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/applet/MyApplet.java b/src/main/java/com/bootdo/headFirst/templatemethod/applet/MyApplet.java new file mode 100644 index 0000000000000000000000000000000000000000..fe2241b4d285545bbd934667e71c8661898d0b5b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/applet/MyApplet.java @@ -0,0 +1,33 @@ +package com.bootdo.headFirst.templatemethod.applet; + +import java.applet.Applet; +import java.awt.Graphics; + +public class MyApplet extends Applet { + String message; + + public void init() { + message = "Hello World, I'm alive!"; + repaint(); + } + + public void start() { + message = "Now I'm starting up..."; + repaint(); + } + + public void stop() { + message = "Oh, now I'm being stopped..."; + repaint(); + } + + public void destroy() { + message = "Goodbye, cruel world"; + repaint(); + } + + public void paint(Graphics g) { + g.drawString(message, 5, 15); + } +} + diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/barista/BeverageTestDrive.java b/src/main/java/com/bootdo/headFirst/templatemethod/barista/BeverageTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..27e1eaff46a45fd265f102e59885e3fae37d6d72 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/barista/BeverageTestDrive.java @@ -0,0 +1,25 @@ +package com.bootdo.headFirst.templatemethod.barista; + +public class BeverageTestDrive { + public static void main(String[] args) { + + Tea tea = new Tea(); + Coffee coffee = new Coffee(); + + System.out.println("\nMaking tea..."); + tea.prepareRecipe(); + + System.out.println("\nMaking coffee..."); + coffee.prepareRecipe(); + + + TeaWithHook teaHook = new TeaWithHook(); + CoffeeWithHook coffeeHook = new CoffeeWithHook(); + + System.out.println("\nMaking tea..."); + teaHook.prepareRecipe(); + + System.out.println("\nMaking coffee..."); + coffeeHook.prepareRecipe(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/barista/CaffeineBeverage.java b/src/main/java/com/bootdo/headFirst/templatemethod/barista/CaffeineBeverage.java new file mode 100644 index 0000000000000000000000000000000000000000..f92c94df3cc0446b288307f83b3dbce63d14ac14 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/barista/CaffeineBeverage.java @@ -0,0 +1,23 @@ +package com.bootdo.headFirst.templatemethod.barista; + +public abstract class CaffeineBeverage { + + final void prepareRecipe() { + boilWater(); + brew(); + pourInCup(); + addCondiments(); + } + + abstract void brew(); + + abstract void addCondiments(); + + void boilWater() { + System.out.println("Boiling water"); + } + + void pourInCup() { + System.out.println("Pouring into cup"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/barista/CaffeineBeverageWithHook.java b/src/main/java/com/bootdo/headFirst/templatemethod/barista/CaffeineBeverageWithHook.java new file mode 100644 index 0000000000000000000000000000000000000000..c6de1a435fa3281f1221b745d087b0bb42505cfc --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/barista/CaffeineBeverageWithHook.java @@ -0,0 +1,29 @@ +package com.bootdo.headFirst.templatemethod.barista; + +public abstract class CaffeineBeverageWithHook { + + void prepareRecipe() { + boilWater(); + brew(); + pourInCup(); + if (customerWantsCondiments()) { + addCondiments(); + } + } + + abstract void brew(); + + abstract void addCondiments(); + + void boilWater() { + System.out.println("Boiling water"); + } + + void pourInCup() { + System.out.println("Pouring into cup"); + } + + boolean customerWantsCondiments() { + return true; + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/barista/Coffee.java b/src/main/java/com/bootdo/headFirst/templatemethod/barista/Coffee.java new file mode 100644 index 0000000000000000000000000000000000000000..071395feb01241d90cb371573ae5575a69e7b589 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/barista/Coffee.java @@ -0,0 +1,10 @@ +package com.bootdo.headFirst.templatemethod.barista; + +public class Coffee extends CaffeineBeverage { + public void brew() { + System.out.println("Dripping Coffee through filter"); + } + public void addCondiments() { + System.out.println("Adding Sugar and Milk"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/barista/CoffeeWithHook.java b/src/main/java/com/bootdo/headFirst/templatemethod/barista/CoffeeWithHook.java new file mode 100644 index 0000000000000000000000000000000000000000..75c6b8c68a32fa5c5e331e75c046a3b04081aa1f --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/barista/CoffeeWithHook.java @@ -0,0 +1,42 @@ +package com.bootdo.headFirst.templatemethod.barista; + +import java.io.*; + +public class CoffeeWithHook extends CaffeineBeverageWithHook { + + public void brew() { + System.out.println("Dripping Coffee through filter"); + } + + public void addCondiments() { + System.out.println("Adding Sugar and Milk"); + } + + public boolean customerWantsCondiments() { + + String answer = getUserInput(); + + if (answer.toLowerCase().startsWith("y")) { + return true; + } else { + return false; + } + } + + private String getUserInput() { + String answer = null; + + System.out.print("Would you like milk and sugar with your coffee (y/n)? "); + + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + try { + answer = in.readLine(); + } catch (IOException ioe) { + System.err.println("IO error trying to read your answer"); + } + if (answer == null) { + return "no"; + } + return answer; + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/barista/Tea.java b/src/main/java/com/bootdo/headFirst/templatemethod/barista/Tea.java new file mode 100644 index 0000000000000000000000000000000000000000..3ac9aa53dc7e0437392d7109e292413a9b787822 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/barista/Tea.java @@ -0,0 +1,10 @@ +package com.bootdo.headFirst.templatemethod.barista; + +public class Tea extends CaffeineBeverage { + public void brew() { + System.out.println("Steeping the tea"); + } + public void addCondiments() { + System.out.println("Adding Lemon"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/barista/TeaWithHook.java b/src/main/java/com/bootdo/headFirst/templatemethod/barista/TeaWithHook.java new file mode 100644 index 0000000000000000000000000000000000000000..dc880c3459709953bb9cafd2edf8d3d134798623 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/barista/TeaWithHook.java @@ -0,0 +1,43 @@ +package com.bootdo.headFirst.templatemethod.barista; + +import java.io.*; + +public class TeaWithHook extends CaffeineBeverageWithHook { + + public void brew() { + System.out.println("Steeping the tea"); + } + + public void addCondiments() { + System.out.println("Adding Lemon"); + } + + public boolean customerWantsCondiments() { + + String answer = getUserInput(); + + if (answer.toLowerCase().startsWith("y")) { + return true; + } else { + return false; + } + } + + private String getUserInput() { + // get the user's response + String answer = null; + + System.out.print("Would you like milk and sugar with your coffee (y/n)? "); + + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + try { + answer = in.readLine(); + } catch (IOException ioe) { + System.err.println("IO error trying to read your answer"); + } + if (answer == null) { + return "no"; + } + return answer; + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/frame/MyFrame.java b/src/main/java/com/bootdo/headFirst/templatemethod/frame/MyFrame.java new file mode 100644 index 0000000000000000000000000000000000000000..eeedac1631c9552a1553ec2955a7d5109164a53b --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/frame/MyFrame.java @@ -0,0 +1,25 @@ +package com.bootdo.headFirst.templatemethod.frame; + +import java.awt.*; +import javax.swing.*; + +public class MyFrame extends JFrame { + + public MyFrame(String title) { + super(title); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + this.setSize(300,300); + this.setVisible(true); + } + + public void paint(Graphics graphics) { + super.paint(graphics); + String msg = "I rule!!"; + graphics.drawString(msg, 100, 100); + } + + public static void main(String[] args) { + MyFrame myFrame = new MyFrame("Head First Design Patterns"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/simplebarista/Barista.java b/src/main/java/com/bootdo/headFirst/templatemethod/simplebarista/Barista.java new file mode 100644 index 0000000000000000000000000000000000000000..8e0bd2c4d39156942570a5fab47d423ee8cc47de --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/simplebarista/Barista.java @@ -0,0 +1,13 @@ +package com.bootdo.headFirst.templatemethod.simplebarista; + +public class Barista { + + public static void main(String[] args) { + Tea tea = new Tea(); + Coffee coffee = new Coffee(); + System.out.println("Making tea..."); + tea.prepareRecipe(); + System.out.println("Making coffee..."); + coffee.prepareRecipe(); + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/simplebarista/Coffee.java b/src/main/java/com/bootdo/headFirst/templatemethod/simplebarista/Coffee.java new file mode 100644 index 0000000000000000000000000000000000000000..84d7b21a24d8a23f34d204be91a37ed8b08fc980 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/simplebarista/Coffee.java @@ -0,0 +1,27 @@ +package com.bootdo.headFirst.templatemethod.simplebarista; + +public class Coffee { + + void prepareRecipe() { + boilWater(); + brewCoffeeGrinds(); + pourInCup(); + addSugarAndMilk(); + } + + public void boilWater() { + System.out.println("Boiling water"); + } + + public void brewCoffeeGrinds() { + System.out.println("Dripping Coffee through filter"); + } + + public void pourInCup() { + System.out.println("Pouring into cup"); + } + + public void addSugarAndMilk() { + System.out.println("Adding Sugar and Milk"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/simplebarista/Tea.java b/src/main/java/com/bootdo/headFirst/templatemethod/simplebarista/Tea.java new file mode 100644 index 0000000000000000000000000000000000000000..918add47fa911ca45a6f3ba1bebef0df96b1137a --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/simplebarista/Tea.java @@ -0,0 +1,27 @@ +package com.bootdo.headFirst.templatemethod.simplebarista; + +public class Tea { + + void prepareRecipe() { + boilWater(); + steepTeaBag(); + pourInCup(); + addLemon(); + } + + public void boilWater() { + System.out.println("Boiling water"); + } + + public void steepTeaBag() { + System.out.println("Steeping the tea"); + } + + public void addLemon() { + System.out.println("Adding Lemon"); + } + + public void pourInCup() { + System.out.println("Pouring into cup"); + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/sort/Duck.java b/src/main/java/com/bootdo/headFirst/templatemethod/sort/Duck.java new file mode 100644 index 0000000000000000000000000000000000000000..6659981f49308478527d60ec3c20fb809cbd7d88 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/sort/Duck.java @@ -0,0 +1,30 @@ +package com.bootdo.headFirst.templatemethod.sort; + +public class Duck implements Comparable { + String name; + int weight; + + public Duck(String name, int weight) { + this.name = name; + this.weight = weight; + } + + public String toString() { + return name + " weighs " + weight; + } + + + + public int compareTo(Object object) { + + Duck otherDuck = (Duck)object; + + if (this.weight < otherDuck.weight) { + return -1; + } else if (this.weight == otherDuck.weight) { + return 0; + } else { // this.weight > otherDuck.weight + return 1; + } + } +} diff --git a/src/main/java/com/bootdo/headFirst/templatemethod/sort/DuckSortTestDrive.java b/src/main/java/com/bootdo/headFirst/templatemethod/sort/DuckSortTestDrive.java new file mode 100644 index 0000000000000000000000000000000000000000..cbe3ee034d1c900076a6f027d6250ec8d395c2c7 --- /dev/null +++ b/src/main/java/com/bootdo/headFirst/templatemethod/sort/DuckSortTestDrive.java @@ -0,0 +1,32 @@ +package com.bootdo.headFirst.templatemethod.sort; + +import java.util.ArrayList; +import java.util.Arrays; + +public class DuckSortTestDrive { + + public static void main(String[] args) { + Duck[] ducks = { + new Duck("Daffy", 8), + new Duck("Dewey", 2), + new Duck("Howard", 7), + new Duck("Louie", 2), + new Duck("Donald", 10), + new Duck("Huey", 2) + }; + + System.out.println("Before sorting:"); + display(ducks); + + Arrays.sort(ducks); + + System.out.println("\nAfter sorting:"); + display(ducks); + } + + public static void display(Duck[] ducks) { + for (int i = 0; i < ducks.length; i++) { + System.out.println(ducks[i]); + } + } +} diff --git a/bootdo/src/main/java/com/bootdo/oa/config/WebSocketConfig.java b/src/main/java/com/bootdo/oa/config/WebSocketConfig.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/config/WebSocketConfig.java rename to src/main/java/com/bootdo/oa/config/WebSocketConfig.java diff --git a/bootdo/src/main/java/com/bootdo/oa/controller/NotifyController.java b/src/main/java/com/bootdo/oa/controller/NotifyController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/controller/NotifyController.java rename to src/main/java/com/bootdo/oa/controller/NotifyController.java diff --git a/bootdo/src/main/java/com/bootdo/oa/controller/WebSocketController.java b/src/main/java/com/bootdo/oa/controller/WebSocketController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/controller/WebSocketController.java rename to src/main/java/com/bootdo/oa/controller/WebSocketController.java diff --git a/bootdo/src/main/java/com/bootdo/oa/dao/NotifyDao.java b/src/main/java/com/bootdo/oa/dao/NotifyDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/dao/NotifyDao.java rename to src/main/java/com/bootdo/oa/dao/NotifyDao.java diff --git a/bootdo/src/main/java/com/bootdo/oa/dao/NotifyRecordDao.java b/src/main/java/com/bootdo/oa/dao/NotifyRecordDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/dao/NotifyRecordDao.java rename to src/main/java/com/bootdo/oa/dao/NotifyRecordDao.java diff --git a/bootdo/src/main/java/com/bootdo/oa/domain/Message.java b/src/main/java/com/bootdo/oa/domain/Message.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/domain/Message.java rename to src/main/java/com/bootdo/oa/domain/Message.java diff --git a/bootdo/src/main/java/com/bootdo/oa/domain/NotifyDO.java b/src/main/java/com/bootdo/oa/domain/NotifyDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/domain/NotifyDO.java rename to src/main/java/com/bootdo/oa/domain/NotifyDO.java diff --git a/bootdo/src/main/java/com/bootdo/oa/domain/NotifyDTO.java b/src/main/java/com/bootdo/oa/domain/NotifyDTO.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/oa/domain/NotifyDTO.java rename to src/main/java/com/bootdo/oa/domain/NotifyDTO.java index 9f852ed25791012d77a8b02aa89595aacc8ea14d..a02ee5b77131c8d1fa70d63441b909faf1039348 100644 --- a/bootdo/src/main/java/com/bootdo/oa/domain/NotifyDTO.java +++ b/src/main/java/com/bootdo/oa/domain/NotifyDTO.java @@ -1,45 +1,45 @@ -package com.bootdo.oa.domain; - -public class NotifyDTO extends NotifyDO { - - private static final long serialVersionUID = 1L; - - private String isRead; - - private String before; - - private String sender; - - public String getIsRead() { - return isRead; - } - - public void setIsRead(String isRead) { - this.isRead = isRead; - } - - public String getBefore() { - return before; - } - - public void setBefore(String before) { - this.before = before; - } - - public String getSender() { - return sender; - } - - public void setSender(String sender) { - this.sender = sender; - } - - @Override - public String toString() { - return "NotifyDTO{" + - "isRead='" + isRead + '\'' + - ", before='" + before + '\'' + - ", sender='" + sender + '\'' + - '}'; - } -} +package com.bootdo.oa.domain; + +public class NotifyDTO extends NotifyDO { + + private static final long serialVersionUID = 1L; + + private String isRead; + + private String before; + + private String sender; + + public String getIsRead() { + return isRead; + } + + public void setIsRead(String isRead) { + this.isRead = isRead; + } + + public String getBefore() { + return before; + } + + public void setBefore(String before) { + this.before = before; + } + + public String getSender() { + return sender; + } + + public void setSender(String sender) { + this.sender = sender; + } + + @Override + public String toString() { + return "NotifyDTO{" + + "isRead='" + isRead + '\'' + + ", before='" + before + '\'' + + ", sender='" + sender + '\'' + + '}'; + } +} diff --git a/bootdo/src/main/java/com/bootdo/oa/domain/NotifyRecordDO.java b/src/main/java/com/bootdo/oa/domain/NotifyRecordDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/domain/NotifyRecordDO.java rename to src/main/java/com/bootdo/oa/domain/NotifyRecordDO.java diff --git a/bootdo/src/main/java/com/bootdo/oa/domain/Response.java b/src/main/java/com/bootdo/oa/domain/Response.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/domain/Response.java rename to src/main/java/com/bootdo/oa/domain/Response.java diff --git a/bootdo/src/main/java/com/bootdo/oa/service/NotifyRecordService.java b/src/main/java/com/bootdo/oa/service/NotifyRecordService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/service/NotifyRecordService.java rename to src/main/java/com/bootdo/oa/service/NotifyRecordService.java diff --git a/bootdo/src/main/java/com/bootdo/oa/service/NotifyService.java b/src/main/java/com/bootdo/oa/service/NotifyService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/service/NotifyService.java rename to src/main/java/com/bootdo/oa/service/NotifyService.java diff --git a/bootdo/src/main/java/com/bootdo/oa/service/impl/NotifyRecordServiceImpl.java b/src/main/java/com/bootdo/oa/service/impl/NotifyRecordServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/service/impl/NotifyRecordServiceImpl.java rename to src/main/java/com/bootdo/oa/service/impl/NotifyRecordServiceImpl.java diff --git a/bootdo/src/main/java/com/bootdo/oa/service/impl/NotifyServiceImpl.java b/src/main/java/com/bootdo/oa/service/impl/NotifyServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/oa/service/impl/NotifyServiceImpl.java rename to src/main/java/com/bootdo/oa/service/impl/NotifyServiceImpl.java diff --git a/src/main/java/com/bootdo/simpleProxy/MyInvocationHandler.java b/src/main/java/com/bootdo/simpleProxy/MyInvocationHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..de76e425fd68b64891a3909fe02d71f94dae220d --- /dev/null +++ b/src/main/java/com/bootdo/simpleProxy/MyInvocationHandler.java @@ -0,0 +1,66 @@ +package com.bootdo.simpleProxy; + +import org.apache.catalina.User; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/8/29 23:44 + * @Desc: 动态代理处理器 + **/ +public class MyInvocationHandler implements InvocationHandler { + + private UserService targetObject; + + public MyInvocationHandler(UserService userService){ + this.targetObject = userService; + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + before(); + Object result = method.invoke(targetObject, args); + after(); + return result; + } + + private void before(){ + System.out.println("事物开启!"); + } + + private void after(){ + System.out.println("事物关闭!"); + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/bootdo/simpleProxy/ProxyTest.java b/src/main/java/com/bootdo/simpleProxy/ProxyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f952f80c459cfbb315ca36c64366fe3b887b0a33 --- /dev/null +++ b/src/main/java/com/bootdo/simpleProxy/ProxyTest.java @@ -0,0 +1,52 @@ +package com.bootdo.simpleProxy; + +import sun.misc.ProxyGenerator; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.lang.reflect.Proxy; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/8/29 23:54 + * @Desc: + **/ +public class ProxyTest { + + public static void main(String[] args) throws Throwable { + System.out.println("---------------JDK动态代理----------------"); + UserService userService = (UserService) Proxy.newProxyInstance( + ProxyTest.class.getClassLoader(), + new Class[]{UserService.class}, + new MyInvocationHandler(new UserServiceImpl()) + ); + + userService.sayHello(); + + System.out.println("---------------自定义动态代理----------------"); + UserService proxyObject = (UserService)SelfDefineProxy.getProxyObject( + ProxyTest.class.getClassLoader(), + UserService.class, + new MyInvocationHandler(new UserServiceImpl())); + + proxyObject.sayHello(); + + //createProxyFile(); + + } + + /** + * 输出我们内存中的动态代理类的字节码文件 + * @author heylinlook + * @date 2018/4/23 15:07 + * @param + * @return + */ + public static void createProxyFile() throws IOException { + byte[] generateProxyClass = ProxyGenerator.generateProxyClass("$Proxy0", new Class[]{UserService.class}); + + FileOutputStream outputStream = new FileOutputStream("$Proxy0.class"); + outputStream.write(generateProxyClass); + outputStream.close(); + } +} diff --git a/src/main/java/com/bootdo/simpleProxy/SelfDefineProxy.java b/src/main/java/com/bootdo/simpleProxy/SelfDefineProxy.java new file mode 100644 index 0000000000000000000000000000000000000000..5a106cc7d7ca7e800f3439dab66b1376f7d8c20e --- /dev/null +++ b/src/main/java/com/bootdo/simpleProxy/SelfDefineProxy.java @@ -0,0 +1,135 @@ +package com.bootdo.simpleProxy; + +import com.bootdo.simpleProxy.classloader.SimpleClassLoader; + +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.logging.MemoryHandler; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/3 23:28 + * @Desc: 自定义代理类 + **/ +public class SelfDefineProxy { + + static String rt = "\r\n"; + + public static Object getProxyObject(ClassLoader loader,Class interfaces,InvocationHandler h){ + String path = "D:\\JavaWorkSpace\\bootdo\\bootdo\\src\\main\\java\\com\\bootdo\\simpleProxy\\temp\\$Proxy0.java"; + + //1. + String proxySourceCode = get$Proxy0(interfaces); + //2. + outputFile(proxySourceCode,path); + //3. + compileJavaFile(path); + //4. + return loadClassToJvm(h); + } + + //4. 将字节码加载到内存 + private static Object loadClassToJvm(InvocationHandler h){ + try { + SimpleClassLoader loader = new SimpleClassLoader("D:\\JavaWorkSpace\\bootdo\\bootdo\\src\\main\\java\\com\\bootdo\\simpleProxy\\temp"); + //得到动态代理类的反射对象 + Class $Proxy0 = loader.findClass("$Proxy0"); + //反射获取构造函数 + Constructor constructor = $Proxy0.getConstructor(MyInvocationHandler.class); + //创建动态代理实例 + return constructor.newInstance(h); + } catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(); + } + return null; + } + + //3. 将源码编译成字节码文件 .class + private static void compileJavaFile(String fileName){ + + try { + //获得当前系统中的编译器 + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + //获取文件管理者 + StandardJavaFileManager manager = compiler.getStandardFileManager(null, null, null); + Iterable fileObjects = manager.getJavaFileObjects(fileName); + //编译任务 + JavaCompiler.CompilationTask task = compiler.getTask(null, manager, null, null, null, fileObjects); + //开始编译,执行完可在当前目录下看到.class文件 + task.call(); + //关闭文件管理者 + manager.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + //2. 将源码写入本地文件 + private static void outputFile(String proxySourceCode,String path){ + + File f = new File(path); + + try { + if (!f.exists()) + f.createNewFile(); + FileWriter fw = new FileWriter(f); + fw.write(proxySourceCode); + fw.flush(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + + + + + + //1. 使用字符串拼凑出动态代理对象的java源码 + public static String get$Proxy0(Class interfaces){ + Method[] methods = interfaces.getMethods(); + String proxyClass = "package com.bootdo.simpleProxy.temp;" + rt + + "import com.bootdo.simpleProxy.MyInvocationHandler;" + rt + + "import java.lang.reflect.Method;" + rt + + "public class $Proxy0 implements " + interfaces.getName() + "{" + rt + + + "MyInvocationHandler h;" + rt + + + "public $Proxy0(MyInvocationHandler h){this.h = h;}" + rt + + + getMethodString(methods,interfaces) + rt + + + "}" + rt; + return proxyClass; + } + + + /** + * 拼接出所有的方法 + * @param methods + * @param interfaces + * @return + */ + private static String getMethodString(Method[] methods,Class interfaces){ + String proxyMethod = ""; + for(Method method : methods){ + proxyMethod += "public String " + method.getName() +"() throws Throwable {" + rt + + + "Method md = " + interfaces.getName() + ".class.getMethod(\""+ method.getName() +"\",new Class[]{});" + rt + + "return (String)this.h.invoke(this,md,null);" + rt + + "}"; + } + return proxyMethod; + } +} diff --git a/src/main/java/com/bootdo/simpleProxy/UserService.java b/src/main/java/com/bootdo/simpleProxy/UserService.java new file mode 100644 index 0000000000000000000000000000000000000000..ac42408dd3b566b8602689a24ca2d1d327e07fd9 --- /dev/null +++ b/src/main/java/com/bootdo/simpleProxy/UserService.java @@ -0,0 +1,11 @@ +package com.bootdo.simpleProxy; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/8/29 23:31 + * @Desc: 接口 + **/ +public interface UserService { + + String sayHello() throws Throwable; +} diff --git a/src/main/java/com/bootdo/simpleProxy/UserServiceImpl.java b/src/main/java/com/bootdo/simpleProxy/UserServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4a46ea445269fd001c4d8563f466a4f20df11caf --- /dev/null +++ b/src/main/java/com/bootdo/simpleProxy/UserServiceImpl.java @@ -0,0 +1,15 @@ +package com.bootdo.simpleProxy; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/8/29 23:32 + * @Desc: 实现类 + **/ +public class UserServiceImpl implements UserService{ + + @Override + public String sayHello() { + System.out.println("你好,上海"); + return "执行成功"; + } +} diff --git a/src/main/java/com/bootdo/simpleProxy/classloader/SimpleClassLoader.java b/src/main/java/com/bootdo/simpleProxy/classloader/SimpleClassLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..a91421fe8af87c265b07eddf46b31379826ad453 --- /dev/null +++ b/src/main/java/com/bootdo/simpleProxy/classloader/SimpleClassLoader.java @@ -0,0 +1,55 @@ +package com.bootdo.simpleProxy.classloader; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + +/** + * 自定义的类加载器 + * @author heylinlook + * @date 2018/4/23 14:34 + * @param + * @return + */ +public class SimpleClassLoader extends ClassLoader { + + File dir; + + //把文件路径用构造函数传进来 + public SimpleClassLoader(String path) { + dir = new File(path); + } + + /* + * 本方法就是去加载对应的字节码文件 + * */ + @Override + public Class findClass(String name) throws ClassNotFoundException { + //如果文件路径可用 + if (dir != null) { + File clazzFile = new File(dir, name + ".class"); + //如果字节码文件存在 + if (clazzFile.exists()) { + //把字节码文件加载到VM + try { + //文件流对接class文件 + FileInputStream inputStream = new FileInputStream(clazzFile); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int len; + //将class文件读取到buffer中 + while ((len = inputStream.read(buffer)) != -1) { + //将buffer中的内容读取到baos中的buffer + baos.write(buffer, 0, len); + } + //FIXME 将buffer中的字节读到内存加载为class 这个前缀要动态获取 + return defineClass("com.bootdo.simpleProxy.temp." + name, baos.toByteArray(), 0, baos.size()); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return super.findClass(name); + } +} diff --git "a/src/main/java/com/bootdo/simpleProxy/\345\212\250\346\200\201\344\273\243\347\220\206\347\261\273\345\233\276.png" "b/src/main/java/com/bootdo/simpleProxy/\345\212\250\346\200\201\344\273\243\347\220\206\347\261\273\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..da1f00161c68d96a5275db3682bdaf6e767cb0c1 Binary files /dev/null and "b/src/main/java/com/bootdo/simpleProxy/\345\212\250\346\200\201\344\273\243\347\220\206\347\261\273\345\233\276.png" differ diff --git a/bootdo/src/main/java/com/bootdo/system/config/BDSessionListener.java b/src/main/java/com/bootdo/system/config/BDSessionListener.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/system/config/BDSessionListener.java rename to src/main/java/com/bootdo/system/config/BDSessionListener.java index 3dee548fc09b0c77b27847167a5c37eaebf299a7..431eb41dbf01166080772ea8ed3c12a61a23d21d 100644 --- a/bootdo/src/main/java/com/bootdo/system/config/BDSessionListener.java +++ b/src/main/java/com/bootdo/system/config/BDSessionListener.java @@ -1,32 +1,32 @@ -package com.bootdo.system.config; - -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.shiro.session.Session; -import org.apache.shiro.session.SessionListener; - -public class BDSessionListener implements SessionListener { - - private final AtomicInteger sessionCount = new AtomicInteger(0); - - @Override - public void onStart(Session session) { - sessionCount.incrementAndGet(); - } - - @Override - public void onStop(Session session) { - sessionCount.decrementAndGet(); - } - - @Override - public void onExpiration(Session session) { - sessionCount.decrementAndGet(); - - } - - public int getSessionCount() { - return sessionCount.get(); - } - -} +package com.bootdo.system.config; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.shiro.session.Session; +import org.apache.shiro.session.SessionListener; + +public class BDSessionListener implements SessionListener { + + private final AtomicInteger sessionCount = new AtomicInteger(0); + + @Override + public void onStart(Session session) { + sessionCount.incrementAndGet(); + } + + @Override + public void onStop(Session session) { + sessionCount.decrementAndGet(); + } + + @Override + public void onExpiration(Session session) { + sessionCount.decrementAndGet(); + + } + + public int getSessionCount() { + return sessionCount.get(); + } + +} diff --git a/bootdo/src/main/java/com/bootdo/system/config/ShiroConfig.java b/src/main/java/com/bootdo/system/config/ShiroConfig.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/config/ShiroConfig.java rename to src/main/java/com/bootdo/system/config/ShiroConfig.java diff --git a/bootdo/src/main/java/com/bootdo/system/config/Swagger2Config.java b/src/main/java/com/bootdo/system/config/Swagger2Config.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/config/Swagger2Config.java rename to src/main/java/com/bootdo/system/config/Swagger2Config.java diff --git a/bootdo/src/main/java/com/bootdo/system/config/XssConfig.java b/src/main/java/com/bootdo/system/config/XssConfig.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/config/XssConfig.java rename to src/main/java/com/bootdo/system/config/XssConfig.java diff --git a/bootdo/src/main/java/com/bootdo/system/controller/DeptController.java b/src/main/java/com/bootdo/system/controller/DeptController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/controller/DeptController.java rename to src/main/java/com/bootdo/system/controller/DeptController.java diff --git a/bootdo/src/main/java/com/bootdo/system/controller/LoginController.java b/src/main/java/com/bootdo/system/controller/LoginController.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/system/controller/LoginController.java rename to src/main/java/com/bootdo/system/controller/LoginController.java index bfb77924f2af5597a621a451b69322ee60310b31..3293d87577bc5cb321efef831d985c2868523aa2 100644 --- a/bootdo/src/main/java/com/bootdo/system/controller/LoginController.java +++ b/src/main/java/com/bootdo/system/controller/LoginController.java @@ -1,133 +1,133 @@ -package com.bootdo.system.controller; - -import com.bootdo.common.annotation.Log; -import com.bootdo.common.config.BootdoConfig; -import com.bootdo.common.controller.BaseController; -import com.bootdo.common.domain.FileDO; -import com.bootdo.common.domain.Tree; -import com.bootdo.common.service.FileService; -import com.bootdo.common.utils.*; -import com.bootdo.system.domain.MenuDO; -import com.bootdo.system.service.MenuService; -import io.swagger.models.auth.In; -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.authc.AuthenticationException; -import org.apache.shiro.authc.UsernamePasswordToken; -import org.apache.shiro.subject.Subject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -@Controller -public class LoginController extends BaseController { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - MenuService menuService; - @Autowired - FileService fileService; - @Autowired - BootdoConfig bootdoConfig; - - @GetMapping({"/", ""}) - String welcome(Model model) { - - return "redirect:/blog"; - } - - @Log("请求访问主页") - @GetMapping({"/index"}) - String index(Model model) { - List> menus = menuService.listMenuTree(getUserId()); - model.addAttribute("menus", menus); - model.addAttribute("name", getUser().getName()); - FileDO fileDO = fileService.get(getUser().getPicId()); - if (fileDO != null && fileDO.getUrl() != null) { - if (fileService.isExist(fileDO.getUrl())) { - model.addAttribute("picUrl", fileDO.getUrl()); - } else { - model.addAttribute("picUrl", "/img/photo_s.jpg"); - } - } else { - model.addAttribute("picUrl", "/img/photo_s.jpg"); - } - model.addAttribute("username", getUser().getUsername()); - return "index_v1"; - } - - @GetMapping("/login") - String login(Model model) { - model.addAttribute("username", bootdoConfig.getUsername()); - model.addAttribute("password", bootdoConfig.getPassword()); - return "login"; - } - - @Log("登录") - @PostMapping("/login") - @ResponseBody - R ajaxLogin(String username, String password,String verify,HttpServletRequest request) { - - try { - //从session中获取随机数 - String random = (String) request.getSession().getAttribute(RandomValidateCodeUtil.RANDOMCODEKEY); - if (StringUtils.isBlank(verify)) { - return R.error("请输入验证码"); - } - if (random.equals(verify)) { - } else { - return R.error("请输入正确的验证码"); - } - } catch (Exception e) { - logger.error("验证码校验失败", e); - return R.error("验证码校验失败"); - } - password = MD5Utils.encrypt(username, password); - UsernamePasswordToken token = new UsernamePasswordToken(username, password); - Subject subject = SecurityUtils.getSubject(); - try { - subject.login(token); - return R.ok(); - } catch (AuthenticationException e) { - return R.error("用户或密码错误"); - } - } - - @GetMapping("/logout") - String logout() { - ShiroUtils.logout(); - return "redirect:/login"; - } - - @GetMapping("/main") - String main() { - return "main"; - } - - /** - * 生成验证码 - */ - @GetMapping(value = "/getVerify") - public void getVerify(HttpServletRequest request, HttpServletResponse response) { - try { - response.setContentType("image/jpeg");//设置相应类型,告诉浏览器输出的内容为图片 - response.setHeader("Pragma", "No-cache");//设置响应头信息,告诉浏览器不要缓存此内容 - response.setHeader("Cache-Control", "no-cache"); - response.setDateHeader("Expire", 0); - RandomValidateCodeUtil randomValidateCode = new RandomValidateCodeUtil(); - randomValidateCode.getRandcode(request, response);//输出验证码图片方法 - } catch (Exception e) { - logger.error("获取验证码失败>>>> ", e); - } - } - -} +package com.bootdo.system.controller; + +import com.bootdo.common.annotation.Log; +import com.bootdo.common.config.BootdoConfig; +import com.bootdo.common.controller.BaseController; +import com.bootdo.common.domain.FileDO; +import com.bootdo.common.domain.Tree; +import com.bootdo.common.service.FileService; +import com.bootdo.common.utils.*; +import com.bootdo.system.domain.MenuDO; +import com.bootdo.system.service.MenuService; +import io.swagger.models.auth.In; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.subject.Subject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Controller +public class LoginController extends BaseController { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + MenuService menuService; + @Autowired + FileService fileService; + @Autowired + BootdoConfig bootdoConfig; + + @GetMapping({"/", ""}) + String welcome(Model model) { + + return "redirect:/blog"; + } + + @Log("请求访问主页") + @GetMapping({"/index"}) + String index(Model model) { + List> menus = menuService.listMenuTree(getUserId()); + model.addAttribute("menus", menus); + model.addAttribute("name", getUser().getName()); + FileDO fileDO = fileService.get(getUser().getPicId()); + if (fileDO != null && fileDO.getUrl() != null) { + if (fileService.isExist(fileDO.getUrl())) { + model.addAttribute("picUrl", fileDO.getUrl()); + } else { + model.addAttribute("picUrl", "/img/photo_s.jpg"); + } + } else { + model.addAttribute("picUrl", "/img/photo_s.jpg"); + } + model.addAttribute("username", getUser().getUsername()); + return "index_v1"; + } + + @GetMapping("/login") + String login(Model model) { + model.addAttribute("username", bootdoConfig.getUsername()); + model.addAttribute("password", bootdoConfig.getPassword()); + return "login"; + } + + @Log("登录") + @PostMapping("/login") + @ResponseBody + R ajaxLogin(String username, String password,String verify,HttpServletRequest request) { + + try { + //从session中获取随机数 + String random = (String) request.getSession().getAttribute(RandomValidateCodeUtil.RANDOMCODEKEY); + if (StringUtils.isBlank(verify)) { + return R.error("请输入验证码"); + } + if (random.equals(verify)) { + } else { + return R.error("请输入正确的验证码"); + } + } catch (Exception e) { + logger.error("验证码校验失败", e); + return R.error("验证码校验失败"); + } + password = MD5Utils.encrypt(username, password); + UsernamePasswordToken token = new UsernamePasswordToken(username, password); + Subject subject = SecurityUtils.getSubject(); + try { + subject.login(token); + return R.ok(); + } catch (AuthenticationException e) { + return R.error("用户或密码错误"); + } + } + + @GetMapping("/logout") + String logout() { + ShiroUtils.logout(); + return "redirect:/login"; + } + + @GetMapping("/main") + String main() { + return "main"; + } + + /** + * 生成验证码 + */ + @GetMapping(value = "/getVerify") + public void getVerify(HttpServletRequest request, HttpServletResponse response) { + try { + response.setContentType("image/jpeg");//设置相应类型,告诉浏览器输出的内容为图片 + response.setHeader("Pragma", "No-cache");//设置响应头信息,告诉浏览器不要缓存此内容 + response.setHeader("Cache-Control", "no-cache"); + response.setDateHeader("Expire", 0); + RandomValidateCodeUtil randomValidateCode = new RandomValidateCodeUtil(); + randomValidateCode.getRandcode(request, response);//输出验证码图片方法 + } catch (Exception e) { + logger.error("获取验证码失败>>>> ", e); + } + } + +} diff --git a/bootdo/src/main/java/com/bootdo/system/controller/MenuController.java b/src/main/java/com/bootdo/system/controller/MenuController.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/system/controller/MenuController.java rename to src/main/java/com/bootdo/system/controller/MenuController.java index 22b4528d3477fed783cce7fd6edb3b9697f07819..0f17ad12cfaa78cd4f696bb503ab320148b699b8 100644 --- a/bootdo/src/main/java/com/bootdo/system/controller/MenuController.java +++ b/src/main/java/com/bootdo/system/controller/MenuController.java @@ -1,130 +1,130 @@ -package com.bootdo.system.controller; - -import com.bootdo.common.annotation.Log; -import com.bootdo.common.config.Constant; -import com.bootdo.common.controller.BaseController; -import com.bootdo.common.domain.Tree; -import com.bootdo.common.utils.R; -import com.bootdo.system.domain.MenuDO; -import com.bootdo.system.service.MenuService; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Map; - -/** - * @author bootdo 1992lcg@163.com - */ -@RequestMapping("/sys/menu") -@Controller -public class MenuController extends BaseController { - String prefix = "system/menu"; - @Autowired - MenuService menuService; - - @RequiresPermissions("sys:menu:menu") - @GetMapping() - String menu(Model model) { - return prefix+"/menu"; - } - - @RequiresPermissions("sys:menu:menu") - @RequestMapping("/list") - @ResponseBody - List list(@RequestParam Map params) { - List menus = menuService.list(params); - return menus; - } - - @Log("添加菜单") - @RequiresPermissions("sys:menu:add") - @GetMapping("/add/{pId}") - String add(Model model, @PathVariable("pId") Long pId) { - model.addAttribute("pId", pId); - if (pId == 0) { - model.addAttribute("pName", "根目录"); - } else { - model.addAttribute("pName", menuService.get(pId).getName()); - } - return prefix + "/add"; - } - - @Log("编辑菜单") - @RequiresPermissions("sys:menu:edit") - @GetMapping("/edit/{id}") - String edit(Model model, @PathVariable("id") Long id) { - MenuDO mdo = menuService.get(id); - Long pId = mdo.getParentId(); - model.addAttribute("pId", pId); - if (pId == 0) { - model.addAttribute("pName", "根目录"); - } else { - model.addAttribute("pName", menuService.get(pId).getName()); - } - model.addAttribute("menu", mdo); - return prefix+"/edit"; - } - - @Log("保存菜单") - @RequiresPermissions("sys:menu:add") - @PostMapping("/save") - @ResponseBody - R save(MenuDO menu) { - if (Constant.DEMO_ACCOUNT.equals(getUsername())) { - return R.error(1, "演示系统不允许修改,完整体验请部署程序"); - } - if (menuService.save(menu) > 0) { - return R.ok(); - } else { - return R.error(1, "保存失败"); - } - } - - @Log("更新菜单") - @RequiresPermissions("sys:menu:edit") - @PostMapping("/update") - @ResponseBody - R update(MenuDO menu) { - if (Constant.DEMO_ACCOUNT.equals(getUsername())) { - return R.error(1, "演示系统不允许修改,完整体验请部署程序"); - } - if (menuService.update(menu) > 0) { - return R.ok(); - } else { - return R.error(1, "更新失败"); - } - } - - @Log("删除菜单") - @RequiresPermissions("sys:menu:remove") - @PostMapping("/remove") - @ResponseBody - R remove(Long id) { - if (Constant.DEMO_ACCOUNT.equals(getUsername())) { - return R.error(1, "演示系统不允许修改,完整体验请部署程序"); - } - if (menuService.remove(id) > 0) { - return R.ok(); - } else { - return R.error(1, "删除失败"); - } - } - - @GetMapping("/tree") - @ResponseBody - Tree tree() { - Tree tree = menuService.getTree(); - return tree; - } - - @GetMapping("/tree/{roleId}") - @ResponseBody - Tree tree(@PathVariable("roleId") Long roleId) { - Tree tree = menuService.getTree(roleId); - return tree; - } -} +package com.bootdo.system.controller; + +import com.bootdo.common.annotation.Log; +import com.bootdo.common.config.Constant; +import com.bootdo.common.controller.BaseController; +import com.bootdo.common.domain.Tree; +import com.bootdo.common.utils.R; +import com.bootdo.system.domain.MenuDO; +import com.bootdo.system.service.MenuService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * @author bootdo 1992lcg@163.com + */ +@RequestMapping("/sys/menu") +@Controller +public class MenuController extends BaseController { + String prefix = "system/menu"; + @Autowired + MenuService menuService; + + @RequiresPermissions("sys:menu:menu") + @GetMapping() + String menu(Model model) { + return prefix+"/menu"; + } + + @RequiresPermissions("sys:menu:menu") + @RequestMapping("/list") + @ResponseBody + List list(@RequestParam Map params) { + List menus = menuService.list(params); + return menus; + } + + @Log("添加菜单") + @RequiresPermissions("sys:menu:add") + @GetMapping("/add/{pId}") + String add(Model model, @PathVariable("pId") Long pId) { + model.addAttribute("pId", pId); + if (pId == 0) { + model.addAttribute("pName", "根目录"); + } else { + model.addAttribute("pName", menuService.get(pId).getName()); + } + return prefix + "/add"; + } + + @Log("编辑菜单") + @RequiresPermissions("sys:menu:edit") + @GetMapping("/edit/{id}") + String edit(Model model, @PathVariable("id") Long id) { + MenuDO mdo = menuService.get(id); + Long pId = mdo.getParentId(); + model.addAttribute("pId", pId); + if (pId == 0) { + model.addAttribute("pName", "根目录"); + } else { + model.addAttribute("pName", menuService.get(pId).getName()); + } + model.addAttribute("menu", mdo); + return prefix+"/edit"; + } + + @Log("保存菜单") + @RequiresPermissions("sys:menu:add") + @PostMapping("/save") + @ResponseBody + R save(MenuDO menu) { + if (Constant.DEMO_ACCOUNT.equals(getUsername())) { + return R.error(1, "演示系统不允许修改,完整体验请部署程序"); + } + if (menuService.save(menu) > 0) { + return R.ok(); + } else { + return R.error(1, "保存失败"); + } + } + + @Log("更新菜单") + @RequiresPermissions("sys:menu:edit") + @PostMapping("/update") + @ResponseBody + R update(MenuDO menu) { + if (Constant.DEMO_ACCOUNT.equals(getUsername())) { + return R.error(1, "演示系统不允许修改,完整体验请部署程序"); + } + if (menuService.update(menu) > 0) { + return R.ok(); + } else { + return R.error(1, "更新失败"); + } + } + + @Log("删除菜单") + @RequiresPermissions("sys:menu:remove") + @PostMapping("/remove") + @ResponseBody + R remove(Long id) { + if (Constant.DEMO_ACCOUNT.equals(getUsername())) { + return R.error(1, "演示系统不允许修改,完整体验请部署程序"); + } + if (menuService.remove(id) > 0) { + return R.ok(); + } else { + return R.error(1, "删除失败"); + } + } + + @GetMapping("/tree") + @ResponseBody + Tree tree() { + Tree tree = menuService.getTree(); + return tree; + } + + @GetMapping("/tree/{roleId}") + @ResponseBody + Tree tree(@PathVariable("roleId") Long roleId) { + Tree tree = menuService.getTree(roleId); + return tree; + } +} diff --git a/bootdo/src/main/java/com/bootdo/system/controller/RoleController.java b/src/main/java/com/bootdo/system/controller/RoleController.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/system/controller/RoleController.java rename to src/main/java/com/bootdo/system/controller/RoleController.java index 27ad2193f951cac1c1421a3b8b2aedaac56c8e8c..99723a99f98226a6f15d26dfcef4aec32f557ec5 100644 --- a/bootdo/src/main/java/com/bootdo/system/controller/RoleController.java +++ b/src/main/java/com/bootdo/system/controller/RoleController.java @@ -1,113 +1,113 @@ -package com.bootdo.system.controller; - -import com.bootdo.common.annotation.Log; -import com.bootdo.common.config.Constant; -import com.bootdo.common.controller.BaseController; -import com.bootdo.common.utils.R; -import com.bootdo.system.domain.RoleDO; -import com.bootdo.system.service.RoleService; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -@RequestMapping("/sys/role") -@Controller -public class RoleController extends BaseController { - String prefix = "system/role"; - @Autowired - RoleService roleService; - - @RequiresPermissions("sys:role:role") - @GetMapping() - String role() { - return prefix + "/role"; - } - - @RequiresPermissions("sys:role:role") - @GetMapping("/list") - @ResponseBody() - List list() { - List roles = roleService.list(); - return roles; - } - - @Log("添加角色") - @RequiresPermissions("sys:role:add") - @GetMapping("/add") - String add() { - return prefix + "/add"; - } - - @Log("编辑角色") - @RequiresPermissions("sys:role:edit") - @GetMapping("/edit/{id}") - String edit(@PathVariable("id") Long id, Model model) { - RoleDO roleDO = roleService.get(id); - model.addAttribute("role", roleDO); - return prefix + "/edit"; - } - - @Log("保存角色") - @RequiresPermissions("sys:role:add") - @PostMapping("/save") - @ResponseBody() - R save(RoleDO role) { - if (Constant.DEMO_ACCOUNT.equals(getUsername())) { - return R.error(1, "演示系统不允许修改,完整体验请部署程序"); - } - if (roleService.save(role) > 0) { - return R.ok(); - } else { - return R.error(1, "保存失败"); - } - } - - @Log("更新角色") - @RequiresPermissions("sys:role:edit") - @PostMapping("/update") - @ResponseBody() - R update(RoleDO role) { - if (Constant.DEMO_ACCOUNT.equals(getUsername())) { - return R.error(1, "演示系统不允许修改,完整体验请部署程序"); - } - if (roleService.update(role) > 0) { - return R.ok(); - } else { - return R.error(1, "保存失败"); - } - } - - @Log("删除角色") - @RequiresPermissions("sys:role:remove") - @PostMapping("/remove") - @ResponseBody() - R save(Long id) { - if (Constant.DEMO_ACCOUNT.equals(getUsername())) { - return R.error(1, "演示系统不允许修改,完整体验请部署程序"); - } - if (roleService.remove(id) > 0) { - return R.ok(); - } else { - return R.error(1, "删除失败"); - } - } - - @RequiresPermissions("sys:role:batchRemove") - @Log("批量删除角色") - @PostMapping("/batchRemove") - @ResponseBody - R batchRemove(@RequestParam("ids[]") Long[] ids) { - if (Constant.DEMO_ACCOUNT.equals(getUsername())) { - return R.error(1, "演示系统不允许修改,完整体验请部署程序"); - } - int r = roleService.batchremove(ids); - if (r > 0) { - return R.ok(); - } - return R.error(); - } -} +package com.bootdo.system.controller; + +import com.bootdo.common.annotation.Log; +import com.bootdo.common.config.Constant; +import com.bootdo.common.controller.BaseController; +import com.bootdo.common.utils.R; +import com.bootdo.system.domain.RoleDO; +import com.bootdo.system.service.RoleService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RequestMapping("/sys/role") +@Controller +public class RoleController extends BaseController { + String prefix = "system/role"; + @Autowired + RoleService roleService; + + @RequiresPermissions("sys:role:role") + @GetMapping() + String role() { + return prefix + "/role"; + } + + @RequiresPermissions("sys:role:role") + @GetMapping("/list") + @ResponseBody() + List list() { + List roles = roleService.list(); + return roles; + } + + @Log("添加角色") + @RequiresPermissions("sys:role:add") + @GetMapping("/add") + String add() { + return prefix + "/add"; + } + + @Log("编辑角色") + @RequiresPermissions("sys:role:edit") + @GetMapping("/edit/{id}") + String edit(@PathVariable("id") Long id, Model model) { + RoleDO roleDO = roleService.get(id); + model.addAttribute("role", roleDO); + return prefix + "/edit"; + } + + @Log("保存角色") + @RequiresPermissions("sys:role:add") + @PostMapping("/save") + @ResponseBody() + R save(RoleDO role) { + if (Constant.DEMO_ACCOUNT.equals(getUsername())) { + return R.error(1, "演示系统不允许修改,完整体验请部署程序"); + } + if (roleService.save(role) > 0) { + return R.ok(); + } else { + return R.error(1, "保存失败"); + } + } + + @Log("更新角色") + @RequiresPermissions("sys:role:edit") + @PostMapping("/update") + @ResponseBody() + R update(RoleDO role) { + if (Constant.DEMO_ACCOUNT.equals(getUsername())) { + return R.error(1, "演示系统不允许修改,完整体验请部署程序"); + } + if (roleService.update(role) > 0) { + return R.ok(); + } else { + return R.error(1, "保存失败"); + } + } + + @Log("删除角色") + @RequiresPermissions("sys:role:remove") + @PostMapping("/remove") + @ResponseBody() + R save(Long id) { + if (Constant.DEMO_ACCOUNT.equals(getUsername())) { + return R.error(1, "演示系统不允许修改,完整体验请部署程序"); + } + if (roleService.remove(id) > 0) { + return R.ok(); + } else { + return R.error(1, "删除失败"); + } + } + + @RequiresPermissions("sys:role:batchRemove") + @Log("批量删除角色") + @PostMapping("/batchRemove") + @ResponseBody + R batchRemove(@RequestParam("ids[]") Long[] ids) { + if (Constant.DEMO_ACCOUNT.equals(getUsername())) { + return R.error(1, "演示系统不允许修改,完整体验请部署程序"); + } + int r = roleService.batchremove(ids); + if (r > 0) { + return R.ok(); + } + return R.error(); + } +} diff --git a/bootdo/src/main/java/com/bootdo/system/controller/SessionController.java b/src/main/java/com/bootdo/system/controller/SessionController.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/system/controller/SessionController.java rename to src/main/java/com/bootdo/system/controller/SessionController.java index 48e5a878a9f01210d354523a22492727819f232e..17e2490ea227fa8c0dbc7f424c37872cdeba2f3e 100644 --- a/bootdo/src/main/java/com/bootdo/system/controller/SessionController.java +++ b/src/main/java/com/bootdo/system/controller/SessionController.java @@ -1,57 +1,57 @@ -package com.bootdo.system.controller; - -import java.security.Principal; -import java.util.Collection; -import java.util.List; - -import org.apache.shiro.session.Session; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.mvc.support.RedirectAttributes; - -import com.bootdo.common.utils.R; -import com.bootdo.system.domain.UserOnline; -import com.bootdo.system.service.SessionService; - -@RequestMapping("/sys/online") -@Controller -public class SessionController { - @Autowired - SessionService sessionService; - - @GetMapping() - public String online() { - return "system/online/online"; - } - - @ResponseBody - @RequestMapping("/list") - public List list() { - return sessionService.list(); - } - - @ResponseBody - @RequestMapping("/forceLogout/{sessionId}") - public R forceLogout(@PathVariable("sessionId") String sessionId, RedirectAttributes redirectAttributes) { - try { - sessionService.forceLogout(sessionId); - return R.ok(); - } catch (Exception e) { - e.printStackTrace(); - return R.error(); - } - - } - - @ResponseBody - @RequestMapping("/sessionList") - public Collection sessionList() { - return sessionService.sessionList(); - } - - -} +package com.bootdo.system.controller; + +import java.security.Principal; +import java.util.Collection; +import java.util.List; + +import org.apache.shiro.session.Session; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.bootdo.common.utils.R; +import com.bootdo.system.domain.UserOnline; +import com.bootdo.system.service.SessionService; + +@RequestMapping("/sys/online") +@Controller +public class SessionController { + @Autowired + SessionService sessionService; + + @GetMapping() + public String online() { + return "system/online/online"; + } + + @ResponseBody + @RequestMapping("/list") + public List list() { + return sessionService.list(); + } + + @ResponseBody + @RequestMapping("/forceLogout/{sessionId}") + public R forceLogout(@PathVariable("sessionId") String sessionId, RedirectAttributes redirectAttributes) { + try { + sessionService.forceLogout(sessionId); + return R.ok(); + } catch (Exception e) { + e.printStackTrace(); + return R.error(); + } + + } + + @ResponseBody + @RequestMapping("/sessionList") + public Collection sessionList() { + return sessionService.sessionList(); + } + + +} diff --git a/bootdo/src/main/java/com/bootdo/system/controller/UserController.java b/src/main/java/com/bootdo/system/controller/UserController.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/controller/UserController.java rename to src/main/java/com/bootdo/system/controller/UserController.java diff --git a/bootdo/src/main/java/com/bootdo/system/dao/DeptDao.java b/src/main/java/com/bootdo/system/dao/DeptDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/dao/DeptDao.java rename to src/main/java/com/bootdo/system/dao/DeptDao.java diff --git a/bootdo/src/main/java/com/bootdo/system/dao/MenuDao.java b/src/main/java/com/bootdo/system/dao/MenuDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/dao/MenuDao.java rename to src/main/java/com/bootdo/system/dao/MenuDao.java diff --git a/bootdo/src/main/java/com/bootdo/system/dao/RoleDao.java b/src/main/java/com/bootdo/system/dao/RoleDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/dao/RoleDao.java rename to src/main/java/com/bootdo/system/dao/RoleDao.java diff --git a/bootdo/src/main/java/com/bootdo/system/dao/RoleMenuDao.java b/src/main/java/com/bootdo/system/dao/RoleMenuDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/dao/RoleMenuDao.java rename to src/main/java/com/bootdo/system/dao/RoleMenuDao.java diff --git a/bootdo/src/main/java/com/bootdo/system/dao/UserDao.java b/src/main/java/com/bootdo/system/dao/UserDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/dao/UserDao.java rename to src/main/java/com/bootdo/system/dao/UserDao.java diff --git a/bootdo/src/main/java/com/bootdo/system/dao/UserRoleDao.java b/src/main/java/com/bootdo/system/dao/UserRoleDao.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/dao/UserRoleDao.java rename to src/main/java/com/bootdo/system/dao/UserRoleDao.java diff --git a/bootdo/src/main/java/com/bootdo/system/domain/DeptDO.java b/src/main/java/com/bootdo/system/domain/DeptDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/domain/DeptDO.java rename to src/main/java/com/bootdo/system/domain/DeptDO.java diff --git a/bootdo/src/main/java/com/bootdo/system/domain/MenuDO.java b/src/main/java/com/bootdo/system/domain/MenuDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/domain/MenuDO.java rename to src/main/java/com/bootdo/system/domain/MenuDO.java diff --git a/bootdo/src/main/java/com/bootdo/system/domain/RoleDO.java b/src/main/java/com/bootdo/system/domain/RoleDO.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/system/domain/RoleDO.java rename to src/main/java/com/bootdo/system/domain/RoleDO.java index 96b541fd5d1e81679859527524f21f6366cb1c41..a5410cc39253046d407eada670d0b7c5a2fba34b 100644 --- a/bootdo/src/main/java/com/bootdo/system/domain/RoleDO.java +++ b/src/main/java/com/bootdo/system/domain/RoleDO.java @@ -1,94 +1,94 @@ -package com.bootdo.system.domain; - -import java.sql.Timestamp; -import java.util.List; - -public class RoleDO { - - private Long roleId; - private String roleName; - private String roleSign; - private String remark; - private Long userIdCreate; - private Timestamp gmtCreate; - private Timestamp gmtModified; - private List menuIds; - - public Long getRoleId() { - return roleId; - } - - public void setRoleId(Long roleId) { - this.roleId = roleId; - } - - public String getRoleName() { - return roleName; - } - - public void setRoleName(String roleName) { - this.roleName = roleName; - } - - public String getRoleSign() { - return roleSign; - } - - public void setRoleSign(String roleSign) { - this.roleSign = roleSign; - } - - public String getRemark() { - return remark; - } - - public void setRemark(String remark) { - this.remark = remark; - } - - public Long getUserIdCreate() { - return userIdCreate; - } - - public void setUserIdCreate(Long userIdCreate) { - this.userIdCreate = userIdCreate; - } - - public Timestamp getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Timestamp gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Timestamp getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Timestamp gmtModified) { - this.gmtModified = gmtModified; - } - - public List getMenuIds() { - return menuIds; - } - - public void setMenuIds(List menuIds) { - this.menuIds = menuIds; - } - - @Override - public String toString() { - return "RoleDO{" + - "roleId=" + roleId + - ", roleName='" + roleName + '\'' + - ", roleSign='" + roleSign + '\'' + - ", remark='" + remark + '\'' + - ", userIdCreate=" + userIdCreate + - ", gmtCreate=" + gmtCreate + - ", gmtModified=" + gmtModified + - ", menuIds=" + menuIds + - '}'; - } -} +package com.bootdo.system.domain; + +import java.sql.Timestamp; +import java.util.List; + +public class RoleDO { + + private Long roleId; + private String roleName; + private String roleSign; + private String remark; + private Long userIdCreate; + private Timestamp gmtCreate; + private Timestamp gmtModified; + private List menuIds; + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getRoleSign() { + return roleSign; + } + + public void setRoleSign(String roleSign) { + this.roleSign = roleSign; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Long getUserIdCreate() { + return userIdCreate; + } + + public void setUserIdCreate(Long userIdCreate) { + this.userIdCreate = userIdCreate; + } + + public Timestamp getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Timestamp gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Timestamp getGmtModified() { + return gmtModified; + } + + public void setGmtModified(Timestamp gmtModified) { + this.gmtModified = gmtModified; + } + + public List getMenuIds() { + return menuIds; + } + + public void setMenuIds(List menuIds) { + this.menuIds = menuIds; + } + + @Override + public String toString() { + return "RoleDO{" + + "roleId=" + roleId + + ", roleName='" + roleName + '\'' + + ", roleSign='" + roleSign + '\'' + + ", remark='" + remark + '\'' + + ", userIdCreate=" + userIdCreate + + ", gmtCreate=" + gmtCreate + + ", gmtModified=" + gmtModified + + ", menuIds=" + menuIds + + '}'; + } +} diff --git a/bootdo/src/main/java/com/bootdo/system/domain/RoleMenuDO.java b/src/main/java/com/bootdo/system/domain/RoleMenuDO.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/system/domain/RoleMenuDO.java rename to src/main/java/com/bootdo/system/domain/RoleMenuDO.java index 3b1013badd3ba0ddf20c6968f438f341dc9e441b..80f887a7b902cd2ce417551b224e6694e3d74671 100644 --- a/bootdo/src/main/java/com/bootdo/system/domain/RoleMenuDO.java +++ b/src/main/java/com/bootdo/system/domain/RoleMenuDO.java @@ -1,35 +1,35 @@ -package com.bootdo.system.domain; - -public class RoleMenuDO { - private Long id; - private Long roleId; - private Long menuId; - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public Long getRoleId() { - return roleId; - } - public void setRoleId(Long roleId) { - this.roleId = roleId; - } - public Long getMenuId() { - return menuId; - } - public void setMenuId(Long menuId) { - this.menuId = menuId; - } - - @Override - public String toString() { - return "RoleMenuDO{" + - "id=" + id + - ", roleId=" + roleId + - ", menuId=" + menuId + - '}'; - } -} +package com.bootdo.system.domain; + +public class RoleMenuDO { + private Long id; + private Long roleId; + private Long menuId; + + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + public Long getRoleId() { + return roleId; + } + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + public Long getMenuId() { + return menuId; + } + public void setMenuId(Long menuId) { + this.menuId = menuId; + } + + @Override + public String toString() { + return "RoleMenuDO{" + + "id=" + id + + ", roleId=" + roleId + + ", menuId=" + menuId + + '}'; + } +} diff --git a/bootdo/src/main/java/com/bootdo/system/domain/UserDO.java b/src/main/java/com/bootdo/system/domain/UserDO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/domain/UserDO.java rename to src/main/java/com/bootdo/system/domain/UserDO.java diff --git a/bootdo/src/main/java/com/bootdo/system/domain/UserOnline.java b/src/main/java/com/bootdo/system/domain/UserOnline.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/domain/UserOnline.java rename to src/main/java/com/bootdo/system/domain/UserOnline.java diff --git a/bootdo/src/main/java/com/bootdo/system/domain/UserRoleDO.java b/src/main/java/com/bootdo/system/domain/UserRoleDO.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/system/domain/UserRoleDO.java rename to src/main/java/com/bootdo/system/domain/UserRoleDO.java index 453742027d133f4fd93926206f3608d717c19806..16d9d7963d2b2e6314bc3c50df63c6f1bbc85356 100644 --- a/bootdo/src/main/java/com/bootdo/system/domain/UserRoleDO.java +++ b/src/main/java/com/bootdo/system/domain/UserRoleDO.java @@ -1,40 +1,40 @@ -package com.bootdo.system.domain; - -public class UserRoleDO { - private Long id; - private Long userId; - private Long roleId; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public Long getRoleId() { - return roleId; - } - - public void setRoleId(Long roleId) { - this.roleId = roleId; - } - - @Override - public String toString() { - return "UserRoleDO{" + - "id=" + id + - ", userId=" + userId + - ", roleId=" + roleId + - '}'; - } -} +package com.bootdo.system.domain; + +public class UserRoleDO { + private Long id; + private Long userId; + private Long roleId; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + @Override + public String toString() { + return "UserRoleDO{" + + "id=" + id + + ", userId=" + userId + + ", roleId=" + roleId + + '}'; + } +} diff --git a/bootdo/src/main/java/com/bootdo/system/domain/UserToken.java b/src/main/java/com/bootdo/system/domain/UserToken.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/domain/UserToken.java rename to src/main/java/com/bootdo/system/domain/UserToken.java diff --git a/bootdo/src/main/java/com/bootdo/system/filter/XssFilter.java b/src/main/java/com/bootdo/system/filter/XssFilter.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/filter/XssFilter.java rename to src/main/java/com/bootdo/system/filter/XssFilter.java diff --git a/bootdo/src/main/java/com/bootdo/system/filter/XssHttpServletRequestWrapper.java b/src/main/java/com/bootdo/system/filter/XssHttpServletRequestWrapper.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/filter/XssHttpServletRequestWrapper.java rename to src/main/java/com/bootdo/system/filter/XssHttpServletRequestWrapper.java diff --git a/bootdo/src/main/java/com/bootdo/system/service/DeptService.java b/src/main/java/com/bootdo/system/service/DeptService.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/service/DeptService.java rename to src/main/java/com/bootdo/system/service/DeptService.java diff --git a/bootdo/src/main/java/com/bootdo/system/service/MenuService.java b/src/main/java/com/bootdo/system/service/MenuService.java similarity index 94% rename from bootdo/src/main/java/com/bootdo/system/service/MenuService.java rename to src/main/java/com/bootdo/system/service/MenuService.java index 079b9da44999f58a3737eed4ddd7b03bc44c139f..14dd798f37a39b98756ce2bb28ffb115d3a5f2be 100644 --- a/bootdo/src/main/java/com/bootdo/system/service/MenuService.java +++ b/src/main/java/com/bootdo/system/service/MenuService.java @@ -1,33 +1,33 @@ -package com.bootdo.system.service; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.springframework.stereotype.Service; - -import com.bootdo.common.domain.Tree; -import com.bootdo.system.domain.MenuDO; - -@Service -public interface MenuService { - Tree getSysMenuTree(Long id); - - List> listMenuTree(Long id); - - Tree getTree(); - - Tree getTree(Long id); - - List list(Map params); - - int remove(Long id); - - int save(MenuDO menu); - - int update(MenuDO menu); - - MenuDO get(Long id); - - Set listPerms(Long userId); -} +package com.bootdo.system.service; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.springframework.stereotype.Service; + +import com.bootdo.common.domain.Tree; +import com.bootdo.system.domain.MenuDO; + +@Service +public interface MenuService { + Tree getSysMenuTree(Long id); + + List> listMenuTree(Long id); + + Tree getTree(); + + Tree getTree(Long id); + + List list(Map params); + + int remove(Long id); + + int save(MenuDO menu); + + int update(MenuDO menu); + + MenuDO get(Long id); + + Set listPerms(Long userId); +} diff --git a/bootdo/src/main/java/com/bootdo/system/service/RoleService.java b/src/main/java/com/bootdo/system/service/RoleService.java similarity index 93% rename from bootdo/src/main/java/com/bootdo/system/service/RoleService.java rename to src/main/java/com/bootdo/system/service/RoleService.java index 928173a7a8ef4aa1bfe7d12942c4a9f40c3306b5..86918658bc218be2e2f92225d8a85b35212819d5 100644 --- a/bootdo/src/main/java/com/bootdo/system/service/RoleService.java +++ b/src/main/java/com/bootdo/system/service/RoleService.java @@ -1,25 +1,25 @@ -package com.bootdo.system.service; - -import java.util.List; - -import org.springframework.stereotype.Service; - -import com.bootdo.system.domain.RoleDO; - -@Service -public interface RoleService { - - RoleDO get(Long id); - - List list(); - - int save(RoleDO role); - - int update(RoleDO role); - - int remove(Long id); - - List list(Long userId); - - int batchremove(Long[] ids); -} +package com.bootdo.system.service; + +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.bootdo.system.domain.RoleDO; + +@Service +public interface RoleService { + + RoleDO get(Long id); + + List list(); + + int save(RoleDO role); + + int update(RoleDO role); + + int remove(Long id); + + List list(Long userId); + + int batchremove(Long[] ids); +} diff --git a/bootdo/src/main/java/com/bootdo/system/service/SessionService.java b/src/main/java/com/bootdo/system/service/SessionService.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/system/service/SessionService.java rename to src/main/java/com/bootdo/system/service/SessionService.java index 8e9172187d5c8477d1c97a6548e84c3e2e6f96d1..56dd3e3d21cc4a8f563e4eb7c401bec1eb725b90 100644 --- a/bootdo/src/main/java/com/bootdo/system/service/SessionService.java +++ b/src/main/java/com/bootdo/system/service/SessionService.java @@ -1,23 +1,23 @@ -package com.bootdo.system.service; - -import java.io.PrintStream; -import java.security.Principal; -import java.util.Collection; -import java.util.List; - -import com.bootdo.system.domain.UserDO; -import org.apache.shiro.session.Session; -import org.springframework.stereotype.Service; - -import com.bootdo.system.domain.UserOnline; - -@Service -public interface SessionService { - List list(); - - List listOnlineUser(); - - Collection sessionList(); - - boolean forceLogout(String sessionId); -} +package com.bootdo.system.service; + +import java.io.PrintStream; +import java.security.Principal; +import java.util.Collection; +import java.util.List; + +import com.bootdo.system.domain.UserDO; +import org.apache.shiro.session.Session; +import org.springframework.stereotype.Service; + +import com.bootdo.system.domain.UserOnline; + +@Service +public interface SessionService { + List list(); + + List listOnlineUser(); + + Collection sessionList(); + + boolean forceLogout(String sessionId); +} diff --git a/bootdo/src/main/java/com/bootdo/system/service/UserService.java b/src/main/java/com/bootdo/system/service/UserService.java similarity index 95% rename from bootdo/src/main/java/com/bootdo/system/service/UserService.java rename to src/main/java/com/bootdo/system/service/UserService.java index a911db0926566586ed68e62529f28602c3d77557..fed745ec0dda19ed624a761b86409a1434b7fc41 100644 --- a/bootdo/src/main/java/com/bootdo/system/service/UserService.java +++ b/src/main/java/com/bootdo/system/service/UserService.java @@ -1,54 +1,54 @@ -package com.bootdo.system.service; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.bootdo.system.vo.UserVO; -import org.springframework.stereotype.Service; - -import com.bootdo.common.domain.Tree; -import com.bootdo.system.domain.DeptDO; -import com.bootdo.system.domain.UserDO; -import org.springframework.web.multipart.MultipartFile; - -@Service -public interface UserService { - UserDO get(Long id); - - List list(Map map); - - int count(Map map); - - int save(UserDO user); - - int update(UserDO user); - - int remove(Long userId); - - int batchremove(Long[] userIds); - - boolean exit(Map params); - - Set listRoles(Long userId); - - int resetPwd(UserVO userVO,UserDO userDO) throws Exception; - int adminResetPwd(UserVO userVO) throws Exception; - Tree getTree(); - - /** - * 更新个人信息 - * @param userDO - * @return - */ - int updatePersonal(UserDO userDO); - - /** - * 更新个人图片 - * @param file 图片 - * @param avatar_data 裁剪信息 - * @param userId 用户ID - * @throws Exception - */ - Map updatePersonalImg(MultipartFile file, String avatar_data, Long userId) throws Exception; -} +package com.bootdo.system.service; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.bootdo.system.vo.UserVO; +import org.springframework.stereotype.Service; + +import com.bootdo.common.domain.Tree; +import com.bootdo.system.domain.DeptDO; +import com.bootdo.system.domain.UserDO; +import org.springframework.web.multipart.MultipartFile; + +@Service +public interface UserService { + UserDO get(Long id); + + List list(Map map); + + int count(Map map); + + int save(UserDO user); + + int update(UserDO user); + + int remove(Long userId); + + int batchremove(Long[] userIds); + + boolean exit(Map params); + + Set listRoles(Long userId); + + int resetPwd(UserVO userVO,UserDO userDO) throws Exception; + int adminResetPwd(UserVO userVO) throws Exception; + Tree getTree(); + + /** + * 更新个人信息 + * @param userDO + * @return + */ + int updatePersonal(UserDO userDO); + + /** + * 更新个人图片 + * @param file 图片 + * @param avatar_data 裁剪信息 + * @param userId 用户ID + * @throws Exception + */ + Map updatePersonalImg(MultipartFile file, String avatar_data, Long userId) throws Exception; +} diff --git a/bootdo/src/main/java/com/bootdo/system/service/impl/DeptServiceImpl.java b/src/main/java/com/bootdo/system/service/impl/DeptServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/service/impl/DeptServiceImpl.java rename to src/main/java/com/bootdo/system/service/impl/DeptServiceImpl.java diff --git a/bootdo/src/main/java/com/bootdo/system/service/impl/MenuServiceImpl.java b/src/main/java/com/bootdo/system/service/impl/MenuServiceImpl.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/system/service/impl/MenuServiceImpl.java rename to src/main/java/com/bootdo/system/service/impl/MenuServiceImpl.java index dc2279c67e7eaedc12751c69e38c437753d08e3d..b001fc19aaedfcf4ef48e44b58a790cd40995a41 100644 --- a/bootdo/src/main/java/com/bootdo/system/service/impl/MenuServiceImpl.java +++ b/src/main/java/com/bootdo/system/service/impl/MenuServiceImpl.java @@ -1,163 +1,163 @@ -package com.bootdo.system.service.impl; - -import com.bootdo.common.domain.Tree; -import com.bootdo.common.utils.BuildTree; -import com.bootdo.system.dao.MenuDao; -import com.bootdo.system.dao.RoleMenuDao; -import com.bootdo.system.domain.MenuDO; -import com.bootdo.system.service.MenuService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; - -@Service -@Transactional(readOnly = true,rollbackFor = Exception.class) -public class MenuServiceImpl implements MenuService { - @Autowired - MenuDao menuMapper; - @Autowired - RoleMenuDao roleMenuMapper; - - /** - * @param - * @return 树形菜单 - */ - @Cacheable - @Override - public Tree getSysMenuTree(Long id) { - List> trees = new ArrayList>(); - List menuDOs = menuMapper.listMenuByUserId(id); - for (MenuDO sysMenuDO : menuDOs) { - Tree tree = new Tree(); - tree.setId(sysMenuDO.getMenuId().toString()); - tree.setParentId(sysMenuDO.getParentId().toString()); - tree.setText(sysMenuDO.getName()); - Map attributes = new HashMap<>(16); - attributes.put("url", sysMenuDO.getUrl()); - attributes.put("icon", sysMenuDO.getIcon()); - tree.setAttributes(attributes); - trees.add(tree); - } - // 默认顶级菜单为0,根据数据库实际情况调整 - Tree t = BuildTree.build(trees); - return t; - } - - @Override - public List list(Map params) { - List menus = menuMapper.list(params); - return menus; - } - - @Transactional(readOnly = false,rollbackFor = Exception.class) - @Override - public int remove(Long id) { - int result = menuMapper.remove(id); - return result; - } - @Transactional(readOnly = false,rollbackFor = Exception.class) - @Override - public int save(MenuDO menu) { - int r = menuMapper.save(menu); - return r; - } - - @Transactional(readOnly = false,rollbackFor = Exception.class) - @Override - public int update(MenuDO menu) { - int r = menuMapper.update(menu); - return r; - } - - @Override - public MenuDO get(Long id) { - MenuDO menuDO = menuMapper.get(id); - return menuDO; - } - - @Override - public Tree getTree() { - List> trees = new ArrayList>(); - List menuDOs = menuMapper.list(new HashMap<>(16)); - for (MenuDO sysMenuDO : menuDOs) { - Tree tree = new Tree(); - tree.setId(sysMenuDO.getMenuId().toString()); - tree.setParentId(sysMenuDO.getParentId().toString()); - tree.setText(sysMenuDO.getName()); - trees.add(tree); - } - // 默认顶级菜单为0,根据数据库实际情况调整 - Tree t = BuildTree.build(trees); - return t; - } - - @Override - public Tree getTree(Long id) { - // 根据roleId查询权限 - List menus = menuMapper.list(new HashMap(16)); - List menuIds = roleMenuMapper.listMenuIdByRoleId(id); - List temp = menuIds; - for (MenuDO menu : menus) { - if (temp.contains(menu.getParentId())) { - menuIds.remove(menu.getParentId()); - } - } - List> trees = new ArrayList>(); - List menuDOs = menuMapper.list(new HashMap(16)); - for (MenuDO sysMenuDO : menuDOs) { - Tree tree = new Tree(); - tree.setId(sysMenuDO.getMenuId().toString()); - tree.setParentId(sysMenuDO.getParentId().toString()); - tree.setText(sysMenuDO.getName()); - Map state = new HashMap<>(16); - Long menuId = sysMenuDO.getMenuId(); - if (menuIds.contains(menuId)) { - state.put("selected", true); - } else { - state.put("selected", false); - } - tree.setState(state); - trees.add(tree); - } - // 默认顶级菜单为0,根据数据库实际情况调整 - Tree t = BuildTree.build(trees); - return t; - } - - @Override - public Set listPerms(Long userId) { - List perms = menuMapper.listUserPerms(userId); - Set permsSet = new HashSet<>(); - for (String perm : perms) { - if (StringUtils.isNotBlank(perm)) { - permsSet.addAll(Arrays.asList(perm.trim().split(","))); - } - } - return permsSet; - } - - @Override - public List> listMenuTree(Long id) { - List> trees = new ArrayList>(); - List menuDOs = menuMapper.listMenuByUserId(id); - for (MenuDO sysMenuDO : menuDOs) { - Tree tree = new Tree(); - tree.setId(sysMenuDO.getMenuId().toString()); - tree.setParentId(sysMenuDO.getParentId().toString()); - tree.setText(sysMenuDO.getName()); - Map attributes = new HashMap<>(16); - attributes.put("url", sysMenuDO.getUrl()); - attributes.put("icon", sysMenuDO.getIcon()); - tree.setAttributes(attributes); - trees.add(tree); - } - // 默认顶级菜单为0,根据数据库实际情况调整 - List> list = BuildTree.buildList(trees, "0"); - return list; - } - -} +package com.bootdo.system.service.impl; + +import com.bootdo.common.domain.Tree; +import com.bootdo.common.utils.BuildTree; +import com.bootdo.system.dao.MenuDao; +import com.bootdo.system.dao.RoleMenuDao; +import com.bootdo.system.domain.MenuDO; +import com.bootdo.system.service.MenuService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +@Service +@Transactional(readOnly = true,rollbackFor = Exception.class) +public class MenuServiceImpl implements MenuService { + @Autowired + MenuDao menuMapper; + @Autowired + RoleMenuDao roleMenuMapper; + + /** + * @param + * @return 树形菜单 + */ + @Cacheable + @Override + public Tree getSysMenuTree(Long id) { + List> trees = new ArrayList>(); + List menuDOs = menuMapper.listMenuByUserId(id); + for (MenuDO sysMenuDO : menuDOs) { + Tree tree = new Tree(); + tree.setId(sysMenuDO.getMenuId().toString()); + tree.setParentId(sysMenuDO.getParentId().toString()); + tree.setText(sysMenuDO.getName()); + Map attributes = new HashMap<>(16); + attributes.put("url", sysMenuDO.getUrl()); + attributes.put("icon", sysMenuDO.getIcon()); + tree.setAttributes(attributes); + trees.add(tree); + } + // 默认顶级菜单为0,根据数据库实际情况调整 + Tree t = BuildTree.build(trees); + return t; + } + + @Override + public List list(Map params) { + List menus = menuMapper.list(params); + return menus; + } + + @Transactional(readOnly = false,rollbackFor = Exception.class) + @Override + public int remove(Long id) { + int result = menuMapper.remove(id); + return result; + } + @Transactional(readOnly = false,rollbackFor = Exception.class) + @Override + public int save(MenuDO menu) { + int r = menuMapper.save(menu); + return r; + } + + @Transactional(readOnly = false,rollbackFor = Exception.class) + @Override + public int update(MenuDO menu) { + int r = menuMapper.update(menu); + return r; + } + + @Override + public MenuDO get(Long id) { + MenuDO menuDO = menuMapper.get(id); + return menuDO; + } + + @Override + public Tree getTree() { + List> trees = new ArrayList>(); + List menuDOs = menuMapper.list(new HashMap<>(16)); + for (MenuDO sysMenuDO : menuDOs) { + Tree tree = new Tree(); + tree.setId(sysMenuDO.getMenuId().toString()); + tree.setParentId(sysMenuDO.getParentId().toString()); + tree.setText(sysMenuDO.getName()); + trees.add(tree); + } + // 默认顶级菜单为0,根据数据库实际情况调整 + Tree t = BuildTree.build(trees); + return t; + } + + @Override + public Tree getTree(Long id) { + // 根据roleId查询权限 + List menus = menuMapper.list(new HashMap(16)); + List menuIds = roleMenuMapper.listMenuIdByRoleId(id); + List temp = menuIds; + for (MenuDO menu : menus) { + if (temp.contains(menu.getParentId())) { + menuIds.remove(menu.getParentId()); + } + } + List> trees = new ArrayList>(); + List menuDOs = menuMapper.list(new HashMap(16)); + for (MenuDO sysMenuDO : menuDOs) { + Tree tree = new Tree(); + tree.setId(sysMenuDO.getMenuId().toString()); + tree.setParentId(sysMenuDO.getParentId().toString()); + tree.setText(sysMenuDO.getName()); + Map state = new HashMap<>(16); + Long menuId = sysMenuDO.getMenuId(); + if (menuIds.contains(menuId)) { + state.put("selected", true); + } else { + state.put("selected", false); + } + tree.setState(state); + trees.add(tree); + } + // 默认顶级菜单为0,根据数据库实际情况调整 + Tree t = BuildTree.build(trees); + return t; + } + + @Override + public Set listPerms(Long userId) { + List perms = menuMapper.listUserPerms(userId); + Set permsSet = new HashSet<>(); + for (String perm : perms) { + if (StringUtils.isNotBlank(perm)) { + permsSet.addAll(Arrays.asList(perm.trim().split(","))); + } + } + return permsSet; + } + + @Override + public List> listMenuTree(Long id) { + List> trees = new ArrayList>(); + List menuDOs = menuMapper.listMenuByUserId(id); + for (MenuDO sysMenuDO : menuDOs) { + Tree tree = new Tree(); + tree.setId(sysMenuDO.getMenuId().toString()); + tree.setParentId(sysMenuDO.getParentId().toString()); + tree.setText(sysMenuDO.getName()); + Map attributes = new HashMap<>(16); + attributes.put("url", sysMenuDO.getUrl()); + attributes.put("icon", sysMenuDO.getIcon()); + tree.setAttributes(attributes); + trees.add(tree); + } + // 默认顶级菜单为0,根据数据库实际情况调整 + List> list = BuildTree.buildList(trees, "0"); + return list; + } + +} diff --git a/bootdo/src/main/java/com/bootdo/system/service/impl/RoleServiceImpl.java b/src/main/java/com/bootdo/system/service/impl/RoleServiceImpl.java similarity index 96% rename from bootdo/src/main/java/com/bootdo/system/service/impl/RoleServiceImpl.java rename to src/main/java/com/bootdo/system/service/impl/RoleServiceImpl.java index 6e103c92273444a0987188c5493993fddd2957b1..98d39e0f6324a25517debae85a702a702f12352b 100644 --- a/bootdo/src/main/java/com/bootdo/system/service/impl/RoleServiceImpl.java +++ b/src/main/java/com/bootdo/system/service/impl/RoleServiceImpl.java @@ -1,121 +1,121 @@ -package com.bootdo.system.service.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.bootdo.system.dao.RoleDao; -import com.bootdo.system.dao.RoleMenuDao; -import com.bootdo.system.dao.UserDao; -import com.bootdo.system.dao.UserRoleDao; -import com.bootdo.system.domain.RoleDO; -import com.bootdo.system.domain.RoleMenuDO; -import com.bootdo.system.service.RoleService; - - -@Service -public class RoleServiceImpl implements RoleService { - - public static final String ROLE_ALL_KEY = "\"role_all\""; - - public static final String DEMO_CACHE_NAME = "role"; - - @Autowired - RoleDao roleMapper; - @Autowired - RoleMenuDao roleMenuMapper; - @Autowired - UserDao userMapper; - @Autowired - UserRoleDao userRoleMapper; - - @Override - public List list() { - List roles = roleMapper.list(new HashMap<>(16)); - return roles; - } - - - @Override - public List list(Long userId) { - List rolesIds = userRoleMapper.listRoleId(userId); - List roles = roleMapper.list(new HashMap<>(16)); - for (RoleDO roleDO : roles) { - roleDO.setRoleSign("false"); - for (Long roleId : rolesIds) { - if (Objects.equals(roleDO.getRoleId(), roleId)) { - roleDO.setRoleSign("true"); - break; - } - } - } - return roles; - } - @Transactional - @Override - public int save(RoleDO role) { - int count = roleMapper.save(role); - List menuIds = role.getMenuIds(); - Long roleId = role.getRoleId(); - List rms = new ArrayList<>(); - for (Long menuId : menuIds) { - RoleMenuDO rmDo = new RoleMenuDO(); - rmDo.setRoleId(roleId); - rmDo.setMenuId(menuId); - rms.add(rmDo); - } - roleMenuMapper.removeByRoleId(roleId); - if (rms.size() > 0) { - roleMenuMapper.batchSave(rms); - } - return count; - } - - @Transactional - @Override - public int remove(Long id) { - int count = roleMapper.remove(id); - userRoleMapper.removeByRoleId(id); - roleMenuMapper.removeByRoleId(id); - return count; - } - - @Override - public RoleDO get(Long id) { - RoleDO roleDO = roleMapper.get(id); - return roleDO; - } - - @Override - public int update(RoleDO role) { - int r = roleMapper.update(role); - List menuIds = role.getMenuIds(); - Long roleId = role.getRoleId(); - roleMenuMapper.removeByRoleId(roleId); - List rms = new ArrayList<>(); - for (Long menuId : menuIds) { - RoleMenuDO rmDo = new RoleMenuDO(); - rmDo.setRoleId(roleId); - rmDo.setMenuId(menuId); - rms.add(rmDo); - } - if (rms.size() > 0) { - roleMenuMapper.batchSave(rms); - } - return r; - } - - @Override - public int batchremove(Long[] ids) { - int r = roleMapper.batchRemove(ids); - return r; - } - -} +package com.bootdo.system.service.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.bootdo.system.dao.RoleDao; +import com.bootdo.system.dao.RoleMenuDao; +import com.bootdo.system.dao.UserDao; +import com.bootdo.system.dao.UserRoleDao; +import com.bootdo.system.domain.RoleDO; +import com.bootdo.system.domain.RoleMenuDO; +import com.bootdo.system.service.RoleService; + + +@Service +public class RoleServiceImpl implements RoleService { + + public static final String ROLE_ALL_KEY = "\"role_all\""; + + public static final String DEMO_CACHE_NAME = "role"; + + @Autowired + RoleDao roleMapper; + @Autowired + RoleMenuDao roleMenuMapper; + @Autowired + UserDao userMapper; + @Autowired + UserRoleDao userRoleMapper; + + @Override + public List list() { + List roles = roleMapper.list(new HashMap<>(16)); + return roles; + } + + + @Override + public List list(Long userId) { + List rolesIds = userRoleMapper.listRoleId(userId); + List roles = roleMapper.list(new HashMap<>(16)); + for (RoleDO roleDO : roles) { + roleDO.setRoleSign("false"); + for (Long roleId : rolesIds) { + if (Objects.equals(roleDO.getRoleId(), roleId)) { + roleDO.setRoleSign("true"); + break; + } + } + } + return roles; + } + @Transactional + @Override + public int save(RoleDO role) { + int count = roleMapper.save(role); + List menuIds = role.getMenuIds(); + Long roleId = role.getRoleId(); + List rms = new ArrayList<>(); + for (Long menuId : menuIds) { + RoleMenuDO rmDo = new RoleMenuDO(); + rmDo.setRoleId(roleId); + rmDo.setMenuId(menuId); + rms.add(rmDo); + } + roleMenuMapper.removeByRoleId(roleId); + if (rms.size() > 0) { + roleMenuMapper.batchSave(rms); + } + return count; + } + + @Transactional + @Override + public int remove(Long id) { + int count = roleMapper.remove(id); + userRoleMapper.removeByRoleId(id); + roleMenuMapper.removeByRoleId(id); + return count; + } + + @Override + public RoleDO get(Long id) { + RoleDO roleDO = roleMapper.get(id); + return roleDO; + } + + @Override + public int update(RoleDO role) { + int r = roleMapper.update(role); + List menuIds = role.getMenuIds(); + Long roleId = role.getRoleId(); + roleMenuMapper.removeByRoleId(roleId); + List rms = new ArrayList<>(); + for (Long menuId : menuIds) { + RoleMenuDO rmDo = new RoleMenuDO(); + rmDo.setRoleId(roleId); + rmDo.setMenuId(menuId); + rms.add(rmDo); + } + if (rms.size() > 0) { + roleMenuMapper.batchSave(rms); + } + return r; + } + + @Override + public int batchremove(Long[] ids) { + int r = roleMapper.batchRemove(ids); + return r; + } + +} diff --git a/bootdo/src/main/java/com/bootdo/system/service/impl/SessionServiceImpl.java b/src/main/java/com/bootdo/system/service/impl/SessionServiceImpl.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/system/service/impl/SessionServiceImpl.java rename to src/main/java/com/bootdo/system/service/impl/SessionServiceImpl.java index 9837901e3a66cdc27c45e7e9ba3a38acda2ebe69..4d8cf4ebb8a38c60319fb5200057109202b03ead 100644 --- a/bootdo/src/main/java/com/bootdo/system/service/impl/SessionServiceImpl.java +++ b/src/main/java/com/bootdo/system/service/impl/SessionServiceImpl.java @@ -1,87 +1,87 @@ -package com.bootdo.system.service.impl; - -import com.bootdo.system.domain.UserDO; -import com.bootdo.system.domain.UserOnline; -import com.bootdo.system.domain.UserToken; -import com.bootdo.system.service.SessionService; -import org.apache.shiro.session.Session; -import org.apache.shiro.session.mgt.eis.SessionDAO; -import org.apache.shiro.subject.SimplePrincipalCollection; -import org.apache.shiro.subject.support.DefaultSubjectContext; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.security.Principal; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * 待完善 - * - * @author bootdo - */ -@Service -public class SessionServiceImpl implements SessionService { - private final SessionDAO sessionDAO; - - @Autowired - public SessionServiceImpl(SessionDAO sessionDAO) { - this.sessionDAO = sessionDAO; - } - - @Override - public List list() { - List list = new ArrayList<>(); - Collection sessions = sessionDAO.getActiveSessions(); - for (Session session : sessions) { - UserOnline userOnline = new UserOnline(); - if (session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY) == null) { - continue; - } else { - SimplePrincipalCollection principalCollection = (SimplePrincipalCollection) session - .getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY); - UserDO userDO = (UserDO) principalCollection.getPrimaryPrincipal(); - userOnline.setUsername(userDO.getUsername()); - } - userOnline.setId((String) session.getId()); - userOnline.setHost(session.getHost()); - userOnline.setStartTimestamp(session.getStartTimestamp()); - userOnline.setLastAccessTime(session.getLastAccessTime()); - userOnline.setTimeout(session.getTimeout()); - list.add(userOnline); - } - return list; - } - - @Override - public List listOnlineUser() { - List list = new ArrayList<>(); - UserDO userDO; - Collection sessions = sessionDAO.getActiveSessions(); - for (Session session : sessions) { - SimplePrincipalCollection principalCollection = new SimplePrincipalCollection(); - if (session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY) == null) { - continue; - } else { - principalCollection = (SimplePrincipalCollection) session - .getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY); - userDO = (UserDO) principalCollection.getPrimaryPrincipal(); - list.add(userDO); - } - } - return list; - } - - @Override - public Collection sessionList() { - return sessionDAO.getActiveSessions(); - } - - @Override - public boolean forceLogout(String sessionId) { - Session session = sessionDAO.readSession(sessionId); - session.setTimeout(0); - return true; - } -} +package com.bootdo.system.service.impl; + +import com.bootdo.system.domain.UserDO; +import com.bootdo.system.domain.UserOnline; +import com.bootdo.system.domain.UserToken; +import com.bootdo.system.service.SessionService; +import org.apache.shiro.session.Session; +import org.apache.shiro.session.mgt.eis.SessionDAO; +import org.apache.shiro.subject.SimplePrincipalCollection; +import org.apache.shiro.subject.support.DefaultSubjectContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.security.Principal; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * 待完善 + * + * @author bootdo + */ +@Service +public class SessionServiceImpl implements SessionService { + private final SessionDAO sessionDAO; + + @Autowired + public SessionServiceImpl(SessionDAO sessionDAO) { + this.sessionDAO = sessionDAO; + } + + @Override + public List list() { + List list = new ArrayList<>(); + Collection sessions = sessionDAO.getActiveSessions(); + for (Session session : sessions) { + UserOnline userOnline = new UserOnline(); + if (session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY) == null) { + continue; + } else { + SimplePrincipalCollection principalCollection = (SimplePrincipalCollection) session + .getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY); + UserDO userDO = (UserDO) principalCollection.getPrimaryPrincipal(); + userOnline.setUsername(userDO.getUsername()); + } + userOnline.setId((String) session.getId()); + userOnline.setHost(session.getHost()); + userOnline.setStartTimestamp(session.getStartTimestamp()); + userOnline.setLastAccessTime(session.getLastAccessTime()); + userOnline.setTimeout(session.getTimeout()); + list.add(userOnline); + } + return list; + } + + @Override + public List listOnlineUser() { + List list = new ArrayList<>(); + UserDO userDO; + Collection sessions = sessionDAO.getActiveSessions(); + for (Session session : sessions) { + SimplePrincipalCollection principalCollection = new SimplePrincipalCollection(); + if (session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY) == null) { + continue; + } else { + principalCollection = (SimplePrincipalCollection) session + .getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY); + userDO = (UserDO) principalCollection.getPrimaryPrincipal(); + list.add(userDO); + } + } + return list; + } + + @Override + public Collection sessionList() { + return sessionDAO.getActiveSessions(); + } + + @Override + public boolean forceLogout(String sessionId) { + Session session = sessionDAO.readSession(sessionId); + session.setTimeout(0); + return true; + } +} diff --git a/bootdo/src/main/java/com/bootdo/system/service/impl/UserServiceImpl.java b/src/main/java/com/bootdo/system/service/impl/UserServiceImpl.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/service/impl/UserServiceImpl.java rename to src/main/java/com/bootdo/system/service/impl/UserServiceImpl.java diff --git a/bootdo/src/main/java/com/bootdo/system/shiro/UserRealm.java b/src/main/java/com/bootdo/system/shiro/UserRealm.java similarity index 97% rename from bootdo/src/main/java/com/bootdo/system/shiro/UserRealm.java rename to src/main/java/com/bootdo/system/shiro/UserRealm.java index ef0999a158770572ffe993bb31ea6b74accdc85e..14af87b5d0ccf8dabdd1e30e3593663d516363fa 100644 --- a/bootdo/src/main/java/com/bootdo/system/shiro/UserRealm.java +++ b/src/main/java/com/bootdo/system/shiro/UserRealm.java @@ -1,72 +1,72 @@ -package com.bootdo.system.shiro; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import com.bootdo.common.config.ApplicationContextRegister; -import com.bootdo.system.domain.UserToken; -import org.apache.shiro.authc.AuthenticationException; -import org.apache.shiro.authc.AuthenticationInfo; -import org.apache.shiro.authc.AuthenticationToken; -import org.apache.shiro.authc.IncorrectCredentialsException; -import org.apache.shiro.authc.LockedAccountException; -import org.apache.shiro.authc.SimpleAuthenticationInfo; -import org.apache.shiro.authc.UnknownAccountException; -import org.apache.shiro.authz.AuthorizationInfo; -import org.apache.shiro.authz.SimpleAuthorizationInfo; -import org.apache.shiro.realm.AuthorizingRealm; -import org.apache.shiro.subject.PrincipalCollection; -import org.springframework.beans.factory.annotation.Autowired; - -import com.bootdo.common.utils.ShiroUtils; -import com.bootdo.system.dao.UserDao; -import com.bootdo.system.domain.UserDO; -import com.bootdo.system.service.MenuService; - -public class UserRealm extends AuthorizingRealm { -/* @Autowired - UserDao userMapper; - @Autowired - MenuService menuService;*/ - - @Override - protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection arg0) { - Long userId = ShiroUtils.getUserId(); - MenuService menuService = ApplicationContextRegister.getBean(MenuService.class); - Set perms = menuService.listPerms(userId); - SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); - info.setStringPermissions(perms); - return info; - } - - @Override - protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { - String username = (String) token.getPrincipal(); - Map map = new HashMap<>(16); - map.put("username", username); - String password = new String((char[]) token.getCredentials()); - - UserDao userMapper = ApplicationContextRegister.getBean(UserDao.class); - // 查询用户信息 - UserDO user = userMapper.list(map).get(0); - - // 账号不存在 - if (user == null) { - throw new UnknownAccountException("账号或密码不正确"); - } - - // 密码错误 - if (!password.equals(user.getPassword())) { - throw new IncorrectCredentialsException("账号或密码不正确"); - } - - // 账号锁定 - if (user.getStatus() == 0) { - throw new LockedAccountException("账号已被锁定,请联系管理员"); - } - SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, password, getName()); - return info; - } - -} +package com.bootdo.system.shiro; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import com.bootdo.common.config.ApplicationContextRegister; +import com.bootdo.system.domain.UserToken; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.AuthenticationInfo; +import org.apache.shiro.authc.AuthenticationToken; +import org.apache.shiro.authc.IncorrectCredentialsException; +import org.apache.shiro.authc.LockedAccountException; +import org.apache.shiro.authc.SimpleAuthenticationInfo; +import org.apache.shiro.authc.UnknownAccountException; +import org.apache.shiro.authz.AuthorizationInfo; +import org.apache.shiro.authz.SimpleAuthorizationInfo; +import org.apache.shiro.realm.AuthorizingRealm; +import org.apache.shiro.subject.PrincipalCollection; +import org.springframework.beans.factory.annotation.Autowired; + +import com.bootdo.common.utils.ShiroUtils; +import com.bootdo.system.dao.UserDao; +import com.bootdo.system.domain.UserDO; +import com.bootdo.system.service.MenuService; + +public class UserRealm extends AuthorizingRealm { +/* @Autowired + UserDao userMapper; + @Autowired + MenuService menuService;*/ + + @Override + protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection arg0) { + Long userId = ShiroUtils.getUserId(); + MenuService menuService = ApplicationContextRegister.getBean(MenuService.class); + Set perms = menuService.listPerms(userId); + SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); + info.setStringPermissions(perms); + return info; + } + + @Override + protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { + String username = (String) token.getPrincipal(); + Map map = new HashMap<>(16); + map.put("username", username); + String password = new String((char[]) token.getCredentials()); + + UserDao userMapper = ApplicationContextRegister.getBean(UserDao.class); + // 查询用户信息 + UserDO user = userMapper.list(map).get(0); + + // 账号不存在 + if (user == null) { + throw new UnknownAccountException("账号或密码不正确"); + } + + // 密码错误 + if (!password.equals(user.getPassword())) { + throw new IncorrectCredentialsException("账号或密码不正确"); + } + + // 账号锁定 + if (user.getStatus() == 0) { + throw new LockedAccountException("账号已被锁定,请联系管理员"); + } + SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, password, getName()); + return info; + } + +} diff --git a/bootdo/src/main/java/com/bootdo/system/vo/UserVO.java b/src/main/java/com/bootdo/system/vo/UserVO.java similarity index 100% rename from bootdo/src/main/java/com/bootdo/system/vo/UserVO.java rename to src/main/java/com/bootdo/system/vo/UserVO.java diff --git a/src/main/java/com/bootdo/tinySpring/AbstractBeanDefinitionReader.java b/src/main/java/com/bootdo/tinySpring/AbstractBeanDefinitionReader.java new file mode 100644 index 0000000000000000000000000000000000000000..4d1867185799f57a81a10ab40eabc3a48482d194 --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/AbstractBeanDefinitionReader.java @@ -0,0 +1,30 @@ +package com.bootdo.tinySpring; + +import com.bootdo.tinySpring.io.ResourceLoader; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 22:23 + * @Desc: 从配置中读取BeanDefinition需要的信息 + **/ +public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader{ + + private Map registry; + + private ResourceLoader resourceLoader; + + //构造器,初始化属性 + protected AbstractBeanDefinitionReader(ResourceLoader resourceLoader){ + this.registry = new HashMap(); + this.resourceLoader = resourceLoader; + } + + public Map getRegistry(){return registry;} + + public ResourceLoader getResourceLoader() { + return resourceLoader; + } +} diff --git a/src/main/java/com/bootdo/tinySpring/BeanDefinition.java b/src/main/java/com/bootdo/tinySpring/BeanDefinition.java new file mode 100644 index 0000000000000000000000000000000000000000..b93696f577e060bcf5f58df4eb419f407109d352 --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/BeanDefinition.java @@ -0,0 +1,57 @@ +package com.bootdo.tinySpring; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 10:52 + * @Desc: bean的内容以及元数据,保存在BeanFactory中 + **/ +public class BeanDefinition { + //实例 + private Object bean; + //实例的class对象名 -- 拿到名字,获取class,再创建实例 + private String beanClassName; + //实例的class对象 + private Class beanClass; + + private PropertyValues propertyValues = new PropertyValues(); + + public BeanDefinition(){ + } + + public Object getBean(){ + return bean; + } + + public void setBean(Object bean) { + this.bean = bean; + } + + public String getBeanClassName() { + return beanClassName; + } + + public void setBeanClassName(String beanClassName) { + this.beanClassName = beanClassName; + try { + beanClass = Class.forName(beanClassName); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + + public Class getBeanClass() { + return beanClass; + } + + public void setBeanClass(Class beanClass) { + this.beanClass = beanClass; + } + + public PropertyValues getPropertyValues() { + return propertyValues; + } + + public void setPropertyValues(PropertyValues propertyValues) { + this.propertyValues = propertyValues; + } +} diff --git a/src/main/java/com/bootdo/tinySpring/BeanDefinitionReader.java b/src/main/java/com/bootdo/tinySpring/BeanDefinitionReader.java new file mode 100644 index 0000000000000000000000000000000000000000..32421989c00a1f70275b84cc3723c371f09cb416 --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/BeanDefinitionReader.java @@ -0,0 +1,13 @@ +package com.bootdo.tinySpring; + +import java.io.IOException; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 22:12 + * @Desc: 读取配置,将信息转换成BeanDefinition对象 + **/ +public interface BeanDefinitionReader { + + void loadBeanDefinitions(String location) throws Exception; +} diff --git a/src/main/java/com/bootdo/tinySpring/HelloWorldService.java b/src/main/java/com/bootdo/tinySpring/HelloWorldService.java new file mode 100644 index 0000000000000000000000000000000000000000..d27c67fa50c447f3295e263f4f0a2392f23919df --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/HelloWorldService.java @@ -0,0 +1,23 @@ +package com.bootdo.tinySpring; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 10:48 + * @Desc: + **/ +public class HelloWorldService { + + private String text; + + public void helloWorld(){ + System.out.println("Hello World!"); + } + + public void setText(String text) { + this.text = text; + } + + public String getText() { + return text; + } +} diff --git a/src/main/java/com/bootdo/tinySpring/PropertyValue.java b/src/main/java/com/bootdo/tinySpring/PropertyValue.java new file mode 100644 index 0000000000000000000000000000000000000000..937a880e103f881683b210812a329dd691bbad9b --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/PropertyValue.java @@ -0,0 +1,26 @@ +package com.bootdo.tinySpring; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 16:48 + * @Desc: 用户Bean的属性注入 + **/ +public class PropertyValue { + + private final String name; + + private final Object value; + + public PropertyValue(String name, Object value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public Object getValue() { + return value; + } +} diff --git a/src/main/java/com/bootdo/tinySpring/PropertyValues.java b/src/main/java/com/bootdo/tinySpring/PropertyValues.java new file mode 100644 index 0000000000000000000000000000000000000000..6541e95b9d69736fedfdb3686efea3ee464d7e60 --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/PropertyValues.java @@ -0,0 +1,28 @@ +package com.bootdo.tinySpring; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 16:50 + * @Desc: 包装一个对象所有的PropertyValue + * 为什么封装而不是直接用List?因为可以封装一些操作 + **/ +public class PropertyValues { + + private final List propertyValueList = new ArrayList(); + + public PropertyValues() { + } + + //添加 + public void addPropertyValue(PropertyValue pv){ + //TODO:这里可以对重复propertyName进行判断,直接用list无法做到 + this.propertyValueList.add(pv); + } + + public List getPropertyValues(){ + return this.propertyValueList; + } +} diff --git a/src/main/java/com/bootdo/tinySpring/factory/AbstractBeanFactory.java b/src/main/java/com/bootdo/tinySpring/factory/AbstractBeanFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..210445e7d7129f4448985e1172211bf3e77f1ed5 --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/factory/AbstractBeanFactory.java @@ -0,0 +1,41 @@ +package com.bootdo.tinySpring.factory; + + +import com.bootdo.tinySpring.BeanDefinition; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 15:57 + * @Desc: 接口实现类,对原接口的增强。 增加模板方法,等待子类去实现 + **/ +public abstract class AbstractBeanFactory implements BeanFactory { + //Bean容器 + private Map beanDefinitionMap = new ConcurrentHashMap(); + + //获取Bean + @Override + public Object getBean(String name) { + return beanDefinitionMap.get(name) == null ? null : beanDefinitionMap.get(name).getBean(); + } + + //Bean的注册:创建Bean,并放入Bean容器中 + @Override + public void registerBeanDefinition(String name, BeanDefinition beanDefinition) throws Exception { + //创建Bean实例 + Object bean = doCreateBean(beanDefinition); + //放入BeanDefinition + beanDefinition.setBean(bean); + //放入容器 + beanDefinitionMap.put(name,beanDefinition); + } + + /** + * 初始化Bean + * @param beanDefinition + * @return + */ + protected abstract Object doCreateBean(BeanDefinition beanDefinition) throws Exception; +} diff --git a/src/main/java/com/bootdo/tinySpring/factory/AutowireCapableBeanFactory.java b/src/main/java/com/bootdo/tinySpring/factory/AutowireCapableBeanFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..2de8c6e8c244b4806546c92f93deb9fd4e85466d --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/factory/AutowireCapableBeanFactory.java @@ -0,0 +1,48 @@ +package com.bootdo.tinySpring.factory; + +import com.bootdo.tinySpring.BeanDefinition; +import com.bootdo.tinySpring.PropertyValue; + +import java.lang.reflect.Field; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 16:32 + * @Desc: 可自动装配内容的BeanFactory + **/ +public class AutowireCapableBeanFactory extends AbstractBeanFactory{ + + @Override + protected Object doCreateBean(BeanDefinition beanDefinition) throws Exception { + //实例化对象 + Object bean = createBeanInstance(beanDefinition); + //给实例化对象设置属性 + applyPropertyValues(bean,beanDefinition); + return bean; + } + + /** + * 根据BeanDefinition创建Bean实例 + * @param beanDefinition + * @return + */ + protected Object createBeanInstance(BeanDefinition beanDefinition) throws Exception { + return beanDefinition.getBeanClass().newInstance(); + } + + /** + * 给对象设置 + * @param bean + * @param bd + */ + protected void applyPropertyValues(Object bean,BeanDefinition bd) throws Exception { + //循环属性对象,依次设置进入Bean中 + for(PropertyValue pv : bd.getPropertyValues().getPropertyValues()){ + //反射获取字段 + Field declaredField = bean.getClass().getDeclaredField(pv.getName()); + declaredField.setAccessible(true); + declaredField.set(bean,pv.getValue()); + } + + } +} diff --git a/src/main/java/com/bootdo/tinySpring/factory/BeanFactory.java b/src/main/java/com/bootdo/tinySpring/factory/BeanFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..1974a8951650afae949014f579ba33ebe9255dc2 --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/factory/BeanFactory.java @@ -0,0 +1,15 @@ +package com.bootdo.tinySpring.factory; + +import com.bootdo.tinySpring.BeanDefinition; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 15:40 + * @Desc: Bean工厂接口,定义注册Bean、获取Bean的方法 + **/ +public interface BeanFactory { + + Object getBean(String name); + + void registerBeanDefinition(String name, BeanDefinition beanDefinition) throws Exception; +} diff --git a/src/main/java/com/bootdo/tinySpring/io/Resource.java b/src/main/java/com/bootdo/tinySpring/io/Resource.java new file mode 100644 index 0000000000000000000000000000000000000000..e336b4124e000613c82e3ae1d74beabbde745e1b --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/io/Resource.java @@ -0,0 +1,14 @@ +package com.bootdo.tinySpring.io; + +import java.io.IOException; +import java.io.InputStream; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 22:25 + * @Desc: Resource是spring内部定位资源的接口 + **/ +public interface Resource { + + InputStream getInputStream() throws IOException; +} diff --git a/src/main/java/com/bootdo/tinySpring/io/ResourceLoader.java b/src/main/java/com/bootdo/tinySpring/io/ResourceLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..f9cb2e6a596094ecedeb346b121f757cb127fa62 --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/io/ResourceLoader.java @@ -0,0 +1,17 @@ +package com.bootdo.tinySpring.io; + +import java.net.URL; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 22:30 + * @Desc: 资源加载器 + **/ +public class ResourceLoader { + + public Resource getResource(String location){ + //根据path创建资源定位对象 + URL resource = this.getClass().getClassLoader().getResource(location); + return new UrlResource(resource); + } +} diff --git a/src/main/java/com/bootdo/tinySpring/io/UrlResource.java b/src/main/java/com/bootdo/tinySpring/io/UrlResource.java new file mode 100644 index 0000000000000000000000000000000000000000..d9ba28e336b6da30ee6ca0525f4a412c514bd3bb --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/io/UrlResource.java @@ -0,0 +1,27 @@ +package com.bootdo.tinySpring.io; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 22:27 + * @Desc: 通过统一资源定位符获取资源输入流 + **/ +public class UrlResource implements Resource{ + + private final URL url; + + public UrlResource(URL url){ + this.url = url; + } + + @Override + public InputStream getInputStream() throws IOException { + URLConnection urlConnection = url.openConnection(); + urlConnection.connect(); + return urlConnection.getInputStream(); + } +} diff --git a/src/main/java/com/bootdo/tinySpring/xml/XmlBeanDefinitionReader.java b/src/main/java/com/bootdo/tinySpring/xml/XmlBeanDefinitionReader.java new file mode 100644 index 0000000000000000000000000000000000000000..6d792d7d741b201c9eab05df07f0e0d2e32a7eb3 --- /dev/null +++ b/src/main/java/com/bootdo/tinySpring/xml/XmlBeanDefinitionReader.java @@ -0,0 +1,113 @@ +package com.bootdo.tinySpring.xml; + +import com.bootdo.tinySpring.AbstractBeanDefinitionReader; +import com.bootdo.tinySpring.BeanDefinition; +import com.bootdo.tinySpring.PropertyValue; +import com.bootdo.tinySpring.io.ResourceLoader; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.InputStream; + +/** + * @Author: PENGXIAOLIANG + * @Date: 2018/9/16 23:04 + * @Desc: 读取xml获取Bean信息 + **/ +public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader { + //构造器 + public XmlBeanDefinitionReader(ResourceLoader resourceLoader) { + super(resourceLoader); + } + + /** + * 根据xml地址,获取Bean信息 + * @param location + */ + @Override + public void loadBeanDefinitions(String location) throws Exception { + InputStream inputStream = getResourceLoader().getResource(location).getInputStream(); + doLoadBeanDefinitions(inputStream); + } + + /** + * 处理输入流,获取到bean信息 + * @param inputStream + */ + protected void doLoadBeanDefinitions(InputStream inputStream) throws Exception { + //输入流转换成xml对象 + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = factory.newDocumentBuilder(); + Document doc = docBuilder.parse(inputStream); + //解析bean + registerBeanDefinitions(doc); + inputStream.close(); + } + + /** + * 获取到Document对象,解析 + * @param document + */ + public void registerBeanDefinitions(Document document){ + Element root = document.getDocumentElement(); + parseBeanDefinitions(root); + } + + /** + * 解析xml文件,往工厂中装填BeanDefinition + * @param root + */ + protected void parseBeanDefinitions(Element root){ + NodeList nl = root.getChildNodes(); + for (int i = 0; i < nl.getLength(); i++) { + Node node = nl.item(i); + if(node instanceof Element){ + Element element = (Element)node; + processBeanDefinition(element); + } + } + } + + /** + * 从xml文件中,读取信息,创建BeanDefinition对象 + * @param element + */ + protected void processBeanDefinition(Element element){ + //读取类名和类路径 + String name = element.getAttribute("name"); + String className = element.getAttribute("class"); + //创建BeanDefinition + BeanDefinition beanDefinition = new BeanDefinition(); + //填充PropertyValues + processProperty(element,beanDefinition); + //填充beanClassName、beanClass + beanDefinition.setBeanClassName(className); + //放入工厂 + getRegistry().put(name,beanDefinition);//从工厂往外取得时候会初始化bean + + } + + + /** + * 从xml文件中 读取Bean的属性,并注入到BeanDefinition中 + * @param element + * @param beanDefinition + */ + private void processProperty(Element element, BeanDefinition beanDefinition){ + NodeList propertyNode = element.getElementsByTagName("property"); + for (int i = 0; i < propertyNode.getLength(); i++) { + Node node = propertyNode.item(i); + if(node instanceof Element){ + Element propertyEle = (Element) node; + String name = propertyEle.getAttribute("name"); + String value = propertyEle.getAttribute("value"); + beanDefinition.getPropertyValues().addPropertyValue(new PropertyValue(name,value)); + } + } + + } +} diff --git a/bootdo/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml similarity index 91% rename from bootdo/src/main/resources/application-dev.yml rename to src/main/resources/application-dev.yml index 74008e77b47de2ed41f7c46ac100dca686deb52a..8eb3e8e5f3fdd99bf4bb55dd5e8dd47e0f390c2b 100644 --- a/bootdo/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,53 +1,53 @@ -bootdo: - uploadPath: c:/var/uploaded_files/ - username: admin - password: 111111 -logging: - level: - root: info - com.bootdo: debug -spring: - datasource: - type: com.alibaba.druid.pool.DruidDataSource - driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/bootdo?useUnicode=true&characterEncoding=utf8 - username: root - password: root - initialSize: 1 - minIdle: 3 - maxActive: 20 - # 配置获取连接等待超时的时间 - maxWait: 60000 - # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 - timeBetweenEvictionRunsMillis: 60000 - # 配置一个连接在池中最小生存的时间,单位是毫秒 - minEvictableIdleTimeMillis: 30000 - validationQuery: select 'x' - testWhileIdle: true - testOnBorrow: false - testOnReturn: false - # 打开PSCache,并且指定每个连接上PSCache的大小 - poolPreparedStatements: true - maxPoolPreparedStatementPerConnectionSize: 20 - # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 - filters: stat,wall,slf4j - # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 - connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 - # 合并多个DruidDataSource的监控数据 - #useGlobalDataSourceStat: true - redis: - host: localhost - port: 6379 - password: - # 连接超时时间(毫秒) - timeout: 10000 - jedis: - pool: - # 连接池中的最大空闲连接 - max-idle: 8 - # 连接池中的最小空闲连接 - min-idle: 10 - # 连接池最大连接数(使用负值表示没有限制) - max-active: 100 - # 连接池最大阻塞等待时间(使用负值表示没有限制) +bootdo: + uploadPath: c:/var/uploaded_files/ + username: admin + password: 111111 +logging: + level: + root: info + com.bootdo: debug +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.jdbc.Driver + url: jdbc:mysql://47.98.207.189:3306/bootdo?useUnicode=true&characterEncoding=utf8 + username: root + password: PXLpxl123!@# + initialSize: 1 + minIdle: 3 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 30000 + validationQuery: select 'x' + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + # 打开PSCache,并且指定每个连接上PSCache的大小 + poolPreparedStatements: true + maxPoolPreparedStatementPerConnectionSize: 20 + # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 + filters: stat,wall,slf4j + # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + # 合并多个DruidDataSource的监控数据 + #useGlobalDataSourceStat: true + redis: + host: localhost + port: 6379 + password: + # 连接超时时间(毫秒) + timeout: 10000 + jedis: + pool: + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池中的最小空闲连接 + min-idle: 10 + # 连接池最大连接数(使用负值表示没有限制) + max-active: 100 + # 连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1 \ No newline at end of file diff --git a/bootdo/src/main/resources/application-pro.yml b/src/main/resources/application-pdt.yml similarity index 64% rename from bootdo/src/main/resources/application-pro.yml rename to src/main/resources/application-pdt.yml index 332ce05e5dc0d9a631d38048b0e06b3951df3500..7796b2b3ce792c41dde203ffd168e02cb481b8a2 100644 --- a/bootdo/src/main/resources/application-pro.yml +++ b/src/main/resources/application-pdt.yml @@ -1,53 +1,51 @@ -bootdo: - uploadPath: /var/uploaded_files/ - username: test - password: 111111 -logging: - level: - root: error - com.bootdo: info -spring: - datasource: - type: com.alibaba.druid.pool.DruidDataSource - driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/bootdo?useUnicode=true&characterEncoding=utf8 - username: root - password: root - initialSize: 1 - minIdle: 3 - maxActive: 20 - # 配置获取连接等待超时的时间 - maxWait: 60000 - # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 - timeBetweenEvictionRunsMillis: 60000 - # 配置一个连接在池中最小生存的时间,单位是毫秒 - minEvictableIdleTimeMillis: 30000 - validationQuery: select 'x' - testWhileIdle: true - testOnBorrow: false - testOnReturn: false - # 打开PSCache,并且指定每个连接上PSCache的大小 - poolPreparedStatements: true - maxPoolPreparedStatementPerConnectionSize: 20 - # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 - filters: stat,wall,slf4j - # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 - connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 - # 合并多个DruidDataSource的监控数据 - #useGlobalDataSourceStat: true - redis: - host: localhost - port: 6379 - password: - # 连接超时时间(毫秒) - timeout: 10000 - jedis: - pool: - # 连接池中的最大空闲连接 - max-idle: 8 - # 连接池中的最小空闲连接 - min-idle: 10 - # 连接池最大连接数(使用负值表示没有限制) - max-active: 100 - # 连接池最大阻塞等待时间(使用负值表示没有限制) - max-wait: -1 \ No newline at end of file +bootdo: + uploadPath: /var/uploaded_files/ +logging: + level: + root: error + com.bootdo: info +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.jdbc.Driver + url: jdbc:mysql://172.16.3.174:3306/bootdo?useUnicode=true&characterEncoding=utf8 + username: root + password: PXLpxl123!@# + initialSize: 1 + minIdle: 3 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 30000 + validationQuery: select 'x' + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + # 打开PSCache,并且指定每个连接上PSCache的大小 + poolPreparedStatements: true + maxPoolPreparedStatementPerConnectionSize: 20 + # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 + filters: stat,wall,slf4j + # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 + connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + # 合并多个DruidDataSource的监控数据 + #useGlobalDataSourceStat: true + redis: + host: localhost + port: 6379 + password: + # 连接超时时间(毫秒) + timeout: 10000 + jedis: + pool: + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池中的最小空闲连接 + min-idle: 10 + # 连接池最大连接数(使用负值表示没有限制) + max-active: 100 + # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1 \ No newline at end of file diff --git a/bootdo/src/main/resources/application.yml b/src/main/resources/application.yml similarity index 98% rename from bootdo/src/main/resources/application.yml rename to src/main/resources/application.yml index c02ed2a0613f36661baaa4c7cc10b5a9e7f92baa..94b9c54e6a1ef46931c57332eedbfb0b77cee5b0 100644 --- a/bootdo/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,7 +3,7 @@ server: # tomcat: # max-threads: 1000 # min-spare-threads: 30 - port: 80 + port: 8888 # uri-encoding: utf-8 #security: # basic: diff --git a/bootdo/src/main/resources/ehcache.xml b/src/main/resources/config/ehcache.xml similarity index 100% rename from bootdo/src/main/resources/ehcache.xml rename to src/main/resources/config/ehcache.xml diff --git a/bootdo/src/main/resources/config/quartz.properties b/src/main/resources/config/quartz.properties similarity index 100% rename from bootdo/src/main/resources/config/quartz.properties rename to src/main/resources/config/quartz.properties diff --git a/bootdo/src/main/resources/config/ehcache.xml b/src/main/resources/ehcache.xml similarity index 98% rename from bootdo/src/main/resources/config/ehcache.xml rename to src/main/resources/ehcache.xml index b13576db44730afcc8105f33698b15e0f5b7b545..82319263bafa57ce92dbff4ae91c4030534500b5 100644 --- a/bootdo/src/main/resources/config/ehcache.xml +++ b/src/main/resources/ehcache.xml @@ -1,12 +1,12 @@ - - - - - + + + + + \ No newline at end of file diff --git a/bootdo/src/main/resources/generator.properties b/src/main/resources/generator.properties similarity index 100% rename from bootdo/src/main/resources/generator.properties rename to src/main/resources/generator.properties diff --git a/src/main/resources/httpclient.properties b/src/main/resources/httpclient.properties new file mode 100644 index 0000000000000000000000000000000000000000..65743450a6225e0dd5427df9e8db27552587f354 --- /dev/null +++ b/src/main/resources/httpclient.properties @@ -0,0 +1,10 @@ +#ӳĬ +http.defaultMaxPerRoute=100 +#ӳ +http.maxTotal=300 +#ʱ +http.connectTimeout=1000 +#ôӳлȡӵʱ +http.connectionRequestTimeout=500 +#ݴʱ +http.socketTimeout=10000 \ No newline at end of file diff --git a/bootdo/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml similarity index 100% rename from bootdo/src/main/resources/logback-spring.xml rename to src/main/resources/logback-spring.xml diff --git a/bootdo/src/main/resources/mybatis/activiti/SalaryMapper.xml b/src/main/resources/mybatis/activiti/SalaryMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/activiti/SalaryMapper.xml rename to src/main/resources/mybatis/activiti/SalaryMapper.xml diff --git a/bootdo/src/main/resources/mybatis/blog/ContentMapper.xml b/src/main/resources/mybatis/blog/ContentMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/blog/ContentMapper.xml rename to src/main/resources/mybatis/blog/ContentMapper.xml diff --git a/bootdo/src/main/resources/mybatis/common/DictMapper.xml b/src/main/resources/mybatis/common/DictMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/common/DictMapper.xml rename to src/main/resources/mybatis/common/DictMapper.xml diff --git a/bootdo/src/main/resources/mybatis/common/FileMapper.xml b/src/main/resources/mybatis/common/FileMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/common/FileMapper.xml rename to src/main/resources/mybatis/common/FileMapper.xml diff --git a/bootdo/src/main/resources/mybatis/common/LogMapper.xml b/src/main/resources/mybatis/common/LogMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/common/LogMapper.xml rename to src/main/resources/mybatis/common/LogMapper.xml diff --git a/bootdo/src/main/resources/mybatis/common/TaskMapper.xml b/src/main/resources/mybatis/common/TaskMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/common/TaskMapper.xml rename to src/main/resources/mybatis/common/TaskMapper.xml diff --git a/bootdo/src/main/resources/mybatis/oa/NotifyMapper.xml b/src/main/resources/mybatis/oa/NotifyMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/oa/NotifyMapper.xml rename to src/main/resources/mybatis/oa/NotifyMapper.xml diff --git a/bootdo/src/main/resources/mybatis/oa/NotifyRecordMapper.xml b/src/main/resources/mybatis/oa/NotifyRecordMapper.xml similarity index 96% rename from bootdo/src/main/resources/mybatis/oa/NotifyRecordMapper.xml rename to src/main/resources/mybatis/oa/NotifyRecordMapper.xml index 365204bf0dbc442816056da4dec777543403d15e..376e1782f8876af15969b5207b1f9995dec2b5e0 100644 --- a/bootdo/src/main/resources/mybatis/oa/NotifyRecordMapper.xml +++ b/src/main/resources/mybatis/oa/NotifyRecordMapper.xml @@ -1,144 +1,144 @@ - - - - - - - - - - - - - insert into oa_notify_record - ( - `notify_id`, - `user_id`, - `is_read`, - `read_date` - ) - values - ( - #{notifyId}, - #{userId}, - #{isRead}, - #{readDate} - ) - - - - update oa_notify_record - - `notify_id` = #{notifyId}, - `user_id` = #{userId}, - `is_read` = #{isRead}, - `read_date` = #{readDate} - - where id = #{id} - - - - delete from oa_notify_record where id = #{value} - - - - delete from oa_notify_record where id in - - #{id} - - - - - - insert into oa_notify_record - ( - `notify_id`, - `user_id`, - `is_read`, - `read_date` - ) - values - - ( - #{item.notifyId}, - #{item.userId}, - #{item.isRead}, - #{item.readDate} - ) - - - - - - - delete from oa_notify_record where notify_id = - #{value} - - - - delete from oa_notify_record where notify_id in - - #{id} - - - - - update oa_notify_record - - `is_read` = #{isRead}, - `read_date` = #{readDate} - - where notify_id = #{notifyId} and user_id = #{userId} - - - - - + + + + + + + + + + + + + insert into oa_notify_record + ( + `notify_id`, + `user_id`, + `is_read`, + `read_date` + ) + values + ( + #{notifyId}, + #{userId}, + #{isRead}, + #{readDate} + ) + + + + update oa_notify_record + + `notify_id` = #{notifyId}, + `user_id` = #{userId}, + `is_read` = #{isRead}, + `read_date` = #{readDate} + + where id = #{id} + + + + delete from oa_notify_record where id = #{value} + + + + delete from oa_notify_record where id in + + #{id} + + + + + + insert into oa_notify_record + ( + `notify_id`, + `user_id`, + `is_read`, + `read_date` + ) + values + + ( + #{item.notifyId}, + #{item.userId}, + #{item.isRead}, + #{item.readDate} + ) + + + + + + + delete from oa_notify_record where notify_id = + #{value} + + + + delete from oa_notify_record where notify_id in + + #{id} + + + + + update oa_notify_record + + `is_read` = #{isRead}, + `read_date` = #{readDate} + + where notify_id = #{notifyId} and user_id = #{userId} + + + + + diff --git a/bootdo/src/main/resources/mybatis/system/DeptMapper.xml b/src/main/resources/mybatis/system/DeptMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/system/DeptMapper.xml rename to src/main/resources/mybatis/system/DeptMapper.xml diff --git a/bootdo/src/main/resources/mybatis/system/MenuMapper.xml b/src/main/resources/mybatis/system/MenuMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/system/MenuMapper.xml rename to src/main/resources/mybatis/system/MenuMapper.xml diff --git a/bootdo/src/main/resources/mybatis/system/RoleMapper.xml b/src/main/resources/mybatis/system/RoleMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/system/RoleMapper.xml rename to src/main/resources/mybatis/system/RoleMapper.xml diff --git a/bootdo/src/main/resources/mybatis/system/RoleMenuMapper.xml b/src/main/resources/mybatis/system/RoleMenuMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/system/RoleMenuMapper.xml rename to src/main/resources/mybatis/system/RoleMenuMapper.xml diff --git a/bootdo/src/main/resources/mybatis/system/UserMapper.xml b/src/main/resources/mybatis/system/UserMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/system/UserMapper.xml rename to src/main/resources/mybatis/system/UserMapper.xml diff --git a/bootdo/src/main/resources/mybatis/system/UserRoleMapper.xml b/src/main/resources/mybatis/system/UserRoleMapper.xml similarity index 100% rename from bootdo/src/main/resources/mybatis/system/UserRoleMapper.xml rename to src/main/resources/mybatis/system/UserRoleMapper.xml diff --git a/bootdo/src/main/resources/public/FontIcoList.html b/src/main/resources/public/FontIcoList.html similarity index 100% rename from bootdo/src/main/resources/public/FontIcoList.html rename to src/main/resources/public/FontIcoList.html diff --git a/bootdo/src/main/resources/public/chart/graph_echarts.html b/src/main/resources/public/chart/graph_echarts.html similarity index 100% rename from bootdo/src/main/resources/public/chart/graph_echarts.html rename to src/main/resources/public/chart/graph_echarts.html diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/bg.png b/src/main/resources/public/diagram-viewer/images/bg.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/bg.png rename to src/main/resources/public/diagram-viewer/images/bg.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/breadcrumbs.png b/src/main/resources/public/diagram-viewer/images/breadcrumbs.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/breadcrumbs.png rename to src/main/resources/public/diagram-viewer/images/breadcrumbs.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/checker-bg.png b/src/main/resources/public/diagram-viewer/images/checker-bg.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/checker-bg.png rename to src/main/resources/public/diagram-viewer/images/checker-bg.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/blue/message_catch.png b/src/main/resources/public/diagram-viewer/images/deployer/blue/message_catch.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/blue/message_catch.png rename to src/main/resources/public/diagram-viewer/images/deployer/blue/message_catch.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/business_rule.png b/src/main/resources/public/diagram-viewer/images/deployer/business_rule.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/business_rule.png rename to src/main/resources/public/diagram-viewer/images/deployer/business_rule.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/error_catch.png b/src/main/resources/public/diagram-viewer/images/deployer/error_catch.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/error_catch.png rename to src/main/resources/public/diagram-viewer/images/deployer/error_catch.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/error_throw.png b/src/main/resources/public/diagram-viewer/images/deployer/error_throw.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/error_throw.png rename to src/main/resources/public/diagram-viewer/images/deployer/error_throw.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/manual.png b/src/main/resources/public/diagram-viewer/images/deployer/manual.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/manual.png rename to src/main/resources/public/diagram-viewer/images/deployer/manual.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/message_catch.png b/src/main/resources/public/diagram-viewer/images/deployer/message_catch.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/message_catch.png rename to src/main/resources/public/diagram-viewer/images/deployer/message_catch.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/message_throw.png b/src/main/resources/public/diagram-viewer/images/deployer/message_throw.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/message_throw.png rename to src/main/resources/public/diagram-viewer/images/deployer/message_throw.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/receive.png b/src/main/resources/public/diagram-viewer/images/deployer/receive.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/receive.png rename to src/main/resources/public/diagram-viewer/images/deployer/receive.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/script.png b/src/main/resources/public/diagram-viewer/images/deployer/script.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/script.png rename to src/main/resources/public/diagram-viewer/images/deployer/script.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/send.png b/src/main/resources/public/diagram-viewer/images/deployer/send.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/send.png rename to src/main/resources/public/diagram-viewer/images/deployer/send.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/service.png b/src/main/resources/public/diagram-viewer/images/deployer/service.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/service.png rename to src/main/resources/public/diagram-viewer/images/deployer/service.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/signal_catch.png b/src/main/resources/public/diagram-viewer/images/deployer/signal_catch.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/signal_catch.png rename to src/main/resources/public/diagram-viewer/images/deployer/signal_catch.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/signal_throw.png b/src/main/resources/public/diagram-viewer/images/deployer/signal_throw.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/signal_throw.png rename to src/main/resources/public/diagram-viewer/images/deployer/signal_throw.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/timer.png b/src/main/resources/public/diagram-viewer/images/deployer/timer.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/timer.png rename to src/main/resources/public/diagram-viewer/images/deployer/timer.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/images/deployer/user.png b/src/main/resources/public/diagram-viewer/images/deployer/user.png similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/images/deployer/user.png rename to src/main/resources/public/diagram-viewer/images/deployer/user.png diff --git a/bootdo/src/main/resources/public/diagram-viewer/index.html b/src/main/resources/public/diagram-viewer/index.html similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/index.html rename to src/main/resources/public/diagram-viewer/index.html diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/ActivitiRest.js b/src/main/resources/public/diagram-viewer/js/ActivitiRest.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/ActivitiRest.js rename to src/main/resources/public/diagram-viewer/js/ActivitiRest.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/ActivityImpl.js b/src/main/resources/public/diagram-viewer/js/ActivityImpl.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/ActivityImpl.js rename to src/main/resources/public/diagram-viewer/js/ActivityImpl.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/Color.js b/src/main/resources/public/diagram-viewer/js/Color.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/Color.js rename to src/main/resources/public/diagram-viewer/js/Color.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/LineBreakMeasurer.js b/src/main/resources/public/diagram-viewer/js/LineBreakMeasurer.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/LineBreakMeasurer.js rename to src/main/resources/public/diagram-viewer/js/LineBreakMeasurer.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/Polyline.js b/src/main/resources/public/diagram-viewer/js/Polyline.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/Polyline.js rename to src/main/resources/public/diagram-viewer/js/Polyline.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/ProcessDiagramCanvas.js b/src/main/resources/public/diagram-viewer/js/ProcessDiagramCanvas.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/ProcessDiagramCanvas.js rename to src/main/resources/public/diagram-viewer/js/ProcessDiagramCanvas.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/ProcessDiagramGenerator.js b/src/main/resources/public/diagram-viewer/js/ProcessDiagramGenerator.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/ProcessDiagramGenerator.js rename to src/main/resources/public/diagram-viewer/js/ProcessDiagramGenerator.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/jquery/jquery.asyncqueue.js b/src/main/resources/public/diagram-viewer/js/jquery/jquery.asyncqueue.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/jquery/jquery.asyncqueue.js rename to src/main/resources/public/diagram-viewer/js/jquery/jquery.asyncqueue.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/jquery/jquery.js b/src/main/resources/public/diagram-viewer/js/jquery/jquery.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/jquery/jquery.js rename to src/main/resources/public/diagram-viewer/js/jquery/jquery.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/jquery/jquery.progressbar.js b/src/main/resources/public/diagram-viewer/js/jquery/jquery.progressbar.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/jquery/jquery.progressbar.js rename to src/main/resources/public/diagram-viewer/js/jquery/jquery.progressbar.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/jstools.js b/src/main/resources/public/diagram-viewer/js/jstools.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/jstools.js rename to src/main/resources/public/diagram-viewer/js/jstools.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/raphael.2.1.1.js b/src/main/resources/public/diagram-viewer/js/raphael.2.1.1.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/raphael.2.1.1.js rename to src/main/resources/public/diagram-viewer/js/raphael.2.1.1.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/raphael.js b/src/main/resources/public/diagram-viewer/js/raphael.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/raphael.js rename to src/main/resources/public/diagram-viewer/js/raphael.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/raphael_uncompressed.js b/src/main/resources/public/diagram-viewer/js/raphael_uncompressed.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/raphael_uncompressed.js rename to src/main/resources/public/diagram-viewer/js/raphael_uncompressed.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/js/textlayout.js b/src/main/resources/public/diagram-viewer/js/textlayout.js similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/js/textlayout.js rename to src/main/resources/public/diagram-viewer/js/textlayout.js diff --git a/bootdo/src/main/resources/public/diagram-viewer/style.css b/src/main/resources/public/diagram-viewer/style.css similarity index 100% rename from bootdo/src/main/resources/public/diagram-viewer/style.css rename to src/main/resources/public/diagram-viewer/style.css diff --git a/bootdo/src/main/resources/public/modeler.html b/src/main/resources/public/modeler.html similarity index 100% rename from bootdo/src/main/resources/public/modeler.html rename to src/main/resources/public/modeler.html diff --git a/bootdo/src/main/resources/static/css/animate.css b/src/main/resources/static/css/animate.css similarity index 100% rename from bootdo/src/main/resources/static/css/animate.css rename to src/main/resources/static/css/animate.css diff --git a/bootdo/src/main/resources/static/css/blog/bootstrap.min.css b/src/main/resources/static/css/blog/bootstrap.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/blog/bootstrap.min.css rename to src/main/resources/static/css/blog/bootstrap.min.css diff --git a/bootdo/src/main/resources/static/css/blog/clean-blog.css b/src/main/resources/static/css/blog/clean-blog.css similarity index 100% rename from bootdo/src/main/resources/static/css/blog/clean-blog.css rename to src/main/resources/static/css/blog/clean-blog.css diff --git a/bootdo/src/main/resources/static/css/blog/clean-blog.min.css b/src/main/resources/static/css/blog/clean-blog.min.css similarity index 99% rename from bootdo/src/main/resources/static/css/blog/clean-blog.min.css rename to src/main/resources/static/css/blog/clean-blog.min.css index 3152d76e15c36f720f907070fe97595b5c547e47..5c4490506f653254e783e610d73138cfa66c40f8 100644 --- a/bootdo/src/main/resources/static/css/blog/clean-blog.min.css +++ b/src/main/resources/static/css/blog/clean-blog.min.css @@ -1,11 +1,11 @@ -/*! - * Start Bootstrap - Clean Blog v4.0.0-alpha (http://startbootstrap.com/template-overviews/clean-blog) - * Copyright 2013-2017 Start Bootstrap - * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE) - */body{font-family:Lora,'Times New Roman',serif;font-size:20px;color:#333}p{line-height:1.5;margin:30px 0}p a{text-decoration:underline}h1,h2,h3,h4,h5,h6{font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-weight:800}a{-webkit-transition:all .2s;-moz-transition:all .2s;transition:all .2s;color:#333}a:focus,a:hover{color:#0085a1}a img:focus,a img:hover{cursor:zoom-in}blockquote{color:#777;font-style:italic}#mainNav{background-color:#fff;border-bottom:1px solid #eee;position:absolute;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif}#mainNav .navbar-brand{color:#777;font-weight:800}#mainNav .navbar-toggler{color:#777;font-weight:800;text-transform:uppercase;font-size:18px;padding:13px}#mainNav .navbar-nav>li.nav-item>a{text-transform:uppercase;font-size:18px;font-weight:800;letter-spacing:1px}@media only screen and (min-width:992px){#mainNav{background:0 0;border-bottom:1px solid transparent}#mainNav .navbar-brand{color:#fff;padding:20px}#mainNav .navbar-brand:focus,#mainNav .navbar-brand:hover{color:rgba(255,255,255,.8)}#mainNav .navbar-nav>li.nav-item>a{color:#fff;padding:20px}#mainNav .navbar-nav>li.nav-item>a:focus,#mainNav .navbar-nav>li.nav-item>a:hover{color:rgba(255,255,255,.8)}}@media only screen and (min-width:1170px){#mainNav{-webkit-transition:background-color .2s;-moz-transition:background-color .2s;transition:background-color .2s;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0);-webkit-backface-visibility:hidden;backface-visibility:hidden}#mainNav.is-fixed{position:fixed;top:-87px;background-color:rgba(255,255,255,.9);border-bottom:1px solid #fff;-webkit-transition:-webkit-transform .2s;-moz-transition:-moz-transform .2s;transition:transform .2s}#mainNav.is-fixed .navbar-brand{color:#333}#mainNav.is-fixed .navbar-brand:focus,#mainNav.is-fixed .navbar-brand:hover{color:#0085a1}#mainNav.is-fixed .navbar-nav>li.nav-item>a{color:#333}#mainNav.is-fixed .navbar-nav>li.nav-item>a:focus,#mainNav.is-fixed .navbar-nav>li.nav-item>a:hover{color:#0085a1}#mainNav.is-visible{-webkit-transform:translate3d(0,100%,0);-moz-transform:translate3d(0,100%,0);-ms-transform:translate3d(0,100%,0);-o-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}.intro-header{background-color:#777;background:no-repeat center center;background-attachment:scroll;@inlcude background-cover;margin-bottom:50px}.intro-header .page-heading,.intro-header .post-heading,.intro-header .site-heading{padding:100px 0 50px;color:#fff}@media only screen and (min-width:768px){.intro-header .page-heading,.intro-header .post-heading,.intro-header .site-heading{padding:150px 0}}.intro-header .page-heading,.intro-header .site-heading{text-align:center}.intro-header .page-heading h1,.intro-header .site-heading h1{margin-top:0;font-size:50px}.intro-header .page-heading .subheading,.intro-header .site-heading .subheading{font-size:24px;line-height:1.1;display:block;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-weight:300;margin:10px 0 0}@media only screen and (min-width:768px){.intro-header .page-heading h1,.intro-header .site-heading h1{font-size:80px}}.intro-header .post-heading h1{font-size:35px}.intro-header .post-heading .meta,.intro-header .post-heading .subheading{line-height:1.1;display:block}.intro-header .post-heading .subheading{font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:24px;margin:10px 0 30px;font-weight:600}.intro-header .post-heading .meta{font-family:Lora,'Times New Roman',serif;font-style:italic;font-weight:300;font-size:20px}.intro-header .post-heading .meta a{color:#fff}@media only screen and (min-width:768px){.intro-header .post-heading h1{font-size:55px}.intro-header .post-heading .subheading{font-size:30px}}.post-preview>a{color:#333}.post-preview>a:focus,.post-preview>a:hover{text-decoration:none;color:#0085a1}.post-preview>a>.post-title{font-size:30px;margin-top:30px;margin-bottom:10px}.post-preview>a>.post-subtitle{margin:0;font-weight:300;margin-bottom:10px}.post-preview>.post-meta{color:#777;font-size:18px;font-style:italic;margin-top:0}.post-preview>.post-meta>a{text-decoration:none;color:#333}.post-preview>.post-meta>a:focus,.post-preview>.post-meta>a:hover{color:#0085a1;text-decoration:underline}@media only screen and (min-width:768px){.post-preview>a>.post-title{font-size:36px}}.section-heading{font-size:36px;margin-top:60px;font-weight:700}.caption{text-align:center;font-size:14px;padding:10px;font-style:italic;margin:0;display:block;border-bottom-right-radius:5px;border-bottom-left-radius:5px}footer{padding:50px 0 65px}footer .list-inline{margin:0;padding:0}footer .copyright{font-size:14px;text-align:center;margin-bottom:0}.floating-label-form-group{font-size:14px;position:relative;margin-bottom:0;padding-bottom:.5em;border-bottom:1px solid #eee}.floating-label-form-group input,.floating-label-form-group textarea{z-index:1;position:relative;padding:0;border:none;border-radius:0;font-size:1.5em;background:0 0;box-shadow:none!important;resize:none;font-family:Lora,'Times New Roman',serif}.floating-label-form-group input::-webkit-input-placeholder,.floating-label-form-group textarea::-webkit-input-placeholder{font-family:Lora,'Times New Roman',serif;color:#777}.floating-label-form-group label{display:block;z-index:0;position:relative;top:2em;margin:0;font-size:.85em;line-height:1.764705882em;vertical-align:middle;vertical-align:baseline;opacity:0;-webkit-transition:top .3s ease,opacity .3s ease;-moz-transition:top .3s ease,opacity .3s ease;-ms-transition:top .3s ease,opacity .3s ease;transition:top .3s ease,opacity .3s ease}.floating-label-form-group .help-block{margin:15px 0}.floating-label-form-group-with-value label{top:0;opacity:1}.floating-label-form-group-with-focus label{color:#0085a1}form .form-group:first-child .floating-label-form-group{border-top:1px solid #eee}.btn{font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;text-transform:uppercase;font-size:14px;font-weight:800;letter-spacing:1px;border-radius:0;padding:15px 25px}.btn-primary{color:#fff;background-color:#0085a1;border-color:#0085a1}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#005b6e;border-color:#001c22}.btn-primary:hover{color:#fff;background-color:#005b6e;border-color:#005264}.btn-primary.active,.btn-primary:active,.open>.btn-primary.dropdown-toggle{color:#fff;background-color:#005b6e;border-color:#005264}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.btn-primary.dropdown-toggle.focus,.open>.btn-primary.dropdown-toggle:focus,.open>.btn-primary.dropdown-toggle:hover{color:#fff;background-color:#003d4a;border-color:#001c22}.btn-primary.active,.btn-primary:active,.open>.btn-primary.dropdown-toggle{background-image:none}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#0085a1;border-color:#0085a1}.btn-primary .badge{color:#0085a1;background-color:#fff}.btn-lg{font-size:16px;padding:25px 35px}.btn-default:focus,.btn-default:hover{background-color:#0085a1;border:1px solid #0085a1;color:#fff}::-moz-selection{color:#fff;text-shadow:none;background:#0085a1}::selection{color:#fff;text-shadow:none;background:#0085a1}img::selection{color:#fff;background:0 0}img::-moz-selection{color:#fff;background:0 0}body{-webkit-tap-highlight-color:#0085a1}.copyrights{ - text-indent:-9999px; - height:0; - line-height:0; - font-size:0; - overflow:hidden; +/*! + * Start Bootstrap - Clean Blog v4.0.0-alpha (http://startbootstrap.com/template-overviews/clean-blog) + * Copyright 2013-2017 Start Bootstrap + * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE) + */body{font-family:Lora,'Times New Roman',serif;font-size:20px;color:#333}p{line-height:1.5;margin:30px 0}p a{text-decoration:underline}h1,h2,h3,h4,h5,h6{font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-weight:800}a{-webkit-transition:all .2s;-moz-transition:all .2s;transition:all .2s;color:#333}a:focus,a:hover{color:#0085a1}a img:focus,a img:hover{cursor:zoom-in}blockquote{color:#777;font-style:italic}#mainNav{background-color:#fff;border-bottom:1px solid #eee;position:absolute;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif}#mainNav .navbar-brand{color:#777;font-weight:800}#mainNav .navbar-toggler{color:#777;font-weight:800;text-transform:uppercase;font-size:18px;padding:13px}#mainNav .navbar-nav>li.nav-item>a{text-transform:uppercase;font-size:18px;font-weight:800;letter-spacing:1px}@media only screen and (min-width:992px){#mainNav{background:0 0;border-bottom:1px solid transparent}#mainNav .navbar-brand{color:#fff;padding:20px}#mainNav .navbar-brand:focus,#mainNav .navbar-brand:hover{color:rgba(255,255,255,.8)}#mainNav .navbar-nav>li.nav-item>a{color:#fff;padding:20px}#mainNav .navbar-nav>li.nav-item>a:focus,#mainNav .navbar-nav>li.nav-item>a:hover{color:rgba(255,255,255,.8)}}@media only screen and (min-width:1170px){#mainNav{-webkit-transition:background-color .2s;-moz-transition:background-color .2s;transition:background-color .2s;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0);-webkit-backface-visibility:hidden;backface-visibility:hidden}#mainNav.is-fixed{position:fixed;top:-87px;background-color:rgba(255,255,255,.9);border-bottom:1px solid #fff;-webkit-transition:-webkit-transform .2s;-moz-transition:-moz-transform .2s;transition:transform .2s}#mainNav.is-fixed .navbar-brand{color:#333}#mainNav.is-fixed .navbar-brand:focus,#mainNav.is-fixed .navbar-brand:hover{color:#0085a1}#mainNav.is-fixed .navbar-nav>li.nav-item>a{color:#333}#mainNav.is-fixed .navbar-nav>li.nav-item>a:focus,#mainNav.is-fixed .navbar-nav>li.nav-item>a:hover{color:#0085a1}#mainNav.is-visible{-webkit-transform:translate3d(0,100%,0);-moz-transform:translate3d(0,100%,0);-ms-transform:translate3d(0,100%,0);-o-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}.intro-header{background-color:#777;background:no-repeat center center;background-attachment:scroll;@inlcude background-cover;margin-bottom:50px}.intro-header .page-heading,.intro-header .post-heading,.intro-header .site-heading{padding:100px 0 50px;color:#fff}@media only screen and (min-width:768px){.intro-header .page-heading,.intro-header .post-heading,.intro-header .site-heading{padding:150px 0}}.intro-header .page-heading,.intro-header .site-heading{text-align:center}.intro-header .page-heading h1,.intro-header .site-heading h1{margin-top:0;font-size:50px}.intro-header .page-heading .subheading,.intro-header .site-heading .subheading{font-size:24px;line-height:1.1;display:block;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-weight:300;margin:10px 0 0}@media only screen and (min-width:768px){.intro-header .page-heading h1,.intro-header .site-heading h1{font-size:80px}}.intro-header .post-heading h1{font-size:35px}.intro-header .post-heading .meta,.intro-header .post-heading .subheading{line-height:1.1;display:block}.intro-header .post-heading .subheading{font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:24px;margin:10px 0 30px;font-weight:600}.intro-header .post-heading .meta{font-family:Lora,'Times New Roman',serif;font-style:italic;font-weight:300;font-size:20px}.intro-header .post-heading .meta a{color:#fff}@media only screen and (min-width:768px){.intro-header .post-heading h1{font-size:55px}.intro-header .post-heading .subheading{font-size:30px}}.post-preview>a{color:#333}.post-preview>a:focus,.post-preview>a:hover{text-decoration:none;color:#0085a1}.post-preview>a>.post-title{font-size:30px;margin-top:30px;margin-bottom:10px}.post-preview>a>.post-subtitle{margin:0;font-weight:300;margin-bottom:10px}.post-preview>.post-meta{color:#777;font-size:18px;font-style:italic;margin-top:0}.post-preview>.post-meta>a{text-decoration:none;color:#333}.post-preview>.post-meta>a:focus,.post-preview>.post-meta>a:hover{color:#0085a1;text-decoration:underline}@media only screen and (min-width:768px){.post-preview>a>.post-title{font-size:36px}}.section-heading{font-size:36px;margin-top:60px;font-weight:700}.caption{text-align:center;font-size:14px;padding:10px;font-style:italic;margin:0;display:block;border-bottom-right-radius:5px;border-bottom-left-radius:5px}footer{padding:50px 0 65px}footer .list-inline{margin:0;padding:0}footer .copyright{font-size:14px;text-align:center;margin-bottom:0}.floating-label-form-group{font-size:14px;position:relative;margin-bottom:0;padding-bottom:.5em;border-bottom:1px solid #eee}.floating-label-form-group input,.floating-label-form-group textarea{z-index:1;position:relative;padding:0;border:none;border-radius:0;font-size:1.5em;background:0 0;box-shadow:none!important;resize:none;font-family:Lora,'Times New Roman',serif}.floating-label-form-group input::-webkit-input-placeholder,.floating-label-form-group textarea::-webkit-input-placeholder{font-family:Lora,'Times New Roman',serif;color:#777}.floating-label-form-group label{display:block;z-index:0;position:relative;top:2em;margin:0;font-size:.85em;line-height:1.764705882em;vertical-align:middle;vertical-align:baseline;opacity:0;-webkit-transition:top .3s ease,opacity .3s ease;-moz-transition:top .3s ease,opacity .3s ease;-ms-transition:top .3s ease,opacity .3s ease;transition:top .3s ease,opacity .3s ease}.floating-label-form-group .help-block{margin:15px 0}.floating-label-form-group-with-value label{top:0;opacity:1}.floating-label-form-group-with-focus label{color:#0085a1}form .form-group:first-child .floating-label-form-group{border-top:1px solid #eee}.btn{font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;text-transform:uppercase;font-size:14px;font-weight:800;letter-spacing:1px;border-radius:0;padding:15px 25px}.btn-primary{color:#fff;background-color:#0085a1;border-color:#0085a1}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#005b6e;border-color:#001c22}.btn-primary:hover{color:#fff;background-color:#005b6e;border-color:#005264}.btn-primary.active,.btn-primary:active,.open>.btn-primary.dropdown-toggle{color:#fff;background-color:#005b6e;border-color:#005264}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.btn-primary.dropdown-toggle.focus,.open>.btn-primary.dropdown-toggle:focus,.open>.btn-primary.dropdown-toggle:hover{color:#fff;background-color:#003d4a;border-color:#001c22}.btn-primary.active,.btn-primary:active,.open>.btn-primary.dropdown-toggle{background-image:none}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#0085a1;border-color:#0085a1}.btn-primary .badge{color:#0085a1;background-color:#fff}.btn-lg{font-size:16px;padding:25px 35px}.btn-default:focus,.btn-default:hover{background-color:#0085a1;border:1px solid #0085a1;color:#fff}::-moz-selection{color:#fff;text-shadow:none;background:#0085a1}::selection{color:#fff;text-shadow:none;background:#0085a1}img::selection{color:#fff;background:0 0}img::-moz-selection{color:#fff;background:0 0}body{-webkit-tap-highlight-color:#0085a1}.copyrights{ + text-indent:-9999px; + height:0; + line-height:0; + font-size:0; + overflow:hidden; } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/css/bootstrap-rtl.css b/src/main/resources/static/css/bootstrap-rtl.css similarity index 100% rename from bootdo/src/main/resources/static/css/bootstrap-rtl.css rename to src/main/resources/static/css/bootstrap-rtl.css diff --git a/bootdo/src/main/resources/static/css/bootstrap.min.css b/src/main/resources/static/css/bootstrap.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/bootstrap.min.css rename to src/main/resources/static/css/bootstrap.min.css diff --git a/bootdo/src/main/resources/static/css/demo/webuploader-demo.css b/src/main/resources/static/css/demo/webuploader-demo.css similarity index 100% rename from bootdo/src/main/resources/static/css/demo/webuploader-demo.css rename to src/main/resources/static/css/demo/webuploader-demo.css diff --git a/bootdo/src/main/resources/static/css/font-awesome.css b/src/main/resources/static/css/font-awesome.css similarity index 100% rename from bootdo/src/main/resources/static/css/font-awesome.css rename to src/main/resources/static/css/font-awesome.css diff --git a/bootdo/src/main/resources/static/css/font-awesome.min.css b/src/main/resources/static/css/font-awesome.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/font-awesome.min.css rename to src/main/resources/static/css/font-awesome.min.css diff --git a/bootdo/src/main/resources/static/css/gg-bootdo.css b/src/main/resources/static/css/gg-bootdo.css similarity index 100% rename from bootdo/src/main/resources/static/css/gg-bootdo.css rename to src/main/resources/static/css/gg-bootdo.css diff --git a/bootdo/src/main/resources/static/css/layui.css b/src/main/resources/static/css/layui.css similarity index 100% rename from bootdo/src/main/resources/static/css/layui.css rename to src/main/resources/static/css/layui.css diff --git a/bootdo/src/main/resources/static/css/layui.mobile.css b/src/main/resources/static/css/layui.mobile.css similarity index 100% rename from bootdo/src/main/resources/static/css/layui.mobile.css rename to src/main/resources/static/css/layui.mobile.css diff --git a/bootdo/src/main/resources/static/css/login.css b/src/main/resources/static/css/login.css similarity index 100% rename from bootdo/src/main/resources/static/css/login.css rename to src/main/resources/static/css/login.css diff --git a/bootdo/src/main/resources/static/css/patterns/header-profile-skin-1.png b/src/main/resources/static/css/patterns/header-profile-skin-1.png similarity index 100% rename from bootdo/src/main/resources/static/css/patterns/header-profile-skin-1.png rename to src/main/resources/static/css/patterns/header-profile-skin-1.png diff --git a/bootdo/src/main/resources/static/css/patterns/header-profile-skin-3.png b/src/main/resources/static/css/patterns/header-profile-skin-3.png similarity index 100% rename from bootdo/src/main/resources/static/css/patterns/header-profile-skin-3.png rename to src/main/resources/static/css/patterns/header-profile-skin-3.png diff --git a/bootdo/src/main/resources/static/css/patterns/header-profile.png b/src/main/resources/static/css/patterns/header-profile.png similarity index 100% rename from bootdo/src/main/resources/static/css/patterns/header-profile.png rename to src/main/resources/static/css/patterns/header-profile.png diff --git a/bootdo/src/main/resources/static/css/patterns/shattered.png b/src/main/resources/static/css/patterns/shattered.png similarity index 100% rename from bootdo/src/main/resources/static/css/patterns/shattered.png rename to src/main/resources/static/css/patterns/shattered.png diff --git a/bootdo/src/main/resources/static/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css b/src/main/resources/static/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css rename to src/main/resources/static/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery-indicator.css b/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery-indicator.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery-indicator.css rename to src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery-indicator.css diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery-video.css b/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery-video.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery-video.css rename to src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery-video.css diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery.css b/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery.css rename to src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery.css diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery.min.css b/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery.min.css rename to src/main/resources/static/css/plugins/blueimp/css/blueimp-gallery.min.css diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/css/demo.css b/src/main/resources/static/css/plugins/blueimp/css/demo.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/css/demo.css rename to src/main/resources/static/css/plugins/blueimp/css/demo.css diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/img/error.png b/src/main/resources/static/css/plugins/blueimp/img/error.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/img/error.png rename to src/main/resources/static/css/plugins/blueimp/img/error.png diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/img/error.svg b/src/main/resources/static/css/plugins/blueimp/img/error.svg similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/img/error.svg rename to src/main/resources/static/css/plugins/blueimp/img/error.svg diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/img/loading.gif b/src/main/resources/static/css/plugins/blueimp/img/loading.gif similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/img/loading.gif rename to src/main/resources/static/css/plugins/blueimp/img/loading.gif diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/img/play-pause.png b/src/main/resources/static/css/plugins/blueimp/img/play-pause.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/img/play-pause.png rename to src/main/resources/static/css/plugins/blueimp/img/play-pause.png diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/img/play-pause.svg b/src/main/resources/static/css/plugins/blueimp/img/play-pause.svg similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/img/play-pause.svg rename to src/main/resources/static/css/plugins/blueimp/img/play-pause.svg diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/img/video-play.png b/src/main/resources/static/css/plugins/blueimp/img/video-play.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/img/video-play.png rename to src/main/resources/static/css/plugins/blueimp/img/video-play.png diff --git a/bootdo/src/main/resources/static/css/plugins/blueimp/img/video-play.svg b/src/main/resources/static/css/plugins/blueimp/img/video-play.svg similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/blueimp/img/video-play.svg rename to src/main/resources/static/css/plugins/blueimp/img/video-play.svg diff --git a/bootdo/src/main/resources/static/css/plugins/bootstrap-table/bootstrap-table.min.css b/src/main/resources/static/css/plugins/bootstrap-table/bootstrap-table.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/bootstrap-table/bootstrap-table.min.css rename to src/main/resources/static/css/plugins/bootstrap-table/bootstrap-table.min.css diff --git a/bootdo/src/main/resources/static/css/plugins/chosen/chosen-sprite.png b/src/main/resources/static/css/plugins/chosen/chosen-sprite.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/chosen/chosen-sprite.png rename to src/main/resources/static/css/plugins/chosen/chosen-sprite.png diff --git a/bootdo/src/main/resources/static/css/plugins/chosen/chosen-sprite@2x.png b/src/main/resources/static/css/plugins/chosen/chosen-sprite@2x.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/chosen/chosen-sprite@2x.png rename to src/main/resources/static/css/plugins/chosen/chosen-sprite@2x.png diff --git a/bootdo/src/main/resources/static/css/plugins/chosen/chosen.css b/src/main/resources/static/css/plugins/chosen/chosen.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/chosen/chosen.css rename to src/main/resources/static/css/plugins/chosen/chosen.css diff --git a/bootdo/src/main/resources/static/css/plugins/clockpicker/clockpicker.css b/src/main/resources/static/css/plugins/clockpicker/clockpicker.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/clockpicker/clockpicker.css rename to src/main/resources/static/css/plugins/clockpicker/clockpicker.css diff --git a/bootdo/src/main/resources/static/css/plugins/codemirror/ambiance.css b/src/main/resources/static/css/plugins/codemirror/ambiance.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/codemirror/ambiance.css rename to src/main/resources/static/css/plugins/codemirror/ambiance.css diff --git a/bootdo/src/main/resources/static/css/plugins/codemirror/codemirror.css b/src/main/resources/static/css/plugins/codemirror/codemirror.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/codemirror/codemirror.css rename to src/main/resources/static/css/plugins/codemirror/codemirror.css diff --git a/bootdo/src/main/resources/static/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css b/src/main/resources/static/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css rename to src/main/resources/static/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css diff --git a/bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png b/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png rename to src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png diff --git a/bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/alpha.png b/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/alpha.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/alpha.png rename to src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/alpha.png diff --git a/bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/hue-horizontal.png b/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/hue-horizontal.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/hue-horizontal.png rename to src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/hue-horizontal.png diff --git a/bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/hue.png b/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/hue.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/hue.png rename to src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/hue.png diff --git a/bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/saturation.png b/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/saturation.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/saturation.png rename to src/main/resources/static/css/plugins/colorpicker/img/bootstrap-colorpicker/saturation.png diff --git a/bootdo/src/main/resources/static/css/plugins/cropper/cropper.css b/src/main/resources/static/css/plugins/cropper/cropper.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/cropper/cropper.css rename to src/main/resources/static/css/plugins/cropper/cropper.css diff --git a/bootdo/src/main/resources/static/css/plugins/dataTables/dataTables.bootstrap.css b/src/main/resources/static/css/plugins/dataTables/dataTables.bootstrap.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/dataTables/dataTables.bootstrap.css rename to src/main/resources/static/css/plugins/dataTables/dataTables.bootstrap.css diff --git a/bootdo/src/main/resources/static/css/plugins/datapicker/datepicker3.css b/src/main/resources/static/css/plugins/datapicker/datepicker3.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/datapicker/datepicker3.css rename to src/main/resources/static/css/plugins/datapicker/datepicker3.css diff --git a/bootdo/src/main/resources/static/css/plugins/dropzone/basic.css b/src/main/resources/static/css/plugins/dropzone/basic.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/dropzone/basic.css rename to src/main/resources/static/css/plugins/dropzone/basic.css diff --git a/bootdo/src/main/resources/static/css/plugins/dropzone/dropzone.css b/src/main/resources/static/css/plugins/dropzone/dropzone.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/dropzone/dropzone.css rename to src/main/resources/static/css/plugins/dropzone/dropzone.css diff --git a/bootdo/src/main/resources/static/css/plugins/duallistbox/bootstrap-duallistbox.css b/src/main/resources/static/css/plugins/duallistbox/bootstrap-duallistbox.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/duallistbox/bootstrap-duallistbox.css rename to src/main/resources/static/css/plugins/duallistbox/bootstrap-duallistbox.css diff --git a/bootdo/src/main/resources/static/css/plugins/footable/fonts/footable.eot b/src/main/resources/static/css/plugins/footable/fonts/footable.eot similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/footable/fonts/footable.eot rename to src/main/resources/static/css/plugins/footable/fonts/footable.eot diff --git a/bootdo/src/main/resources/static/css/plugins/footable/fonts/footable.svg b/src/main/resources/static/css/plugins/footable/fonts/footable.svg similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/footable/fonts/footable.svg rename to src/main/resources/static/css/plugins/footable/fonts/footable.svg diff --git a/bootdo/src/main/resources/static/css/plugins/footable/fonts/footable.ttf b/src/main/resources/static/css/plugins/footable/fonts/footable.ttf similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/footable/fonts/footable.ttf rename to src/main/resources/static/css/plugins/footable/fonts/footable.ttf diff --git a/bootdo/src/main/resources/static/css/plugins/footable/fonts/footable.woff b/src/main/resources/static/css/plugins/footable/fonts/footable.woff similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/footable/fonts/footable.woff rename to src/main/resources/static/css/plugins/footable/fonts/footable.woff diff --git a/bootdo/src/main/resources/static/css/plugins/footable/footable.core.css b/src/main/resources/static/css/plugins/footable/footable.core.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/footable/footable.core.css rename to src/main/resources/static/css/plugins/footable/footable.core.css diff --git a/bootdo/src/main/resources/static/css/plugins/fullcalendar/fullcalendar.css b/src/main/resources/static/css/plugins/fullcalendar/fullcalendar.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/fullcalendar/fullcalendar.css rename to src/main/resources/static/css/plugins/fullcalendar/fullcalendar.css diff --git a/bootdo/src/main/resources/static/css/plugins/fullcalendar/fullcalendar.print.css b/src/main/resources/static/css/plugins/fullcalendar/fullcalendar.print.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/fullcalendar/fullcalendar.print.css rename to src/main/resources/static/css/plugins/fullcalendar/fullcalendar.print.css diff --git a/bootdo/src/main/resources/static/css/plugins/iCheck/custom.css b/src/main/resources/static/css/plugins/iCheck/custom.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/iCheck/custom.css rename to src/main/resources/static/css/plugins/iCheck/custom.css diff --git a/bootdo/src/main/resources/static/css/plugins/iCheck/green.png b/src/main/resources/static/css/plugins/iCheck/green.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/iCheck/green.png rename to src/main/resources/static/css/plugins/iCheck/green.png diff --git a/bootdo/src/main/resources/static/css/plugins/iCheck/green@2x.png b/src/main/resources/static/css/plugins/iCheck/green@2x.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/iCheck/green@2x.png rename to src/main/resources/static/css/plugins/iCheck/green@2x.png diff --git a/bootdo/src/main/resources/static/css/plugins/images/sort_asc.png b/src/main/resources/static/css/plugins/images/sort_asc.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/images/sort_asc.png rename to src/main/resources/static/css/plugins/images/sort_asc.png diff --git a/bootdo/src/main/resources/static/css/plugins/images/sort_desc.png b/src/main/resources/static/css/plugins/images/sort_desc.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/images/sort_desc.png rename to src/main/resources/static/css/plugins/images/sort_desc.png diff --git a/bootdo/src/main/resources/static/css/plugins/images/sprite-skin-flat.png b/src/main/resources/static/css/plugins/images/sprite-skin-flat.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/images/sprite-skin-flat.png rename to src/main/resources/static/css/plugins/images/sprite-skin-flat.png diff --git a/bootdo/src/main/resources/static/css/plugins/images/spritemap.png b/src/main/resources/static/css/plugins/images/spritemap.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/images/spritemap.png rename to src/main/resources/static/css/plugins/images/spritemap.png diff --git a/bootdo/src/main/resources/static/css/plugins/images/spritemap@2x.png b/src/main/resources/static/css/plugins/images/spritemap@2x.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/images/spritemap@2x.png rename to src/main/resources/static/css/plugins/images/spritemap@2x.png diff --git a/bootdo/src/main/resources/static/css/plugins/ionRangeSlider/ion.rangeSlider.css b/src/main/resources/static/css/plugins/ionRangeSlider/ion.rangeSlider.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/ionRangeSlider/ion.rangeSlider.css rename to src/main/resources/static/css/plugins/ionRangeSlider/ion.rangeSlider.css diff --git a/bootdo/src/main/resources/static/css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css b/src/main/resources/static/css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css rename to src/main/resources/static/css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css diff --git a/bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-bg_flat_0_aaaaaa_40x100.png b/src/main/resources/static/css/plugins/jQueryUI/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-bg_flat_0_aaaaaa_40x100.png rename to src/main/resources/static/css/plugins/jQueryUI/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-bg_flat_75_ffffff_40x100.png b/src/main/resources/static/css/plugins/jQueryUI/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-bg_flat_75_ffffff_40x100.png rename to src/main/resources/static/css/plugins/jQueryUI/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_222222_256x240.png b/src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_222222_256x240.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_222222_256x240.png rename to src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_222222_256x240.png diff --git a/bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_454545_256x240.png b/src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_454545_256x240.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_454545_256x240.png rename to src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_454545_256x240.png diff --git a/bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_888888_256x240.png b/src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_888888_256x240.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_888888_256x240.png rename to src/main/resources/static/css/plugins/jQueryUI/images/ui-icons_888888_256x240.png diff --git a/bootdo/src/main/resources/static/css/plugins/jQueryUI/jquery-ui-1.10.4.custom.min.css b/src/main/resources/static/css/plugins/jQueryUI/jquery-ui-1.10.4.custom.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jQueryUI/jquery-ui-1.10.4.custom.min.css rename to src/main/resources/static/css/plugins/jQueryUI/jquery-ui-1.10.4.custom.min.css diff --git a/bootdo/src/main/resources/static/css/plugins/jasny/jasny-bootstrap.min.css b/src/main/resources/static/css/plugins/jasny/jasny-bootstrap.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jasny/jasny-bootstrap.min.css rename to src/main/resources/static/css/plugins/jasny/jasny-bootstrap.min.css diff --git a/bootdo/src/main/resources/static/css/plugins/jqTreeGrid/jquery.treegrid.css b/src/main/resources/static/css/plugins/jqTreeGrid/jquery.treegrid.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jqTreeGrid/jquery.treegrid.css rename to src/main/resources/static/css/plugins/jqTreeGrid/jquery.treegrid.css diff --git a/bootdo/src/main/resources/static/css/plugins/jqgrid/ui.jqgrid.css b/src/main/resources/static/css/plugins/jqgrid/ui.jqgrid.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jqgrid/ui.jqgrid.css rename to src/main/resources/static/css/plugins/jqgrid/ui.jqgrid.css diff --git a/bootdo/src/main/resources/static/css/plugins/jsTree/32px.png b/src/main/resources/static/css/plugins/jsTree/32px.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jsTree/32px.png rename to src/main/resources/static/css/plugins/jsTree/32px.png diff --git a/bootdo/src/main/resources/static/css/plugins/jsTree/style.min.css b/src/main/resources/static/css/plugins/jsTree/style.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jsTree/style.min.css rename to src/main/resources/static/css/plugins/jsTree/style.min.css diff --git a/bootdo/src/main/resources/static/css/plugins/jsTree/throbber.gif b/src/main/resources/static/css/plugins/jsTree/throbber.gif similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/jsTree/throbber.gif rename to src/main/resources/static/css/plugins/jsTree/throbber.gif diff --git a/bootdo/src/main/resources/static/css/plugins/markdown/bootstrap-markdown.min.css b/src/main/resources/static/css/plugins/markdown/bootstrap-markdown.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/markdown/bootstrap-markdown.min.css rename to src/main/resources/static/css/plugins/markdown/bootstrap-markdown.min.css diff --git a/bootdo/src/main/resources/static/css/plugins/morris/morris-0.4.3.min.css b/src/main/resources/static/css/plugins/morris/morris-0.4.3.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/morris/morris-0.4.3.min.css rename to src/main/resources/static/css/plugins/morris/morris-0.4.3.min.css diff --git a/bootdo/src/main/resources/static/css/plugins/multiselect/bootstrap-multiselect.css b/src/main/resources/static/css/plugins/multiselect/bootstrap-multiselect.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/multiselect/bootstrap-multiselect.css rename to src/main/resources/static/css/plugins/multiselect/bootstrap-multiselect.css diff --git a/bootdo/src/main/resources/static/css/plugins/nouslider/jquery.nouislider.css b/src/main/resources/static/css/plugins/nouslider/jquery.nouislider.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/nouslider/jquery.nouislider.css rename to src/main/resources/static/css/plugins/nouslider/jquery.nouislider.css diff --git a/bootdo/src/main/resources/static/css/plugins/plyr/plyr.css b/src/main/resources/static/css/plugins/plyr/plyr.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/plyr/plyr.css rename to src/main/resources/static/css/plugins/plyr/plyr.css diff --git a/bootdo/src/main/resources/static/css/plugins/plyr/sprite.svg b/src/main/resources/static/css/plugins/plyr/sprite.svg similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/plyr/sprite.svg rename to src/main/resources/static/css/plugins/plyr/sprite.svg diff --git a/bootdo/src/main/resources/static/css/plugins/simditor/simditor.css b/src/main/resources/static/css/plugins/simditor/simditor.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/simditor/simditor.css rename to src/main/resources/static/css/plugins/simditor/simditor.css diff --git a/bootdo/src/main/resources/static/css/plugins/steps/jquery.steps.css b/src/main/resources/static/css/plugins/steps/jquery.steps.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/steps/jquery.steps.css rename to src/main/resources/static/css/plugins/steps/jquery.steps.css diff --git a/bootdo/src/main/resources/static/css/plugins/summernote/font/summernote.woff b/src/main/resources/static/css/plugins/summernote/font/summernote.woff similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/summernote/font/summernote.woff rename to src/main/resources/static/css/plugins/summernote/font/summernote.woff diff --git a/bootdo/src/main/resources/static/css/plugins/summernote/summernote-0.8.8.css b/src/main/resources/static/css/plugins/summernote/summernote-0.8.8.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/summernote/summernote-0.8.8.css rename to src/main/resources/static/css/plugins/summernote/summernote-0.8.8.css diff --git a/bootdo/src/main/resources/static/css/plugins/summernote/summernote-bs3.css b/src/main/resources/static/css/plugins/summernote/summernote-bs3.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/summernote/summernote-bs3.css rename to src/main/resources/static/css/plugins/summernote/summernote-bs3.css diff --git a/bootdo/src/main/resources/static/css/plugins/summernote/summernote.css b/src/main/resources/static/css/plugins/summernote/summernote.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/summernote/summernote.css rename to src/main/resources/static/css/plugins/summernote/summernote.css diff --git a/bootdo/src/main/resources/static/css/plugins/sweetalert/sweetalert.css b/src/main/resources/static/css/plugins/sweetalert/sweetalert.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/sweetalert/sweetalert.css rename to src/main/resources/static/css/plugins/sweetalert/sweetalert.css diff --git a/bootdo/src/main/resources/static/css/plugins/switchery/switchery.css b/src/main/resources/static/css/plugins/switchery/switchery.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/switchery/switchery.css rename to src/main/resources/static/css/plugins/switchery/switchery.css diff --git a/bootdo/src/main/resources/static/css/plugins/toastr/toastr.min.css b/src/main/resources/static/css/plugins/toastr/toastr.min.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/toastr/toastr.min.css rename to src/main/resources/static/css/plugins/toastr/toastr.min.css diff --git a/bootdo/src/main/resources/static/css/plugins/treeview/bootstrap-treeview.css b/src/main/resources/static/css/plugins/treeview/bootstrap-treeview.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/treeview/bootstrap-treeview.css rename to src/main/resources/static/css/plugins/treeview/bootstrap-treeview.css diff --git a/bootdo/src/main/resources/static/css/plugins/webuploader/webuploader.css b/src/main/resources/static/css/plugins/webuploader/webuploader.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/webuploader/webuploader.css rename to src/main/resources/static/css/plugins/webuploader/webuploader.css diff --git a/bootdo/src/main/resources/static/css/plugins/zTree/awesome.css b/src/main/resources/static/css/plugins/zTree/awesome.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/zTree/awesome.css rename to src/main/resources/static/css/plugins/zTree/awesome.css diff --git a/bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/32px.png b/src/main/resources/static/css/plugins/zTree/metroStyle/img/32px.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/32px.png rename to src/main/resources/static/css/plugins/zTree/metroStyle/img/32px.png diff --git a/bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/line_conn.png b/src/main/resources/static/css/plugins/zTree/metroStyle/img/line_conn.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/line_conn.png rename to src/main/resources/static/css/plugins/zTree/metroStyle/img/line_conn.png diff --git a/bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/loading.gif b/src/main/resources/static/css/plugins/zTree/metroStyle/img/loading.gif similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/loading.gif rename to src/main/resources/static/css/plugins/zTree/metroStyle/img/loading.gif diff --git a/bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/metro.gif b/src/main/resources/static/css/plugins/zTree/metroStyle/img/metro.gif similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/metro.gif rename to src/main/resources/static/css/plugins/zTree/metroStyle/img/metro.gif diff --git a/bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/metro.png b/src/main/resources/static/css/plugins/zTree/metroStyle/img/metro.png similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/img/metro.png rename to src/main/resources/static/css/plugins/zTree/metroStyle/img/metro.png diff --git a/bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/metroStyle.css b/src/main/resources/static/css/plugins/zTree/metroStyle/metroStyle.css similarity index 100% rename from bootdo/src/main/resources/static/css/plugins/zTree/metroStyle/metroStyle.css rename to src/main/resources/static/css/plugins/zTree/metroStyle/metroStyle.css diff --git a/bootdo/src/main/resources/static/css/style.css b/src/main/resources/static/css/style.css similarity index 100% rename from bootdo/src/main/resources/static/css/style.css rename to src/main/resources/static/css/style.css diff --git a/bootdo/src/main/resources/static/editor-app/app-cfg.js b/src/main/resources/static/editor-app/app-cfg.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/app-cfg.js rename to src/main/resources/static/editor-app/app-cfg.js diff --git a/bootdo/src/main/resources/static/editor-app/app.js b/src/main/resources/static/editor-app/app.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/app.js rename to src/main/resources/static/editor-app/app.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-assignment-controller.js b/src/main/resources/static/editor-app/configuration/properties-assignment-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-assignment-controller.js rename to src/main/resources/static/editor-app/configuration/properties-assignment-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-condition-expression-controller.js b/src/main/resources/static/editor-app/configuration/properties-condition-expression-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-condition-expression-controller.js rename to src/main/resources/static/editor-app/configuration/properties-condition-expression-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-custom-controllers.js b/src/main/resources/static/editor-app/configuration/properties-custom-controllers.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-custom-controllers.js rename to src/main/resources/static/editor-app/configuration/properties-custom-controllers.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-default-controllers.js b/src/main/resources/static/editor-app/configuration/properties-default-controllers.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-default-controllers.js rename to src/main/resources/static/editor-app/configuration/properties-default-controllers.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-event-listeners-controller.js b/src/main/resources/static/editor-app/configuration/properties-event-listeners-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-event-listeners-controller.js rename to src/main/resources/static/editor-app/configuration/properties-event-listeners-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-execution-listeners-controller.js b/src/main/resources/static/editor-app/configuration/properties-execution-listeners-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-execution-listeners-controller.js rename to src/main/resources/static/editor-app/configuration/properties-execution-listeners-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-fields-controller.js b/src/main/resources/static/editor-app/configuration/properties-fields-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-fields-controller.js rename to src/main/resources/static/editor-app/configuration/properties-fields-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-form-properties-controller.js b/src/main/resources/static/editor-app/configuration/properties-form-properties-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-form-properties-controller.js rename to src/main/resources/static/editor-app/configuration/properties-form-properties-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-in-parameters-controller.js b/src/main/resources/static/editor-app/configuration/properties-in-parameters-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-in-parameters-controller.js rename to src/main/resources/static/editor-app/configuration/properties-in-parameters-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-message-definitions-controller.js b/src/main/resources/static/editor-app/configuration/properties-message-definitions-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-message-definitions-controller.js rename to src/main/resources/static/editor-app/configuration/properties-message-definitions-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-message-scope-controller.js b/src/main/resources/static/editor-app/configuration/properties-message-scope-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-message-scope-controller.js rename to src/main/resources/static/editor-app/configuration/properties-message-scope-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-multiinstance-controller.js b/src/main/resources/static/editor-app/configuration/properties-multiinstance-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-multiinstance-controller.js rename to src/main/resources/static/editor-app/configuration/properties-multiinstance-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-out-parameters-controller.js b/src/main/resources/static/editor-app/configuration/properties-out-parameters-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-out-parameters-controller.js rename to src/main/resources/static/editor-app/configuration/properties-out-parameters-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-sequenceflow-order-controller.js b/src/main/resources/static/editor-app/configuration/properties-sequenceflow-order-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-sequenceflow-order-controller.js rename to src/main/resources/static/editor-app/configuration/properties-sequenceflow-order-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-signal-definitions-controller.js b/src/main/resources/static/editor-app/configuration/properties-signal-definitions-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-signal-definitions-controller.js rename to src/main/resources/static/editor-app/configuration/properties-signal-definitions-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-signal-scope-controller.js b/src/main/resources/static/editor-app/configuration/properties-signal-scope-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-signal-scope-controller.js rename to src/main/resources/static/editor-app/configuration/properties-signal-scope-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties-task-listeners-controller.js b/src/main/resources/static/editor-app/configuration/properties-task-listeners-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties-task-listeners-controller.js rename to src/main/resources/static/editor-app/configuration/properties-task-listeners-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties.js b/src/main/resources/static/editor-app/configuration/properties.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties.js rename to src/main/resources/static/editor-app/configuration/properties.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/assignment-display-template.html b/src/main/resources/static/editor-app/configuration/properties/assignment-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/assignment-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/assignment-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/assignment-popup.html b/src/main/resources/static/editor-app/configuration/properties/assignment-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/assignment-popup.html rename to src/main/resources/static/editor-app/configuration/properties/assignment-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/assignment-write-template.html b/src/main/resources/static/editor-app/configuration/properties/assignment-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/assignment-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/assignment-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/boolean-property-template.html b/src/main/resources/static/editor-app/configuration/properties/boolean-property-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/boolean-property-template.html rename to src/main/resources/static/editor-app/configuration/properties/boolean-property-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/condition-expression-display-template.html b/src/main/resources/static/editor-app/configuration/properties/condition-expression-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/condition-expression-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/condition-expression-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/condition-expression-popup.html b/src/main/resources/static/editor-app/configuration/properties/condition-expression-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/condition-expression-popup.html rename to src/main/resources/static/editor-app/configuration/properties/condition-expression-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/condition-expression-write-template.html b/src/main/resources/static/editor-app/configuration/properties/condition-expression-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/condition-expression-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/condition-expression-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/default-value-display-template.html b/src/main/resources/static/editor-app/configuration/properties/default-value-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/default-value-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/default-value-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/event-listeners-display-template.html b/src/main/resources/static/editor-app/configuration/properties/event-listeners-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/event-listeners-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/event-listeners-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/event-listeners-popup.html b/src/main/resources/static/editor-app/configuration/properties/event-listeners-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/event-listeners-popup.html rename to src/main/resources/static/editor-app/configuration/properties/event-listeners-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/event-listeners-write-template.html b/src/main/resources/static/editor-app/configuration/properties/event-listeners-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/event-listeners-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/event-listeners-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/execution-listeners-display-template.html b/src/main/resources/static/editor-app/configuration/properties/execution-listeners-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/execution-listeners-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/execution-listeners-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/execution-listeners-popup.html b/src/main/resources/static/editor-app/configuration/properties/execution-listeners-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/execution-listeners-popup.html rename to src/main/resources/static/editor-app/configuration/properties/execution-listeners-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/execution-listeners-write-template.html b/src/main/resources/static/editor-app/configuration/properties/execution-listeners-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/execution-listeners-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/execution-listeners-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/feedback-popup.html b/src/main/resources/static/editor-app/configuration/properties/feedback-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/feedback-popup.html rename to src/main/resources/static/editor-app/configuration/properties/feedback-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/fields-display-template.html b/src/main/resources/static/editor-app/configuration/properties/fields-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/fields-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/fields-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/fields-popup.html b/src/main/resources/static/editor-app/configuration/properties/fields-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/fields-popup.html rename to src/main/resources/static/editor-app/configuration/properties/fields-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/fields-write-template.html b/src/main/resources/static/editor-app/configuration/properties/fields-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/fields-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/fields-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/form-properties-display-template.html b/src/main/resources/static/editor-app/configuration/properties/form-properties-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/form-properties-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/form-properties-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/form-properties-popup.html b/src/main/resources/static/editor-app/configuration/properties/form-properties-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/form-properties-popup.html rename to src/main/resources/static/editor-app/configuration/properties/form-properties-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/form-properties-write-template.html b/src/main/resources/static/editor-app/configuration/properties/form-properties-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/form-properties-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/form-properties-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/in-parameters-display-template.html b/src/main/resources/static/editor-app/configuration/properties/in-parameters-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/in-parameters-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/in-parameters-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/in-parameters-popup.html b/src/main/resources/static/editor-app/configuration/properties/in-parameters-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/in-parameters-popup.html rename to src/main/resources/static/editor-app/configuration/properties/in-parameters-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/in-parameters-write-template.html b/src/main/resources/static/editor-app/configuration/properties/in-parameters-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/in-parameters-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/in-parameters-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/message-definitions-display-template.html b/src/main/resources/static/editor-app/configuration/properties/message-definitions-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/message-definitions-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/message-definitions-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/message-definitions-popup.html b/src/main/resources/static/editor-app/configuration/properties/message-definitions-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/message-definitions-popup.html rename to src/main/resources/static/editor-app/configuration/properties/message-definitions-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/message-definitions-write-template.html b/src/main/resources/static/editor-app/configuration/properties/message-definitions-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/message-definitions-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/message-definitions-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/message-property-write-template.html b/src/main/resources/static/editor-app/configuration/properties/message-property-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/message-property-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/message-property-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/multiinstance-property-write-template.html b/src/main/resources/static/editor-app/configuration/properties/multiinstance-property-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/multiinstance-property-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/multiinstance-property-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/out-parameters-display-template.html b/src/main/resources/static/editor-app/configuration/properties/out-parameters-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/out-parameters-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/out-parameters-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/out-parameters-popup.html b/src/main/resources/static/editor-app/configuration/properties/out-parameters-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/out-parameters-popup.html rename to src/main/resources/static/editor-app/configuration/properties/out-parameters-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/out-parameters-write-template.html b/src/main/resources/static/editor-app/configuration/properties/out-parameters-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/out-parameters-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/out-parameters-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-display-template.html b/src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-popup.html b/src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-popup.html rename to src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-write-template.html b/src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/sequenceflow-order-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/signal-definitions-display-template.html b/src/main/resources/static/editor-app/configuration/properties/signal-definitions-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/signal-definitions-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/signal-definitions-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/signal-definitions-popup.html b/src/main/resources/static/editor-app/configuration/properties/signal-definitions-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/signal-definitions-popup.html rename to src/main/resources/static/editor-app/configuration/properties/signal-definitions-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/signal-definitions-write-template.html b/src/main/resources/static/editor-app/configuration/properties/signal-definitions-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/signal-definitions-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/signal-definitions-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/signal-property-write-template.html b/src/main/resources/static/editor-app/configuration/properties/signal-property-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/signal-property-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/signal-property-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/string-property-write-mode-template.html b/src/main/resources/static/editor-app/configuration/properties/string-property-write-mode-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/string-property-write-mode-template.html rename to src/main/resources/static/editor-app/configuration/properties/string-property-write-mode-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/subprocess-reference-display-template.html b/src/main/resources/static/editor-app/configuration/properties/subprocess-reference-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/subprocess-reference-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/subprocess-reference-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/subprocess-reference-popup.html b/src/main/resources/static/editor-app/configuration/properties/subprocess-reference-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/subprocess-reference-popup.html rename to src/main/resources/static/editor-app/configuration/properties/subprocess-reference-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/subprocess-reference-write-template.html b/src/main/resources/static/editor-app/configuration/properties/subprocess-reference-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/subprocess-reference-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/subprocess-reference-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/task-listeners-display-template.html b/src/main/resources/static/editor-app/configuration/properties/task-listeners-display-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/task-listeners-display-template.html rename to src/main/resources/static/editor-app/configuration/properties/task-listeners-display-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/task-listeners-popup.html b/src/main/resources/static/editor-app/configuration/properties/task-listeners-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/task-listeners-popup.html rename to src/main/resources/static/editor-app/configuration/properties/task-listeners-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/task-listeners-write-template.html b/src/main/resources/static/editor-app/configuration/properties/task-listeners-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/task-listeners-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/task-listeners-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/text-popup.html b/src/main/resources/static/editor-app/configuration/properties/text-popup.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/text-popup.html rename to src/main/resources/static/editor-app/configuration/properties/text-popup.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/properties/text-property-write-template.html b/src/main/resources/static/editor-app/configuration/properties/text-property-write-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/properties/text-property-write-template.html rename to src/main/resources/static/editor-app/configuration/properties/text-property-write-template.html diff --git a/bootdo/src/main/resources/static/editor-app/configuration/toolbar-custom-actions.js b/src/main/resources/static/editor-app/configuration/toolbar-custom-actions.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/toolbar-custom-actions.js rename to src/main/resources/static/editor-app/configuration/toolbar-custom-actions.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/toolbar-default-actions.js b/src/main/resources/static/editor-app/configuration/toolbar-default-actions.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/toolbar-default-actions.js rename to src/main/resources/static/editor-app/configuration/toolbar-default-actions.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/toolbar.js b/src/main/resources/static/editor-app/configuration/toolbar.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/toolbar.js rename to src/main/resources/static/editor-app/configuration/toolbar.js diff --git a/bootdo/src/main/resources/static/editor-app/configuration/url-config.js b/src/main/resources/static/editor-app/configuration/url-config.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/configuration/url-config.js rename to src/main/resources/static/editor-app/configuration/url-config.js diff --git a/bootdo/src/main/resources/static/editor-app/css/style-common.css b/src/main/resources/static/editor-app/css/style-common.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/css/style-common.css rename to src/main/resources/static/editor-app/css/style-common.css diff --git a/bootdo/src/main/resources/static/editor-app/css/style-editor.css b/src/main/resources/static/editor-app/css/style-editor.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/css/style-editor.css rename to src/main/resources/static/editor-app/css/style-editor.css diff --git a/bootdo/src/main/resources/static/editor-app/css/style.css b/src/main/resources/static/editor-app/css/style.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/css/style.css rename to src/main/resources/static/editor-app/css/style.css diff --git a/bootdo/src/main/resources/static/editor-app/editor-config.js b/src/main/resources/static/editor-app/editor-config.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor-config.js rename to src/main/resources/static/editor-app/editor-config.js diff --git a/bootdo/src/main/resources/static/editor-app/editor-controller.js b/src/main/resources/static/editor-app/editor-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor-controller.js rename to src/main/resources/static/editor-app/editor-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/editor-utils.js b/src/main/resources/static/editor-app/editor-utils.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor-utils.js rename to src/main/resources/static/editor-app/editor-utils.js diff --git a/bootdo/src/main/resources/static/editor-app/editor.html b/src/main/resources/static/editor-app/editor.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor.html rename to src/main/resources/static/editor-app/editor.html diff --git a/bootdo/src/main/resources/static/editor-app/editor/css/editor.css b/src/main/resources/static/editor-app/editor/css/editor.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor/css/editor.css rename to src/main/resources/static/editor-app/editor/css/editor.css diff --git a/bootdo/src/main/resources/static/editor-app/editor/i18n/translation_de.js b/src/main/resources/static/editor-app/editor/i18n/translation_de.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor/i18n/translation_de.js rename to src/main/resources/static/editor-app/editor/i18n/translation_de.js diff --git a/bootdo/src/main/resources/static/editor-app/editor/i18n/translation_en_us.js b/src/main/resources/static/editor-app/editor/i18n/translation_en_us.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor/i18n/translation_en_us.js rename to src/main/resources/static/editor-app/editor/i18n/translation_en_us.js diff --git a/bootdo/src/main/resources/static/editor-app/editor/i18n/translation_signavio_de.js b/src/main/resources/static/editor-app/editor/i18n/translation_signavio_de.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor/i18n/translation_signavio_de.js rename to src/main/resources/static/editor-app/editor/i18n/translation_signavio_de.js diff --git a/bootdo/src/main/resources/static/editor-app/editor/i18n/translation_signavio_en_us.js b/src/main/resources/static/editor-app/editor/i18n/translation_signavio_en_us.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor/i18n/translation_signavio_en_us.js rename to src/main/resources/static/editor-app/editor/i18n/translation_signavio_en_us.js diff --git a/bootdo/src/main/resources/static/editor-app/editor/oryx.debug.js b/src/main/resources/static/editor-app/editor/oryx.debug.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor/oryx.debug.js rename to src/main/resources/static/editor-app/editor/oryx.debug.js diff --git a/bootdo/src/main/resources/static/editor-app/editor/oryx.js b/src/main/resources/static/editor-app/editor/oryx.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/editor/oryx.js rename to src/main/resources/static/editor-app/editor/oryx.js diff --git a/bootdo/src/main/resources/static/editor-app/eventbus.js b/src/main/resources/static/editor-app/eventbus.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/eventbus.js rename to src/main/resources/static/editor-app/eventbus.js diff --git a/bootdo/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.eot b/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.eot similarity index 100% rename from bootdo/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.eot rename to src/main/resources/static/editor-app/fonts/activiti-admin-webfont.eot diff --git a/bootdo/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.svg b/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.svg similarity index 100% rename from bootdo/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.svg rename to src/main/resources/static/editor-app/fonts/activiti-admin-webfont.svg diff --git a/bootdo/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.ttf b/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.ttf similarity index 100% rename from bootdo/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.ttf rename to src/main/resources/static/editor-app/fonts/activiti-admin-webfont.ttf diff --git a/bootdo/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.woff b/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.woff similarity index 100% rename from bootdo/src/main/resources/static/editor-app/fonts/activiti-admin-webfont.woff rename to src/main/resources/static/editor-app/fonts/activiti-admin-webfont.woff diff --git a/bootdo/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.eot b/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from bootdo/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.eot rename to src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.eot diff --git a/bootdo/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.svg b/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from bootdo/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.svg rename to src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.svg diff --git a/bootdo/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.ttf b/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from bootdo/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.ttf rename to src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.ttf diff --git a/bootdo/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.woff b/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from bootdo/src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.woff rename to src/main/resources/static/editor-app/fonts/glyphicons-halflings-regular.woff diff --git a/bootdo/src/main/resources/static/editor-app/header-controller.js b/src/main/resources/static/editor-app/header-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/header-controller.js rename to src/main/resources/static/editor-app/header-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/i18n/en.json b/src/main/resources/static/editor-app/i18n/en.json similarity index 100% rename from bootdo/src/main/resources/static/editor-app/i18n/en.json rename to src/main/resources/static/editor-app/i18n/en.json diff --git a/bootdo/src/main/resources/static/editor-app/images/bpmn-error.png b/src/main/resources/static/editor-app/images/bpmn-error.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/bpmn-error.png rename to src/main/resources/static/editor-app/images/bpmn-error.png diff --git a/bootdo/src/main/resources/static/editor-app/images/bpmn-warning.png b/src/main/resources/static/editor-app/images/bpmn-warning.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/bpmn-warning.png rename to src/main/resources/static/editor-app/images/bpmn-warning.png diff --git a/bootdo/src/main/resources/static/editor-app/images/datadefinition.png b/src/main/resources/static/editor-app/images/datadefinition.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/datadefinition.png rename to src/main/resources/static/editor-app/images/datadefinition.png diff --git a/bootdo/src/main/resources/static/editor-app/images/delete.png b/src/main/resources/static/editor-app/images/delete.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/delete.png rename to src/main/resources/static/editor-app/images/delete.png diff --git a/bootdo/src/main/resources/static/editor-app/images/loading.gif b/src/main/resources/static/editor-app/images/loading.gif similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/loading.gif rename to src/main/resources/static/editor-app/images/loading.gif diff --git a/bootdo/src/main/resources/static/editor-app/images/logo-2x.png b/src/main/resources/static/editor-app/images/logo-2x.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/logo-2x.png rename to src/main/resources/static/editor-app/images/logo-2x.png diff --git a/bootdo/src/main/resources/static/editor-app/images/logo.png b/src/main/resources/static/editor-app/images/logo.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/logo.png rename to src/main/resources/static/editor-app/images/logo.png diff --git a/bootdo/src/main/resources/static/editor-app/images/nw-handle-dark.gif b/src/main/resources/static/editor-app/images/nw-handle-dark.gif similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/nw-handle-dark.gif rename to src/main/resources/static/editor-app/images/nw-handle-dark.gif diff --git a/bootdo/src/main/resources/static/editor-app/images/se-handle-dark.gif b/src/main/resources/static/editor-app/images/se-handle-dark.gif similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/se-handle-dark.gif rename to src/main/resources/static/editor-app/images/se-handle-dark.gif diff --git a/bootdo/src/main/resources/static/editor-app/images/shapemenu_highlight.png b/src/main/resources/static/editor-app/images/shapemenu_highlight.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/shapemenu_highlight.png rename to src/main/resources/static/editor-app/images/shapemenu_highlight.png diff --git a/bootdo/src/main/resources/static/editor-app/images/wrench.png b/src/main/resources/static/editor-app/images/wrench.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/images/wrench.png rename to src/main/resources/static/editor-app/images/wrench.png diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js b/src/main/resources/static/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js rename to src/main/resources/static/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js.map b/src/main/resources/static/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js.map similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js.map rename to src/main/resources/static/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js.map diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-dragdrop.min-1.0.3.js b/src/main/resources/static/editor-app/libs/angular-dragdrop.min-1.0.3.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-dragdrop.min-1.0.3.js rename to src/main/resources/static/editor-app/libs/angular-dragdrop.min-1.0.3.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-dragdrop_1.0.7/angular-dragdrop.min.js b/src/main/resources/static/editor-app/libs/angular-dragdrop_1.0.7/angular-dragdrop.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-dragdrop_1.0.7/angular-dragdrop.min.js rename to src/main/resources/static/editor-app/libs/angular-dragdrop_1.0.7/angular-dragdrop.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-mocks_1.2.13/angular-mocks.js b/src/main/resources/static/editor-app/libs/angular-mocks_1.2.13/angular-mocks.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-mocks_1.2.13/angular-mocks.js rename to src/main/resources/static/editor-app/libs/angular-mocks_1.2.13/angular-mocks.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.js b/src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.js rename to src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js b/src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js rename to src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js.map b/src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js.map similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js.map rename to src/main/resources/static/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js.map diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.js b/src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.js rename to src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.min.js b/src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.min.js rename to src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.min.js.map b/src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.min.js.map similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.min.js.map rename to src/main/resources/static/editor-app/libs/angular-route_1.2.13/angular-route.min.js.map diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.js b/src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.js rename to src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js b/src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js rename to src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js.map b/src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js.map similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js.map rename to src/main/resources/static/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js.map diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js b/src/main/resources/static/editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js rename to src/main/resources/static/editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-strap_2.0.5/angular-strap.min.js b/src/main/resources/static/editor-app/libs/angular-strap_2.0.5/angular-strap.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-strap_2.0.5/angular-strap.min.js rename to src/main/resources/static/editor-app/libs/angular-strap_2.0.5/angular-strap.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js b/src/main/resources/static/editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js rename to src/main/resources/static/editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/.bower.json b/src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/.bower.json similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/.bower.json rename to src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/.bower.json diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js b/src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js rename to src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js b/src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js rename to src/main/resources/static/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/.bower.json b/src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/.bower.json similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/.bower.json rename to src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/.bower.json diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js b/src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js rename to src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js b/src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js rename to src/main/resources/static/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-translate_2.4.2/angular-translate.js b/src/main/resources/static/editor-app/libs/angular-translate_2.4.2/angular-translate.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-translate_2.4.2/angular-translate.js rename to src/main/resources/static/editor-app/libs/angular-translate_2.4.2/angular-translate.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular-translate_2.4.2/angular-translate.min.js b/src/main/resources/static/editor-app/libs/angular-translate_2.4.2/angular-translate.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular-translate_2.4.2/angular-translate.min.js rename to src/main/resources/static/editor-app/libs/angular-translate_2.4.2/angular-translate.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular_1.2.13/angular-animate.min.js b/src/main/resources/static/editor-app/libs/angular_1.2.13/angular-animate.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular_1.2.13/angular-animate.min.js rename to src/main/resources/static/editor-app/libs/angular_1.2.13/angular-animate.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/angular_1.2.13/angular.min.js b/src/main/resources/static/editor-app/libs/angular_1.2.13/angular.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/angular_1.2.13/angular.min.js rename to src/main/resources/static/editor-app/libs/angular_1.2.13/angular.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker-bs3.css b/src/main/resources/static/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker-bs3.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker-bs3.css rename to src/main/resources/static/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker-bs3.css diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker.js b/src/main/resources/static/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker.js rename to src/main/resources/static/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css.map b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css.map similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css.map rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css.map diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.min.css b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.min.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.min.css rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.min.css diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css.map b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css.map similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css.map rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css.map diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.eot b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.eot rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.eot diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.svg b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.svg rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.svg diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.ttf b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.ttf rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.ttf diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.woff b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.woff rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.woff diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js b/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js rename to src/main/resources/static/editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/.bower.json b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/.bower.json similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/.bower.json rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/.bower.json diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/.gitignore b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/.gitignore similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/.gitignore rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/.gitignore diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/CHANGES b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/CHANGES similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/CHANGES rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/CHANGES diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/CONTRIBUTORS.md b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/CONTRIBUTORS.md similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/CONTRIBUTORS.md rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/CONTRIBUTORS.md diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/LICENSE b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/LICENSE similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/LICENSE rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/LICENSE diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/README.md b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/README.md similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/README.md rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/README.md diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.map b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.map similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.map rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.map diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.min.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.min.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-sham.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.map b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.map similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.map rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.map diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.min.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.min.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/es5-shim.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/package.json b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/package.json similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/package.json rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/package.json diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-matchers.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-matchers.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-matchers.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-matchers.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/index.html b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/index.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/index.html rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/index.html diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/index.min.html b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/index.min.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/index.min.html rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/index.min.html diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine-html.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine-html.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine-html.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine-html.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.css b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.css rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.css diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine_favicon.png b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine_favicon.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine_favicon.png rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine_favicon.png diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/json2.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/json2.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/json2.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/lib/json2.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-array.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-array.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-array.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-array.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-date.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-date.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-date.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-date.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-function.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-function.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-function.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-function.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-number.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-number.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-number.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-number.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-object.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-object.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-object.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-object.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-string.js b/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-string.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-string.js rename to src/main/resources/static/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-string.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/jquery-ui-1.10.3.custom.min.js b/src/main/resources/static/editor-app/libs/jquery-ui-1.10.3.custom.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/jquery-ui-1.10.3.custom.min.js rename to src/main/resources/static/editor-app/libs/jquery-ui-1.10.3.custom.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/jquery.autogrow-textarea.js b/src/main/resources/static/editor-app/libs/jquery.autogrow-textarea.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/jquery.autogrow-textarea.js rename to src/main/resources/static/editor-app/libs/jquery.autogrow-textarea.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.js b/src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.js rename to src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.min.js b/src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.min.js rename to src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.min.map b/src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.min.map similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.min.map rename to src/main/resources/static/editor-app/libs/jquery_1.11.0/jquery.min.map diff --git a/bootdo/src/main/resources/static/editor-app/libs/json3_3.2.6/LICENSE b/src/main/resources/static/editor-app/libs/json3_3.2.6/LICENSE similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/json3_3.2.6/LICENSE rename to src/main/resources/static/editor-app/libs/json3_3.2.6/LICENSE diff --git a/bootdo/src/main/resources/static/editor-app/libs/json3_3.2.6/lib/json3.js b/src/main/resources/static/editor-app/libs/json3_3.2.6/lib/json3.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/json3_3.2.6/lib/json3.js rename to src/main/resources/static/editor-app/libs/json3_3.2.6/lib/json3.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/json3_3.2.6/lib/json3.min.js b/src/main/resources/static/editor-app/libs/json3_3.2.6/lib/json3.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/json3_3.2.6/lib/json3.min.js rename to src/main/resources/static/editor-app/libs/json3_3.2.6/lib/json3.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/momentjs_2.5.1/momentjs.min.js b/src/main/resources/static/editor-app/libs/momentjs_2.5.1/momentjs.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/momentjs_2.5.1/momentjs.min.js rename to src/main/resources/static/editor-app/libs/momentjs_2.5.1/momentjs.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/mousetrap-1.4.5.min.js b/src/main/resources/static/editor-app/libs/mousetrap-1.4.5.min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/mousetrap-1.4.5.min.js rename to src/main/resources/static/editor-app/libs/mousetrap-1.4.5.min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/ng-grid-2.0.7-min.js b/src/main/resources/static/editor-app/libs/ng-grid-2.0.7-min.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/ng-grid-2.0.7-min.js rename to src/main/resources/static/editor-app/libs/ng-grid-2.0.7-min.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/ng-grid-2.0.7.min.css b/src/main/resources/static/editor-app/libs/ng-grid-2.0.7.min.css similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/ng-grid-2.0.7.min.css rename to src/main/resources/static/editor-app/libs/ng-grid-2.0.7.min.css diff --git a/bootdo/src/main/resources/static/editor-app/libs/path_parser.js b/src/main/resources/static/editor-app/libs/path_parser.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/path_parser.js rename to src/main/resources/static/editor-app/libs/path_parser.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/prototype-1.5.1.js b/src/main/resources/static/editor-app/libs/prototype-1.5.1.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/prototype-1.5.1.js rename to src/main/resources/static/editor-app/libs/prototype-1.5.1.js diff --git a/bootdo/src/main/resources/static/editor-app/libs/ui-utils.min-0.0.4.js b/src/main/resources/static/editor-app/libs/ui-utils.min-0.0.4.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/libs/ui-utils.min-0.0.4.js rename to src/main/resources/static/editor-app/libs/ui-utils.min-0.0.4.js diff --git a/bootdo/src/main/resources/static/editor-app/partials/root-stencil-item-template.html b/src/main/resources/static/editor-app/partials/root-stencil-item-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/partials/root-stencil-item-template.html rename to src/main/resources/static/editor-app/partials/root-stencil-item-template.html diff --git a/bootdo/src/main/resources/static/editor-app/partials/stencil-item-template.html b/src/main/resources/static/editor-app/partials/stencil-item-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/partials/stencil-item-template.html rename to src/main/resources/static/editor-app/partials/stencil-item-template.html diff --git a/bootdo/src/main/resources/static/editor-app/plugins.xml b/src/main/resources/static/editor-app/plugins.xml similarity index 100% rename from bootdo/src/main/resources/static/editor-app/plugins.xml rename to src/main/resources/static/editor-app/plugins.xml diff --git a/bootdo/src/main/resources/static/editor-app/popups/icon-template.html b/src/main/resources/static/editor-app/popups/icon-template.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/popups/icon-template.html rename to src/main/resources/static/editor-app/popups/icon-template.html diff --git a/bootdo/src/main/resources/static/editor-app/popups/save-model.html b/src/main/resources/static/editor-app/popups/save-model.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/popups/save-model.html rename to src/main/resources/static/editor-app/popups/save-model.html diff --git a/bootdo/src/main/resources/static/editor-app/popups/select-shape.html b/src/main/resources/static/editor-app/popups/select-shape.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/popups/select-shape.html rename to src/main/resources/static/editor-app/popups/select-shape.html diff --git a/bootdo/src/main/resources/static/editor-app/popups/unsaved-changes.html b/src/main/resources/static/editor-app/popups/unsaved-changes.html similarity index 100% rename from bootdo/src/main/resources/static/editor-app/popups/unsaved-changes.html rename to src/main/resources/static/editor-app/popups/unsaved-changes.html diff --git a/bootdo/src/main/resources/static/editor-app/select-shape-controller.js b/src/main/resources/static/editor-app/select-shape-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/select-shape-controller.js rename to src/main/resources/static/editor-app/select-shape-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/stencil-controller.js b/src/main/resources/static/editor-app/stencil-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencil-controller.js rename to src/main/resources/static/editor-app/stencil-controller.js diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.collapsed.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.collapsed.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.collapsed.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.collapsed.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/expanded.subprocess.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/expanded.subprocess.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/expanded.subprocess.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/expanded.subprocess.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.business.rule.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.business.rule.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.business.rule.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.business.rule.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.camel.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.camel.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.camel.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.camel.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.manual.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.manual.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.manual.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.manual.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.mule.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.mule.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.mule.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.mule.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.receive.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.receive.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.receive.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.receive.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.script.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.script.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.script.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.script.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.send.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.send.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.send.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.send.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.service.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.service.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.service.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.service.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.shell.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.shell.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.shell.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.shell.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.user.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.user.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.user.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.user.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/subprocess.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/subprocess.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/subprocess.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/subprocess.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/task.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/task.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/task.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/activity/task.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/artifact/text.annotation.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/artifact/text.annotation.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/artifact/text.annotation.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/artifact/text.annotation.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/cancel.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/cancel.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/cancel.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/cancel.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/compensation.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/compensation.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/compensation.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/compensation.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/error.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/error.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/error.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/error.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/message.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/message.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/message.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/message.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/signal.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/signal.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/signal.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/signal.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/timer.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/timer.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/timer.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/catching/timer.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/association.undirected.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/association.undirected.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/association.undirected.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/association.undirected.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/association.unidirectional.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/association.unidirectional.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/association.unidirectional.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/association.unidirectional.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/messageflow.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/messageflow.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/messageflow.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/messageflow.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/sequenceflow.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/sequenceflow.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/sequenceflow.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/connector/sequenceflow.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/dataobject/data.store.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/dataobject/data.store.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/dataobject/data.store.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/dataobject/data.store.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/diagram.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/diagram.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/diagram.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/diagram.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/cancel.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/cancel.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/cancel.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/cancel.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/error.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/error.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/error.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/error.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/none.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/none.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/none.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/none.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/terminate.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/terminate.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/terminate.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/endevent/terminate.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/eventbased.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/eventbased.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/eventbased.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/eventbased.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/exclusive.databased.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/exclusive.databased.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/exclusive.databased.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/exclusive.databased.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/inclusive.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/inclusive.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/inclusive.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/inclusive.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/parallel.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/parallel.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/parallel.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/gateway/parallel.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/error.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/error.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/error.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/error.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/message.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/message.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/message.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/message.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/none.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/none.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/none.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/none.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/signal.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/signal.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/signal.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/signal.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/timer.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/timer.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/timer.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/startevent/timer.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/swimlane/lane.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/swimlane/lane.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/swimlane/lane.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/swimlane/lane.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/swimlane/pool.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/swimlane/pool.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/swimlane/pool.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/swimlane/pool.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/throwing/none.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/throwing/none.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/throwing/none.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/throwing/none.png diff --git a/bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/throwing/signal.png b/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/throwing/signal.png similarity index 100% rename from bootdo/src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/throwing/signal.png rename to src/main/resources/static/editor-app/stencilsets/bpmn2.0/icons/throwing/signal.png diff --git a/bootdo/src/main/resources/static/editor-app/toolbar-controller.js b/src/main/resources/static/editor-app/toolbar-controller.js similarity index 100% rename from bootdo/src/main/resources/static/editor-app/toolbar-controller.js rename to src/main/resources/static/editor-app/toolbar-controller.js diff --git a/bootdo/src/main/resources/static/favicon.ico b/src/main/resources/static/favicon.ico similarity index 100% rename from bootdo/src/main/resources/static/favicon.ico rename to src/main/resources/static/favicon.ico diff --git a/bootdo/src/main/resources/static/fonts/FontAwesome.otf b/src/main/resources/static/fonts/FontAwesome.otf similarity index 100% rename from bootdo/src/main/resources/static/fonts/FontAwesome.otf rename to src/main/resources/static/fonts/FontAwesome.otf diff --git a/bootdo/src/main/resources/static/fonts/fontawesome-webfont.eot b/src/main/resources/static/fonts/fontawesome-webfont.eot similarity index 100% rename from bootdo/src/main/resources/static/fonts/fontawesome-webfont.eot rename to src/main/resources/static/fonts/fontawesome-webfont.eot diff --git a/bootdo/src/main/resources/static/fonts/fontawesome-webfont.svg b/src/main/resources/static/fonts/fontawesome-webfont.svg similarity index 100% rename from bootdo/src/main/resources/static/fonts/fontawesome-webfont.svg rename to src/main/resources/static/fonts/fontawesome-webfont.svg diff --git a/bootdo/src/main/resources/static/fonts/fontawesome-webfont.ttf b/src/main/resources/static/fonts/fontawesome-webfont.ttf similarity index 100% rename from bootdo/src/main/resources/static/fonts/fontawesome-webfont.ttf rename to src/main/resources/static/fonts/fontawesome-webfont.ttf diff --git a/bootdo/src/main/resources/static/fonts/fontawesome-webfont.woff b/src/main/resources/static/fonts/fontawesome-webfont.woff similarity index 100% rename from bootdo/src/main/resources/static/fonts/fontawesome-webfont.woff rename to src/main/resources/static/fonts/fontawesome-webfont.woff diff --git a/bootdo/src/main/resources/static/fonts/fontawesome-webfont.woff2 b/src/main/resources/static/fonts/fontawesome-webfont.woff2 similarity index 100% rename from bootdo/src/main/resources/static/fonts/fontawesome-webfont.woff2 rename to src/main/resources/static/fonts/fontawesome-webfont.woff2 diff --git a/bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.eot b/src/main/resources/static/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.eot rename to src/main/resources/static/fonts/glyphicons-halflings-regular.eot diff --git a/bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.svg b/src/main/resources/static/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.svg rename to src/main/resources/static/fonts/glyphicons-halflings-regular.svg diff --git a/bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf b/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.ttf rename to src/main/resources/static/fonts/glyphicons-halflings-regular.ttf diff --git a/bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.woff b/src/main/resources/static/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.woff rename to src/main/resources/static/fonts/glyphicons-halflings-regular.woff diff --git a/bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2 b/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2 similarity index 100% rename from bootdo/src/main/resources/static/fonts/glyphicons-halflings-regular.woff2 rename to src/main/resources/static/fonts/glyphicons-halflings-regular.woff2 diff --git a/bootdo/src/main/resources/static/fonts/icomoon/icomoon.eot b/src/main/resources/static/fonts/icomoon/icomoon.eot similarity index 100% rename from bootdo/src/main/resources/static/fonts/icomoon/icomoon.eot rename to src/main/resources/static/fonts/icomoon/icomoon.eot diff --git a/bootdo/src/main/resources/static/fonts/icomoon/icomoon.svg b/src/main/resources/static/fonts/icomoon/icomoon.svg similarity index 100% rename from bootdo/src/main/resources/static/fonts/icomoon/icomoon.svg rename to src/main/resources/static/fonts/icomoon/icomoon.svg diff --git a/bootdo/src/main/resources/static/fonts/icomoon/icomoon.ttf b/src/main/resources/static/fonts/icomoon/icomoon.ttf similarity index 100% rename from bootdo/src/main/resources/static/fonts/icomoon/icomoon.ttf rename to src/main/resources/static/fonts/icomoon/icomoon.ttf diff --git a/bootdo/src/main/resources/static/fonts/icomoon/icomoon.woff b/src/main/resources/static/fonts/icomoon/icomoon.woff similarity index 100% rename from bootdo/src/main/resources/static/fonts/icomoon/icomoon.woff rename to src/main/resources/static/fonts/icomoon/icomoon.woff diff --git a/bootdo/src/main/resources/static/img/a1.jpg b/src/main/resources/static/img/a1.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/a1.jpg rename to src/main/resources/static/img/a1.jpg diff --git a/bootdo/src/main/resources/static/img/a2.jpg b/src/main/resources/static/img/a2.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/a2.jpg rename to src/main/resources/static/img/a2.jpg diff --git a/bootdo/src/main/resources/static/img/a3.jpg b/src/main/resources/static/img/a3.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/a3.jpg rename to src/main/resources/static/img/a3.jpg diff --git a/bootdo/src/main/resources/static/img/a4.jpg b/src/main/resources/static/img/a4.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/a4.jpg rename to src/main/resources/static/img/a4.jpg diff --git a/bootdo/src/main/resources/static/img/a5.jpg b/src/main/resources/static/img/a5.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/a5.jpg rename to src/main/resources/static/img/a5.jpg diff --git a/bootdo/src/main/resources/static/img/a6.jpg b/src/main/resources/static/img/a6.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/a6.jpg rename to src/main/resources/static/img/a6.jpg diff --git a/bootdo/src/main/resources/static/img/a7.jpg b/src/main/resources/static/img/a7.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/a7.jpg rename to src/main/resources/static/img/a7.jpg diff --git a/bootdo/src/main/resources/static/img/a8.jpg b/src/main/resources/static/img/a8.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/a8.jpg rename to src/main/resources/static/img/a8.jpg diff --git a/bootdo/src/main/resources/static/img/a9.jpg b/src/main/resources/static/img/a9.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/a9.jpg rename to src/main/resources/static/img/a9.jpg diff --git a/bootdo/src/main/resources/static/img/backg01.jpg b/src/main/resources/static/img/backg01.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/backg01.jpg rename to src/main/resources/static/img/backg01.jpg diff --git a/bootdo/src/main/resources/static/img/backg02.jpg b/src/main/resources/static/img/backg02.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/backg02.jpg rename to src/main/resources/static/img/backg02.jpg diff --git a/bootdo/src/main/resources/static/img/background-login.jpg b/src/main/resources/static/img/background-login.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/background-login.jpg rename to src/main/resources/static/img/background-login.jpg diff --git a/bootdo/src/main/resources/static/img/background_login.jpg b/src/main/resources/static/img/background_login.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/background_login.jpg rename to src/main/resources/static/img/background_login.jpg diff --git a/bootdo/src/main/resources/static/img/bg.png b/src/main/resources/static/img/bg.png similarity index 100% rename from bootdo/src/main/resources/static/img/bg.png rename to src/main/resources/static/img/bg.png diff --git a/bootdo/src/main/resources/static/img/blog/about-bg.jpg b/src/main/resources/static/img/blog/about-bg.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/blog/about-bg.jpg rename to src/main/resources/static/img/blog/about-bg.jpg diff --git a/bootdo/src/main/resources/static/img/blog/contact-bg.jpg b/src/main/resources/static/img/blog/contact-bg.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/blog/contact-bg.jpg rename to src/main/resources/static/img/blog/contact-bg.jpg diff --git a/bootdo/src/main/resources/static/img/blog/home-bg.jpg b/src/main/resources/static/img/blog/home-bg.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/blog/home-bg.jpg rename to src/main/resources/static/img/blog/home-bg.jpg diff --git a/bootdo/src/main/resources/static/img/blog/post-bg.jpg b/src/main/resources/static/img/blog/post-bg.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/blog/post-bg.jpg rename to src/main/resources/static/img/blog/post-bg.jpg diff --git a/bootdo/src/main/resources/static/img/blog/post-sample-image.jpg b/src/main/resources/static/img/blog/post-sample-image.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/blog/post-sample-image.jpg rename to src/main/resources/static/img/blog/post-sample-image.jpg diff --git a/bootdo/src/main/resources/static/img/blog/qqbootdo.png b/src/main/resources/static/img/blog/qqbootdo.png similarity index 100% rename from bootdo/src/main/resources/static/img/blog/qqbootdo.png rename to src/main/resources/static/img/blog/qqbootdo.png diff --git a/bootdo/src/main/resources/static/img/browser.png b/src/main/resources/static/img/browser.png similarity index 100% rename from bootdo/src/main/resources/static/img/browser.png rename to src/main/resources/static/img/browser.png diff --git a/bootdo/src/main/resources/static/img/browser.psd b/src/main/resources/static/img/browser.psd similarity index 100% rename from bootdo/src/main/resources/static/img/browser.psd rename to src/main/resources/static/img/browser.psd diff --git a/bootdo/src/main/resources/static/img/court.jpg b/src/main/resources/static/img/court.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/court.jpg rename to src/main/resources/static/img/court.jpg diff --git a/bootdo/src/main/resources/static/img/iconfont-logo.png b/src/main/resources/static/img/iconfont-logo.png similarity index 100% rename from bootdo/src/main/resources/static/img/iconfont-logo.png rename to src/main/resources/static/img/iconfont-logo.png diff --git a/bootdo/src/main/resources/static/img/icons.png b/src/main/resources/static/img/icons.png similarity index 100% rename from bootdo/src/main/resources/static/img/icons.png rename to src/main/resources/static/img/icons.png diff --git a/bootdo/src/main/resources/static/img/index.jpg b/src/main/resources/static/img/index.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/index.jpg rename to src/main/resources/static/img/index.jpg diff --git a/bootdo/src/main/resources/static/img/index_4.jpg b/src/main/resources/static/img/index_4.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/index_4.jpg rename to src/main/resources/static/img/index_4.jpg diff --git a/bootdo/src/main/resources/static/img/loading-upload.gif b/src/main/resources/static/img/loading-upload.gif similarity index 100% rename from bootdo/src/main/resources/static/img/loading-upload.gif rename to src/main/resources/static/img/loading-upload.gif diff --git a/bootdo/src/main/resources/static/img/loading.gif b/src/main/resources/static/img/loading.gif similarity index 100% rename from bootdo/src/main/resources/static/img/loading.gif rename to src/main/resources/static/img/loading.gif diff --git a/bootdo/src/main/resources/static/img/locked.png b/src/main/resources/static/img/locked.png similarity index 100% rename from bootdo/src/main/resources/static/img/locked.png rename to src/main/resources/static/img/locked.png diff --git a/bootdo/src/main/resources/static/img/login-background.jpg b/src/main/resources/static/img/login-background.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/login-background.jpg rename to src/main/resources/static/img/login-background.jpg diff --git a/bootdo/src/main/resources/static/img/p1.jpg b/src/main/resources/static/img/p1.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/p1.jpg rename to src/main/resources/static/img/p1.jpg diff --git a/bootdo/src/main/resources/static/img/p2.jpg b/src/main/resources/static/img/p2.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/p2.jpg rename to src/main/resources/static/img/p2.jpg diff --git a/bootdo/src/main/resources/static/img/p3.jpg b/src/main/resources/static/img/p3.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/p3.jpg rename to src/main/resources/static/img/p3.jpg diff --git a/bootdo/src/main/resources/static/img/p_big1.jpg b/src/main/resources/static/img/p_big1.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/p_big1.jpg rename to src/main/resources/static/img/p_big1.jpg diff --git a/bootdo/src/main/resources/static/img/p_big2.jpg b/src/main/resources/static/img/p_big2.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/p_big2.jpg rename to src/main/resources/static/img/p_big2.jpg diff --git a/bootdo/src/main/resources/static/img/p_big3.jpg b/src/main/resources/static/img/p_big3.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/p_big3.jpg rename to src/main/resources/static/img/p_big3.jpg diff --git a/bootdo/src/main/resources/static/img/photo_s.jpg b/src/main/resources/static/img/photo_s.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/photo_s.jpg rename to src/main/resources/static/img/photo_s.jpg diff --git a/bootdo/src/main/resources/static/img/post-bg.jpg b/src/main/resources/static/img/post-bg.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/post-bg.jpg rename to src/main/resources/static/img/post-bg.jpg diff --git a/bootdo/src/main/resources/static/img/profile.jpg b/src/main/resources/static/img/profile.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/profile.jpg rename to src/main/resources/static/img/profile.jpg diff --git a/bootdo/src/main/resources/static/img/profile_big.jpg b/src/main/resources/static/img/profile_big.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/profile_big.jpg rename to src/main/resources/static/img/profile_big.jpg diff --git a/bootdo/src/main/resources/static/img/profile_small.jpg b/src/main/resources/static/img/profile_small.jpg similarity index 100% rename from bootdo/src/main/resources/static/img/profile_small.jpg rename to src/main/resources/static/img/profile_small.jpg diff --git a/bootdo/src/main/resources/static/img/progress.png b/src/main/resources/static/img/progress.png similarity index 100% rename from bootdo/src/main/resources/static/img/progress.png rename to src/main/resources/static/img/progress.png diff --git a/bootdo/src/main/resources/static/img/qr_code.png b/src/main/resources/static/img/qr_code.png similarity index 100% rename from bootdo/src/main/resources/static/img/qr_code.png rename to src/main/resources/static/img/qr_code.png diff --git a/bootdo/src/main/resources/static/img/sprite-skin-flat.png b/src/main/resources/static/img/sprite-skin-flat.png similarity index 100% rename from bootdo/src/main/resources/static/img/sprite-skin-flat.png rename to src/main/resources/static/img/sprite-skin-flat.png diff --git a/bootdo/src/main/resources/static/img/success.png b/src/main/resources/static/img/success.png similarity index 100% rename from bootdo/src/main/resources/static/img/success.png rename to src/main/resources/static/img/success.png diff --git a/bootdo/src/main/resources/static/img/user.png b/src/main/resources/static/img/user.png similarity index 100% rename from bootdo/src/main/resources/static/img/user.png rename to src/main/resources/static/img/user.png diff --git a/bootdo/src/main/resources/static/img/webuploader.png b/src/main/resources/static/img/webuploader.png similarity index 100% rename from bootdo/src/main/resources/static/img/webuploader.png rename to src/main/resources/static/img/webuploader.png diff --git a/bootdo/src/main/resources/static/img/wenku_logo.png b/src/main/resources/static/img/wenku_logo.png similarity index 100% rename from bootdo/src/main/resources/static/img/wenku_logo.png rename to src/main/resources/static/img/wenku_logo.png diff --git a/bootdo/src/main/resources/static/js/ajax-util.js b/src/main/resources/static/js/ajax-util.js similarity index 100% rename from bootdo/src/main/resources/static/js/ajax-util.js rename to src/main/resources/static/js/ajax-util.js diff --git a/bootdo/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js similarity index 100% rename from bootdo/src/main/resources/static/js/app.js rename to src/main/resources/static/js/app.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/SalaryAdjustment/form.js b/src/main/resources/static/js/appjs/act/SalaryAdjustment/form.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/SalaryAdjustment/form.js rename to src/main/resources/static/js/appjs/act/SalaryAdjustment/form.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/model/add.js b/src/main/resources/static/js/appjs/act/model/add.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/model/add.js rename to src/main/resources/static/js/appjs/act/model/add.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/model/edit.js b/src/main/resources/static/js/appjs/act/model/edit.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/model/edit.js rename to src/main/resources/static/js/appjs/act/model/edit.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/model/model.js b/src/main/resources/static/js/appjs/act/model/model.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/model/model.js rename to src/main/resources/static/js/appjs/act/model/model.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/process/add.js b/src/main/resources/static/js/appjs/act/process/add.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/process/add.js rename to src/main/resources/static/js/appjs/act/process/add.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/process/edit.js b/src/main/resources/static/js/appjs/act/process/edit.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/process/edit.js rename to src/main/resources/static/js/appjs/act/process/edit.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/process/process.js b/src/main/resources/static/js/appjs/act/process/process.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/process/process.js rename to src/main/resources/static/js/appjs/act/process/process.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/salary/add.js b/src/main/resources/static/js/appjs/act/salary/add.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/salary/add.js rename to src/main/resources/static/js/appjs/act/salary/add.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/salary/edit.js b/src/main/resources/static/js/appjs/act/salary/edit.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/salary/edit.js rename to src/main/resources/static/js/appjs/act/salary/edit.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/salary/salary.js b/src/main/resources/static/js/appjs/act/salary/salary.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/salary/salary.js rename to src/main/resources/static/js/appjs/act/salary/salary.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/task/gotoTask.js b/src/main/resources/static/js/appjs/act/task/gotoTask.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/task/gotoTask.js rename to src/main/resources/static/js/appjs/act/task/gotoTask.js diff --git a/bootdo/src/main/resources/static/js/appjs/act/task/totoTask.js b/src/main/resources/static/js/appjs/act/task/totoTask.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/act/task/totoTask.js rename to src/main/resources/static/js/appjs/act/task/totoTask.js diff --git a/bootdo/src/main/resources/static/js/appjs/blog/bComments/add.js b/src/main/resources/static/js/appjs/blog/bComments/add.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/blog/bComments/add.js rename to src/main/resources/static/js/appjs/blog/bComments/add.js index 8d938336b9fef014a39c7ee95617a3bd78f2d3b1..a5a4e1bc872deea92b1ffad2207276ee1a028e3f 100644 --- a/bootdo/src/main/resources/static/js/appjs/blog/bComments/add.js +++ b/src/main/resources/static/js/appjs/blog/bComments/add.js @@ -1,54 +1,54 @@ -$().ready(function() { - $('.summernote').summernote({ - height:'220px', - lang : 'zh-CN' - }); - validateRule(); -}); -$.validator.setDefaults({ - submitHandler : function() { - save(); - } -}); -function save() { - var content_sn = $("#content_sn").code(); - $("#content").val(content_sn); - $.ajax({ - cache : true, - type : "POST", - url : "/blog/bComments/save", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - title : { - required : true - } - }, - messages : { - title : { - required : icon + "请输入标题" - } - } - }) +$().ready(function() { + $('.summernote').summernote({ + height:'220px', + lang : 'zh-CN' + }); + validateRule(); +}); +$.validator.setDefaults({ + submitHandler : function() { + save(); + } +}); +function save() { + var content_sn = $("#content_sn").code(); + $("#content").val(content_sn); + $.ajax({ + cache : true, + type : "POST", + url : "/blog/bComments/save", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + title : { + required : true + } + }, + messages : { + title : { + required : icon + "请输入标题" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/blog/bComments/bComments.js b/src/main/resources/static/js/appjs/blog/bComments/bComments.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/blog/bComments/bComments.js rename to src/main/resources/static/js/appjs/blog/bComments/bComments.js diff --git a/bootdo/src/main/resources/static/js/appjs/blog/bContent/add.js b/src/main/resources/static/js/appjs/blog/bContent/add.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/blog/bContent/add.js rename to src/main/resources/static/js/appjs/blog/bContent/add.js index cd2a5c26138fd5d1dfe6a9b0068d10f0cf14cfc3..ecf4526f30b02e9c0038e97cc94483121bd5fe8a 100644 --- a/bootdo/src/main/resources/static/js/appjs/blog/bContent/add.js +++ b/src/main/resources/static/js/appjs/blog/bContent/add.js @@ -1,65 +1,65 @@ -$().ready(function() { - - $('.summernote').summernote({ - height : '220px', - lang : 'zh-CN', - callbacks: { - onImageUpload: function(files, editor, $editable) { - sendFile(files); - } - } - }); - validateRule(); -}); - - -$.validator.setDefaults({ - submitHandler : function() { - save(1); - } -}); -function save(status) { - $("#status").val(status); - var content_sn = $("#content_sn").summernote('code'); - $("#content").val(content_sn); - $.ajax({ - cache : true, - type : "POST", - url : "/blog/bContent/save", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(r) { - if (r.code == 0) { - parent.layer.msg(r.msg); - parent.reLoad(); - $("#cid").val(r.cid); - - } else { - parent.layer.alert(r.msg) - } - } - }); -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - title : "required", - author : "required", - content : "required" - }, - messages : { - title : "请填写文章标题", - author : "请填写文章作者", - content : "请填写文章内容" - } - }); -} - -function returnList() { - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); +$().ready(function() { + + $('.summernote').summernote({ + height : '220px', + lang : 'zh-CN', + callbacks: { + onImageUpload: function(files, editor, $editable) { + sendFile(files); + } + } + }); + validateRule(); +}); + + +$.validator.setDefaults({ + submitHandler : function() { + save(1); + } +}); +function save(status) { + $("#status").val(status); + var content_sn = $("#content_sn").summernote('code'); + $("#content").val(content_sn); + $.ajax({ + cache : true, + type : "POST", + url : "/blog/bContent/save", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(r) { + if (r.code == 0) { + parent.layer.msg(r.msg); + parent.reLoad(); + $("#cid").val(r.cid); + + } else { + parent.layer.alert(r.msg) + } + } + }); +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + title : "required", + author : "required", + content : "required" + }, + messages : { + title : "请填写文章标题", + author : "请填写文章作者", + content : "请填写文章内容" + } + }); +} + +function returnList() { + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/blog/bContent/bContent.js b/src/main/resources/static/js/appjs/blog/bContent/bContent.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/blog/bContent/bContent.js rename to src/main/resources/static/js/appjs/blog/bContent/bContent.js diff --git a/bootdo/src/main/resources/static/js/appjs/blog/bContent/edit.js b/src/main/resources/static/js/appjs/blog/bContent/edit.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/blog/bContent/edit.js rename to src/main/resources/static/js/appjs/blog/bContent/edit.js index e69964da32d61305e4e57ddf7398df42b3d1440e..7e3cc7a8680938112ffc731c7c5ffcede60675e1 100644 --- a/bootdo/src/main/resources/static/js/appjs/blog/bContent/edit.js +++ b/src/main/resources/static/js/appjs/blog/bContent/edit.js @@ -1,71 +1,71 @@ -$().ready(function() { - $('.summernote').summernote({ - height : '220px', - lang : 'zh-CN', - callbacks: { - onImageUpload: function(files, editor, $editable) { - console.log("onImageUpload"); - sendFile(files); - } - } - }); - var content = $("#content").val(); - - $('#content_sn').summernote('code', content); - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - save(); - } -}); -function save(status) { - $("#status").val(status); - - var content_sn = $("#content_sn").summernote('code'); - $("#content").val(content_sn); - $.ajax({ - cache : true, - type : "POST", - url : "/blog/bContent/save", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入姓名" - } - } - }) -} - -function returnList() { - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); -} - +$().ready(function() { + $('.summernote').summernote({ + height : '220px', + lang : 'zh-CN', + callbacks: { + onImageUpload: function(files, editor, $editable) { + console.log("onImageUpload"); + sendFile(files); + } + } + }); + var content = $("#content").val(); + + $('#content_sn').summernote('code', content); + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + save(); + } +}); +function save(status) { + $("#status").val(status); + + var content_sn = $("#content_sn").summernote('code'); + $("#content").val(content_sn); + $.ajax({ + cache : true, + type : "POST", + url : "/blog/bContent/save", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入姓名" + } + } + }) +} + +function returnList() { + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); +} + diff --git a/bootdo/src/main/resources/static/js/appjs/blog/bootstrap.min.js b/src/main/resources/static/js/appjs/blog/bootstrap.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/blog/bootstrap.min.js rename to src/main/resources/static/js/appjs/blog/bootstrap.min.js diff --git a/bootdo/src/main/resources/static/js/appjs/blog/clean-blog.min.js b/src/main/resources/static/js/appjs/blog/clean-blog.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/blog/clean-blog.min.js rename to src/main/resources/static/js/appjs/blog/clean-blog.min.js diff --git a/bootdo/src/main/resources/static/js/appjs/blog/jquery.min.js b/src/main/resources/static/js/appjs/blog/jquery.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/blog/jquery.min.js rename to src/main/resources/static/js/appjs/blog/jquery.min.js diff --git a/bootdo/src/main/resources/static/js/appjs/blog/tether.min.js b/src/main/resources/static/js/appjs/blog/tether.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/blog/tether.min.js rename to src/main/resources/static/js/appjs/blog/tether.min.js diff --git a/bootdo/src/main/resources/static/js/appjs/common/dict/add.js b/src/main/resources/static/js/appjs/common/dict/add.js similarity index 94% rename from bootdo/src/main/resources/static/js/appjs/common/dict/add.js rename to src/main/resources/static/js/appjs/common/dict/add.js index a2ea3fd3bbe8eb8de2f1ee103b63ecd6649f114b..ae0cf220edbe5f2b78827940230d67b23d8048d6 100644 --- a/bootdo/src/main/resources/static/js/appjs/common/dict/add.js +++ b/src/main/resources/static/js/appjs/common/dict/add.js @@ -1,49 +1,49 @@ -$().ready(function() { - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - save(); - } -}); -function save() { - $.ajax({ - cache : true, - type : "POST", - url : "/common/dict/save", - data : $('#signupForm').serialize(), // 你的formid - async : false, - error : function(request) { - parent.layer.alert("网络超时"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入名字" - } - } - }) +$().ready(function() { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + save(); + } +}); +function save() { + $.ajax({ + cache : true, + type : "POST", + url : "/common/dict/save", + data : $('#signupForm').serialize(), // 你的formid + async : false, + error : function(request) { + parent.layer.alert("网络超时"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入名字" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/common/dict/dict.js b/src/main/resources/static/js/appjs/common/dict/dict.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/common/dict/dict.js rename to src/main/resources/static/js/appjs/common/dict/dict.js diff --git a/bootdo/src/main/resources/static/js/appjs/common/dict/edit.js b/src/main/resources/static/js/appjs/common/dict/edit.js similarity index 94% rename from bootdo/src/main/resources/static/js/appjs/common/dict/edit.js rename to src/main/resources/static/js/appjs/common/dict/edit.js index 4110ee41c2636ef7933763ba8992c13fbdde84d8..82d01b0c33cc4255560ba1dd967088bb6b07cd9f 100644 --- a/bootdo/src/main/resources/static/js/appjs/common/dict/edit.js +++ b/src/main/resources/static/js/appjs/common/dict/edit.js @@ -1,49 +1,49 @@ -$().ready(function() { - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - update(); - } -}); -function update() { - $.ajax({ - cache : true, - type : "POST", - url : "/common/dict/update", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入名字" - } - } - }) +$().ready(function() { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + update(); + } +}); +function update() { + $.ajax({ + cache : true, + type : "POST", + url : "/common/dict/update", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入名字" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/common/generator/edit.js b/src/main/resources/static/js/appjs/common/generator/edit.js similarity index 94% rename from bootdo/src/main/resources/static/js/appjs/common/generator/edit.js rename to src/main/resources/static/js/appjs/common/generator/edit.js index 478882fe04d7b7acbfd29ceb0898d952f1232161..b4dcb1e45eb1c83ac735b372a7c32e469d2f1d18 100644 --- a/bootdo/src/main/resources/static/js/appjs/common/generator/edit.js +++ b/src/main/resources/static/js/appjs/common/generator/edit.js @@ -1,62 +1,62 @@ -// 以下为官方示例 -$().ready(function() { - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - console.log('提交修改'); - update(); - } -}); -function update() { - $.ajax({ - cache : true, - type : "POST", - url : "/common/generator/update", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("网络连接超时"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg(data.msg); - - } else { - parent.layer.msg(data.msg); - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - author : { - required : true - }, - email : { - required : true, - }, - package : { - required : true, - }, - - }, - messages : { - - author : { - required : icon + "请输入作者" - }, - email : { - required : icon + "请输入email", - }, - package : { - required : icon + "请输入包名", - }, - } - }) -} +// 以下为官方示例 +$().ready(function() { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + console.log('提交修改'); + update(); + } +}); +function update() { + $.ajax({ + cache : true, + type : "POST", + url : "/common/generator/update", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("网络连接超时"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg(data.msg); + + } else { + parent.layer.msg(data.msg); + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + author : { + required : true + }, + email : { + required : true, + }, + package : { + required : true, + }, + + }, + messages : { + + author : { + required : icon + "请输入作者" + }, + email : { + required : icon + "请输入email", + }, + package : { + required : icon + "请输入包名", + }, + } + }) +} diff --git a/bootdo/src/main/resources/static/js/appjs/common/generator/list.js b/src/main/resources/static/js/appjs/common/generator/list.js similarity index 97% rename from bootdo/src/main/resources/static/js/appjs/common/generator/list.js rename to src/main/resources/static/js/appjs/common/generator/list.js index f09050e5a9e1a692f32fde35e45a641bcbf0aac7..7bdf779278e5c27730e0b0ae7a84468533795aff 100644 --- a/bootdo/src/main/resources/static/js/appjs/common/generator/list.js +++ b/src/main/resources/static/js/appjs/common/generator/list.js @@ -1,101 +1,101 @@ -var prefix = "/common/generator" -$(function() { - load(); -}); - -function load() { - $('#exampleTable') - .bootstrapTable( - { - method : 'get', // 服务器数据的请求方式 get or post - url : prefix + "/list", // 服务器数据的加载地址 - showRefresh : true, - showToggle : true, - showColumns : true, - iconSize : 'outline', - toolbar : '#exampleToolbar', - striped : true, // 设置为true会有隔行变色效果 - dataType : "json", // 服务器返回的数据类型 - pagination : true, // 设置为true会在底部显示分页条 - // queryParamsType : "limit", - // //设置为limit则会发送符合RESTFull格式的参数 - singleSelect : false, // 设置为true将禁止多选 - // contentType : "application/x-www-form-urlencoded", - // //发送到服务器的数据编码类型 - pageSize : 10, // 如果设置了分页,每页数据条数 - pageNumber : 1, // 如果设置了分布,首页页码 - search : true, // 是否显示搜索框 - showColumns : true, // 是否显示内容下拉框(选择显示的列) - sidePagination : "client", // 设置在哪里进行分页,可选值为"client" 或者 - // "server" - // queryParams : queryParams, - // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 - // queryParamsType = 'limit' ,返回参数必须包含 - // limit, offset, search, sort, order 否则, 需要包含: - // pageSize, pageNumber, searchText, sortName, - // sortOrder. - // 返回false将会终止请求 - columns : [ - { - checkbox : true - }, - { - field : 'tableName', // 列字段名 - title : '表名称' // 列标题 - }, - { - field : 'engine', - title : 'engine' - }, - { - field : 'tableComment', - title : '表描述' - }, - { - field : 'createTime', - title : '创建时间' - }, - { - title : '操作', - field : 'id', - align : 'center', - formatter : function(value, row, index) { - var e = ' '; - return e; - } - } ] - }); -} -function reLoad() { - $('#exampleTable').bootstrapTable('refresh'); -} -function code(tableName) { - location.href = prefix + "/code/" + tableName; -} -function batchCode() { - var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 - if (rows.length == 0) { - layer.msg("请选择要生成代码的表"); - return; - } - var tables = new Array(); - // 遍历所有选择的行数据,取每条数据对应的ID - $.each(rows, function(i, row) { - tables[i] = row['tableName']; - }); - location.href = prefix + "/batchCode?tables=" + JSON.stringify(tables).replace('[','%5B').replace(']','%5D'); -} - -function edit(){ - console.log('打开配置页面'); - layer.open({ - type : 2, - title : '增加', - maxmin : true, - shadeClose : false, - area : [ '800px', '520px' ], - content : prefix + '/edit' - }); +var prefix = "/common/generator" +$(function() { + load(); +}); + +function load() { + $('#exampleTable') + .bootstrapTable( + { + method : 'get', // 服务器数据的请求方式 get or post + url : prefix + "/list", // 服务器数据的加载地址 + showRefresh : true, + showToggle : true, + showColumns : true, + iconSize : 'outline', + toolbar : '#exampleToolbar', + striped : true, // 设置为true会有隔行变色效果 + dataType : "json", // 服务器返回的数据类型 + pagination : true, // 设置为true会在底部显示分页条 + // queryParamsType : "limit", + // //设置为limit则会发送符合RESTFull格式的参数 + singleSelect : false, // 设置为true将禁止多选 + // contentType : "application/x-www-form-urlencoded", + // //发送到服务器的数据编码类型 + pageSize : 10, // 如果设置了分页,每页数据条数 + pageNumber : 1, // 如果设置了分布,首页页码 + search : true, // 是否显示搜索框 + showColumns : true, // 是否显示内容下拉框(选择显示的列) + sidePagination : "client", // 设置在哪里进行分页,可选值为"client" 或者 + // "server" + // queryParams : queryParams, + // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 + // queryParamsType = 'limit' ,返回参数必须包含 + // limit, offset, search, sort, order 否则, 需要包含: + // pageSize, pageNumber, searchText, sortName, + // sortOrder. + // 返回false将会终止请求 + columns : [ + { + checkbox : true + }, + { + field : 'tableName', // 列字段名 + title : '表名称' // 列标题 + }, + { + field : 'engine', + title : 'engine' + }, + { + field : 'tableComment', + title : '表描述' + }, + { + field : 'createTime', + title : '创建时间' + }, + { + title : '操作', + field : 'id', + align : 'center', + formatter : function(value, row, index) { + var e = ' '; + return e; + } + } ] + }); +} +function reLoad() { + $('#exampleTable').bootstrapTable('refresh'); +} +function code(tableName) { + location.href = prefix + "/code/" + tableName; +} +function batchCode() { + var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 + if (rows.length == 0) { + layer.msg("请选择要生成代码的表"); + return; + } + var tables = new Array(); + // 遍历所有选择的行数据,取每条数据对应的ID + $.each(rows, function(i, row) { + tables[i] = row['tableName']; + }); + location.href = prefix + "/batchCode?tables=" + JSON.stringify(tables).replace('[','%5B').replace(']','%5D'); +} + +function edit(){ + console.log('打开配置页面'); + layer.open({ + type : 2, + title : '增加', + maxmin : true, + shadeClose : false, + area : [ '800px', '520px' ], + content : prefix + '/edit' + }); } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/common/job/add.js b/src/main/resources/static/js/appjs/common/job/add.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/common/job/add.js rename to src/main/resources/static/js/appjs/common/job/add.js diff --git a/bootdo/src/main/resources/static/js/appjs/common/job/edit.js b/src/main/resources/static/js/appjs/common/job/edit.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/common/job/edit.js rename to src/main/resources/static/js/appjs/common/job/edit.js diff --git a/bootdo/src/main/resources/static/js/appjs/common/job/job.js b/src/main/resources/static/js/appjs/common/job/job.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/common/job/job.js rename to src/main/resources/static/js/appjs/common/job/job.js diff --git a/bootdo/src/main/resources/static/js/appjs/common/log/log.js b/src/main/resources/static/js/appjs/common/log/log.js similarity index 97% rename from bootdo/src/main/resources/static/js/appjs/common/log/log.js rename to src/main/resources/static/js/appjs/common/log/log.js index 4c3bd0297962edbb9d8958a232bd441bc314daa0..8089ca5a8ec7f4261e5527cef1542cf8088f4c43 100644 --- a/bootdo/src/main/resources/static/js/appjs/common/log/log.js +++ b/src/main/resources/static/js/appjs/common/log/log.js @@ -1,176 +1,176 @@ -var prefix = "/common/log" -$(function () { - load(); - -}); -$('#exampleTable').on('load-success.bs.table', function (e, data) { - if (data.total && !data.rows.length) { - $('#exampleTable').bootstrapTable('selectPage').bootstrapTable('refresh'); - } -}); - -function load() { - $('#exampleTable') - .bootstrapTable( - { - method: 'get', // 服务器数据的请求方式 get or post - url: prefix + "/list", // 服务器数据的加载地址 - // showRefresh : true, - // showToggle : true, - // showColumns : true, - iconSize: 'outline', - toolbar: '#exampleToolbar', - striped: true, // 设置为true会有隔行变色效果 - dataType: "json", // 服务器返回的数据类型 - pagination: true, // 设置为true会在底部显示分页条 - // queryParamsType : "limit", - // //设置为limit则会发送符合RESTFull格式的参数 - singleSelect: false, // 设置为true将禁止多选 - // contentType : "application/x-www-form-urlencoded", - // //发送到服务器的数据编码类型 - pageSize: 10, // 如果设置了分页,每页数据条数 - pageNumber: 1, // 如果设置了分布,首页页码 - // search : true, // 是否显示搜索框 - // showColumns : true, // 是否显示内容下拉框(选择显示的列) - sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 - // "server" - queryParams: function (params) { - return { - limit: params.limit, - offset: params.offset, - name: $('#searchName').val(), - sort: 'gmt_create', - order: 'desc', - operation: $("#searchOperation").val(), - username: $("#searchUsername").val() - }; - }, - // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 - // queryParamsType = 'limit' ,返回参数必须包含 - // limit, offset, search, sort, order 否则, 需要包含: - // pageSize, pageNumber, searchText, sortName, - // sortOrder. - // 返回false将会终止请求 - columns: [ - { - checkbox: true - }, - { - field: 'id', // 列字段名 - title: '序号' // 列标题 - }, - { - field: 'userId', - title: '用户Id' - }, - { - field: 'username', - title: '用户名' - }, - { - field: 'operation', - title: '操作' - }, - { - field: 'time', - title: '用时' - }, - { - field: 'method', - title: '方法' - }, - { - field: 'params', - title: '参数' - }, - { - field: 'ip', - title: 'IP地址' - }, - { - field: 'gmtCreate', - title: '创建时间' - }, - { - title: '操作', - field: 'id', - align: 'center', - formatter: function (value, row, index) { - var e = ' '; - var d = ' '; - var f = ' '; - return d; - } - }] - }); -} - -function reLoad() { - $('#exampleTable').bootstrapTable('refresh'); -} - -function remove(id) { - layer.confirm('确定要删除选中的记录?', { - btn: ['确定', '取消'] - }, function () { - $.ajax({ - url: prefix + "/remove", - type: "post", - data: { - 'id': id - }, - beforeSend: function (request) { - index = layer.load(); - }, - success: function (r) { - if (r.code == 0) { - layer.close(index); - layer.msg(r.msg); - reLoad(); - } else { - layer.msg(r.msg); - } - } - }); - }) -} - -function batchRemove() { - var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 - if (rows.length == 0) { - layer.msg("请选择要删除的数据"); - return; - } - layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { - btn: ['确定', '取消'] - // 按钮 - }, function () { - var ids = new Array(); - // 遍历所有选择的行数据,取每条数据对应的ID - $.each(rows, function (i, row) { - ids[i] = row['id']; - }); - $.ajax({ - type: 'POST', - data: { - "ids": ids - }, - url: prefix + '/batchRemove', - success: function (r) { - if (r.code == 0) { - layer.msg(r.msg); - reLoad(); - } else { - layer.msg(r.msg); - } - } - }); - }, function () { - }); +var prefix = "/common/log" +$(function () { + load(); + +}); +$('#exampleTable').on('load-success.bs.table', function (e, data) { + if (data.total && !data.rows.length) { + $('#exampleTable').bootstrapTable('selectPage').bootstrapTable('refresh'); + } +}); + +function load() { + $('#exampleTable') + .bootstrapTable( + { + method: 'get', // 服务器数据的请求方式 get or post + url: prefix + "/list", // 服务器数据的加载地址 + // showRefresh : true, + // showToggle : true, + // showColumns : true, + iconSize: 'outline', + toolbar: '#exampleToolbar', + striped: true, // 设置为true会有隔行变色效果 + dataType: "json", // 服务器返回的数据类型 + pagination: true, // 设置为true会在底部显示分页条 + // queryParamsType : "limit", + // //设置为limit则会发送符合RESTFull格式的参数 + singleSelect: false, // 设置为true将禁止多选 + // contentType : "application/x-www-form-urlencoded", + // //发送到服务器的数据编码类型 + pageSize: 10, // 如果设置了分页,每页数据条数 + pageNumber: 1, // 如果设置了分布,首页页码 + // search : true, // 是否显示搜索框 + // showColumns : true, // 是否显示内容下拉框(选择显示的列) + sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 + // "server" + queryParams: function (params) { + return { + limit: params.limit, + offset: params.offset, + name: $('#searchName').val(), + sort: 'gmt_create', + order: 'desc', + operation: $("#searchOperation").val(), + username: $("#searchUsername").val() + }; + }, + // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 + // queryParamsType = 'limit' ,返回参数必须包含 + // limit, offset, search, sort, order 否则, 需要包含: + // pageSize, pageNumber, searchText, sortName, + // sortOrder. + // 返回false将会终止请求 + columns: [ + { + checkbox: true + }, + { + field: 'id', // 列字段名 + title: '序号' // 列标题 + }, + { + field: 'userId', + title: '用户Id' + }, + { + field: 'username', + title: '用户名' + }, + { + field: 'operation', + title: '操作' + }, + { + field: 'time', + title: '用时' + }, + { + field: 'method', + title: '方法' + }, + { + field: 'params', + title: '参数' + }, + { + field: 'ip', + title: 'IP地址' + }, + { + field: 'gmtCreate', + title: '创建时间' + }, + { + title: '操作', + field: 'id', + align: 'center', + formatter: function (value, row, index) { + var e = ' '; + var d = ' '; + var f = ' '; + return d; + } + }] + }); +} + +function reLoad() { + $('#exampleTable').bootstrapTable('refresh'); +} + +function remove(id) { + layer.confirm('确定要删除选中的记录?', { + btn: ['确定', '取消'] + }, function () { + $.ajax({ + url: prefix + "/remove", + type: "post", + data: { + 'id': id + }, + beforeSend: function (request) { + index = layer.load(); + }, + success: function (r) { + if (r.code == 0) { + layer.close(index); + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }) +} + +function batchRemove() { + var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 + if (rows.length == 0) { + layer.msg("请选择要删除的数据"); + return; + } + layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { + btn: ['确定', '取消'] + // 按钮 + }, function () { + var ids = new Array(); + // 遍历所有选择的行数据,取每条数据对应的ID + $.each(rows, function (i, row) { + ids[i] = row['id']; + }); + $.ajax({ + type: 'POST', + data: { + "ids": ids + }, + url: prefix + '/batchRemove', + success: function (r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }, function () { + }); } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/oa/notify/add.js b/src/main/resources/static/js/appjs/oa/notify/add.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/oa/notify/add.js rename to src/main/resources/static/js/appjs/oa/notify/add.js index 1c4586ce4300b69fb52bfc46bafb2e149746942d..ae0751679d06ce610fc68d3e6d2f1d617894d827 100644 --- a/bootdo/src/main/resources/static/js/appjs/oa/notify/add.js +++ b/src/main/resources/static/js/appjs/oa/notify/add.js @@ -1,90 +1,90 @@ -$().ready(function() { - loadType(); - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - save(); - } -}); -function save() { - $.ajax({ - cache : true, - type : "POST", - url : "/oa/notify/save", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入姓名" - } - } - }) -} -function loadType(){ - var html = ""; - $.ajax({ - url : '/common/dict/list/oa_notify_type', - success : function(data) { - //加载数据 - for (var i = 0; i < data.length; i++) { - html += '' - } - $(".chosen-select").append(html); - $(".chosen-select").chosen({ - maxHeight : 200 - }); - //点击事件 - $('.chosen-select').on('change', function(e, params) { - console.log(params.selected); - var opt = { - query : { - type : params.selected, - } - } - $('#exampleTable').bootstrapTable('refresh', opt); - }); - } - }); -} - -var openUser = function(){ - layer.open({ - type:2, - title:"选择人员", - area : [ '300px', '450px' ], - content:"/sys/user/treeView" - }) -} - -function loadUser(userIds,userNames){ - $("#userIds").val(userIds); - $("#userNames").val(userNames); +$().ready(function() { + loadType(); + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + save(); + } +}); +function save() { + $.ajax({ + cache : true, + type : "POST", + url : "/oa/notify/save", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入姓名" + } + } + }) +} +function loadType(){ + var html = ""; + $.ajax({ + url : '/common/dict/list/oa_notify_type', + success : function(data) { + //加载数据 + for (var i = 0; i < data.length; i++) { + html += '' + } + $(".chosen-select").append(html); + $(".chosen-select").chosen({ + maxHeight : 200 + }); + //点击事件 + $('.chosen-select').on('change', function(e, params) { + console.log(params.selected); + var opt = { + query : { + type : params.selected, + } + } + $('#exampleTable').bootstrapTable('refresh', opt); + }); + } + }); +} + +var openUser = function(){ + layer.open({ + type:2, + title:"选择人员", + area : [ '300px', '450px' ], + content:"/sys/user/treeView" + }) +} + +function loadUser(userIds,userNames){ + $("#userIds").val(userIds); + $("#userNames").val(userNames); } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/oa/notify/edit.js b/src/main/resources/static/js/appjs/oa/notify/edit.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/oa/notify/edit.js rename to src/main/resources/static/js/appjs/oa/notify/edit.js index 14ee1ef082ddf19032e3cd9bdf0d33b6bd24ad0c..3be103e2af18e2744ce2aa4eb58fed34297debeb 100644 --- a/bootdo/src/main/resources/static/js/appjs/oa/notify/edit.js +++ b/src/main/resources/static/js/appjs/oa/notify/edit.js @@ -1,74 +1,74 @@ -$().ready(function() { - //loadType(); - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - update(); - } -}); -function update() { - $.ajax({ - cache : true, - type : "POST", - url : "/oa/notify/update", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入名字" - } - } - }) -} - -function loadType(){ - var html = ""; - $.ajax({ - url : '/common/dict/list/oa_notify_type', - success : function(data) { - // 加载数据 - for (var i = 0; i < data.length; i++) { - html += '' - } - $(".chosen-select").append(html); - $(".chosen-select").chosen({ - maxHeight : 200 - }); - $(".chosen-select").val($("#Ttype").val()); - $(".chosen-select").trigger("chosen:updated"); - // 点击事件 - $('.chosen-select').on('change', function(e, params) { - - }); - } - }); -} - +$().ready(function() { + //loadType(); + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + update(); + } +}); +function update() { + $.ajax({ + cache : true, + type : "POST", + url : "/oa/notify/update", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入名字" + } + } + }) +} + +function loadType(){ + var html = ""; + $.ajax({ + url : '/common/dict/list/oa_notify_type', + success : function(data) { + // 加载数据 + for (var i = 0; i < data.length; i++) { + html += '' + } + $(".chosen-select").append(html); + $(".chosen-select").chosen({ + maxHeight : 200 + }); + $(".chosen-select").val($("#Ttype").val()); + $(".chosen-select").trigger("chosen:updated"); + // 点击事件 + $('.chosen-select').on('change', function(e, params) { + + }); + } + }); +} + diff --git a/bootdo/src/main/resources/static/js/appjs/oa/notify/notify.js b/src/main/resources/static/js/appjs/oa/notify/notify.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/oa/notify/notify.js rename to src/main/resources/static/js/appjs/oa/notify/notify.js diff --git a/bootdo/src/main/resources/static/js/appjs/oa/notify/read.js b/src/main/resources/static/js/appjs/oa/notify/read.js similarity index 94% rename from bootdo/src/main/resources/static/js/appjs/oa/notify/read.js rename to src/main/resources/static/js/appjs/oa/notify/read.js index cc21f02a7539af87707d2dc8e066e023a1d4bfc7..8960f45f99a83d44dca3b29a8a63ea783bdc31b2 100644 --- a/bootdo/src/main/resources/static/js/appjs/oa/notify/read.js +++ b/src/main/resources/static/js/appjs/oa/notify/read.js @@ -1,49 +1,49 @@ -$().ready(function() { - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - update(); - } -}); -function update() { - $.ajax({ - cache : true, - type : "POST", - url : "/oa/notify/update", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入名字" - } - } - }) +$().ready(function() { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + update(); + } +}); +function update() { + $.ajax({ + cache : true, + type : "POST", + url : "/oa/notify/update", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入名字" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/oa/notify/selfNotify.js b/src/main/resources/static/js/appjs/oa/notify/selfNotify.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/oa/notify/selfNotify.js rename to src/main/resources/static/js/appjs/oa/notify/selfNotify.js diff --git a/bootdo/src/main/resources/static/js/appjs/oa/webSocket/jquery.js b/src/main/resources/static/js/appjs/oa/webSocket/jquery.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/oa/webSocket/jquery.js rename to src/main/resources/static/js/appjs/oa/webSocket/jquery.js diff --git a/bootdo/src/main/resources/static/js/appjs/oa/webSocket/sockjs.min.js b/src/main/resources/static/js/appjs/oa/webSocket/sockjs.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/oa/webSocket/sockjs.min.js rename to src/main/resources/static/js/appjs/oa/webSocket/sockjs.min.js diff --git a/bootdo/src/main/resources/static/js/appjs/oa/webSocket/stomp.min.js b/src/main/resources/static/js/appjs/oa/webSocket/stomp.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/oa/webSocket/stomp.min.js rename to src/main/resources/static/js/appjs/oa/webSocket/stomp.min.js diff --git a/bootdo/src/main/resources/static/js/appjs/sys/menu/add.js b/src/main/resources/static/js/appjs/sys/menu/add.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/sys/menu/add.js rename to src/main/resources/static/js/appjs/sys/menu/add.js index 755e786de2f0c580c748bf1c4aedff300f7720a1..98823b15b3c9c557a81b7e0bf9dc8b18011fcf0d 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/menu/add.js +++ b/src/main/resources/static/js/appjs/sys/menu/add.js @@ -1,67 +1,67 @@ -var prefix = "/sys/menu" -$(function() { - validateRule(); - //打开图标列表 - $("#ico-btn").click(function(){ - layer.open({ - type: 2, - title:'图标列表', - content: '/FontIcoList.html', - area: ['480px', '90%'], - success: function(layero, index){ - //var body = layer.getChildFrame('.ico-list', index); - //console.log(layero, index); - } - }); - }); -}); -$.validator.setDefaults({ - submitHandler : function() { - submit01(); - } -}); -function submit01() { - $.ajax({ - cache : true, - type : "POST", - url : prefix + "/save", - data : $('#signupForm').serialize(), - async : false, - error : function(request) { - laryer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("保存成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - layer.alert(data.msg) - } - } - }); -} - -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - }, - type : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入菜单名" - }, - type : { - required : icon + "请选择菜单类型" - } - } - }) +var prefix = "/sys/menu" +$(function() { + validateRule(); + //打开图标列表 + $("#ico-btn").click(function(){ + layer.open({ + type: 2, + title:'图标列表', + content: '/FontIcoList.html', + area: ['480px', '90%'], + success: function(layero, index){ + //var body = layer.getChildFrame('.ico-list', index); + //console.log(layero, index); + } + }); + }); +}); +$.validator.setDefaults({ + submitHandler : function() { + submit01(); + } +}); +function submit01() { + $.ajax({ + cache : true, + type : "POST", + url : prefix + "/save", + data : $('#signupForm').serialize(), + async : false, + error : function(request) { + laryer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("保存成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + layer.alert(data.msg) + } + } + }); +} + +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + }, + type : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入菜单名" + }, + type : { + required : icon + "请选择菜单类型" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/sys/menu/edit.js b/src/main/resources/static/js/appjs/sys/menu/edit.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/sys/menu/edit.js rename to src/main/resources/static/js/appjs/sys/menu/edit.js index 7abaed549d260b2d590bcb62ab64507ffd3c25e1..5a81370e2fcda49b2d977998846a62918aed71e4 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/menu/edit.js +++ b/src/main/resources/static/js/appjs/sys/menu/edit.js @@ -1,91 +1,91 @@ -var prefix = "/sys/menu" -$(function() { - validateRule(); - - //打开图标列表 - $("#ico-btn").click(function(){ - layer.open({ - type: 2, - title:'图标列表', - content: '/FontIcoList.html', - area: ['480px', '90%'], - success: function(layero, index){ - //var body = layer.getChildFrame('.ico-list', index); - //console.log(layero, index); - } - }); - }); - -}); -$.validator.setDefaults({ - submitHandler : function() { - update(); - } -}); -function update() { - $.ajax({ - cache : true, - type : "POST", - url : prefix + "/update", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - laryer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("保存成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - layer.alert(data.msg) - } - - } - }); - -} -function validate() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - }, - type : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入菜单名" - }, - type : { - required : icon + "请选择菜单类型" - } - } - }) -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - }, - type : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入菜单名" - }, - type : { - required : icon + "请选择菜单类型" - } - } - }) +var prefix = "/sys/menu" +$(function() { + validateRule(); + + //打开图标列表 + $("#ico-btn").click(function(){ + layer.open({ + type: 2, + title:'图标列表', + content: '/FontIcoList.html', + area: ['480px', '90%'], + success: function(layero, index){ + //var body = layer.getChildFrame('.ico-list', index); + //console.log(layero, index); + } + }); + }); + +}); +$.validator.setDefaults({ + submitHandler : function() { + update(); + } +}); +function update() { + $.ajax({ + cache : true, + type : "POST", + url : prefix + "/update", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + laryer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("保存成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + layer.alert(data.msg) + } + + } + }); + +} +function validate() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + }, + type : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入菜单名" + }, + type : { + required : icon + "请选择菜单类型" + } + } + }) +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + }, + type : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入菜单名" + }, + type : { + required : icon + "请选择菜单类型" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/sys/menu/menu.js b/src/main/resources/static/js/appjs/sys/menu/menu.js similarity index 97% rename from bootdo/src/main/resources/static/js/appjs/sys/menu/menu.js rename to src/main/resources/static/js/appjs/sys/menu/menu.js index f61e30c99cf952a5ba5d522174564d682fe2e219..8104d41900ff72439c9bdf9f0216c3e8233f6928 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/menu/menu.js +++ b/src/main/resources/static/js/appjs/sys/menu/menu.js @@ -1,156 +1,156 @@ -var prefix = "/sys/menu" -$(document).ready(function () { - load(); -}); -var load = function () { - $('#exampleTable') - .bootstrapTreeTable( - { - id: 'menuId', - code: 'menuId', - parentCode: 'parentId', - type: "GET", // 请求数据的ajax类型 - url: prefix + '/list', // 请求数据的ajax的url - ajaxParams: {sort:'order_num'}, // 请求数据的ajax的data属性 - expandColumn: '1',// 在哪一列上面显示展开按钮 - striped: true, // 是否各行渐变色 - bordered: true, // 是否显示边框 - expandAll: false, // 是否全部展开 - // toolbar : '#exampleToolbar', - columns: [ - { - title: '编号', - field: 'menuId', - visible: false, - align: 'center', - valign: 'center', - width: '5%' - }, - { - title: '名称', - valign: 'center', - field: 'name', - width: '20%' - }, - - { - title: '图标', - field: 'icon', - align: 'center', - valign: 'center', - width : '5%', - formatter: function (item, index) { - return item.icon == null ? '' - : ''; - } - }, - { - title: '类型', - field: 'type', - align: 'center', - valign: 'center', - width : '10%', - formatter: function (item, index) { - if (item.type === 0) { - return '目录'; - } - if (item.type === 1) { - return '菜单'; - } - if (item.type === 2) { - return '按钮'; - } - } - }, - { - title: '地址', - valign: 'center', - width : '20%', - field: 'url' - }, - { - title: '权限标识', - valign: 'center', - width : '20%', - field: 'perms' - }, - { - title: '操作', - field: 'id', - align: 'center', - valign: 'center', - formatter: function (item, index) { - var e = ' '; - var p = ' '; - var d = ' '; - return e + d + p; - } - }] - }); -} - -function reLoad() { - load(); -} - -function add(pId) { - layer.open({ - type: 2, - title: '增加菜单', - maxmin: true, - shadeClose: false, // 点击遮罩关闭层 - area: ['800px', '520px'], - content: prefix + '/add/' + pId // iframe的url - }); -} - -function remove(id) { - layer.confirm('确定要删除选中的记录?', { - btn: ['确定', '取消'] - }, function () { - $.ajax({ - url: prefix + "/remove", - type: "post", - data: { - 'id': id - }, - success: function (data) { - if (data.code == 0) { - layer.msg("删除成功"); - reLoad(); - } else { - layer.msg(data.msg); - } - } - }); - }) -} - -function edit(id) { - layer.open({ - type: 2, - title: '菜单修改', - maxmin: true, - shadeClose: false, // 点击遮罩关闭层 - area: ['800px', '520px'], - content: prefix + '/edit/' + id // iframe的url - }); -} - -function batchRemove() { - // var rows = $('#exampleTable').bootstrapTable('getSelections'); - +var prefix = "/sys/menu" +$(document).ready(function () { + load(); +}); +var load = function () { + $('#exampleTable') + .bootstrapTreeTable( + { + id: 'menuId', + code: 'menuId', + parentCode: 'parentId', + type: "GET", // 请求数据的ajax类型 + url: prefix + '/list', // 请求数据的ajax的url + ajaxParams: {sort:'order_num'}, // 请求数据的ajax的data属性 + expandColumn: '1',// 在哪一列上面显示展开按钮 + striped: true, // 是否各行渐变色 + bordered: true, // 是否显示边框 + expandAll: false, // 是否全部展开 + // toolbar : '#exampleToolbar', + columns: [ + { + title: '编号', + field: 'menuId', + visible: false, + align: 'center', + valign: 'center', + width: '5%' + }, + { + title: '名称', + valign: 'center', + field: 'name', + width: '20%' + }, + + { + title: '图标', + field: 'icon', + align: 'center', + valign: 'center', + width : '5%', + formatter: function (item, index) { + return item.icon == null ? '' + : ''; + } + }, + { + title: '类型', + field: 'type', + align: 'center', + valign: 'center', + width : '10%', + formatter: function (item, index) { + if (item.type === 0) { + return '目录'; + } + if (item.type === 1) { + return '菜单'; + } + if (item.type === 2) { + return '按钮'; + } + } + }, + { + title: '地址', + valign: 'center', + width : '20%', + field: 'url' + }, + { + title: '权限标识', + valign: 'center', + width : '20%', + field: 'perms' + }, + { + title: '操作', + field: 'id', + align: 'center', + valign: 'center', + formatter: function (item, index) { + var e = ' '; + var p = ' '; + var d = ' '; + return e + d + p; + } + }] + }); +} + +function reLoad() { + load(); +} + +function add(pId) { + layer.open({ + type: 2, + title: '增加菜单', + maxmin: true, + shadeClose: false, // 点击遮罩关闭层 + area: ['800px', '520px'], + content: prefix + '/add/' + pId // iframe的url + }); +} + +function remove(id) { + layer.confirm('确定要删除选中的记录?', { + btn: ['确定', '取消'] + }, function () { + $.ajax({ + url: prefix + "/remove", + type: "post", + data: { + 'id': id + }, + success: function (data) { + if (data.code == 0) { + layer.msg("删除成功"); + reLoad(); + } else { + layer.msg(data.msg); + } + } + }); + }) +} + +function edit(id) { + layer.open({ + type: 2, + title: '菜单修改', + maxmin: true, + shadeClose: false, // 点击遮罩关闭层 + area: ['800px', '520px'], + content: prefix + '/edit/' + id // iframe的url + }); +} + +function batchRemove() { + // var rows = $('#exampleTable').bootstrapTable('getSelections'); + } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/sys/online/online.js b/src/main/resources/static/js/appjs/sys/online/online.js similarity index 96% rename from bootdo/src/main/resources/static/js/appjs/sys/online/online.js rename to src/main/resources/static/js/appjs/sys/online/online.js index d33d302c00d0653062b0a4106428eaab01e54d6d..f2c9369b57d7280f51f12302652d7bd15ad31d1b 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/online/online.js +++ b/src/main/resources/static/js/appjs/sys/online/online.js @@ -1,221 +1,221 @@ -var prefix = "/sys/online" -$(function() { - load(); -}); - -function load() { - $('#exampleTable') - .bootstrapTable( - { - method : 'get', // 服务器数据的请求方式 get or post - url : prefix + "/list", // 服务器数据的加载地址 - // showRefresh : true, - // showToggle : true, - // showColumns : true, - iconSize : 'outline', - toolbar : '#exampleToolbar', - striped : true, // 设置为true会有隔行变色效果 - dataType : "json", // 服务器返回的数据类型 - pagination : true, // 设置为true会在底部显示分页条 - // queryParamsType : "limit", - // //设置为limit则会发送符合RESTFull格式的参数 - singleSelect : false, // 设置为true将禁止多选 - // contentType : "application/x-www-form-urlencoded", - // //发送到服务器的数据编码类型 - pageSize : 10, // 如果设置了分页,每页数据条数 - pageNumber : 1, // 如果设置了分布,首页页码 - // search : true, // 是否显示搜索框 - showColumns : false, // 是否显示内容下拉框(选择显示的列) - sidePagination : "client", // 设置在哪里进行分页,可选值为"client" 或者 - // "server" - queryParams : function(params) { - return { - // 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对 - limit : params.limit, - offset : params.offset, - name : $('#searchName').val() - }; - }, - // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 - // queryParamsType = 'limit' ,返回参数必须包含 - // limit, offset, search, sort, order 否则, 需要包含: - // pageSize, pageNumber, searchText, sortName, - // sortOrder. - // 返回false将会终止请求 - columns : [ - { - checkbox : true - }, - { - field : 'id', // 列字段名 - title : '序号' // 列标题 - }, - { - field : 'username', - title : '用户名' - }, - { - field : 'host', - title : '主机' - }, - { - field : 'startTimestamp', - title : '登录时间' - }, - { - field : 'lastAccessTime', - title : '最后访问时间' - }, - { - field : 'timeout', - title : '过期时间' - }, - { - field : 'status', - title : '状态', - align : 'center', - formatter : function(value, row, index) { - if (value == 'on_line') { - return '在线'; - } else if (value == 'off_line') { - return '离线'; - } - } - }, - { - title : '操作', - field : 'id', - align : 'center', - formatter : function(value, row, index) { - var d = ' '; - return d; - } - } ] - }); -} -function reLoad() { - $('#exampleTable').bootstrapTable('refresh'); -} -function add() { - // iframe层 - layer.open({ - type : 2, - title : '增加用户', - maxmin : true, - shadeClose : false, // 点击遮罩关闭层 - area : [ '800px', '520px' ], - content : prefix + '/add' - }); -} -function forceLogout(id) { - layer.confirm('确定要强制选中用户下线吗?', { - btn : [ '确定', '取消' ] - }, function() { - $.ajax({ - url : prefix+"/forceLogout/" + id, - type : "post", - data : { - 'id' : id - }, - success : function(r) { - if (r.code == 0) { - layer.msg(r.msg); - reLoad(); - } else { - layer.msg(r.msg); - } - } - }); - }) -} -function edit(id) { - layer.open({ - type : 2, - title : '用户修改', - maxmin : true, - shadeClose : true, // 点击遮罩关闭层 - area : [ '800px', '520px' ], - content : prefix + '/edit/' + id // iframe的url - }); -} -function resetPwd(id) { - layer.open({ - type : 2, - title : '重置密码', - maxmin : true, - shadeClose : false, // 点击遮罩关闭层 - area : [ '400px', '260px' ], - content : prefix + '/resetPwd/' + id // iframe的url - }); -} -function batchRemove() { - var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 - if (rows.length == 0) { - layer.msg("请选择要删除的数据"); - return; - } - layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { - btn : [ '确定', '取消' ] - // 按钮 - }, function() { - var ids = new Array(); - // 遍历所有选择的行数据,取每条数据对应的ID - $.each(rows, function(i, row) { - ids[i] = row['userId']; - }); - $.ajax({ - type : 'POST', - data : { - "ids" : ids - }, - url : prefix + '/batchRemove', - success : function(r) { - if (r.code == 0) { - layer.msg(r.msg); - reLoad(); - } else { - layer.msg(r.msg); - } - } - }); - }, function() { - }); -} -function getTreeData() { - $.ajax({ - type : "GET", - url : "/system/sysDept/tree", - success : function(tree) { - loadTree(tree); - } - }); -} -function loadTree(tree) { - $('#jstree').jstree({ - 'core' : { - 'data' : tree - }, - "plugins" : [ "search" ] - }); - $('#jstree').jstree().open_all(); -} -$('#jstree').on("changed.jstree", function(e, data) { - if (data.selected == -1) { - var opt = { - query : { - deptId : '', - } - } - $('#exampleTable').bootstrapTable('refresh', opt); - } else { - var opt = { - query : { - deptId : data.selected[0], - } - } - $('#exampleTable').bootstrapTable('refresh', opt); - } - +var prefix = "/sys/online" +$(function() { + load(); +}); + +function load() { + $('#exampleTable') + .bootstrapTable( + { + method : 'get', // 服务器数据的请求方式 get or post + url : prefix + "/list", // 服务器数据的加载地址 + // showRefresh : true, + // showToggle : true, + // showColumns : true, + iconSize : 'outline', + toolbar : '#exampleToolbar', + striped : true, // 设置为true会有隔行变色效果 + dataType : "json", // 服务器返回的数据类型 + pagination : true, // 设置为true会在底部显示分页条 + // queryParamsType : "limit", + // //设置为limit则会发送符合RESTFull格式的参数 + singleSelect : false, // 设置为true将禁止多选 + // contentType : "application/x-www-form-urlencoded", + // //发送到服务器的数据编码类型 + pageSize : 10, // 如果设置了分页,每页数据条数 + pageNumber : 1, // 如果设置了分布,首页页码 + // search : true, // 是否显示搜索框 + showColumns : false, // 是否显示内容下拉框(选择显示的列) + sidePagination : "client", // 设置在哪里进行分页,可选值为"client" 或者 + // "server" + queryParams : function(params) { + return { + // 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对 + limit : params.limit, + offset : params.offset, + name : $('#searchName').val() + }; + }, + // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 + // queryParamsType = 'limit' ,返回参数必须包含 + // limit, offset, search, sort, order 否则, 需要包含: + // pageSize, pageNumber, searchText, sortName, + // sortOrder. + // 返回false将会终止请求 + columns : [ + { + checkbox : true + }, + { + field : 'id', // 列字段名 + title : '序号' // 列标题 + }, + { + field : 'username', + title : '用户名' + }, + { + field : 'host', + title : '主机' + }, + { + field : 'startTimestamp', + title : '登录时间' + }, + { + field : 'lastAccessTime', + title : '最后访问时间' + }, + { + field : 'timeout', + title : '过期时间' + }, + { + field : 'status', + title : '状态', + align : 'center', + formatter : function(value, row, index) { + if (value == 'on_line') { + return '在线'; + } else if (value == 'off_line') { + return '离线'; + } + } + }, + { + title : '操作', + field : 'id', + align : 'center', + formatter : function(value, row, index) { + var d = ' '; + return d; + } + } ] + }); +} +function reLoad() { + $('#exampleTable').bootstrapTable('refresh'); +} +function add() { + // iframe层 + layer.open({ + type : 2, + title : '增加用户', + maxmin : true, + shadeClose : false, // 点击遮罩关闭层 + area : [ '800px', '520px' ], + content : prefix + '/add' + }); +} +function forceLogout(id) { + layer.confirm('确定要强制选中用户下线吗?', { + btn : [ '确定', '取消' ] + }, function() { + $.ajax({ + url : prefix+"/forceLogout/" + id, + type : "post", + data : { + 'id' : id + }, + success : function(r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }) +} +function edit(id) { + layer.open({ + type : 2, + title : '用户修改', + maxmin : true, + shadeClose : true, // 点击遮罩关闭层 + area : [ '800px', '520px' ], + content : prefix + '/edit/' + id // iframe的url + }); +} +function resetPwd(id) { + layer.open({ + type : 2, + title : '重置密码', + maxmin : true, + shadeClose : false, // 点击遮罩关闭层 + area : [ '400px', '260px' ], + content : prefix + '/resetPwd/' + id // iframe的url + }); +} +function batchRemove() { + var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 + if (rows.length == 0) { + layer.msg("请选择要删除的数据"); + return; + } + layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { + btn : [ '确定', '取消' ] + // 按钮 + }, function() { + var ids = new Array(); + // 遍历所有选择的行数据,取每条数据对应的ID + $.each(rows, function(i, row) { + ids[i] = row['userId']; + }); + $.ajax({ + type : 'POST', + data : { + "ids" : ids + }, + url : prefix + '/batchRemove', + success : function(r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }, function() { + }); +} +function getTreeData() { + $.ajax({ + type : "GET", + url : "/system/sysDept/tree", + success : function(tree) { + loadTree(tree); + } + }); +} +function loadTree(tree) { + $('#jstree').jstree({ + 'core' : { + 'data' : tree + }, + "plugins" : [ "search" ] + }); + $('#jstree').jstree().open_all(); +} +$('#jstree').on("changed.jstree", function(e, data) { + if (data.selected == -1) { + var opt = { + query : { + deptId : '', + } + } + $('#exampleTable').bootstrapTable('refresh', opt); + } else { + var opt = { + query : { + deptId : data.selected[0], + } + } + $('#exampleTable').bootstrapTable('refresh', opt); + } + }); \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/sys/role/add.js b/src/main/resources/static/js/appjs/sys/role/add.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/sys/role/add.js rename to src/main/resources/static/js/appjs/sys/role/add.js index 0cc27ef3ffb57b1a4c5bec3f2ad0e9852faae5d0..ea080db419800aeb074c728011608004e9ab62d6 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/role/add.js +++ b/src/main/resources/static/js/appjs/sys/role/add.js @@ -1,89 +1,89 @@ -//var menuTree; - -var menuIds; -$(function() { - getMenuTreeData(); - validateRule(); -}); -$.validator.setDefaults({ - submitHandler : function() { - getAllSelectNodes(); - save(); - } -}); - -function getAllSelectNodes() { - var ref = $('#menuTree').jstree(true); // 获得整个树 - - menuIds = ref.get_selected(); // 获得所有选中节点的,返回值为数组 - - $("#menuTree").find(".jstree-undetermined").each(function(i, element) { - menuIds.push($(element).closest('.jstree-node').attr("id")); - }); -} -function getMenuTreeData() { - $.ajax({ - type : "GET", - url : "/sys/menu/tree", - success : function(menuTree) { - loadMenuTree(menuTree); - } - }); -} -function loadMenuTree(menuTree) { - $('#menuTree').jstree({ - 'core' : { - 'data' : menuTree - }, - "checkbox" : { - "three_state" : true, - }, - "plugins" : [ "wholerow", "checkbox" ] - }); - //$('#menuTree').jstree("open_all"); - -} - -function save() { - $('#menuIds').val(menuIds); - var role = $('#signupForm').serialize(); - $.ajax({ - cache : true, - type : "POST", - url : "/sys/role/save", - data : role, // 你的formid - - async : false, - error : function(request) { - alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - - parent.layer.close(index); - - } else { - parent.layer.msg(data.msg); - } - } - }); -} - -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - roleName : { - required : true - } - }, - messages : { - roleName : { - required : icon + "请输入角色名" - } - } - }); +//var menuTree; + +var menuIds; +$(function() { + getMenuTreeData(); + validateRule(); +}); +$.validator.setDefaults({ + submitHandler : function() { + getAllSelectNodes(); + save(); + } +}); + +function getAllSelectNodes() { + var ref = $('#menuTree').jstree(true); // 获得整个树 + + menuIds = ref.get_selected(); // 获得所有选中节点的,返回值为数组 + + $("#menuTree").find(".jstree-undetermined").each(function(i, element) { + menuIds.push($(element).closest('.jstree-node').attr("id")); + }); +} +function getMenuTreeData() { + $.ajax({ + type : "GET", + url : "/sys/menu/tree", + success : function(menuTree) { + loadMenuTree(menuTree); + } + }); +} +function loadMenuTree(menuTree) { + $('#menuTree').jstree({ + 'core' : { + 'data' : menuTree + }, + "checkbox" : { + "three_state" : true, + }, + "plugins" : [ "wholerow", "checkbox" ] + }); + //$('#menuTree').jstree("open_all"); + +} + +function save() { + $('#menuIds').val(menuIds); + var role = $('#signupForm').serialize(); + $.ajax({ + cache : true, + type : "POST", + url : "/sys/role/save", + data : role, // 你的formid + + async : false, + error : function(request) { + alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + + parent.layer.close(index); + + } else { + parent.layer.msg(data.msg); + } + } + }); +} + +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + roleName : { + required : true + } + }, + messages : { + roleName : { + required : icon + "请输入角色名" + } + } + }); } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/sys/role/edit.js b/src/main/resources/static/js/appjs/sys/role/edit.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/sys/role/edit.js rename to src/main/resources/static/js/appjs/sys/role/edit.js index 269cbef6a7bd73f62fe9d2f0f932552c2aea0ebe..87c41f1c4457b1488553b9f2784df193ed5a805a 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/role/edit.js +++ b/src/main/resources/static/js/appjs/sys/role/edit.js @@ -1,85 +1,85 @@ -var menuIds; -$(function() { - getMenuTreeData(); - validateRule(); -}); -$.validator.setDefaults({ - submitHandler : function() { - getAllSelectNodes(); - update(); - } -}); -function loadMenuTree(menuTree) { - $('#menuTree').jstree({ - "plugins" : [ "wholerow", "checkbox" ], - 'core' : { - 'data' : menuTree - }, - "checkbox" : { - //"keep_selected_style" : false, - //"undetermined" : true - //"three_state" : false, - //"cascade" : ' up' - } - }); - $('#menuTree').jstree('open_all'); -} -function getAllSelectNodes() { - var ref = $('#menuTree').jstree(true); // 获得整个树 - menuIds = ref.get_selected(); // 获得所有选中节点的,返回值为数组 - $("#menuTree").find(".jstree-undetermined").each(function(i, element) { - menuIds.push($(element).closest('.jstree-node').attr("id")); - }); - console.log(menuIds); -} -function getMenuTreeData() { - var roleId = $('#roleId').val(); - $.ajax({ - type : "GET", - url : "/sys/menu/tree/" + roleId, - success : function(data) { - loadMenuTree(data); - } - }); -} -function update() { - $('#menuIds').val(menuIds); - var role = $('#signupForm').serialize(); - $.ajax({ - cache : true, - type : "POST", - url : "/sys/role/update", - data : role, // 你的formid - async : false, - error : function(request) { - alert("Connection error"); - }, - success : function(r) { - if (r.code == 0) { - parent.layer.msg(r.msg); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.msg(r.msg); - } - - } - }); -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - roleName : { - required : true - } - }, - messages : { - roleName : { - required : icon + "请输入角色名" - } - } - }); +var menuIds; +$(function() { + getMenuTreeData(); + validateRule(); +}); +$.validator.setDefaults({ + submitHandler : function() { + getAllSelectNodes(); + update(); + } +}); +function loadMenuTree(menuTree) { + $('#menuTree').jstree({ + "plugins" : [ "wholerow", "checkbox" ], + 'core' : { + 'data' : menuTree + }, + "checkbox" : { + //"keep_selected_style" : false, + //"undetermined" : true + //"three_state" : false, + //"cascade" : ' up' + } + }); + $('#menuTree').jstree('open_all'); +} +function getAllSelectNodes() { + var ref = $('#menuTree').jstree(true); // 获得整个树 + menuIds = ref.get_selected(); // 获得所有选中节点的,返回值为数组 + $("#menuTree").find(".jstree-undetermined").each(function(i, element) { + menuIds.push($(element).closest('.jstree-node').attr("id")); + }); + console.log(menuIds); +} +function getMenuTreeData() { + var roleId = $('#roleId').val(); + $.ajax({ + type : "GET", + url : "/sys/menu/tree/" + roleId, + success : function(data) { + loadMenuTree(data); + } + }); +} +function update() { + $('#menuIds').val(menuIds); + var role = $('#signupForm').serialize(); + $.ajax({ + cache : true, + type : "POST", + url : "/sys/role/update", + data : role, // 你的formid + async : false, + error : function(request) { + alert("Connection error"); + }, + success : function(r) { + if (r.code == 0) { + parent.layer.msg(r.msg); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.msg(r.msg); + } + + } + }); +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + roleName : { + required : true + } + }, + messages : { + roleName : { + required : icon + "请输入角色名" + } + } + }); } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/sys/role/role.js b/src/main/resources/static/js/appjs/sys/role/role.js similarity index 96% rename from bootdo/src/main/resources/static/js/appjs/sys/role/role.js rename to src/main/resources/static/js/appjs/sys/role/role.js index 583473d658046c748473fd350d44ef29f167ad76..239c2ec6583d4b9a19eef7748baae7ebae213f30 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/role/role.js +++ b/src/main/resources/static/js/appjs/sys/role/role.js @@ -1,150 +1,150 @@ -var prefix = "/sys/role"; -$(function() { - load(); -}); - -function load() { - $('#exampleTable') - .bootstrapTable( - { - method : 'get', // 服务器数据的请求方式 get or post - url : prefix + "/list", // 服务器数据的加载地址 - striped : true, // 设置为true会有隔行变色效果 - dataType : "json", // 服务器返回的数据类型 - pagination : true, // 设置为true会在底部显示分页条 - // queryParamsType : "limit", - // //设置为limit则会发送符合RESTFull格式的参数 - singleSelect : false, // 设置为true将禁止多选 - iconSize : 'outline', - toolbar : '#exampleToolbar', - // contentType : "application/x-www-form-urlencoded", - // //发送到服务器的数据编码类型 - pageSize : 10, // 如果设置了分页,每页数据条数 - pageNumber : 1, // 如果设置了分布,首页页码 - search : true, // 是否显示搜索框 - showColumns : true, // 是否显示内容下拉框(选择显示的列) - sidePagination : "client", // 设置在哪里进行分页,可选值为"client" 或者 - // "server" - // queryParams : queryParams, - // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 - // queryParamsType = 'limit' ,返回参数必须包含 - // limit, offset, search, sort, order 否则, 需要包含: - // pageSize, pageNumber, searchText, sortName, - // sortOrder. - // 返回false将会终止请求 - columns : [ - { // 列配置项 - // 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/ - checkbox : true - // 列表中显示复选框 - }, - { - field : 'roleId', // 列字段名 - title : '序号' // 列标题 - }, - { - field : 'roleName', - title : '角色名' - }, - { - field : 'remark', - title : '备注' - }, - { - field : '', - title : '权限' - }, - { - title : '操作', - field : 'roleId', - align : 'center', - formatter : function(value, row, index) { - var e = ' '; - var d = ' '; - return e + d; - } - } ] - }); -} -function reLoad() { - $('#exampleTable').bootstrapTable('refresh'); -} -function add() { - // iframe层 - layer.open({ - type : 2, - title : '添加角色', - maxmin : true, - shadeClose : false, // 点击遮罩关闭层 - area : [ '800px', '520px' ], - content : prefix + '/add' // iframe的url - }); -} -function remove(id) { - layer.confirm('确定要删除选中的记录?', { - btn : [ '确定', '取消' ] - }, function() { - $.ajax({ - url : prefix + "/remove", - type : "post", - data : { - 'id' : id - }, - success : function(r) { - if (r.code === 0) { - layer.msg("删除成功"); - reLoad(); - } else { - layer.msg(r.msg); - } - } - }); - }) - -} -function edit(id) { - layer.open({ - type : 2, - title : '角色修改', - maxmin : true, - shadeClose : true, // 点击遮罩关闭层 - area : [ '800px', '520px' ], - content : prefix + '/edit/' + id // iframe的url - }); -} -function batchRemove() { - - var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 - if (rows.length == 0) { - layer.msg("请选择要删除的数据"); - return; - } - layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { - btn : [ '确定', '取消' ] - }, function() { - var ids = new Array(); - $.each(rows, function(i, row) { - ids[i] = row['roleId']; - }); - console.log(ids); - $.ajax({ - type : 'POST', - data : { - "ids" : ids - }, - url : prefix + '/batchRemove', - success : function(r) { - if (r.code == 0) { - layer.msg(r.msg); - reLoad(); - } else { - layer.msg(r.msg); - } - } - }); - }, function() {}); +var prefix = "/sys/role"; +$(function() { + load(); +}); + +function load() { + $('#exampleTable') + .bootstrapTable( + { + method : 'get', // 服务器数据的请求方式 get or post + url : prefix + "/list", // 服务器数据的加载地址 + striped : true, // 设置为true会有隔行变色效果 + dataType : "json", // 服务器返回的数据类型 + pagination : true, // 设置为true会在底部显示分页条 + // queryParamsType : "limit", + // //设置为limit则会发送符合RESTFull格式的参数 + singleSelect : false, // 设置为true将禁止多选 + iconSize : 'outline', + toolbar : '#exampleToolbar', + // contentType : "application/x-www-form-urlencoded", + // //发送到服务器的数据编码类型 + pageSize : 10, // 如果设置了分页,每页数据条数 + pageNumber : 1, // 如果设置了分布,首页页码 + search : true, // 是否显示搜索框 + showColumns : true, // 是否显示内容下拉框(选择显示的列) + sidePagination : "client", // 设置在哪里进行分页,可选值为"client" 或者 + // "server" + // queryParams : queryParams, + // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 + // queryParamsType = 'limit' ,返回参数必须包含 + // limit, offset, search, sort, order 否则, 需要包含: + // pageSize, pageNumber, searchText, sortName, + // sortOrder. + // 返回false将会终止请求 + columns : [ + { // 列配置项 + // 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/ + checkbox : true + // 列表中显示复选框 + }, + { + field : 'roleId', // 列字段名 + title : '序号' // 列标题 + }, + { + field : 'roleName', + title : '角色名' + }, + { + field : 'remark', + title : '备注' + }, + { + field : '', + title : '权限' + }, + { + title : '操作', + field : 'roleId', + align : 'center', + formatter : function(value, row, index) { + var e = ' '; + var d = ' '; + return e + d; + } + } ] + }); +} +function reLoad() { + $('#exampleTable').bootstrapTable('refresh'); +} +function add() { + // iframe层 + layer.open({ + type : 2, + title : '添加角色', + maxmin : true, + shadeClose : false, // 点击遮罩关闭层 + area : [ '800px', '520px' ], + content : prefix + '/add' // iframe的url + }); +} +function remove(id) { + layer.confirm('确定要删除选中的记录?', { + btn : [ '确定', '取消' ] + }, function() { + $.ajax({ + url : prefix + "/remove", + type : "post", + data : { + 'id' : id + }, + success : function(r) { + if (r.code === 0) { + layer.msg("删除成功"); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }) + +} +function edit(id) { + layer.open({ + type : 2, + title : '角色修改', + maxmin : true, + shadeClose : true, // 点击遮罩关闭层 + area : [ '800px', '520px' ], + content : prefix + '/edit/' + id // iframe的url + }); +} +function batchRemove() { + + var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 + if (rows.length == 0) { + layer.msg("请选择要删除的数据"); + return; + } + layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { + btn : [ '确定', '取消' ] + }, function() { + var ids = new Array(); + $.each(rows, function(i, row) { + ids[i] = row['roleId']; + }); + console.log(ids); + $.ajax({ + type : 'POST', + data : { + "ids" : ids + }, + url : prefix + '/batchRemove', + success : function(r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }, function() {}); } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/sys/user/add.js b/src/main/resources/static/js/appjs/sys/user/add.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/sys/user/add.js rename to src/main/resources/static/js/appjs/sys/user/add.js index bf4979d0a660b9f6bcacd6e40224b4567c2b01b1..61a7f98275ff13d80a2dbd8160971d2e01990489 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/user/add.js +++ b/src/main/resources/static/js/appjs/sys/user/add.js @@ -1,122 +1,122 @@ -$().ready(function() { - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - save(); - } -}); -function getCheckedRoles() { - var adIds = ""; - $("input:checkbox[name=role]:checked").each(function(i) { - if (0 == i) { - adIds = $(this).val(); - } else { - adIds += ("," + $(this).val()); - } - }); - return adIds; -} -function save() { - $("#roleIds").val(getCheckedRoles()); - $.ajax({ - cache : true, - type : "POST", - url : "/sys/user/save", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - }, - username : { - required : true, - minlength : 2, - remote : { - url : "/sys/user/exit", // 后台处理程序 - type : "post", // 数据发送方式 - dataType : "json", // 接受数据格式 - data : { // 要传递的数据 - username : function() { - return $("#username").val(); - } - } - } - }, - password : { - required : true, - minlength : 6 - }, - confirm_password : { - required : true, - minlength : 6, - equalTo : "#password" - }, - email : { - required : true, - email : true - }, - topic : { - required : "#newsletter:checked", - minlength : 2 - }, - agree : "required" - }, - messages : { - - name : { - required : icon + "请输入姓名" - }, - username : { - required : icon + "请输入您的用户名", - minlength : icon + "用户名必须两个字符以上", - remote : icon + "用户名已经存在" - }, - password : { - required : icon + "请输入您的密码", - minlength : icon + "密码必须6个字符以上" - }, - confirm_password : { - required : icon + "请再次输入密码", - minlength : icon + "密码必须6个字符以上", - equalTo : icon + "两次输入的密码不一致" - }, - email : icon + "请输入您的E-mail", - } - }) -} - -var openDept = function(){ - layer.open({ - type:2, - title:"选择部门", - area : [ '300px', '450px' ], - content:"/system/sysDept/treeView" - }) -} -function loadDept( deptId,deptName){ - $("#deptId").val(deptId); - $("#deptName").val(deptName); +$().ready(function() { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + save(); + } +}); +function getCheckedRoles() { + var adIds = ""; + $("input:checkbox[name=role]:checked").each(function(i) { + if (0 == i) { + adIds = $(this).val(); + } else { + adIds += ("," + $(this).val()); + } + }); + return adIds; +} +function save() { + $("#roleIds").val(getCheckedRoles()); + $.ajax({ + cache : true, + type : "POST", + url : "/sys/user/save", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + }, + username : { + required : true, + minlength : 2, + remote : { + url : "/sys/user/exit", // 后台处理程序 + type : "post", // 数据发送方式 + dataType : "json", // 接受数据格式 + data : { // 要传递的数据 + username : function() { + return $("#username").val(); + } + } + } + }, + password : { + required : true, + minlength : 6 + }, + confirm_password : { + required : true, + minlength : 6, + equalTo : "#password" + }, + email : { + required : true, + email : true + }, + topic : { + required : "#newsletter:checked", + minlength : 2 + }, + agree : "required" + }, + messages : { + + name : { + required : icon + "请输入姓名" + }, + username : { + required : icon + "请输入您的用户名", + minlength : icon + "用户名必须两个字符以上", + remote : icon + "用户名已经存在" + }, + password : { + required : icon + "请输入您的密码", + minlength : icon + "密码必须6个字符以上" + }, + confirm_password : { + required : icon + "请再次输入密码", + minlength : icon + "密码必须6个字符以上", + equalTo : icon + "两次输入的密码不一致" + }, + email : icon + "请输入您的E-mail", + } + }) +} + +var openDept = function(){ + layer.open({ + type:2, + title:"选择部门", + area : [ '300px', '450px' ], + content:"/system/sysDept/treeView" + }) +} +function loadDept( deptId,deptName){ + $("#deptId").val(deptId); + $("#deptName").val(deptName); } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/sys/user/edit.js b/src/main/resources/static/js/appjs/sys/user/edit.js similarity index 95% rename from bootdo/src/main/resources/static/js/appjs/sys/user/edit.js rename to src/main/resources/static/js/appjs/sys/user/edit.js index 1d032a4db9f739f3063c80f6b42e95c16d7f87f1..eb350337db8143f43a2538c796cbcf41bbd490aa 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/user/edit.js +++ b/src/main/resources/static/js/appjs/sys/user/edit.js @@ -1,125 +1,125 @@ -// 以下为官方示例 -$().ready(function() { - validateRule(); - // $("#signupForm").validate(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - update(); - } -}); -function update() { - $("#roleIds").val(getCheckedRoles()); - $.ajax({ - cache : true, - type : "POST", - url : "/sys/user/update", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg(data.msg); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.msg(data.msg); - } - - } - }); - -} -function getCheckedRoles() { - var adIds = ""; - $("input:checkbox[name=role]:checked").each(function(i) { - if (0 == i) { - adIds = $(this).val(); - } else { - adIds += ("," + $(this).val()); - } - }); - return adIds; -} -function setCheckedRoles() { - var roleIds = $("#roleIds").val(); - alert(roleIds); - var adIds = ""; - $("input:checkbox[name=role]:checked").each(function(i) { - if (0 == i) { - adIds = $(this).val(); - } else { - adIds += ("," + $(this).val()); - } - }); - return adIds; -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - }, - username : { - required : true, - minlength : 2 - }, - password : { - required : true, - minlength : 6 - }, - confirm_password : { - required : true, - minlength : 6, - equalTo : "#password" - }, - email : { - required : true, - email : true - }, - topic : { - required : "#newsletter:checked", - minlength : 2 - }, - agree : "required" - }, - messages : { - - name : { - required : icon + "请输入姓名" - }, - username : { - required : icon + "请输入您的用户名", - minlength : icon + "用户名必须两个字符以上" - }, - password : { - required : icon + "请输入您的密码", - minlength : icon + "密码必须6个字符以上" - }, - confirm_password : { - required : icon + "请再次输入密码", - minlength : icon + "密码必须6个字符以上", - equalTo : icon + "两次输入的密码不一致" - }, - email : icon + "请输入您的E-mail", - } - }) -} -var openDept = function(){ - layer.open({ - type:2, - title:"选择部门", - area : [ '300px', '450px' ], - content:"/system/sysDept/treeView" - }) -} -function loadDept( deptId,deptName){ - $("#deptId").val(deptId); - $("#deptName").val(deptName); +// 以下为官方示例 +$().ready(function() { + validateRule(); + // $("#signupForm").validate(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + update(); + } +}); +function update() { + $("#roleIds").val(getCheckedRoles()); + $.ajax({ + cache : true, + type : "POST", + url : "/sys/user/update", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg(data.msg); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.msg(data.msg); + } + + } + }); + +} +function getCheckedRoles() { + var adIds = ""; + $("input:checkbox[name=role]:checked").each(function(i) { + if (0 == i) { + adIds = $(this).val(); + } else { + adIds += ("," + $(this).val()); + } + }); + return adIds; +} +function setCheckedRoles() { + var roleIds = $("#roleIds").val(); + alert(roleIds); + var adIds = ""; + $("input:checkbox[name=role]:checked").each(function(i) { + if (0 == i) { + adIds = $(this).val(); + } else { + adIds += ("," + $(this).val()); + } + }); + return adIds; +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + }, + username : { + required : true, + minlength : 2 + }, + password : { + required : true, + minlength : 6 + }, + confirm_password : { + required : true, + minlength : 6, + equalTo : "#password" + }, + email : { + required : true, + email : true + }, + topic : { + required : "#newsletter:checked", + minlength : 2 + }, + agree : "required" + }, + messages : { + + name : { + required : icon + "请输入姓名" + }, + username : { + required : icon + "请输入您的用户名", + minlength : icon + "用户名必须两个字符以上" + }, + password : { + required : icon + "请输入您的密码", + minlength : icon + "密码必须6个字符以上" + }, + confirm_password : { + required : icon + "请再次输入密码", + minlength : icon + "密码必须6个字符以上", + equalTo : icon + "两次输入的密码不一致" + }, + email : icon + "请输入您的E-mail", + } + }) +} +var openDept = function(){ + layer.open({ + type:2, + title:"选择部门", + area : [ '300px', '450px' ], + content:"/system/sysDept/treeView" + }) +} +function loadDept( deptId,deptName){ + $("#deptId").val(deptId); + $("#deptName").val(deptName); } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/sys/user/gg-bootdo.js b/src/main/resources/static/js/appjs/sys/user/gg-bootdo.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/sys/user/gg-bootdo.js rename to src/main/resources/static/js/appjs/sys/user/gg-bootdo.js diff --git a/bootdo/src/main/resources/static/js/appjs/sys/user/personal.js b/src/main/resources/static/js/appjs/sys/user/personal.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/sys/user/personal.js rename to src/main/resources/static/js/appjs/sys/user/personal.js diff --git a/bootdo/src/main/resources/static/js/appjs/sys/user/user.js b/src/main/resources/static/js/appjs/sys/user/user.js similarity index 96% rename from bootdo/src/main/resources/static/js/appjs/sys/user/user.js rename to src/main/resources/static/js/appjs/sys/user/user.js index fed89b6a5d807ef25e7d81d3e7675d055b500f2c..21a411dea956d52934b0c90ca30a8a1653965552 100644 --- a/bootdo/src/main/resources/static/js/appjs/sys/user/user.js +++ b/src/main/resources/static/js/appjs/sys/user/user.js @@ -1,221 +1,221 @@ -var prefix = "/sys/user" -$(function() { - var deptId = ''; - getTreeData(); - load(deptId); -}); - -function load(deptId) { - $('#exampleTable') - .bootstrapTable( - { - method : 'get', // 服务器数据的请求方式 get or post - url : prefix + "/list", // 服务器数据的加载地址 - // showRefresh : true, - // showToggle : true, - // showColumns : true, - iconSize : 'outline', - toolbar : '#exampleToolbar', - striped : true, // 设置为true会有隔行变色效果 - dataType : "json", // 服务器返回的数据类型 - pagination : true, // 设置为true会在底部显示分页条 - // queryParamsType : "limit", - // //设置为limit则会发送符合RESTFull格式的参数 - singleSelect : false, // 设置为true将禁止多选 - // contentType : "application/x-www-form-urlencoded", - // //发送到服务器的数据编码类型 - pageSize : 10, // 如果设置了分页,每页数据条数 - pageNumber : 1, // 如果设置了分布,首页页码 - // search : true, // 是否显示搜索框 - showColumns : false, // 是否显示内容下拉框(选择显示的列) - sidePagination : "server", // 设置在哪里进行分页,可选值为"client" 或者 - // "server" - queryParams : function(params) { - return { - // 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对 - limit : params.limit, - offset : params.offset, - name : $('#searchName').val(), - deptId : deptId - }; - }, - // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 - // queryParamsType = 'limit' ,返回参数必须包含 - // limit, offset, search, sort, order 否则, 需要包含: - // pageSize, pageNumber, searchText, sortName, - // sortOrder. - // 返回false将会终止请求 - columns : [ - { - checkbox : true - }, - { - field : 'userId', // 列字段名 - title : '序号' // 列标题 - }, - { - field : 'name', - title : '姓名' - }, - { - field : 'username', - title : '用户名' - }, - { - field : 'email', - title : '邮箱' - }, - { - field : 'status', - title : '状态', - align : 'center', - formatter : function(value, row, index) { - if (value == '0') { - return '禁用'; - } else if (value == '1') { - return '正常'; - } - } - }, - { - title : '操作', - field : 'id', - align : 'center', - formatter : function(value, row, index) { - var e = ' '; - var d = ' '; - var f = ' '; - return e + d + f; - } - } ] - }); -} -function reLoad() { - $('#exampleTable').bootstrapTable('refresh'); -} -function add() { - // iframe层 - layer.open({ - type : 2, - title : '增加用户', - maxmin : true, - shadeClose : false, // 点击遮罩关闭层 - area : [ '800px', '520px' ], - content : prefix + '/add' - }); -} -function remove(id) { - layer.confirm('确定要删除选中的记录?', { - btn : [ '确定', '取消' ] - }, function() { - $.ajax({ - url : "/sys/user/remove", - type : "post", - data : { - 'id' : id - }, - success : function(r) { - if (r.code == 0) { - layer.msg(r.msg); - reLoad(); - } else { - layer.msg(r.msg); - } - } - }); - }) -} -function edit(id) { - layer.open({ - type : 2, - title : '用户修改', - maxmin : true, - shadeClose : false, - area : [ '800px', '520px' ], - content : prefix + '/edit/' + id // iframe的url - }); -} -function resetPwd(id) { - layer.open({ - type : 2, - title : '重置密码', - maxmin : true, - shadeClose : false, // 点击遮罩关闭层 - area : [ '400px', '260px' ], - content : prefix + '/resetPwd/' + id // iframe的url - }); -} -function batchRemove() { - var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 - if (rows.length == 0) { - layer.msg("请选择要删除的数据"); - return; - } - layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { - btn : [ '确定', '取消' ] - // 按钮 - }, function() { - var ids = new Array(); - // 遍历所有选择的行数据,取每条数据对应的ID - $.each(rows, function(i, row) { - ids[i] = row['userId']; - }); - $.ajax({ - type : 'POST', - data : { - "ids" : ids - }, - url : prefix + '/batchRemove', - success : function(r) { - if (r.code == 0) { - layer.msg(r.msg); - reLoad(); - } else { - layer.msg(r.msg); - } - } - }); - }, function() {}); -} -function getTreeData() { - $.ajax({ - type : "GET", - url : "/system/sysDept/tree", - success : function(tree) { - loadTree(tree); - } - }); -} -function loadTree(tree) { - $('#jstree').jstree({ - 'core' : { - 'data' : tree - }, - "plugins" : [ "search" ] - }); - $('#jstree').jstree().open_all(); -} -$('#jstree').on("changed.jstree", function(e, data) { - if (data.selected == -1) { - var opt = { - query : { - deptId : '', - } - } - $('#exampleTable').bootstrapTable('refresh', opt); - } else { - var opt = { - query : { - deptId : data.selected[0], - } - } - $('#exampleTable').bootstrapTable('refresh',opt); - } - +var prefix = "/sys/user" +$(function() { + var deptId = ''; + getTreeData(); + load(deptId); +}); + +function load(deptId) { + $('#exampleTable') + .bootstrapTable( + { + method : 'get', // 服务器数据的请求方式 get or post + url : prefix + "/list", // 服务器数据的加载地址 + // showRefresh : true, + // showToggle : true, + // showColumns : true, + iconSize : 'outline', + toolbar : '#exampleToolbar', + striped : true, // 设置为true会有隔行变色效果 + dataType : "json", // 服务器返回的数据类型 + pagination : true, // 设置为true会在底部显示分页条 + // queryParamsType : "limit", + // //设置为limit则会发送符合RESTFull格式的参数 + singleSelect : false, // 设置为true将禁止多选 + // contentType : "application/x-www-form-urlencoded", + // //发送到服务器的数据编码类型 + pageSize : 10, // 如果设置了分页,每页数据条数 + pageNumber : 1, // 如果设置了分布,首页页码 + // search : true, // 是否显示搜索框 + showColumns : false, // 是否显示内容下拉框(选择显示的列) + sidePagination : "server", // 设置在哪里进行分页,可选值为"client" 或者 + // "server" + queryParams : function(params) { + return { + // 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对 + limit : params.limit, + offset : params.offset, + name : $('#searchName').val(), + deptId : deptId + }; + }, + // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 + // queryParamsType = 'limit' ,返回参数必须包含 + // limit, offset, search, sort, order 否则, 需要包含: + // pageSize, pageNumber, searchText, sortName, + // sortOrder. + // 返回false将会终止请求 + columns : [ + { + checkbox : true + }, + { + field : 'userId', // 列字段名 + title : '序号' // 列标题 + }, + { + field : 'name', + title : '姓名' + }, + { + field : 'username', + title : '用户名' + }, + { + field : 'email', + title : '邮箱' + }, + { + field : 'status', + title : '状态', + align : 'center', + formatter : function(value, row, index) { + if (value == '0') { + return '禁用'; + } else if (value == '1') { + return '正常'; + } + } + }, + { + title : '操作', + field : 'id', + align : 'center', + formatter : function(value, row, index) { + var e = ' '; + var d = ' '; + var f = ' '; + return e + d + f; + } + } ] + }); +} +function reLoad() { + $('#exampleTable').bootstrapTable('refresh'); +} +function add() { + // iframe层 + layer.open({ + type : 2, + title : '增加用户', + maxmin : true, + shadeClose : false, // 点击遮罩关闭层 + area : [ '800px', '520px' ], + content : prefix + '/add' + }); +} +function remove(id) { + layer.confirm('确定要删除选中的记录?', { + btn : [ '确定', '取消' ] + }, function() { + $.ajax({ + url : "/sys/user/remove", + type : "post", + data : { + 'id' : id + }, + success : function(r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }) +} +function edit(id) { + layer.open({ + type : 2, + title : '用户修改', + maxmin : true, + shadeClose : false, + area : [ '800px', '520px' ], + content : prefix + '/edit/' + id // iframe的url + }); +} +function resetPwd(id) { + layer.open({ + type : 2, + title : '重置密码', + maxmin : true, + shadeClose : false, // 点击遮罩关闭层 + area : [ '400px', '260px' ], + content : prefix + '/resetPwd/' + id // iframe的url + }); +} +function batchRemove() { + var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 + if (rows.length == 0) { + layer.msg("请选择要删除的数据"); + return; + } + layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { + btn : [ '确定', '取消' ] + // 按钮 + }, function() { + var ids = new Array(); + // 遍历所有选择的行数据,取每条数据对应的ID + $.each(rows, function(i, row) { + ids[i] = row['userId']; + }); + $.ajax({ + type : 'POST', + data : { + "ids" : ids + }, + url : prefix + '/batchRemove', + success : function(r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }, function() {}); +} +function getTreeData() { + $.ajax({ + type : "GET", + url : "/system/sysDept/tree", + success : function(tree) { + loadTree(tree); + } + }); +} +function loadTree(tree) { + $('#jstree').jstree({ + 'core' : { + 'data' : tree + }, + "plugins" : [ "search" ] + }); + $('#jstree').jstree().open_all(); +} +$('#jstree').on("changed.jstree", function(e, data) { + if (data.selected == -1) { + var opt = { + query : { + deptId : '', + } + } + $('#exampleTable').bootstrapTable('refresh', opt); + } else { + var opt = { + query : { + deptId : data.selected[0], + } + } + $('#exampleTable').bootstrapTable('refresh',opt); + } + }); \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/system/sysDept/add.js b/src/main/resources/static/js/appjs/system/sysDept/add.js similarity index 94% rename from bootdo/src/main/resources/static/js/appjs/system/sysDept/add.js rename to src/main/resources/static/js/appjs/system/sysDept/add.js index 3a37c32f0e233a2b284237dd76cb7c28a51515b6..9ba0154a0c839558e4f525d2483977d41edacfbc 100644 --- a/bootdo/src/main/resources/static/js/appjs/system/sysDept/add.js +++ b/src/main/resources/static/js/appjs/system/sysDept/add.js @@ -1,49 +1,49 @@ -$().ready(function() { - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - save(); - } -}); -function save() { - $.ajax({ - cache : true, - type : "POST", - url : "/system/sysDept/save", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入姓名" - } - } - }) +$().ready(function() { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + save(); + } +}); +function save() { + $.ajax({ + cache : true, + type : "POST", + url : "/system/sysDept/save", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入姓名" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/system/sysDept/edit.js b/src/main/resources/static/js/appjs/system/sysDept/edit.js similarity index 94% rename from bootdo/src/main/resources/static/js/appjs/system/sysDept/edit.js rename to src/main/resources/static/js/appjs/system/sysDept/edit.js index e66dbc9e02ad9448ddb7d2e477f9e0c17336a966..e0e68352eb9fa3d3c1d609c46514680c600c08a9 100644 --- a/bootdo/src/main/resources/static/js/appjs/system/sysDept/edit.js +++ b/src/main/resources/static/js/appjs/system/sysDept/edit.js @@ -1,49 +1,49 @@ -$().ready(function() { - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - update(); - } -}); -function update() { - $.ajax({ - cache : true, - type : "POST", - url : "/system/sysDept/update", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入名字" - } - } - }) +$().ready(function() { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + update(); + } +}); +function update() { + $.ajax({ + cache : true, + type : "POST", + url : "/system/sysDept/update", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入名字" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/appjs/system/sysDept/sysDept.js b/src/main/resources/static/js/appjs/system/sysDept/sysDept.js similarity index 100% rename from bootdo/src/main/resources/static/js/appjs/system/sysDept/sysDept.js rename to src/main/resources/static/js/appjs/system/sysDept/sysDept.js diff --git a/bootdo/src/main/resources/static/js/bootstrap-paginator.min.js b/src/main/resources/static/js/bootstrap-paginator.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/bootstrap-paginator.min.js rename to src/main/resources/static/js/bootstrap-paginator.min.js diff --git a/bootdo/src/main/resources/static/js/bootstrap.min.js b/src/main/resources/static/js/bootstrap.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/bootstrap.min.js rename to src/main/resources/static/js/bootstrap.min.js diff --git a/bootdo/src/main/resources/static/js/contabs.js b/src/main/resources/static/js/contabs.js similarity index 100% rename from bootdo/src/main/resources/static/js/contabs.js rename to src/main/resources/static/js/contabs.js diff --git a/bootdo/src/main/resources/static/js/content.js b/src/main/resources/static/js/content.js similarity index 100% rename from bootdo/src/main/resources/static/js/content.js rename to src/main/resources/static/js/content.js diff --git a/bootdo/src/main/resources/static/js/demo/bootstrap-table-demo.js b/src/main/resources/static/js/demo/bootstrap-table-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/bootstrap-table-demo.js rename to src/main/resources/static/js/demo/bootstrap-table-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/bootstrap_table_test.json b/src/main/resources/static/js/demo/bootstrap_table_test.json similarity index 100% rename from bootdo/src/main/resources/static/js/demo/bootstrap_table_test.json rename to src/main/resources/static/js/demo/bootstrap_table_test.json diff --git a/bootdo/src/main/resources/static/js/demo/bootstrap_table_test2.json b/src/main/resources/static/js/demo/bootstrap_table_test2.json similarity index 100% rename from bootdo/src/main/resources/static/js/demo/bootstrap_table_test2.json rename to src/main/resources/static/js/demo/bootstrap_table_test2.json diff --git a/bootdo/src/main/resources/static/js/demo/echarts-demo.js b/src/main/resources/static/js/demo/echarts-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/echarts-demo.js rename to src/main/resources/static/js/demo/echarts-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/flot-demo.js b/src/main/resources/static/js/demo/flot-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/flot-demo.js rename to src/main/resources/static/js/demo/flot-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/form-advanced-demo.js b/src/main/resources/static/js/demo/form-advanced-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/form-advanced-demo.js rename to src/main/resources/static/js/demo/form-advanced-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/form-validate-demo.js b/src/main/resources/static/js/demo/form-validate-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/form-validate-demo.js rename to src/main/resources/static/js/demo/form-validate-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/layer-demo.js b/src/main/resources/static/js/demo/layer-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/layer-demo.js rename to src/main/resources/static/js/demo/layer-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/morris-demo.js b/src/main/resources/static/js/demo/morris-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/morris-demo.js rename to src/main/resources/static/js/demo/morris-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/peity-demo.js b/src/main/resources/static/js/demo/peity-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/peity-demo.js rename to src/main/resources/static/js/demo/peity-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/photos.json b/src/main/resources/static/js/demo/photos.json similarity index 100% rename from bootdo/src/main/resources/static/js/demo/photos.json rename to src/main/resources/static/js/demo/photos.json diff --git a/bootdo/src/main/resources/static/js/demo/rickshaw-demo.js b/src/main/resources/static/js/demo/rickshaw-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/rickshaw-demo.js rename to src/main/resources/static/js/demo/rickshaw-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/sparkline-demo.js b/src/main/resources/static/js/demo/sparkline-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/sparkline-demo.js rename to src/main/resources/static/js/demo/sparkline-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/table_base.json b/src/main/resources/static/js/demo/table_base.json similarity index 100% rename from bootdo/src/main/resources/static/js/demo/table_base.json rename to src/main/resources/static/js/demo/table_base.json diff --git a/bootdo/src/main/resources/static/js/demo/treeview-demo.js b/src/main/resources/static/js/demo/treeview-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/treeview-demo.js rename to src/main/resources/static/js/demo/treeview-demo.js diff --git a/bootdo/src/main/resources/static/js/demo/webuploader-demo.js b/src/main/resources/static/js/demo/webuploader-demo.js similarity index 100% rename from bootdo/src/main/resources/static/js/demo/webuploader-demo.js rename to src/main/resources/static/js/demo/webuploader-demo.js diff --git a/bootdo/src/main/resources/static/js/jquery-ui-1.10.4.min.js b/src/main/resources/static/js/jquery-ui-1.10.4.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/jquery-ui-1.10.4.min.js rename to src/main/resources/static/js/jquery-ui-1.10.4.min.js diff --git a/bootdo/src/main/resources/static/js/jquery-ui.custom.min.js b/src/main/resources/static/js/jquery-ui.custom.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/jquery-ui.custom.min.js rename to src/main/resources/static/js/jquery-ui.custom.min.js diff --git a/bootdo/src/main/resources/static/js/jquery.min.js b/src/main/resources/static/js/jquery.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/jquery.min.js rename to src/main/resources/static/js/jquery.min.js diff --git a/bootdo/src/main/resources/static/js/jquery.min.map b/src/main/resources/static/js/jquery.min.map similarity index 100% rename from bootdo/src/main/resources/static/js/jquery.min.map rename to src/main/resources/static/js/jquery.min.map diff --git a/bootdo/src/main/resources/static/js/lay/all-mobile.js b/src/main/resources/static/js/lay/all-mobile.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/all-mobile.js rename to src/main/resources/static/js/lay/all-mobile.js diff --git a/bootdo/src/main/resources/static/js/lay/all.js b/src/main/resources/static/js/lay/all.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/all.js rename to src/main/resources/static/js/lay/all.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/carousel.js b/src/main/resources/static/js/lay/modules/carousel.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/carousel.js rename to src/main/resources/static/js/lay/modules/carousel.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/code.js b/src/main/resources/static/js/lay/modules/code.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/code.js rename to src/main/resources/static/js/lay/modules/code.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/element.js b/src/main/resources/static/js/lay/modules/element.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/element.js rename to src/main/resources/static/js/lay/modules/element.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/flow.js b/src/main/resources/static/js/lay/modules/flow.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/flow.js rename to src/main/resources/static/js/lay/modules/flow.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/form.js b/src/main/resources/static/js/lay/modules/form.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/form.js rename to src/main/resources/static/js/lay/modules/form.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/jquery.js b/src/main/resources/static/js/lay/modules/jquery.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/jquery.js rename to src/main/resources/static/js/lay/modules/jquery.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/laydate.js b/src/main/resources/static/js/lay/modules/laydate.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/laydate.js rename to src/main/resources/static/js/lay/modules/laydate.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/layedit.js b/src/main/resources/static/js/lay/modules/layedit.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/layedit.js rename to src/main/resources/static/js/lay/modules/layedit.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/layer.js b/src/main/resources/static/js/lay/modules/layer.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/layer.js rename to src/main/resources/static/js/lay/modules/layer.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/laypage.js b/src/main/resources/static/js/lay/modules/laypage.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/laypage.js rename to src/main/resources/static/js/lay/modules/laypage.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/laytpl.js b/src/main/resources/static/js/lay/modules/laytpl.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/laytpl.js rename to src/main/resources/static/js/lay/modules/laytpl.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/mobile.js b/src/main/resources/static/js/lay/modules/mobile.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/mobile.js rename to src/main/resources/static/js/lay/modules/mobile.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/mobile/layer-mobile.js b/src/main/resources/static/js/lay/modules/mobile/layer-mobile.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/mobile/layer-mobile.js rename to src/main/resources/static/js/lay/modules/mobile/layer-mobile.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/mobile/layim-mobile-open.js b/src/main/resources/static/js/lay/modules/mobile/layim-mobile-open.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/mobile/layim-mobile-open.js rename to src/main/resources/static/js/lay/modules/mobile/layim-mobile-open.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/mobile/upload-mobile.js b/src/main/resources/static/js/lay/modules/mobile/upload-mobile.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/mobile/upload-mobile.js rename to src/main/resources/static/js/lay/modules/mobile/upload-mobile.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/mobile/zepto.js b/src/main/resources/static/js/lay/modules/mobile/zepto.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/mobile/zepto.js rename to src/main/resources/static/js/lay/modules/mobile/zepto.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/table.js b/src/main/resources/static/js/lay/modules/table.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/table.js rename to src/main/resources/static/js/lay/modules/table.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/tree.js b/src/main/resources/static/js/lay/modules/tree.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/tree.js rename to src/main/resources/static/js/lay/modules/tree.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/upload.js b/src/main/resources/static/js/lay/modules/upload.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/upload.js rename to src/main/resources/static/js/lay/modules/upload.js diff --git a/bootdo/src/main/resources/static/js/lay/modules/util.js b/src/main/resources/static/js/lay/modules/util.js similarity index 100% rename from bootdo/src/main/resources/static/js/lay/modules/util.js rename to src/main/resources/static/js/lay/modules/util.js diff --git a/bootdo/src/main/resources/static/js/layui.js b/src/main/resources/static/js/layui.js similarity index 100% rename from bootdo/src/main/resources/static/js/layui.js rename to src/main/resources/static/js/layui.js diff --git a/bootdo/src/main/resources/static/js/openTab.js b/src/main/resources/static/js/openTab.js similarity index 100% rename from bootdo/src/main/resources/static/js/openTab.js rename to src/main/resources/static/js/openTab.js diff --git a/bootdo/src/main/resources/static/js/plugins/beautifyhtml/beautifyhtml.js b/src/main/resources/static/js/plugins/beautifyhtml/beautifyhtml.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/beautifyhtml/beautifyhtml.js rename to src/main/resources/static/js/plugins/beautifyhtml/beautifyhtml.js diff --git a/bootdo/src/main/resources/static/js/plugins/blueimp/jquery.blueimp-gallery.min.js b/src/main/resources/static/js/plugins/blueimp/jquery.blueimp-gallery.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/blueimp/jquery.blueimp-gallery.min.js rename to src/main/resources/static/js/plugins/blueimp/jquery.blueimp-gallery.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/bootstrap-paginator.min.js b/src/main/resources/static/js/plugins/bootstrap-paginator.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/bootstrap-paginator.min.js rename to src/main/resources/static/js/plugins/bootstrap-paginator.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js b/src/main/resources/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js rename to src/main/resources/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/bootstrap-table/bootstrap-table.min.js b/src/main/resources/static/js/plugins/bootstrap-table/bootstrap-table.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/bootstrap-table/bootstrap-table.min.js rename to src/main/resources/static/js/plugins/bootstrap-table/bootstrap-table.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js b/src/main/resources/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js rename to src/main/resources/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js diff --git a/bootdo/src/main/resources/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js b/src/main/resources/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js rename to src/main/resources/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/chartJs/Chart.min.js b/src/main/resources/static/js/plugins/chartJs/Chart.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/chartJs/Chart.min.js rename to src/main/resources/static/js/plugins/chartJs/Chart.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/chosen/chosen.jquery.js b/src/main/resources/static/js/plugins/chosen/chosen.jquery.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/chosen/chosen.jquery.js rename to src/main/resources/static/js/plugins/chosen/chosen.jquery.js diff --git a/bootdo/src/main/resources/static/js/plugins/clipboard/clipboard.min.js b/src/main/resources/static/js/plugins/clipboard/clipboard.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/clipboard/clipboard.min.js rename to src/main/resources/static/js/plugins/clipboard/clipboard.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/clockpicker/clockpicker.js b/src/main/resources/static/js/plugins/clockpicker/clockpicker.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/clockpicker/clockpicker.js rename to src/main/resources/static/js/plugins/clockpicker/clockpicker.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/codemirror.js b/src/main/resources/static/js/plugins/codemirror/codemirror.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/codemirror.js rename to src/main/resources/static/js/plugins/codemirror/codemirror.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/apl/apl.js b/src/main/resources/static/js/plugins/codemirror/mode/apl/apl.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/apl/apl.js rename to src/main/resources/static/js/plugins/codemirror/mode/apl/apl.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/apl/index.html b/src/main/resources/static/js/plugins/codemirror/mode/apl/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/apl/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/apl/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/asterisk/asterisk.js b/src/main/resources/static/js/plugins/codemirror/mode/asterisk/asterisk.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/asterisk/asterisk.js rename to src/main/resources/static/js/plugins/codemirror/mode/asterisk/asterisk.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/asterisk/index.html b/src/main/resources/static/js/plugins/codemirror/mode/asterisk/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/asterisk/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/asterisk/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/clike/clike.js b/src/main/resources/static/js/plugins/codemirror/mode/clike/clike.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/clike/clike.js rename to src/main/resources/static/js/plugins/codemirror/mode/clike/clike.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/clike/index.html b/src/main/resources/static/js/plugins/codemirror/mode/clike/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/clike/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/clike/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/clike/scala.html b/src/main/resources/static/js/plugins/codemirror/mode/clike/scala.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/clike/scala.html rename to src/main/resources/static/js/plugins/codemirror/mode/clike/scala.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/clojure/clojure.js b/src/main/resources/static/js/plugins/codemirror/mode/clojure/clojure.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/clojure/clojure.js rename to src/main/resources/static/js/plugins/codemirror/mode/clojure/clojure.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/clojure/index.html b/src/main/resources/static/js/plugins/codemirror/mode/clojure/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/clojure/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/clojure/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/cobol/cobol.js b/src/main/resources/static/js/plugins/codemirror/mode/cobol/cobol.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/cobol/cobol.js rename to src/main/resources/static/js/plugins/codemirror/mode/cobol/cobol.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/cobol/index.html b/src/main/resources/static/js/plugins/codemirror/mode/cobol/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/cobol/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/cobol/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/coffeescript/coffeescript.js b/src/main/resources/static/js/plugins/codemirror/mode/coffeescript/coffeescript.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/coffeescript/coffeescript.js rename to src/main/resources/static/js/plugins/codemirror/mode/coffeescript/coffeescript.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/coffeescript/index.html b/src/main/resources/static/js/plugins/codemirror/mode/coffeescript/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/coffeescript/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/coffeescript/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/commonlisp/commonlisp.js b/src/main/resources/static/js/plugins/codemirror/mode/commonlisp/commonlisp.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/commonlisp/commonlisp.js rename to src/main/resources/static/js/plugins/codemirror/mode/commonlisp/commonlisp.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/commonlisp/index.html b/src/main/resources/static/js/plugins/codemirror/mode/commonlisp/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/commonlisp/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/commonlisp/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/css.js b/src/main/resources/static/js/plugins/codemirror/mode/css/css.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/css.js rename to src/main/resources/static/js/plugins/codemirror/mode/css/css.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/index.html b/src/main/resources/static/js/plugins/codemirror/mode/css/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/css/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/less.html b/src/main/resources/static/js/plugins/codemirror/mode/css/less.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/less.html rename to src/main/resources/static/js/plugins/codemirror/mode/css/less.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/less_test.js b/src/main/resources/static/js/plugins/codemirror/mode/css/less_test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/less_test.js rename to src/main/resources/static/js/plugins/codemirror/mode/css/less_test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/scss.html b/src/main/resources/static/js/plugins/codemirror/mode/css/scss.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/scss.html rename to src/main/resources/static/js/plugins/codemirror/mode/css/scss.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/scss_test.js b/src/main/resources/static/js/plugins/codemirror/mode/css/scss_test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/scss_test.js rename to src/main/resources/static/js/plugins/codemirror/mode/css/scss_test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/test.js b/src/main/resources/static/js/plugins/codemirror/mode/css/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/css/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/css/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/cypher/cypher.js b/src/main/resources/static/js/plugins/codemirror/mode/cypher/cypher.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/cypher/cypher.js rename to src/main/resources/static/js/plugins/codemirror/mode/cypher/cypher.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/cypher/index.html b/src/main/resources/static/js/plugins/codemirror/mode/cypher/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/cypher/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/cypher/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/d/d.js b/src/main/resources/static/js/plugins/codemirror/mode/d/d.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/d/d.js rename to src/main/resources/static/js/plugins/codemirror/mode/d/d.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/d/index.html b/src/main/resources/static/js/plugins/codemirror/mode/d/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/d/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/d/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/dart/dart.js b/src/main/resources/static/js/plugins/codemirror/mode/dart/dart.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/dart/dart.js rename to src/main/resources/static/js/plugins/codemirror/mode/dart/dart.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/dart/index.html b/src/main/resources/static/js/plugins/codemirror/mode/dart/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/dart/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/dart/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/diff/diff.js b/src/main/resources/static/js/plugins/codemirror/mode/diff/diff.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/diff/diff.js rename to src/main/resources/static/js/plugins/codemirror/mode/diff/diff.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/diff/index.html b/src/main/resources/static/js/plugins/codemirror/mode/diff/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/diff/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/diff/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/django/django.js b/src/main/resources/static/js/plugins/codemirror/mode/django/django.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/django/django.js rename to src/main/resources/static/js/plugins/codemirror/mode/django/django.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/django/index.html b/src/main/resources/static/js/plugins/codemirror/mode/django/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/django/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/django/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/dockerfile/dockerfile.js b/src/main/resources/static/js/plugins/codemirror/mode/dockerfile/dockerfile.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/dockerfile/dockerfile.js rename to src/main/resources/static/js/plugins/codemirror/mode/dockerfile/dockerfile.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/dockerfile/index.html b/src/main/resources/static/js/plugins/codemirror/mode/dockerfile/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/dockerfile/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/dockerfile/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/dtd/dtd.js b/src/main/resources/static/js/plugins/codemirror/mode/dtd/dtd.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/dtd/dtd.js rename to src/main/resources/static/js/plugins/codemirror/mode/dtd/dtd.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/dtd/index.html b/src/main/resources/static/js/plugins/codemirror/mode/dtd/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/dtd/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/dtd/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/dylan/dylan.js b/src/main/resources/static/js/plugins/codemirror/mode/dylan/dylan.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/dylan/dylan.js rename to src/main/resources/static/js/plugins/codemirror/mode/dylan/dylan.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/dylan/index.html b/src/main/resources/static/js/plugins/codemirror/mode/dylan/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/dylan/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/dylan/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/ebnf/ebnf.js b/src/main/resources/static/js/plugins/codemirror/mode/ebnf/ebnf.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/ebnf/ebnf.js rename to src/main/resources/static/js/plugins/codemirror/mode/ebnf/ebnf.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/ebnf/index.html b/src/main/resources/static/js/plugins/codemirror/mode/ebnf/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/ebnf/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/ebnf/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/ecl/ecl.js b/src/main/resources/static/js/plugins/codemirror/mode/ecl/ecl.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/ecl/ecl.js rename to src/main/resources/static/js/plugins/codemirror/mode/ecl/ecl.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/ecl/index.html b/src/main/resources/static/js/plugins/codemirror/mode/ecl/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/ecl/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/ecl/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/eiffel/eiffel.js b/src/main/resources/static/js/plugins/codemirror/mode/eiffel/eiffel.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/eiffel/eiffel.js rename to src/main/resources/static/js/plugins/codemirror/mode/eiffel/eiffel.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/eiffel/index.html b/src/main/resources/static/js/plugins/codemirror/mode/eiffel/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/eiffel/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/eiffel/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/erlang/erlang.js b/src/main/resources/static/js/plugins/codemirror/mode/erlang/erlang.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/erlang/erlang.js rename to src/main/resources/static/js/plugins/codemirror/mode/erlang/erlang.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/erlang/index.html b/src/main/resources/static/js/plugins/codemirror/mode/erlang/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/erlang/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/erlang/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/fortran/fortran.js b/src/main/resources/static/js/plugins/codemirror/mode/fortran/fortran.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/fortran/fortran.js rename to src/main/resources/static/js/plugins/codemirror/mode/fortran/fortran.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/fortran/index.html b/src/main/resources/static/js/plugins/codemirror/mode/fortran/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/fortran/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/fortran/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/gas/gas.js b/src/main/resources/static/js/plugins/codemirror/mode/gas/gas.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/gas/gas.js rename to src/main/resources/static/js/plugins/codemirror/mode/gas/gas.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/gas/index.html b/src/main/resources/static/js/plugins/codemirror/mode/gas/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/gas/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/gas/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/gfm/gfm.js b/src/main/resources/static/js/plugins/codemirror/mode/gfm/gfm.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/gfm/gfm.js rename to src/main/resources/static/js/plugins/codemirror/mode/gfm/gfm.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/gfm/index.html b/src/main/resources/static/js/plugins/codemirror/mode/gfm/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/gfm/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/gfm/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/gfm/test.js b/src/main/resources/static/js/plugins/codemirror/mode/gfm/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/gfm/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/gfm/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/gherkin/gherkin.js b/src/main/resources/static/js/plugins/codemirror/mode/gherkin/gherkin.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/gherkin/gherkin.js rename to src/main/resources/static/js/plugins/codemirror/mode/gherkin/gherkin.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/gherkin/index.html b/src/main/resources/static/js/plugins/codemirror/mode/gherkin/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/gherkin/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/gherkin/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/go/go.js b/src/main/resources/static/js/plugins/codemirror/mode/go/go.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/go/go.js rename to src/main/resources/static/js/plugins/codemirror/mode/go/go.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/go/index.html b/src/main/resources/static/js/plugins/codemirror/mode/go/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/go/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/go/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/groovy/groovy.js b/src/main/resources/static/js/plugins/codemirror/mode/groovy/groovy.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/groovy/groovy.js rename to src/main/resources/static/js/plugins/codemirror/mode/groovy/groovy.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/groovy/index.html b/src/main/resources/static/js/plugins/codemirror/mode/groovy/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/groovy/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/groovy/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/haml/haml.js b/src/main/resources/static/js/plugins/codemirror/mode/haml/haml.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/haml/haml.js rename to src/main/resources/static/js/plugins/codemirror/mode/haml/haml.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/haml/index.html b/src/main/resources/static/js/plugins/codemirror/mode/haml/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/haml/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/haml/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/haml/test.js b/src/main/resources/static/js/plugins/codemirror/mode/haml/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/haml/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/haml/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/haskell/haskell.js b/src/main/resources/static/js/plugins/codemirror/mode/haskell/haskell.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/haskell/haskell.js rename to src/main/resources/static/js/plugins/codemirror/mode/haskell/haskell.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/haskell/index.html b/src/main/resources/static/js/plugins/codemirror/mode/haskell/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/haskell/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/haskell/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/haxe/haxe.js b/src/main/resources/static/js/plugins/codemirror/mode/haxe/haxe.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/haxe/haxe.js rename to src/main/resources/static/js/plugins/codemirror/mode/haxe/haxe.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/haxe/index.html b/src/main/resources/static/js/plugins/codemirror/mode/haxe/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/haxe/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/haxe/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/htmlembedded/htmlembedded.js b/src/main/resources/static/js/plugins/codemirror/mode/htmlembedded/htmlembedded.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/htmlembedded/htmlembedded.js rename to src/main/resources/static/js/plugins/codemirror/mode/htmlembedded/htmlembedded.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/htmlembedded/index.html b/src/main/resources/static/js/plugins/codemirror/mode/htmlembedded/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/htmlembedded/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/htmlembedded/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/htmlmixed/htmlmixed.js b/src/main/resources/static/js/plugins/codemirror/mode/htmlmixed/htmlmixed.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/htmlmixed/htmlmixed.js rename to src/main/resources/static/js/plugins/codemirror/mode/htmlmixed/htmlmixed.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/htmlmixed/index.html b/src/main/resources/static/js/plugins/codemirror/mode/htmlmixed/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/htmlmixed/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/htmlmixed/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/http/http.js b/src/main/resources/static/js/plugins/codemirror/mode/http/http.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/http/http.js rename to src/main/resources/static/js/plugins/codemirror/mode/http/http.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/http/index.html b/src/main/resources/static/js/plugins/codemirror/mode/http/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/http/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/http/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/idl/idl.js b/src/main/resources/static/js/plugins/codemirror/mode/idl/idl.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/idl/idl.js rename to src/main/resources/static/js/plugins/codemirror/mode/idl/idl.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/idl/index.html b/src/main/resources/static/js/plugins/codemirror/mode/idl/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/idl/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/idl/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/index.html b/src/main/resources/static/js/plugins/codemirror/mode/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/jade/index.html b/src/main/resources/static/js/plugins/codemirror/mode/jade/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/jade/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/jade/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/jade/jade.js b/src/main/resources/static/js/plugins/codemirror/mode/jade/jade.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/jade/jade.js rename to src/main/resources/static/js/plugins/codemirror/mode/jade/jade.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/index.html b/src/main/resources/static/js/plugins/codemirror/mode/javascript/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/javascript/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/javascript.js b/src/main/resources/static/js/plugins/codemirror/mode/javascript/javascript.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/javascript.js rename to src/main/resources/static/js/plugins/codemirror/mode/javascript/javascript.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/json-ld.html b/src/main/resources/static/js/plugins/codemirror/mode/javascript/json-ld.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/json-ld.html rename to src/main/resources/static/js/plugins/codemirror/mode/javascript/json-ld.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/test.js b/src/main/resources/static/js/plugins/codemirror/mode/javascript/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/javascript/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/typescript.html b/src/main/resources/static/js/plugins/codemirror/mode/javascript/typescript.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/javascript/typescript.html rename to src/main/resources/static/js/plugins/codemirror/mode/javascript/typescript.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/jinja2/index.html b/src/main/resources/static/js/plugins/codemirror/mode/jinja2/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/jinja2/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/jinja2/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/jinja2/jinja2.js b/src/main/resources/static/js/plugins/codemirror/mode/jinja2/jinja2.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/jinja2/jinja2.js rename to src/main/resources/static/js/plugins/codemirror/mode/jinja2/jinja2.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/julia/index.html b/src/main/resources/static/js/plugins/codemirror/mode/julia/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/julia/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/julia/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/julia/julia.js b/src/main/resources/static/js/plugins/codemirror/mode/julia/julia.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/julia/julia.js rename to src/main/resources/static/js/plugins/codemirror/mode/julia/julia.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/kotlin/index.html b/src/main/resources/static/js/plugins/codemirror/mode/kotlin/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/kotlin/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/kotlin/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/kotlin/kotlin.js b/src/main/resources/static/js/plugins/codemirror/mode/kotlin/kotlin.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/kotlin/kotlin.js rename to src/main/resources/static/js/plugins/codemirror/mode/kotlin/kotlin.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/livescript/index.html b/src/main/resources/static/js/plugins/codemirror/mode/livescript/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/livescript/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/livescript/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/livescript/livescript.js b/src/main/resources/static/js/plugins/codemirror/mode/livescript/livescript.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/livescript/livescript.js rename to src/main/resources/static/js/plugins/codemirror/mode/livescript/livescript.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/lua/index.html b/src/main/resources/static/js/plugins/codemirror/mode/lua/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/lua/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/lua/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/lua/lua.js b/src/main/resources/static/js/plugins/codemirror/mode/lua/lua.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/lua/lua.js rename to src/main/resources/static/js/plugins/codemirror/mode/lua/lua.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/markdown/index.html b/src/main/resources/static/js/plugins/codemirror/mode/markdown/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/markdown/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/markdown/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/markdown/markdown.js b/src/main/resources/static/js/plugins/codemirror/mode/markdown/markdown.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/markdown/markdown.js rename to src/main/resources/static/js/plugins/codemirror/mode/markdown/markdown.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/markdown/test.js b/src/main/resources/static/js/plugins/codemirror/mode/markdown/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/markdown/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/markdown/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/meta.js b/src/main/resources/static/js/plugins/codemirror/mode/meta.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/meta.js rename to src/main/resources/static/js/plugins/codemirror/mode/meta.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/mirc/index.html b/src/main/resources/static/js/plugins/codemirror/mode/mirc/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/mirc/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/mirc/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/mirc/mirc.js b/src/main/resources/static/js/plugins/codemirror/mode/mirc/mirc.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/mirc/mirc.js rename to src/main/resources/static/js/plugins/codemirror/mode/mirc/mirc.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/mllike/index.html b/src/main/resources/static/js/plugins/codemirror/mode/mllike/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/mllike/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/mllike/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/mllike/mllike.js b/src/main/resources/static/js/plugins/codemirror/mode/mllike/mllike.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/mllike/mllike.js rename to src/main/resources/static/js/plugins/codemirror/mode/mllike/mllike.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/modelica/index.html b/src/main/resources/static/js/plugins/codemirror/mode/modelica/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/modelica/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/modelica/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/modelica/modelica.js b/src/main/resources/static/js/plugins/codemirror/mode/modelica/modelica.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/modelica/modelica.js rename to src/main/resources/static/js/plugins/codemirror/mode/modelica/modelica.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/nginx/index.html b/src/main/resources/static/js/plugins/codemirror/mode/nginx/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/nginx/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/nginx/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/nginx/nginx.js b/src/main/resources/static/js/plugins/codemirror/mode/nginx/nginx.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/nginx/nginx.js rename to src/main/resources/static/js/plugins/codemirror/mode/nginx/nginx.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/ntriples/index.html b/src/main/resources/static/js/plugins/codemirror/mode/ntriples/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/ntriples/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/ntriples/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/ntriples/ntriples.js b/src/main/resources/static/js/plugins/codemirror/mode/ntriples/ntriples.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/ntriples/ntriples.js rename to src/main/resources/static/js/plugins/codemirror/mode/ntriples/ntriples.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/octave/index.html b/src/main/resources/static/js/plugins/codemirror/mode/octave/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/octave/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/octave/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/octave/octave.js b/src/main/resources/static/js/plugins/codemirror/mode/octave/octave.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/octave/octave.js rename to src/main/resources/static/js/plugins/codemirror/mode/octave/octave.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/pascal/index.html b/src/main/resources/static/js/plugins/codemirror/mode/pascal/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/pascal/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/pascal/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/pascal/pascal.js b/src/main/resources/static/js/plugins/codemirror/mode/pascal/pascal.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/pascal/pascal.js rename to src/main/resources/static/js/plugins/codemirror/mode/pascal/pascal.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/pegjs/index.html b/src/main/resources/static/js/plugins/codemirror/mode/pegjs/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/pegjs/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/pegjs/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/pegjs/pegjs.js b/src/main/resources/static/js/plugins/codemirror/mode/pegjs/pegjs.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/pegjs/pegjs.js rename to src/main/resources/static/js/plugins/codemirror/mode/pegjs/pegjs.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/perl/index.html b/src/main/resources/static/js/plugins/codemirror/mode/perl/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/perl/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/perl/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/perl/perl.js b/src/main/resources/static/js/plugins/codemirror/mode/perl/perl.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/perl/perl.js rename to src/main/resources/static/js/plugins/codemirror/mode/perl/perl.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/php/index.html b/src/main/resources/static/js/plugins/codemirror/mode/php/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/php/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/php/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/php/php.js b/src/main/resources/static/js/plugins/codemirror/mode/php/php.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/php/php.js rename to src/main/resources/static/js/plugins/codemirror/mode/php/php.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/php/test.js b/src/main/resources/static/js/plugins/codemirror/mode/php/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/php/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/php/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/pig/index.html b/src/main/resources/static/js/plugins/codemirror/mode/pig/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/pig/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/pig/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/pig/pig.js b/src/main/resources/static/js/plugins/codemirror/mode/pig/pig.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/pig/pig.js rename to src/main/resources/static/js/plugins/codemirror/mode/pig/pig.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/properties/index.html b/src/main/resources/static/js/plugins/codemirror/mode/properties/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/properties/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/properties/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/properties/properties.js b/src/main/resources/static/js/plugins/codemirror/mode/properties/properties.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/properties/properties.js rename to src/main/resources/static/js/plugins/codemirror/mode/properties/properties.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/puppet/index.html b/src/main/resources/static/js/plugins/codemirror/mode/puppet/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/puppet/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/puppet/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/puppet/puppet.js b/src/main/resources/static/js/plugins/codemirror/mode/puppet/puppet.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/puppet/puppet.js rename to src/main/resources/static/js/plugins/codemirror/mode/puppet/puppet.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/python/index.html b/src/main/resources/static/js/plugins/codemirror/mode/python/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/python/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/python/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/python/python.js b/src/main/resources/static/js/plugins/codemirror/mode/python/python.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/python/python.js rename to src/main/resources/static/js/plugins/codemirror/mode/python/python.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/q/index.html b/src/main/resources/static/js/plugins/codemirror/mode/q/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/q/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/q/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/q/q.js b/src/main/resources/static/js/plugins/codemirror/mode/q/q.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/q/q.js rename to src/main/resources/static/js/plugins/codemirror/mode/q/q.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/r/index.html b/src/main/resources/static/js/plugins/codemirror/mode/r/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/r/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/r/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/r/r.js b/src/main/resources/static/js/plugins/codemirror/mode/r/r.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/r/r.js rename to src/main/resources/static/js/plugins/codemirror/mode/r/r.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/rpm/changes/index.html b/src/main/resources/static/js/plugins/codemirror/mode/rpm/changes/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/rpm/changes/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/rpm/changes/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/rpm/index.html b/src/main/resources/static/js/plugins/codemirror/mode/rpm/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/rpm/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/rpm/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/rpm/rpm.js b/src/main/resources/static/js/plugins/codemirror/mode/rpm/rpm.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/rpm/rpm.js rename to src/main/resources/static/js/plugins/codemirror/mode/rpm/rpm.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/rst/index.html b/src/main/resources/static/js/plugins/codemirror/mode/rst/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/rst/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/rst/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/rst/rst.js b/src/main/resources/static/js/plugins/codemirror/mode/rst/rst.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/rst/rst.js rename to src/main/resources/static/js/plugins/codemirror/mode/rst/rst.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/ruby/index.html b/src/main/resources/static/js/plugins/codemirror/mode/ruby/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/ruby/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/ruby/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/ruby/ruby.js b/src/main/resources/static/js/plugins/codemirror/mode/ruby/ruby.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/ruby/ruby.js rename to src/main/resources/static/js/plugins/codemirror/mode/ruby/ruby.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/ruby/test.js b/src/main/resources/static/js/plugins/codemirror/mode/ruby/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/ruby/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/ruby/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/rust/index.html b/src/main/resources/static/js/plugins/codemirror/mode/rust/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/rust/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/rust/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/rust/rust.js b/src/main/resources/static/js/plugins/codemirror/mode/rust/rust.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/rust/rust.js rename to src/main/resources/static/js/plugins/codemirror/mode/rust/rust.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/sass/index.html b/src/main/resources/static/js/plugins/codemirror/mode/sass/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/sass/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/sass/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/sass/sass.js b/src/main/resources/static/js/plugins/codemirror/mode/sass/sass.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/sass/sass.js rename to src/main/resources/static/js/plugins/codemirror/mode/sass/sass.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/scheme/index.html b/src/main/resources/static/js/plugins/codemirror/mode/scheme/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/scheme/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/scheme/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/scheme/scheme.js b/src/main/resources/static/js/plugins/codemirror/mode/scheme/scheme.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/scheme/scheme.js rename to src/main/resources/static/js/plugins/codemirror/mode/scheme/scheme.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/shell/index.html b/src/main/resources/static/js/plugins/codemirror/mode/shell/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/shell/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/shell/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/shell/shell.js b/src/main/resources/static/js/plugins/codemirror/mode/shell/shell.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/shell/shell.js rename to src/main/resources/static/js/plugins/codemirror/mode/shell/shell.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/shell/test.js b/src/main/resources/static/js/plugins/codemirror/mode/shell/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/shell/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/shell/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/sieve/index.html b/src/main/resources/static/js/plugins/codemirror/mode/sieve/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/sieve/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/sieve/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/sieve/sieve.js b/src/main/resources/static/js/plugins/codemirror/mode/sieve/sieve.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/sieve/sieve.js rename to src/main/resources/static/js/plugins/codemirror/mode/sieve/sieve.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/slim/index.html b/src/main/resources/static/js/plugins/codemirror/mode/slim/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/slim/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/slim/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/slim/slim.js b/src/main/resources/static/js/plugins/codemirror/mode/slim/slim.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/slim/slim.js rename to src/main/resources/static/js/plugins/codemirror/mode/slim/slim.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/slim/test.js b/src/main/resources/static/js/plugins/codemirror/mode/slim/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/slim/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/slim/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/smalltalk/index.html b/src/main/resources/static/js/plugins/codemirror/mode/smalltalk/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/smalltalk/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/smalltalk/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/smalltalk/smalltalk.js b/src/main/resources/static/js/plugins/codemirror/mode/smalltalk/smalltalk.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/smalltalk/smalltalk.js rename to src/main/resources/static/js/plugins/codemirror/mode/smalltalk/smalltalk.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/smarty/index.html b/src/main/resources/static/js/plugins/codemirror/mode/smarty/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/smarty/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/smarty/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/smarty/smarty.js b/src/main/resources/static/js/plugins/codemirror/mode/smarty/smarty.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/smarty/smarty.js rename to src/main/resources/static/js/plugins/codemirror/mode/smarty/smarty.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/smartymixed/index.html b/src/main/resources/static/js/plugins/codemirror/mode/smartymixed/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/smartymixed/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/smartymixed/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/smartymixed/smartymixed.js b/src/main/resources/static/js/plugins/codemirror/mode/smartymixed/smartymixed.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/smartymixed/smartymixed.js rename to src/main/resources/static/js/plugins/codemirror/mode/smartymixed/smartymixed.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/solr/index.html b/src/main/resources/static/js/plugins/codemirror/mode/solr/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/solr/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/solr/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/solr/solr.js b/src/main/resources/static/js/plugins/codemirror/mode/solr/solr.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/solr/solr.js rename to src/main/resources/static/js/plugins/codemirror/mode/solr/solr.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/soy/index.html b/src/main/resources/static/js/plugins/codemirror/mode/soy/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/soy/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/soy/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/soy/soy.js b/src/main/resources/static/js/plugins/codemirror/mode/soy/soy.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/soy/soy.js rename to src/main/resources/static/js/plugins/codemirror/mode/soy/soy.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/sparql/index.html b/src/main/resources/static/js/plugins/codemirror/mode/sparql/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/sparql/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/sparql/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/sparql/sparql.js b/src/main/resources/static/js/plugins/codemirror/mode/sparql/sparql.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/sparql/sparql.js rename to src/main/resources/static/js/plugins/codemirror/mode/sparql/sparql.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/spreadsheet/index.html b/src/main/resources/static/js/plugins/codemirror/mode/spreadsheet/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/spreadsheet/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/spreadsheet/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/spreadsheet/spreadsheet.js b/src/main/resources/static/js/plugins/codemirror/mode/spreadsheet/spreadsheet.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/spreadsheet/spreadsheet.js rename to src/main/resources/static/js/plugins/codemirror/mode/spreadsheet/spreadsheet.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/sql/index.html b/src/main/resources/static/js/plugins/codemirror/mode/sql/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/sql/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/sql/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/sql/sql.js b/src/main/resources/static/js/plugins/codemirror/mode/sql/sql.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/sql/sql.js rename to src/main/resources/static/js/plugins/codemirror/mode/sql/sql.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/stex/index.html b/src/main/resources/static/js/plugins/codemirror/mode/stex/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/stex/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/stex/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/stex/stex.js b/src/main/resources/static/js/plugins/codemirror/mode/stex/stex.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/stex/stex.js rename to src/main/resources/static/js/plugins/codemirror/mode/stex/stex.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/stex/test.js b/src/main/resources/static/js/plugins/codemirror/mode/stex/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/stex/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/stex/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tcl/index.html b/src/main/resources/static/js/plugins/codemirror/mode/tcl/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tcl/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/tcl/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tcl/tcl.js b/src/main/resources/static/js/plugins/codemirror/mode/tcl/tcl.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tcl/tcl.js rename to src/main/resources/static/js/plugins/codemirror/mode/tcl/tcl.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/textile/index.html b/src/main/resources/static/js/plugins/codemirror/mode/textile/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/textile/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/textile/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/textile/test.js b/src/main/resources/static/js/plugins/codemirror/mode/textile/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/textile/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/textile/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/textile/textile.js b/src/main/resources/static/js/plugins/codemirror/mode/textile/textile.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/textile/textile.js rename to src/main/resources/static/js/plugins/codemirror/mode/textile/textile.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/index.html b/src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/tiddlywiki.css b/src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/tiddlywiki.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/tiddlywiki.css rename to src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/tiddlywiki.css diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/tiddlywiki.js b/src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/tiddlywiki.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/tiddlywiki.js rename to src/main/resources/static/js/plugins/codemirror/mode/tiddlywiki/tiddlywiki.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiki/index.html b/src/main/resources/static/js/plugins/codemirror/mode/tiki/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiki/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/tiki/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiki/tiki.css b/src/main/resources/static/js/plugins/codemirror/mode/tiki/tiki.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiki/tiki.css rename to src/main/resources/static/js/plugins/codemirror/mode/tiki/tiki.css diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiki/tiki.js b/src/main/resources/static/js/plugins/codemirror/mode/tiki/tiki.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tiki/tiki.js rename to src/main/resources/static/js/plugins/codemirror/mode/tiki/tiki.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/toml/index.html b/src/main/resources/static/js/plugins/codemirror/mode/toml/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/toml/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/toml/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/toml/toml.js b/src/main/resources/static/js/plugins/codemirror/mode/toml/toml.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/toml/toml.js rename to src/main/resources/static/js/plugins/codemirror/mode/toml/toml.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tornado/index.html b/src/main/resources/static/js/plugins/codemirror/mode/tornado/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tornado/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/tornado/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/tornado/tornado.js b/src/main/resources/static/js/plugins/codemirror/mode/tornado/tornado.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/tornado/tornado.js rename to src/main/resources/static/js/plugins/codemirror/mode/tornado/tornado.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/turtle/index.html b/src/main/resources/static/js/plugins/codemirror/mode/turtle/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/turtle/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/turtle/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/turtle/turtle.js b/src/main/resources/static/js/plugins/codemirror/mode/turtle/turtle.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/turtle/turtle.js rename to src/main/resources/static/js/plugins/codemirror/mode/turtle/turtle.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/vb/index.html b/src/main/resources/static/js/plugins/codemirror/mode/vb/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/vb/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/vb/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/vb/vb.js b/src/main/resources/static/js/plugins/codemirror/mode/vb/vb.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/vb/vb.js rename to src/main/resources/static/js/plugins/codemirror/mode/vb/vb.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/vbscript/index.html b/src/main/resources/static/js/plugins/codemirror/mode/vbscript/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/vbscript/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/vbscript/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/vbscript/vbscript.js b/src/main/resources/static/js/plugins/codemirror/mode/vbscript/vbscript.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/vbscript/vbscript.js rename to src/main/resources/static/js/plugins/codemirror/mode/vbscript/vbscript.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/velocity/index.html b/src/main/resources/static/js/plugins/codemirror/mode/velocity/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/velocity/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/velocity/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/velocity/velocity.js b/src/main/resources/static/js/plugins/codemirror/mode/velocity/velocity.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/velocity/velocity.js rename to src/main/resources/static/js/plugins/codemirror/mode/velocity/velocity.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/verilog/index.html b/src/main/resources/static/js/plugins/codemirror/mode/verilog/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/verilog/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/verilog/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/verilog/test.js b/src/main/resources/static/js/plugins/codemirror/mode/verilog/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/verilog/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/verilog/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/verilog/verilog.js b/src/main/resources/static/js/plugins/codemirror/mode/verilog/verilog.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/verilog/verilog.js rename to src/main/resources/static/js/plugins/codemirror/mode/verilog/verilog.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/xml/index.html b/src/main/resources/static/js/plugins/codemirror/mode/xml/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/xml/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/xml/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/xml/test.js b/src/main/resources/static/js/plugins/codemirror/mode/xml/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/xml/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/xml/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/xml/xml.js b/src/main/resources/static/js/plugins/codemirror/mode/xml/xml.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/xml/xml.js rename to src/main/resources/static/js/plugins/codemirror/mode/xml/xml.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/xquery/index.html b/src/main/resources/static/js/plugins/codemirror/mode/xquery/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/xquery/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/xquery/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/xquery/test.js b/src/main/resources/static/js/plugins/codemirror/mode/xquery/test.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/xquery/test.js rename to src/main/resources/static/js/plugins/codemirror/mode/xquery/test.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/xquery/xquery.js b/src/main/resources/static/js/plugins/codemirror/mode/xquery/xquery.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/xquery/xquery.js rename to src/main/resources/static/js/plugins/codemirror/mode/xquery/xquery.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/yaml/index.html b/src/main/resources/static/js/plugins/codemirror/mode/yaml/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/yaml/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/yaml/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/yaml/yaml.js b/src/main/resources/static/js/plugins/codemirror/mode/yaml/yaml.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/yaml/yaml.js rename to src/main/resources/static/js/plugins/codemirror/mode/yaml/yaml.js diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/z80/index.html b/src/main/resources/static/js/plugins/codemirror/mode/z80/index.html similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/z80/index.html rename to src/main/resources/static/js/plugins/codemirror/mode/z80/index.html diff --git a/bootdo/src/main/resources/static/js/plugins/codemirror/mode/z80/z80.js b/src/main/resources/static/js/plugins/codemirror/mode/z80/z80.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/codemirror/mode/z80/z80.js rename to src/main/resources/static/js/plugins/codemirror/mode/z80/z80.js diff --git a/bootdo/src/main/resources/static/js/plugins/colorpicker/bootstrap-colorpicker.min.js b/src/main/resources/static/js/plugins/colorpicker/bootstrap-colorpicker.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/colorpicker/bootstrap-colorpicker.min.js rename to src/main/resources/static/js/plugins/colorpicker/bootstrap-colorpicker.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/cropper/cropper.min.js b/src/main/resources/static/js/plugins/cropper/cropper.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/cropper/cropper.min.js rename to src/main/resources/static/js/plugins/cropper/cropper.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/dataTables/dataTables.bootstrap.js b/src/main/resources/static/js/plugins/dataTables/dataTables.bootstrap.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/dataTables/dataTables.bootstrap.js rename to src/main/resources/static/js/plugins/dataTables/dataTables.bootstrap.js diff --git a/bootdo/src/main/resources/static/js/plugins/dataTables/jquery.dataTables.js b/src/main/resources/static/js/plugins/dataTables/jquery.dataTables.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/dataTables/jquery.dataTables.js rename to src/main/resources/static/js/plugins/dataTables/jquery.dataTables.js diff --git a/bootdo/src/main/resources/static/js/plugins/datapicker/bootstrap-datepicker.js b/src/main/resources/static/js/plugins/datapicker/bootstrap-datepicker.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/datapicker/bootstrap-datepicker.js rename to src/main/resources/static/js/plugins/datapicker/bootstrap-datepicker.js diff --git a/bootdo/src/main/resources/static/js/plugins/diff_match_patch/diff_match_patch.js b/src/main/resources/static/js/plugins/diff_match_patch/diff_match_patch.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/diff_match_patch/diff_match_patch.js rename to src/main/resources/static/js/plugins/diff_match_patch/diff_match_patch.js diff --git a/bootdo/src/main/resources/static/js/plugins/distpicker/distpicker.data.min.js b/src/main/resources/static/js/plugins/distpicker/distpicker.data.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/distpicker/distpicker.data.min.js rename to src/main/resources/static/js/plugins/distpicker/distpicker.data.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/distpicker/distpicker.js b/src/main/resources/static/js/plugins/distpicker/distpicker.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/distpicker/distpicker.js rename to src/main/resources/static/js/plugins/distpicker/distpicker.js diff --git a/bootdo/src/main/resources/static/js/plugins/distpicker/distpicker.min.js b/src/main/resources/static/js/plugins/distpicker/distpicker.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/distpicker/distpicker.min.js rename to src/main/resources/static/js/plugins/distpicker/distpicker.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/dropzone/dropzone.js b/src/main/resources/static/js/plugins/dropzone/dropzone.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/dropzone/dropzone.js rename to src/main/resources/static/js/plugins/dropzone/dropzone.js diff --git a/bootdo/src/main/resources/static/js/plugins/duallistbox/jquery.bootstrap-duallistbox.js b/src/main/resources/static/js/plugins/duallistbox/jquery.bootstrap-duallistbox.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/duallistbox/jquery.bootstrap-duallistbox.js rename to src/main/resources/static/js/plugins/duallistbox/jquery.bootstrap-duallistbox.js diff --git a/bootdo/src/main/resources/static/js/plugins/easypiechart/jquery.easypiechart.js b/src/main/resources/static/js/plugins/easypiechart/jquery.easypiechart.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/easypiechart/jquery.easypiechart.js rename to src/main/resources/static/js/plugins/easypiechart/jquery.easypiechart.js diff --git a/bootdo/src/main/resources/static/js/plugins/echarts/echarts-all.js b/src/main/resources/static/js/plugins/echarts/echarts-all.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/echarts/echarts-all.js rename to src/main/resources/static/js/plugins/echarts/echarts-all.js diff --git a/bootdo/src/main/resources/static/js/plugins/fancybox/blank.gif b/src/main/resources/static/js/plugins/fancybox/blank.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fancybox/blank.gif rename to src/main/resources/static/js/plugins/fancybox/blank.gif diff --git a/bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_loading.gif b/src/main/resources/static/js/plugins/fancybox/fancybox_loading.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_loading.gif rename to src/main/resources/static/js/plugins/fancybox/fancybox_loading.gif diff --git a/bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_loading@2x.gif b/src/main/resources/static/js/plugins/fancybox/fancybox_loading@2x.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_loading@2x.gif rename to src/main/resources/static/js/plugins/fancybox/fancybox_loading@2x.gif diff --git a/bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_overlay.png b/src/main/resources/static/js/plugins/fancybox/fancybox_overlay.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_overlay.png rename to src/main/resources/static/js/plugins/fancybox/fancybox_overlay.png diff --git a/bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_sprite.png b/src/main/resources/static/js/plugins/fancybox/fancybox_sprite.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_sprite.png rename to src/main/resources/static/js/plugins/fancybox/fancybox_sprite.png diff --git a/bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_sprite@2x.png b/src/main/resources/static/js/plugins/fancybox/fancybox_sprite@2x.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fancybox/fancybox_sprite@2x.png rename to src/main/resources/static/js/plugins/fancybox/fancybox_sprite@2x.png diff --git a/bootdo/src/main/resources/static/js/plugins/fancybox/jquery.fancybox.css b/src/main/resources/static/js/plugins/fancybox/jquery.fancybox.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fancybox/jquery.fancybox.css rename to src/main/resources/static/js/plugins/fancybox/jquery.fancybox.css diff --git a/bootdo/src/main/resources/static/js/plugins/fancybox/jquery.fancybox.js b/src/main/resources/static/js/plugins/fancybox/jquery.fancybox.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fancybox/jquery.fancybox.js rename to src/main/resources/static/js/plugins/fancybox/jquery.fancybox.js diff --git a/bootdo/src/main/resources/static/js/plugins/flot/curvedLines.js b/src/main/resources/static/js/plugins/flot/curvedLines.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/flot/curvedLines.js rename to src/main/resources/static/js/plugins/flot/curvedLines.js diff --git a/bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.js b/src/main/resources/static/js/plugins/flot/jquery.flot.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.js rename to src/main/resources/static/js/plugins/flot/jquery.flot.js diff --git a/bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.pie.js b/src/main/resources/static/js/plugins/flot/jquery.flot.pie.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.pie.js rename to src/main/resources/static/js/plugins/flot/jquery.flot.pie.js diff --git a/bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.resize.js b/src/main/resources/static/js/plugins/flot/jquery.flot.resize.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.resize.js rename to src/main/resources/static/js/plugins/flot/jquery.flot.resize.js diff --git a/bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.spline.js b/src/main/resources/static/js/plugins/flot/jquery.flot.spline.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.spline.js rename to src/main/resources/static/js/plugins/flot/jquery.flot.spline.js diff --git a/bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.symbol.js b/src/main/resources/static/js/plugins/flot/jquery.flot.symbol.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.symbol.js rename to src/main/resources/static/js/plugins/flot/jquery.flot.symbol.js diff --git a/bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.tooltip.min.js b/src/main/resources/static/js/plugins/flot/jquery.flot.tooltip.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/flot/jquery.flot.tooltip.min.js rename to src/main/resources/static/js/plugins/flot/jquery.flot.tooltip.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/footable/footable.all.min.js b/src/main/resources/static/js/plugins/footable/footable.all.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/footable/footable.all.min.js rename to src/main/resources/static/js/plugins/footable/footable.all.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/fullcalendar/fullcalendar.min.js b/src/main/resources/static/js/plugins/fullcalendar/fullcalendar.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fullcalendar/fullcalendar.min.js rename to src/main/resources/static/js/plugins/fullcalendar/fullcalendar.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/fullcalendar/moment.min.js b/src/main/resources/static/js/plugins/fullcalendar/moment.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/fullcalendar/moment.min.js rename to src/main/resources/static/js/plugins/fullcalendar/moment.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/gritter/images/gritter-light.png b/src/main/resources/static/js/plugins/gritter/images/gritter-light.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/gritter/images/gritter-light.png rename to src/main/resources/static/js/plugins/gritter/images/gritter-light.png diff --git a/bootdo/src/main/resources/static/js/plugins/gritter/images/gritter.png b/src/main/resources/static/js/plugins/gritter/images/gritter.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/gritter/images/gritter.png rename to src/main/resources/static/js/plugins/gritter/images/gritter.png diff --git a/bootdo/src/main/resources/static/js/plugins/gritter/images/ie-spacer.gif b/src/main/resources/static/js/plugins/gritter/images/ie-spacer.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/gritter/images/ie-spacer.gif rename to src/main/resources/static/js/plugins/gritter/images/ie-spacer.gif diff --git a/bootdo/src/main/resources/static/js/plugins/gritter/jquery.gritter.css b/src/main/resources/static/js/plugins/gritter/jquery.gritter.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/gritter/jquery.gritter.css rename to src/main/resources/static/js/plugins/gritter/jquery.gritter.css diff --git a/bootdo/src/main/resources/static/js/plugins/gritter/jquery.gritter.min.js b/src/main/resources/static/js/plugins/gritter/jquery.gritter.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/gritter/jquery.gritter.min.js rename to src/main/resources/static/js/plugins/gritter/jquery.gritter.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/iCheck/icheck.min.js b/src/main/resources/static/js/plugins/iCheck/icheck.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/iCheck/icheck.min.js rename to src/main/resources/static/js/plugins/iCheck/icheck.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/ionRangeSlider/ion.rangeSlider.min.js b/src/main/resources/static/js/plugins/ionRangeSlider/ion.rangeSlider.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/ionRangeSlider/ion.rangeSlider.min.js rename to src/main/resources/static/js/plugins/ionRangeSlider/ion.rangeSlider.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/ionRangeSlider/jasny/jasny-bootstrap.min.js b/src/main/resources/static/js/plugins/ionRangeSlider/jasny/jasny-bootstrap.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/ionRangeSlider/jasny/jasny-bootstrap.min.js rename to src/main/resources/static/js/plugins/ionRangeSlider/jasny/jasny-bootstrap.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/jasny/jasny-bootstrap.min.js b/src/main/resources/static/js/plugins/jasny/jasny-bootstrap.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jasny/jasny-bootstrap.min.js rename to src/main/resources/static/js/plugins/jasny/jasny-bootstrap.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/jeditable/jquery.jeditable.js b/src/main/resources/static/js/plugins/jeditable/jquery.jeditable.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jeditable/jquery.jeditable.js rename to src/main/resources/static/js/plugins/jeditable/jquery.jeditable.js diff --git a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.bootstrap3.js b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.bootstrap3.js similarity index 97% rename from bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.bootstrap3.js rename to src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.bootstrap3.js index 1118697fb065a2b60dea591760a2db3b0808f5a6..ac4a835205a1f95d926ee0d1e9d546ef6ea13d76 100644 --- a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.bootstrap3.js +++ b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.bootstrap3.js @@ -1,4 +1,4 @@ -$.extend($.fn.treegrid.defaults, { - expanderExpandedClass: 'glyphicon glyphicon-chevron-down', - expanderCollapsedClass: 'glyphicon glyphicon-chevron-right' -}); +$.extend($.fn.treegrid.defaults, { + expanderExpandedClass: 'glyphicon glyphicon-chevron-down', + expanderCollapsedClass: 'glyphicon glyphicon-chevron-right' +}); diff --git a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.css b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.css similarity index 98% rename from bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.css rename to src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.css index 39a4b700f5db9c7656ffb939ecbfad0da1aaf6c5..2487166bd533f65c1042230b73a2b20395dfa9a4 100644 --- a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.css +++ b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.css @@ -1,17 +1,17 @@ -.treegrid-indent {width:16px; height: 16px; display: inline-block; position: relative;} - -.treegrid-expander {width:16px; height: 16px; display: inline-block; position: relative; cursor: pointer;} - -.treegrid-expander-expanded{background-image: url(img/collapse.png); } -.treegrid-expander-collapsed{background-image: url(img/expand.png);} -.treegrid-selected{background: #f5f5f5 !important;} -.treegrid-table{border:0 !important;margin-bottom:0} -.treegrid-table tbody {display:block;height:auto;overflow-y:auto;} -.treegrid-table thead, .treegrid-table tbody tr {display:table;width:100%;table-layout:fixed;} -.treegrid-thead th{line-height:40px;border: 0 !important;background:#fff !important;border-radius: 4px;border-left:1px solid #e7eaec !important;border-bottom:2px solid #e7eaec !important;text-align: center;} -.treegrid-thead tr :first-child{border-left:0 !important} -.treegrid-tbody td{border: 0 !important;border-left:1px solid #e7eaec !important;border-bottom:1px solid #e7eaec !important;overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis;} -.treegrid-tbody tr :first-child{border-left:0 !important} - +.treegrid-indent {width:16px; height: 16px; display: inline-block; position: relative;} + +.treegrid-expander {width:16px; height: 16px; display: inline-block; position: relative; cursor: pointer;} + +.treegrid-expander-expanded{background-image: url(img/collapse.png); } +.treegrid-expander-collapsed{background-image: url(img/expand.png);} +.treegrid-selected{background: #f5f5f5 !important;} +.treegrid-table{border:0 !important;margin-bottom:0} +.treegrid-table tbody {display:block;height:auto;overflow-y:auto;} +.treegrid-table thead, .treegrid-table tbody tr {display:table;width:100%;table-layout:fixed;} +.treegrid-thead th{line-height:40px;border: 0 !important;background:#fff !important;border-radius: 4px;border-left:1px solid #e7eaec !important;border-bottom:2px solid #e7eaec !important;text-align: center;} +.treegrid-thead tr :first-child{border-left:0 !important} +.treegrid-tbody td{border: 0 !important;border-left:1px solid #e7eaec !important;border-bottom:1px solid #e7eaec !important;overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis;} +.treegrid-tbody tr :first-child{border-left:0 !important} + diff --git a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.extension.js b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.extension.js similarity index 97% rename from bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.extension.js rename to src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.extension.js index 654407d7703f73e4d2ef2f6dba572a9923619fea..67d0bf05421505e9a65c5bd845e78fbb706e317f 100644 --- a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.extension.js +++ b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.extension.js @@ -1,258 +1,258 @@ -(function($) { - "use strict"; - - $.fn.bootstrapTreeTable = function(options, param) { - // 如果是调用方法 - if (typeof options == 'string') { - return $.fn.bootstrapTreeTable.methods[options](this, param); - } - - // 如果是初始化组件 - options = $.extend({}, $.fn.bootstrapTreeTable.defaults, options || {}); - // 是否有radio或checkbox - var hasSelectItem = false; - var target = $(this); - // 在外层包装一下div,样式用的bootstrap-table的 - var _main_div = $("
"); - target.before(_main_div); - _main_div.append(target); - target.addClass("table table-hover treegrid-table table-bordered"); - if (options.striped) { - target.addClass('table-striped'); - } - // 工具条在外层包装一下div,样式用的bootstrap-table的 - if(options.toolbar){ - var _tool_div = $(""); - var _tool_left_div = $("
"); - _tool_left_div.append($(options.toolbar)); - _tool_div.append(_tool_left_div); - _main_div.before(_tool_div); - } - // 得到根节点 - target.getRootNodes = function(data) { - // 指定Root节点值 - var _root = options.rootCodeValue?options.rootCodeValue:null - var result = []; - $.each(data, function(index, item) { - // 这里兼容几种常见Root节点写法 - // 默认的几种判断 - var _defaultRootFlag = item[options.parentCode] == '0' - || item[options.parentCode] == 0 - || item[options.parentCode] == null - || item[options.parentCode] == ''; - if (!item[options.parentCode] || (_root?(item[options.parentCode] == options.rootCodeValue):_defaultRootFlag)){ - result.push(item); - } - // 添加一个默认属性,用来判断当前节点有没有被显示 - item.isShow = false; - }); - return result; - }; - var j = 0; - // 递归获取子节点并且设置子节点 - target.getChildNodes = function(data, parentNode, parentIndex, tbody) { - $.each(data, function(i, item) { - if (item[options.parentCode] == parentNode[options.code]) { - var tr = $(''); - var nowParentIndex = (parentIndex + (j++) + 1); - tr.addClass('treegrid-' + nowParentIndex); - tr.addClass('treegrid-parent-' + parentIndex); - target.renderRow(tr,item); - item.isShow = true; - tbody.append(tr); - target.getChildNodes(data, item, nowParentIndex, tbody) - - } - }); - }; - // 绘制行 - target.renderRow = function(tr,item){ - $.each(options.columns, function(index, column) { - // 判断有没有选择列 - if(index==0&&column.field=='selectItem'){ - hasSelectItem = true; - var td = $(''); - if(column.radio){ - var _ipt = $(''); - td.append(_ipt); - } - if(column.checkbox){ - var _ipt = $(''); - td.append(_ipt); - } - tr.append(td); - }else{ - var td = $(''); - // 增加formatter渲染 - if (column.formatter) { - td.html(column.formatter.call(this, item, index)); - } else { - td.text(item[column.field]); - } - tr.append(td); - } - }); - } - // 加载数据 - target.load = function(parms){ - // 加载数据前先清空 - target.html(""); - // 构造表头 - var thr = $(''); - $.each(options.columns, function(i, item) { - var th = null; - // 判断有没有选择列 - if(i==0&&item.field=='selectItem'){ - hasSelectItem = true; - th = $(''); - }else{ - th = $(''); - } - th.text(item.title); - thr.append(th); - }); - var thead = $(''); - thead.append(thr); - target.append(thead); - // 构造表体 - var tbody = $(''); - target.append(tbody); - // 添加加载loading - var _loading = '
正在努力地加载数据中,请稍候……
' - tbody.html(_loading); - // 默认高度 - if(options.height){ - tbody.css("height",options.height); - } - $.ajax({ - type : options.type, - url : options.url, - data : parms?parms:options.ajaxParams, - dataType : "JSON", - success : function(data, textStatus, jqXHR) { - // 加载完数据先清空 - tbody.html(""); - if(!data||data.length<=0){ - var _empty = '
没有记录
' - tbody.html(_empty); - return; - } - var rootNode = target.getRootNodes(data); - $.each(rootNode, function(i, item) { - var tr = $(''); - tr.addClass('treegrid-' + (j + "_" + i)); - target.renderRow(tr,item); - item.isShow = true; - tbody.append(tr); - target.getChildNodes(data, item, (j + "_" + i), tbody); - }); - // 下边的操作主要是为了查询时让一些没有根节点的节点显示 - $.each(data, function(i, item) { - if(!item.isShow){ - var tr = $(''); - tr.addClass('treegrid-' + (j + "_" + i)); - target.renderRow(tr,item); - tbody.append(tr); - } - }); - target.append(tbody); - // 初始化treegrid - target.treegrid({ - treeColumn: options.expandColumn?options.expandColumn:(hasSelectItem?1:0),//如果有radio或checkbox默认第二列层级显示,当前是在用户未设置的提前下 - expanderExpandedClass : options.expanderExpandedClass, - expanderCollapsedClass : options.expanderCollapsedClass - }); - if (!options.expandAll) { - target.treegrid('collapseAll'); - } - //动态设置表头宽度 - //thead.css("width", tbody.children(":first").css("width")); - // 行点击选中事件 - target.find("tbody").find("tr").click(function(){ - if(hasSelectItem){ - var _ipt = $(this).find("input[name='select_item']"); - if(_ipt.attr("type")=="radio"){ - _ipt.prop('checked',true); - target.find("tbody").find("tr").removeClass("treegrid-selected"); - $(this).addClass("treegrid-selected"); - }else{ - if(_ipt.prop('checked')){ - _ipt.prop('checked',false); - $(this).removeClass("treegrid-selected"); - }else{ - _ipt.prop('checked',true); - $(this).addClass("treegrid-selected"); - } - } - } - }); - }, - error:function(xhr,textStatus){ - var _errorMsg = '
'+xhr.responseText+'
' - tbody.html(_errorMsg); - debugger; - }, - }); - } - if (options.url) { - target.load(); - } else { - // 也可以通过defaults里面的data属性通过传递一个数据集合进来对组件进行初始化....有兴趣可以自己实现,思路和上述类似 - } - - return target; - }; - - // 组件方法封装........ - $.fn.bootstrapTreeTable.methods = { - // 返回选中记录的id(返回的id由配置中的id属性指定) - // 为了兼容bootstrap-table的写法,统一返回数组,这里只返回了指定的id - getSelections : function(target, data) { - // 所有被选中的记录input - var _ipt = target.find("tbody").find("tr").find("input[name='select_item']:checked"); - var chk_value =[]; - // 如果是radio - if(_ipt.attr("type")=="radio"){ - chk_value.push({id:_ipt.val()}); - }else{ - _ipt.each(function(_i,_item){ - chk_value.push({id:$(_item).val()}); - }); - } - return chk_value; - }, - // 刷新记录 - refresh : function(target, parms) { - if(parms){ - target.load(parms); - }else{ - target.load(); - } - }, - // 重置表格视图 - resetHeight : function(target, height) { - target.find("tbody").css("height", height + 'px'); - } - // 组件的其他方法也可以进行类似封装........ - }; - - $.fn.bootstrapTreeTable.defaults = { - id : 'menuId',// 选取记录返回的值 - code : 'menuId',// 用于设置父子关系 - parentCode : 'parentId',// 用于设置父子关系 - rootCodeValue: null,//设置根节点code值----可指定根节点,默认为null,"",0,"0" - data : [], // 构造table的数据集合 - type : "GET", // 请求数据的ajax类型 - url : null, // 请求数据的ajax的url - ajaxParams : {}, // 请求数据的ajax的data属性 - expandColumn : null,// 在哪一列上面显示展开按钮 - expandAll : true, // 是否全部展开 - striped : false, // 是否各行渐变色 - columns : [], - toolbar: null,//顶部工具条 - height: 0, - expanderExpandedClass : 'glyphicon glyphicon-chevron-down',// 展开的按钮的图标 - expanderCollapsedClass : 'glyphicon glyphicon-chevron-right'// 缩起的按钮的图标 - - }; +(function($) { + "use strict"; + + $.fn.bootstrapTreeTable = function(options, param) { + // 如果是调用方法 + if (typeof options == 'string') { + return $.fn.bootstrapTreeTable.methods[options](this, param); + } + + // 如果是初始化组件 + options = $.extend({}, $.fn.bootstrapTreeTable.defaults, options || {}); + // 是否有radio或checkbox + var hasSelectItem = false; + var target = $(this); + // 在外层包装一下div,样式用的bootstrap-table的 + var _main_div = $("
"); + target.before(_main_div); + _main_div.append(target); + target.addClass("table table-hover treegrid-table table-bordered"); + if (options.striped) { + target.addClass('table-striped'); + } + // 工具条在外层包装一下div,样式用的bootstrap-table的 + if(options.toolbar){ + var _tool_div = $(""); + var _tool_left_div = $("
"); + _tool_left_div.append($(options.toolbar)); + _tool_div.append(_tool_left_div); + _main_div.before(_tool_div); + } + // 得到根节点 + target.getRootNodes = function(data) { + // 指定Root节点值 + var _root = options.rootCodeValue?options.rootCodeValue:null + var result = []; + $.each(data, function(index, item) { + // 这里兼容几种常见Root节点写法 + // 默认的几种判断 + var _defaultRootFlag = item[options.parentCode] == '0' + || item[options.parentCode] == 0 + || item[options.parentCode] == null + || item[options.parentCode] == ''; + if (!item[options.parentCode] || (_root?(item[options.parentCode] == options.rootCodeValue):_defaultRootFlag)){ + result.push(item); + } + // 添加一个默认属性,用来判断当前节点有没有被显示 + item.isShow = false; + }); + return result; + }; + var j = 0; + // 递归获取子节点并且设置子节点 + target.getChildNodes = function(data, parentNode, parentIndex, tbody) { + $.each(data, function(i, item) { + if (item[options.parentCode] == parentNode[options.code]) { + var tr = $(''); + var nowParentIndex = (parentIndex + (j++) + 1); + tr.addClass('treegrid-' + nowParentIndex); + tr.addClass('treegrid-parent-' + parentIndex); + target.renderRow(tr,item); + item.isShow = true; + tbody.append(tr); + target.getChildNodes(data, item, nowParentIndex, tbody) + + } + }); + }; + // 绘制行 + target.renderRow = function(tr,item){ + $.each(options.columns, function(index, column) { + // 判断有没有选择列 + if(index==0&&column.field=='selectItem'){ + hasSelectItem = true; + var td = $(''); + if(column.radio){ + var _ipt = $(''); + td.append(_ipt); + } + if(column.checkbox){ + var _ipt = $(''); + td.append(_ipt); + } + tr.append(td); + }else{ + var td = $(''); + // 增加formatter渲染 + if (column.formatter) { + td.html(column.formatter.call(this, item, index)); + } else { + td.text(item[column.field]); + } + tr.append(td); + } + }); + } + // 加载数据 + target.load = function(parms){ + // 加载数据前先清空 + target.html(""); + // 构造表头 + var thr = $(''); + $.each(options.columns, function(i, item) { + var th = null; + // 判断有没有选择列 + if(i==0&&item.field=='selectItem'){ + hasSelectItem = true; + th = $(''); + }else{ + th = $(''); + } + th.text(item.title); + thr.append(th); + }); + var thead = $(''); + thead.append(thr); + target.append(thead); + // 构造表体 + var tbody = $(''); + target.append(tbody); + // 添加加载loading + var _loading = '
正在努力地加载数据中,请稍候……
' + tbody.html(_loading); + // 默认高度 + if(options.height){ + tbody.css("height",options.height); + } + $.ajax({ + type : options.type, + url : options.url, + data : parms?parms:options.ajaxParams, + dataType : "JSON", + success : function(data, textStatus, jqXHR) { + // 加载完数据先清空 + tbody.html(""); + if(!data||data.length<=0){ + var _empty = '
没有记录
' + tbody.html(_empty); + return; + } + var rootNode = target.getRootNodes(data); + $.each(rootNode, function(i, item) { + var tr = $(''); + tr.addClass('treegrid-' + (j + "_" + i)); + target.renderRow(tr,item); + item.isShow = true; + tbody.append(tr); + target.getChildNodes(data, item, (j + "_" + i), tbody); + }); + // 下边的操作主要是为了查询时让一些没有根节点的节点显示 + $.each(data, function(i, item) { + if(!item.isShow){ + var tr = $(''); + tr.addClass('treegrid-' + (j + "_" + i)); + target.renderRow(tr,item); + tbody.append(tr); + } + }); + target.append(tbody); + // 初始化treegrid + target.treegrid({ + treeColumn: options.expandColumn?options.expandColumn:(hasSelectItem?1:0),//如果有radio或checkbox默认第二列层级显示,当前是在用户未设置的提前下 + expanderExpandedClass : options.expanderExpandedClass, + expanderCollapsedClass : options.expanderCollapsedClass + }); + if (!options.expandAll) { + target.treegrid('collapseAll'); + } + //动态设置表头宽度 + //thead.css("width", tbody.children(":first").css("width")); + // 行点击选中事件 + target.find("tbody").find("tr").click(function(){ + if(hasSelectItem){ + var _ipt = $(this).find("input[name='select_item']"); + if(_ipt.attr("type")=="radio"){ + _ipt.prop('checked',true); + target.find("tbody").find("tr").removeClass("treegrid-selected"); + $(this).addClass("treegrid-selected"); + }else{ + if(_ipt.prop('checked')){ + _ipt.prop('checked',false); + $(this).removeClass("treegrid-selected"); + }else{ + _ipt.prop('checked',true); + $(this).addClass("treegrid-selected"); + } + } + } + }); + }, + error:function(xhr,textStatus){ + var _errorMsg = '
'+xhr.responseText+'
' + tbody.html(_errorMsg); + debugger; + }, + }); + } + if (options.url) { + target.load(); + } else { + // 也可以通过defaults里面的data属性通过传递一个数据集合进来对组件进行初始化....有兴趣可以自己实现,思路和上述类似 + } + + return target; + }; + + // 组件方法封装........ + $.fn.bootstrapTreeTable.methods = { + // 返回选中记录的id(返回的id由配置中的id属性指定) + // 为了兼容bootstrap-table的写法,统一返回数组,这里只返回了指定的id + getSelections : function(target, data) { + // 所有被选中的记录input + var _ipt = target.find("tbody").find("tr").find("input[name='select_item']:checked"); + var chk_value =[]; + // 如果是radio + if(_ipt.attr("type")=="radio"){ + chk_value.push({id:_ipt.val()}); + }else{ + _ipt.each(function(_i,_item){ + chk_value.push({id:$(_item).val()}); + }); + } + return chk_value; + }, + // 刷新记录 + refresh : function(target, parms) { + if(parms){ + target.load(parms); + }else{ + target.load(); + } + }, + // 重置表格视图 + resetHeight : function(target, height) { + target.find("tbody").css("height", height + 'px'); + } + // 组件的其他方法也可以进行类似封装........ + }; + + $.fn.bootstrapTreeTable.defaults = { + id : 'menuId',// 选取记录返回的值 + code : 'menuId',// 用于设置父子关系 + parentCode : 'parentId',// 用于设置父子关系 + rootCodeValue: null,//设置根节点code值----可指定根节点,默认为null,"",0,"0" + data : [], // 构造table的数据集合 + type : "GET", // 请求数据的ajax类型 + url : null, // 请求数据的ajax的url + ajaxParams : {}, // 请求数据的ajax的data属性 + expandColumn : null,// 在哪一列上面显示展开按钮 + expandAll : true, // 是否全部展开 + striped : false, // 是否各行渐变色 + columns : [], + toolbar: null,//顶部工具条 + height: 0, + expanderExpandedClass : 'glyphicon glyphicon-chevron-down',// 展开的按钮的图标 + expanderCollapsedClass : 'glyphicon glyphicon-chevron-right'// 缩起的按钮的图标 + + }; })(jQuery); \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.js b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.js similarity index 97% rename from bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.js rename to src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.js index 1785e531a56d091138edb80008b53455f8ef8291..600f23196282ebf86a964a29410ace4a06d61890 100644 --- a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.js +++ b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.js @@ -1,619 +1,619 @@ -/* - * jQuery treegrid Plugin 0.2.0 - * https://github.com/maxazan/jquery-treegrid - * - * Copyright 2013, Pomazan Max - * Licensed under the MIT licenses. - */ -(function($) { - - var methods = { - /** - * Initialize tree - * - * @param {Object} options - * @returns {Object[]} - */ - initTree: function(options) { - var settings = $.extend({}, this.treegrid.defaults, options); - return this.each(function() { - var $this = $(this); - $this.treegrid('setTreeContainer', $(this)); - $this.treegrid('setSettings', settings); - settings.getRootNodes.apply(this, [$(this)]).treegrid('initNode', settings); - }); - }, - /** - * Initialize node - * - * @param {Object} settings - * @returns {Object[]} - */ - initNode: function(settings) { - return this.each(function() { - var $this = $(this); - $this.treegrid('setTreeContainer', settings.getTreeGridContainer.apply(this)); - $this.treegrid('getChildNodes').treegrid('initNode', settings); - $this.treegrid('initExpander').treegrid('initIndent').treegrid('initEvents').treegrid('initState').treegrid("initSettingsEvents"); - }); - }, - /** - * Initialize node events - * - * @returns {Node} - */ - initEvents: function() { - var $this = $(this); - //Save state on change - $this.on("change", function() { - var $this = $(this); - $this.treegrid('render'); - if ($this.treegrid('getSetting', 'saveState')) { - $this.treegrid('saveState'); - } - }); - //Default behavior on collapse - $this.on("collapse", function() { - var $this = $(this); - $this.removeClass('treegrid-expanded'); - $this.addClass('treegrid-collapsed'); - }); - //Default behavior on expand - $this.on("expand", function() { - var $this = $(this); - $this.removeClass('treegrid-collapsed'); - $this.addClass('treegrid-expanded'); - }); - - return $this; - }, - /** - * Initialize events from settings - * - * @returns {Node} - */ - initSettingsEvents: function() { - var $this = $(this); - //Save state on change - $this.on("change", function() { - var $this = $(this); - if (typeof ($this.treegrid('getSetting', 'onChange')) === "function") { - $this.treegrid('getSetting', 'onChange').apply($this); - } - }); - //Default behavior on collapse - $this.on("collapse", function() { - var $this = $(this); - if (typeof ($this.treegrid('getSetting', 'onCollapse')) === "function") { - $this.treegrid('getSetting', 'onCollapse').apply($this); - } - }); - //Default behavior on expand - $this.on("expand", function() { - var $this = $(this); - if (typeof ($this.treegrid('getSetting', 'onExpand')) === "function") { - $this.treegrid('getSetting', 'onExpand').apply($this); - } - - }); - - return $this; - }, - /** - * Initialize expander for node - * - * @returns {Node} - */ - initExpander: function() { - var $this = $(this); - var cell = $this.find('td').get($this.treegrid('getSetting', 'treeColumn')); - var tpl = $this.treegrid('getSetting', 'expanderTemplate'); - var expander = $this.treegrid('getSetting', 'getExpander').apply(this); - if (expander) { - expander.remove(); - } - $(tpl).prependTo(cell).click(function() { - $($(this).closest('tr')).treegrid('toggle'); - }); - return $this; - }, - /** - * Initialize indent for node - * - * @returns {Node} - */ - initIndent: function() { - var $this = $(this); - $this.find('.treegrid-indent').remove(); - for (var i = 0; i < $(this).treegrid('getDepth'); i++) { - $($this.treegrid('getSetting', 'indentTemplate')).insertBefore($this.find('.treegrid-expander')); - } - return $this; - }, - /** - * Initialise state of node - * - * @returns {Node} - */ - initState: function() { - var $this = $(this); - if ($this.treegrid('getSetting', 'saveState') && !$this.treegrid('isFirstInit')) { - $this.treegrid('restoreState'); - } else { - if ($this.treegrid('getSetting', 'initialState') === "expanded") { - $this.treegrid('expand'); - } else { - $this.treegrid('collapse'); - } - } - return $this; - }, - /** - * Return true if this tree was never been initialised - * - * @returns {Boolean} - */ - isFirstInit: function() { - var tree = $(this).treegrid('getTreeContainer'); - if (tree.data('first_init') === undefined) { - tree.data('first_init', $.cookie(tree.treegrid('getSetting', 'saveStateName')) === undefined); - } - return tree.data('first_init'); - }, - /** - * Save state of current node - * - * @returns {Node} - */ - saveState: function() { - var $this = $(this); - if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') { - - var stateArrayString = $.cookie($this.treegrid('getSetting', 'saveStateName')) || ''; - var stateArray = (stateArrayString === '' ? [] : stateArrayString.split(',')); - var nodeId = $this.treegrid('getNodeId'); - - if ($this.treegrid('isExpanded')) { - if ($.inArray(nodeId, stateArray) === -1) { - stateArray.push(nodeId); - } - } else if ($this.treegrid('isCollapsed')) { - if ($.inArray(nodeId, stateArray) !== -1) { - stateArray.splice($.inArray(nodeId, stateArray), 1); - } - } - $.cookie($this.treegrid('getSetting', 'saveStateName'), stateArray.join(',')); - } - return $this; - }, - /** - * Restore state of current node. - * - * @returns {Node} - */ - restoreState: function() { - var $this = $(this); - if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') { - var stateArray = $.cookie($this.treegrid('getSetting', 'saveStateName')).split(','); - if ($.inArray($this.treegrid('getNodeId'), stateArray) !== -1) { - $this.treegrid('expand'); - } else { - $this.treegrid('collapse'); - } - - } - return $this; - }, - /** - * Method return setting by name - * - * @param {type} name - * @returns {unresolved} - */ - getSetting: function(name) { - if (!$(this).treegrid('getTreeContainer')) { - return null; - } - return $(this).treegrid('getTreeContainer').data('settings')[name]; - }, - /** - * Add new settings - * - * @param {Object} settings - */ - setSettings: function(settings) { - $(this).treegrid('getTreeContainer').data('settings', settings); - }, - /** - * Return tree container - * - * @returns {HtmlElement} - */ - getTreeContainer: function() { - return $(this).data('treegrid'); - }, - /** - * Set tree container - * - * @param {HtmlE;ement} container - */ - setTreeContainer: function(container) { - return $(this).data('treegrid', container); - }, - /** - * Method return all root nodes of tree. - * - * Start init all child nodes from it. - * - * @returns {Array} - */ - getRootNodes: function() { - return $(this).treegrid('getSetting', 'getRootNodes').apply(this, [$(this).treegrid('getTreeContainer')]); - }, - /** - * Method return all nodes of tree. - * - * @returns {Array} - */ - getAllNodes: function() { - return $(this).treegrid('getSetting', 'getAllNodes').apply(this, [$(this).treegrid('getTreeContainer')]); - }, - /** - * Mthod return true if element is Node - * - * @returns {String} - */ - isNode: function() { - return $(this).treegrid('getNodeId') !== null; - }, - /** - * Mthod return id of node - * - * @returns {String} - */ - getNodeId: function() { - if ($(this).treegrid('getSetting', 'getNodeId') === null) { - return null; - } else { - return $(this).treegrid('getSetting', 'getNodeId').apply(this); - } - }, - /** - * Method return parent id of node or null if root node - * - * @returns {String} - */ - getParentNodeId: function() { - return $(this).treegrid('getSetting', 'getParentNodeId').apply(this); - }, - /** - * Method return parent node or null if root node - * - * @returns {Object[]} - */ - getParentNode: function() { - if ($(this).treegrid('getParentNodeId') === null) { - return null; - } else { - return $(this).treegrid('getSetting', 'getNodeById').apply(this, [$(this).treegrid('getParentNodeId'), $(this).treegrid('getTreeContainer')]); - } - }, - /** - * Method return array of child nodes or null if node is leaf - * - * @returns {Object[]} - */ - getChildNodes: function() { - return $(this).treegrid('getSetting', 'getChildNodes').apply(this, [$(this).treegrid('getNodeId'), $(this).treegrid('getTreeContainer')]); - }, - /** - * Method return depth of tree. - * - * This method is needs for calculate indent - * - * @returns {Number} - */ - getDepth: function() { - if ($(this).treegrid('getParentNode') === null) { - return 0; - } - return $(this).treegrid('getParentNode').treegrid('getDepth') + 1; - }, - /** - * Method return true if node is root - * - * @returns {Boolean} - */ - isRoot: function() { - return $(this).treegrid('getDepth') === 0; - }, - /** - * Method return true if node has no child nodes - * - * @returns {Boolean} - */ - isLeaf: function() { - return $(this).treegrid('getChildNodes').length === 0; - }, - /** - * Method return true if node last in branch - * - * @returns {Boolean} - */ - isLast: function() { - if ($(this).treegrid('isNode')) { - var parentNode = $(this).treegrid('getParentNode'); - if (parentNode === null) { - if ($(this).treegrid('getNodeId') === $(this).treegrid('getRootNodes').last().treegrid('getNodeId')) { - return true; - } - } else { - if ($(this).treegrid('getNodeId') === parentNode.treegrid('getChildNodes').last().treegrid('getNodeId')) { - return true; - } - } - } - return false; - }, - /** - * Method return true if node first in branch - * - * @returns {Boolean} - */ - isFirst: function() { - if ($(this).treegrid('isNode')) { - var parentNode = $(this).treegrid('getParentNode'); - if (parentNode === null) { - if ($(this).treegrid('getNodeId') === $(this).treegrid('getRootNodes').first().treegrid('getNodeId')) { - return true; - } - } else { - if ($(this).treegrid('getNodeId') === parentNode.treegrid('getChildNodes').first().treegrid('getNodeId')) { - return true; - } - } - } - return false; - }, - /** - * Return true if node expanded - * - * @returns {Boolean} - */ - isExpanded: function() { - return $(this).hasClass('treegrid-expanded'); - }, - /** - * Return true if node collapsed - * - * @returns {Boolean} - */ - isCollapsed: function() { - return $(this).hasClass('treegrid-collapsed'); - }, - /** - * Return true if at least one of parent node is collapsed - * - * @returns {Boolean} - */ - isOneOfParentsCollapsed: function() { - var $this = $(this); - if ($this.treegrid('isRoot')) { - return false; - } else { - if ($this.treegrid('getParentNode').treegrid('isCollapsed')) { - return true; - } else { - return $this.treegrid('getParentNode').treegrid('isOneOfParentsCollapsed'); - } - } - }, - /** - * Expand node - * - * @returns {Node} - */ - expand: function() { - return $(this).each(function() { - var $this = $(this); - if (!$this.treegrid('isLeaf') && !$this.treegrid("isExpanded")) { - $this.trigger("expand"); - $this.trigger("change"); - } - }); - }, - /** - * Expand all nodes - * - * @returns {Node} - */ - expandAll: function() { - var $this = $(this); - $this.treegrid('getRootNodes').treegrid('expandRecursive'); - return $this; - }, - /** - * Expand current node and all child nodes begin from current - * - * @returns {Node} - */ - expandRecursive: function() { - return $(this).each(function() { - var $this = $(this); - $this.treegrid('expand'); - if (!$this.treegrid('isLeaf')) { - $this.treegrid('getChildNodes').treegrid('expandRecursive'); - } - }); - }, - /** - * Collapse node - * - * @returns {Node} - */ - collapse: function() { - return $(this).each(function() { - var $this = $(this); - if (!$this.treegrid('isLeaf') && !$this.treegrid("isCollapsed")) { - $this.trigger("collapse"); - $this.trigger("change"); - } - }); - }, - /** - * Collapse all nodes - * - * @returns {Node} - */ - collapseAll: function() { - var $this = $(this); - $this.treegrid('getRootNodes').treegrid('collapseRecursive'); - return $this; - }, - /** - * Collapse current node and all child nodes begin from current - * - * @returns {Node} - */ - collapseRecursive: function() { - return $(this).each(function() { - var $this = $(this); - $this.treegrid('collapse'); - if (!$this.treegrid('isLeaf')) { - $this.treegrid('getChildNodes').treegrid('collapseRecursive'); - } - }); - }, - /** - * Expand if collapsed, Collapse if expanded - * - * @returns {Node} - */ - toggle: function() { - var $this = $(this); - if ($this.treegrid('isExpanded')) { - $this.treegrid('collapse'); - } else { - $this.treegrid('expand'); - } - return $this; - }, - /** - * Rendering node - * - * @returns {Node} - */ - render: function() { - return $(this).each(function() { - var $this = $(this); - - if ($this.treegrid('isOneOfParentsCollapsed')) { - $this.hide(); - } else { - $this.show(); - } - if (!$this.treegrid('isLeaf')) { - $this.treegrid('renderExpander'); - $this.treegrid('getChildNodes').treegrid('render'); - } - }); - }, - /** - * Rendering expander depends on node state - * - * @returns {Node} - */ - renderExpander: function() { - return $(this).each(function() { - var $this = $(this); - var expander = $this.treegrid('getSetting', 'getExpander').apply(this); - if (expander) { - - if (!$this.treegrid('isCollapsed')) { - expander.removeClass($this.treegrid('getSetting', 'expanderCollapsedClass')); - expander.addClass($this.treegrid('getSetting', 'expanderExpandedClass')); - } else { - expander.removeClass($this.treegrid('getSetting', 'expanderExpandedClass')); - expander.addClass($this.treegrid('getSetting', 'expanderCollapsedClass')); - } - } else { - $this.treegrid('initExpander'); - $this.treegrid('renderExpander'); - } - }); - } - }; - $.fn.treegrid = function(method) { - if (methods[method]) { - return methods[ method ].apply(this, Array.prototype.slice.call(arguments, 1)); - } else if (typeof method === 'object' || !method) { - return methods.initTree.apply(this, arguments); - } else { - $.error('Method with name ' + method + ' does not exists for jQuery.treegrid'); - } - }; - /** - * Plugin's default options - */ - $.fn.treegrid.defaults = { - initialState: 'expanded', - saveState: false, - saveStateMethod: 'cookie', - saveStateName: 'tree-grid-state', - expanderTemplate: '', - indentTemplate: '', - expanderExpandedClass: 'treegrid-expander-expanded', - expanderCollapsedClass: 'treegrid-expander-collapsed', - treeColumn: 0, - getExpander: function() { - return $(this).find('.treegrid-expander'); - }, - getNodeId: function() { - var template = /treegrid-([A-Za-z0-9_-]+)/; - if (template.test($(this).attr('class'))) { - return template.exec($(this).attr('class'))[1]; - } - return null; - }, - getParentNodeId: function() { - var template = /treegrid-parent-([A-Za-z0-9_-]+)/; - if (template.test($(this).attr('class'))) { - return template.exec($(this).attr('class'))[1]; - } - return null; - }, - getNodeById: function(id, treegridContainer) { - var templateClass = "treegrid-" + id; - return treegridContainer.find('tr.' + templateClass); - }, - getChildNodes: function(id, treegridContainer) { - var templateClass = "treegrid-parent-" + id; - return treegridContainer.find('tr.' + templateClass); - }, - getTreeGridContainer: function() { - return $(this).closest('table'); - }, - getRootNodes: function(treegridContainer) { - var result = $.grep(treegridContainer.find('tr'), function(element) { - var classNames = $(element).attr('class'); - var templateClass = /treegrid-([A-Za-z0-9_-]+)/; - var templateParentClass = /treegrid-parent-([A-Za-z0-9_-]+)/; - return templateClass.test(classNames) && !templateParentClass.test(classNames); - }); - return $(result); - }, - getAllNodes: function(treegridContainer) { - var result = $.grep(treegridContainer.find('tr'), function(element) { - var classNames = $(element).attr('class'); - var templateClass = /treegrid-([A-Za-z0-9_-]+)/; - return templateClass.test(classNames); - }); - return $(result); - }, - //Events - onCollapse: null, - onExpand: null, - onChange: null - - }; +/* + * jQuery treegrid Plugin 0.2.0 + * https://github.com/maxazan/jquery-treegrid + * + * Copyright 2013, Pomazan Max + * Licensed under the MIT licenses. + */ +(function($) { + + var methods = { + /** + * Initialize tree + * + * @param {Object} options + * @returns {Object[]} + */ + initTree: function(options) { + var settings = $.extend({}, this.treegrid.defaults, options); + return this.each(function() { + var $this = $(this); + $this.treegrid('setTreeContainer', $(this)); + $this.treegrid('setSettings', settings); + settings.getRootNodes.apply(this, [$(this)]).treegrid('initNode', settings); + }); + }, + /** + * Initialize node + * + * @param {Object} settings + * @returns {Object[]} + */ + initNode: function(settings) { + return this.each(function() { + var $this = $(this); + $this.treegrid('setTreeContainer', settings.getTreeGridContainer.apply(this)); + $this.treegrid('getChildNodes').treegrid('initNode', settings); + $this.treegrid('initExpander').treegrid('initIndent').treegrid('initEvents').treegrid('initState').treegrid("initSettingsEvents"); + }); + }, + /** + * Initialize node events + * + * @returns {Node} + */ + initEvents: function() { + var $this = $(this); + //Save state on change + $this.on("change", function() { + var $this = $(this); + $this.treegrid('render'); + if ($this.treegrid('getSetting', 'saveState')) { + $this.treegrid('saveState'); + } + }); + //Default behavior on collapse + $this.on("collapse", function() { + var $this = $(this); + $this.removeClass('treegrid-expanded'); + $this.addClass('treegrid-collapsed'); + }); + //Default behavior on expand + $this.on("expand", function() { + var $this = $(this); + $this.removeClass('treegrid-collapsed'); + $this.addClass('treegrid-expanded'); + }); + + return $this; + }, + /** + * Initialize events from settings + * + * @returns {Node} + */ + initSettingsEvents: function() { + var $this = $(this); + //Save state on change + $this.on("change", function() { + var $this = $(this); + if (typeof ($this.treegrid('getSetting', 'onChange')) === "function") { + $this.treegrid('getSetting', 'onChange').apply($this); + } + }); + //Default behavior on collapse + $this.on("collapse", function() { + var $this = $(this); + if (typeof ($this.treegrid('getSetting', 'onCollapse')) === "function") { + $this.treegrid('getSetting', 'onCollapse').apply($this); + } + }); + //Default behavior on expand + $this.on("expand", function() { + var $this = $(this); + if (typeof ($this.treegrid('getSetting', 'onExpand')) === "function") { + $this.treegrid('getSetting', 'onExpand').apply($this); + } + + }); + + return $this; + }, + /** + * Initialize expander for node + * + * @returns {Node} + */ + initExpander: function() { + var $this = $(this); + var cell = $this.find('td').get($this.treegrid('getSetting', 'treeColumn')); + var tpl = $this.treegrid('getSetting', 'expanderTemplate'); + var expander = $this.treegrid('getSetting', 'getExpander').apply(this); + if (expander) { + expander.remove(); + } + $(tpl).prependTo(cell).click(function() { + $($(this).closest('tr')).treegrid('toggle'); + }); + return $this; + }, + /** + * Initialize indent for node + * + * @returns {Node} + */ + initIndent: function() { + var $this = $(this); + $this.find('.treegrid-indent').remove(); + for (var i = 0; i < $(this).treegrid('getDepth'); i++) { + $($this.treegrid('getSetting', 'indentTemplate')).insertBefore($this.find('.treegrid-expander')); + } + return $this; + }, + /** + * Initialise state of node + * + * @returns {Node} + */ + initState: function() { + var $this = $(this); + if ($this.treegrid('getSetting', 'saveState') && !$this.treegrid('isFirstInit')) { + $this.treegrid('restoreState'); + } else { + if ($this.treegrid('getSetting', 'initialState') === "expanded") { + $this.treegrid('expand'); + } else { + $this.treegrid('collapse'); + } + } + return $this; + }, + /** + * Return true if this tree was never been initialised + * + * @returns {Boolean} + */ + isFirstInit: function() { + var tree = $(this).treegrid('getTreeContainer'); + if (tree.data('first_init') === undefined) { + tree.data('first_init', $.cookie(tree.treegrid('getSetting', 'saveStateName')) === undefined); + } + return tree.data('first_init'); + }, + /** + * Save state of current node + * + * @returns {Node} + */ + saveState: function() { + var $this = $(this); + if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') { + + var stateArrayString = $.cookie($this.treegrid('getSetting', 'saveStateName')) || ''; + var stateArray = (stateArrayString === '' ? [] : stateArrayString.split(',')); + var nodeId = $this.treegrid('getNodeId'); + + if ($this.treegrid('isExpanded')) { + if ($.inArray(nodeId, stateArray) === -1) { + stateArray.push(nodeId); + } + } else if ($this.treegrid('isCollapsed')) { + if ($.inArray(nodeId, stateArray) !== -1) { + stateArray.splice($.inArray(nodeId, stateArray), 1); + } + } + $.cookie($this.treegrid('getSetting', 'saveStateName'), stateArray.join(',')); + } + return $this; + }, + /** + * Restore state of current node. + * + * @returns {Node} + */ + restoreState: function() { + var $this = $(this); + if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') { + var stateArray = $.cookie($this.treegrid('getSetting', 'saveStateName')).split(','); + if ($.inArray($this.treegrid('getNodeId'), stateArray) !== -1) { + $this.treegrid('expand'); + } else { + $this.treegrid('collapse'); + } + + } + return $this; + }, + /** + * Method return setting by name + * + * @param {type} name + * @returns {unresolved} + */ + getSetting: function(name) { + if (!$(this).treegrid('getTreeContainer')) { + return null; + } + return $(this).treegrid('getTreeContainer').data('settings')[name]; + }, + /** + * Add new settings + * + * @param {Object} settings + */ + setSettings: function(settings) { + $(this).treegrid('getTreeContainer').data('settings', settings); + }, + /** + * Return tree container + * + * @returns {HtmlElement} + */ + getTreeContainer: function() { + return $(this).data('treegrid'); + }, + /** + * Set tree container + * + * @param {HtmlE;ement} container + */ + setTreeContainer: function(container) { + return $(this).data('treegrid', container); + }, + /** + * Method return all root nodes of tree. + * + * Start init all child nodes from it. + * + * @returns {Array} + */ + getRootNodes: function() { + return $(this).treegrid('getSetting', 'getRootNodes').apply(this, [$(this).treegrid('getTreeContainer')]); + }, + /** + * Method return all nodes of tree. + * + * @returns {Array} + */ + getAllNodes: function() { + return $(this).treegrid('getSetting', 'getAllNodes').apply(this, [$(this).treegrid('getTreeContainer')]); + }, + /** + * Mthod return true if element is Node + * + * @returns {String} + */ + isNode: function() { + return $(this).treegrid('getNodeId') !== null; + }, + /** + * Mthod return id of node + * + * @returns {String} + */ + getNodeId: function() { + if ($(this).treegrid('getSetting', 'getNodeId') === null) { + return null; + } else { + return $(this).treegrid('getSetting', 'getNodeId').apply(this); + } + }, + /** + * Method return parent id of node or null if root node + * + * @returns {String} + */ + getParentNodeId: function() { + return $(this).treegrid('getSetting', 'getParentNodeId').apply(this); + }, + /** + * Method return parent node or null if root node + * + * @returns {Object[]} + */ + getParentNode: function() { + if ($(this).treegrid('getParentNodeId') === null) { + return null; + } else { + return $(this).treegrid('getSetting', 'getNodeById').apply(this, [$(this).treegrid('getParentNodeId'), $(this).treegrid('getTreeContainer')]); + } + }, + /** + * Method return array of child nodes or null if node is leaf + * + * @returns {Object[]} + */ + getChildNodes: function() { + return $(this).treegrid('getSetting', 'getChildNodes').apply(this, [$(this).treegrid('getNodeId'), $(this).treegrid('getTreeContainer')]); + }, + /** + * Method return depth of tree. + * + * This method is needs for calculate indent + * + * @returns {Number} + */ + getDepth: function() { + if ($(this).treegrid('getParentNode') === null) { + return 0; + } + return $(this).treegrid('getParentNode').treegrid('getDepth') + 1; + }, + /** + * Method return true if node is root + * + * @returns {Boolean} + */ + isRoot: function() { + return $(this).treegrid('getDepth') === 0; + }, + /** + * Method return true if node has no child nodes + * + * @returns {Boolean} + */ + isLeaf: function() { + return $(this).treegrid('getChildNodes').length === 0; + }, + /** + * Method return true if node last in branch + * + * @returns {Boolean} + */ + isLast: function() { + if ($(this).treegrid('isNode')) { + var parentNode = $(this).treegrid('getParentNode'); + if (parentNode === null) { + if ($(this).treegrid('getNodeId') === $(this).treegrid('getRootNodes').last().treegrid('getNodeId')) { + return true; + } + } else { + if ($(this).treegrid('getNodeId') === parentNode.treegrid('getChildNodes').last().treegrid('getNodeId')) { + return true; + } + } + } + return false; + }, + /** + * Method return true if node first in branch + * + * @returns {Boolean} + */ + isFirst: function() { + if ($(this).treegrid('isNode')) { + var parentNode = $(this).treegrid('getParentNode'); + if (parentNode === null) { + if ($(this).treegrid('getNodeId') === $(this).treegrid('getRootNodes').first().treegrid('getNodeId')) { + return true; + } + } else { + if ($(this).treegrid('getNodeId') === parentNode.treegrid('getChildNodes').first().treegrid('getNodeId')) { + return true; + } + } + } + return false; + }, + /** + * Return true if node expanded + * + * @returns {Boolean} + */ + isExpanded: function() { + return $(this).hasClass('treegrid-expanded'); + }, + /** + * Return true if node collapsed + * + * @returns {Boolean} + */ + isCollapsed: function() { + return $(this).hasClass('treegrid-collapsed'); + }, + /** + * Return true if at least one of parent node is collapsed + * + * @returns {Boolean} + */ + isOneOfParentsCollapsed: function() { + var $this = $(this); + if ($this.treegrid('isRoot')) { + return false; + } else { + if ($this.treegrid('getParentNode').treegrid('isCollapsed')) { + return true; + } else { + return $this.treegrid('getParentNode').treegrid('isOneOfParentsCollapsed'); + } + } + }, + /** + * Expand node + * + * @returns {Node} + */ + expand: function() { + return $(this).each(function() { + var $this = $(this); + if (!$this.treegrid('isLeaf') && !$this.treegrid("isExpanded")) { + $this.trigger("expand"); + $this.trigger("change"); + } + }); + }, + /** + * Expand all nodes + * + * @returns {Node} + */ + expandAll: function() { + var $this = $(this); + $this.treegrid('getRootNodes').treegrid('expandRecursive'); + return $this; + }, + /** + * Expand current node and all child nodes begin from current + * + * @returns {Node} + */ + expandRecursive: function() { + return $(this).each(function() { + var $this = $(this); + $this.treegrid('expand'); + if (!$this.treegrid('isLeaf')) { + $this.treegrid('getChildNodes').treegrid('expandRecursive'); + } + }); + }, + /** + * Collapse node + * + * @returns {Node} + */ + collapse: function() { + return $(this).each(function() { + var $this = $(this); + if (!$this.treegrid('isLeaf') && !$this.treegrid("isCollapsed")) { + $this.trigger("collapse"); + $this.trigger("change"); + } + }); + }, + /** + * Collapse all nodes + * + * @returns {Node} + */ + collapseAll: function() { + var $this = $(this); + $this.treegrid('getRootNodes').treegrid('collapseRecursive'); + return $this; + }, + /** + * Collapse current node and all child nodes begin from current + * + * @returns {Node} + */ + collapseRecursive: function() { + return $(this).each(function() { + var $this = $(this); + $this.treegrid('collapse'); + if (!$this.treegrid('isLeaf')) { + $this.treegrid('getChildNodes').treegrid('collapseRecursive'); + } + }); + }, + /** + * Expand if collapsed, Collapse if expanded + * + * @returns {Node} + */ + toggle: function() { + var $this = $(this); + if ($this.treegrid('isExpanded')) { + $this.treegrid('collapse'); + } else { + $this.treegrid('expand'); + } + return $this; + }, + /** + * Rendering node + * + * @returns {Node} + */ + render: function() { + return $(this).each(function() { + var $this = $(this); + + if ($this.treegrid('isOneOfParentsCollapsed')) { + $this.hide(); + } else { + $this.show(); + } + if (!$this.treegrid('isLeaf')) { + $this.treegrid('renderExpander'); + $this.treegrid('getChildNodes').treegrid('render'); + } + }); + }, + /** + * Rendering expander depends on node state + * + * @returns {Node} + */ + renderExpander: function() { + return $(this).each(function() { + var $this = $(this); + var expander = $this.treegrid('getSetting', 'getExpander').apply(this); + if (expander) { + + if (!$this.treegrid('isCollapsed')) { + expander.removeClass($this.treegrid('getSetting', 'expanderCollapsedClass')); + expander.addClass($this.treegrid('getSetting', 'expanderExpandedClass')); + } else { + expander.removeClass($this.treegrid('getSetting', 'expanderExpandedClass')); + expander.addClass($this.treegrid('getSetting', 'expanderCollapsedClass')); + } + } else { + $this.treegrid('initExpander'); + $this.treegrid('renderExpander'); + } + }); + } + }; + $.fn.treegrid = function(method) { + if (methods[method]) { + return methods[ method ].apply(this, Array.prototype.slice.call(arguments, 1)); + } else if (typeof method === 'object' || !method) { + return methods.initTree.apply(this, arguments); + } else { + $.error('Method with name ' + method + ' does not exists for jQuery.treegrid'); + } + }; + /** + * Plugin's default options + */ + $.fn.treegrid.defaults = { + initialState: 'expanded', + saveState: false, + saveStateMethod: 'cookie', + saveStateName: 'tree-grid-state', + expanderTemplate: '', + indentTemplate: '', + expanderExpandedClass: 'treegrid-expander-expanded', + expanderCollapsedClass: 'treegrid-expander-collapsed', + treeColumn: 0, + getExpander: function() { + return $(this).find('.treegrid-expander'); + }, + getNodeId: function() { + var template = /treegrid-([A-Za-z0-9_-]+)/; + if (template.test($(this).attr('class'))) { + return template.exec($(this).attr('class'))[1]; + } + return null; + }, + getParentNodeId: function() { + var template = /treegrid-parent-([A-Za-z0-9_-]+)/; + if (template.test($(this).attr('class'))) { + return template.exec($(this).attr('class'))[1]; + } + return null; + }, + getNodeById: function(id, treegridContainer) { + var templateClass = "treegrid-" + id; + return treegridContainer.find('tr.' + templateClass); + }, + getChildNodes: function(id, treegridContainer) { + var templateClass = "treegrid-parent-" + id; + return treegridContainer.find('tr.' + templateClass); + }, + getTreeGridContainer: function() { + return $(this).closest('table'); + }, + getRootNodes: function(treegridContainer) { + var result = $.grep(treegridContainer.find('tr'), function(element) { + var classNames = $(element).attr('class'); + var templateClass = /treegrid-([A-Za-z0-9_-]+)/; + var templateParentClass = /treegrid-parent-([A-Za-z0-9_-]+)/; + return templateClass.test(classNames) && !templateParentClass.test(classNames); + }); + return $(result); + }, + getAllNodes: function(treegridContainer) { + var result = $.grep(treegridContainer.find('tr'), function(element) { + var classNames = $(element).attr('class'); + var templateClass = /treegrid-([A-Za-z0-9_-]+)/; + return templateClass.test(classNames); + }); + return $(result); + }, + //Events + onCollapse: null, + onExpand: null, + onChange: null + + }; })(jQuery); \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.min.js b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.min.js similarity index 99% rename from bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.min.js rename to src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.min.js index eacd2fd02ce83b0381d40d9b8753f76b1a1f1f16..7b7566f3234425bb3ac6f09a32c703198ada143d 100644 --- a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.min.js +++ b/src/main/resources/static/js/plugins/jqTreeGrid/jquery.treegrid.min.js @@ -1,2 +1,2 @@ -/*! jquery-treegrid 0.3.0 */ +/*! jquery-treegrid 0.3.0 */ !function(a){var b={initTree:function(b){var c=a.extend({},this.treegrid.defaults,b);return this.each(function(){var b=a(this);b.treegrid("setTreeContainer",a(this)),b.treegrid("setSettings",c),c.getRootNodes.apply(this,[a(this)]).treegrid("initNode",c),b.treegrid("getRootNodes").treegrid("render")})},initNode:function(b){return this.each(function(){var c=a(this);c.treegrid("setTreeContainer",b.getTreeGridContainer.apply(this)),c.treegrid("getChildNodes").treegrid("initNode",b),c.treegrid("initExpander").treegrid("initIndent").treegrid("initEvents").treegrid("initState").treegrid("initChangeEvent").treegrid("initSettingsEvents")})},initChangeEvent:function(){var b=a(this);return b.on("change",function(){var b=a(this);b.treegrid("render"),b.treegrid("getSetting","saveState")&&b.treegrid("saveState")}),b},initEvents:function(){var b=a(this);return b.on("collapse",function(){var b=a(this);b.removeClass("treegrid-expanded"),b.addClass("treegrid-collapsed")}),b.on("expand",function(){var b=a(this);b.removeClass("treegrid-collapsed"),b.addClass("treegrid-expanded")}),b},initSettingsEvents:function(){var b=a(this);return b.on("change",function(){var b=a(this);"function"==typeof b.treegrid("getSetting","onChange")&&b.treegrid("getSetting","onChange").apply(b)}),b.on("collapse",function(){var b=a(this);"function"==typeof b.treegrid("getSetting","onCollapse")&&b.treegrid("getSetting","onCollapse").apply(b)}),b.on("expand",function(){var b=a(this);"function"==typeof b.treegrid("getSetting","onExpand")&&b.treegrid("getSetting","onExpand").apply(b)}),b},initExpander:function(){var b=a(this),c=b.find("td").get(b.treegrid("getSetting","treeColumn")),d=b.treegrid("getSetting","expanderTemplate"),e=b.treegrid("getSetting","getExpander").apply(this);return e&&e.remove(),a(d).prependTo(c).click(function(){a(a(this).closest("tr")).treegrid("toggle")}),b},initIndent:function(){var b=a(this);b.find(".treegrid-indent").remove();for(var c=b.treegrid("getSetting","indentTemplate"),d=b.find(".treegrid-expander"),e=b.treegrid("getDepth"),f=0;e>f;f++)a(c).insertBefore(d);return b},initState:function(){var b=a(this);return b.treegrid(b.treegrid("getSetting","saveState")&&!b.treegrid("isFirstInit")?"restoreState":"expanded"===b.treegrid("getSetting","initialState")?"expand":"collapse"),b},isFirstInit:function(){var b=a(this).treegrid("getTreeContainer");return void 0===b.data("first_init")&&b.data("first_init",void 0===a.cookie(b.treegrid("getSetting","saveStateName"))),b.data("first_init")},saveState:function(){var b=a(this);if("cookie"===b.treegrid("getSetting","saveStateMethod")){var c=a.cookie(b.treegrid("getSetting","saveStateName"))||"",d=""===c?[]:c.split(","),e=b.treegrid("getNodeId");b.treegrid("isExpanded")?-1===a.inArray(e,d)&&d.push(e):b.treegrid("isCollapsed")&&-1!==a.inArray(e,d)&&d.splice(a.inArray(e,d),1),a.cookie(b.treegrid("getSetting","saveStateName"),d.join(","))}return b},restoreState:function(){var b=a(this);if("cookie"===b.treegrid("getSetting","saveStateMethod")){var c=a.cookie(b.treegrid("getSetting","saveStateName")).split(",");b.treegrid(-1!==a.inArray(b.treegrid("getNodeId"),c)?"expand":"collapse")}return b},getSetting:function(b){return a(this).treegrid("getTreeContainer")?a(this).treegrid("getTreeContainer").data("settings")[b]:null},setSettings:function(b){a(this).treegrid("getTreeContainer").data("settings",b)},getTreeContainer:function(){return a(this).data("treegrid")},setTreeContainer:function(b){return a(this).data("treegrid",b)},getRootNodes:function(){return a(this).treegrid("getSetting","getRootNodes").apply(this,[a(this).treegrid("getTreeContainer")])},getAllNodes:function(){return a(this).treegrid("getSetting","getAllNodes").apply(this,[a(this).treegrid("getTreeContainer")])},isNode:function(){return null!==a(this).treegrid("getNodeId")},getNodeId:function(){return null===a(this).treegrid("getSetting","getNodeId")?null:a(this).treegrid("getSetting","getNodeId").apply(this)},getParentNodeId:function(){return a(this).treegrid("getSetting","getParentNodeId").apply(this)},getParentNode:function(){return null===a(this).treegrid("getParentNodeId")?null:a(this).treegrid("getSetting","getNodeById").apply(this,[a(this).treegrid("getParentNodeId"),a(this).treegrid("getTreeContainer")])},getChildNodes:function(){return a(this).treegrid("getSetting","getChildNodes").apply(this,[a(this).treegrid("getNodeId"),a(this).treegrid("getTreeContainer")])},getDepth:function(){return null===a(this).treegrid("getParentNode")?0:a(this).treegrid("getParentNode").treegrid("getDepth")+1},isRoot:function(){return 0===a(this).treegrid("getDepth")},isLeaf:function(){return 0===a(this).treegrid("getChildNodes").length},isLast:function(){if(a(this).treegrid("isNode")){var b=a(this).treegrid("getParentNode");if(null===b){if(a(this).treegrid("getNodeId")===a(this).treegrid("getRootNodes").last().treegrid("getNodeId"))return!0}else if(a(this).treegrid("getNodeId")===b.treegrid("getChildNodes").last().treegrid("getNodeId"))return!0}return!1},isFirst:function(){if(a(this).treegrid("isNode")){var b=a(this).treegrid("getParentNode");if(null===b){if(a(this).treegrid("getNodeId")===a(this).treegrid("getRootNodes").first().treegrid("getNodeId"))return!0}else if(a(this).treegrid("getNodeId")===b.treegrid("getChildNodes").first().treegrid("getNodeId"))return!0}return!1},isExpanded:function(){return a(this).hasClass("treegrid-expanded")},isCollapsed:function(){return a(this).hasClass("treegrid-collapsed")},isOneOfParentsCollapsed:function(){var b=a(this);return b.treegrid("isRoot")?!1:b.treegrid("getParentNode").treegrid("isCollapsed")?!0:b.treegrid("getParentNode").treegrid("isOneOfParentsCollapsed")},expand:function(){return this.treegrid("isLeaf")||this.treegrid("isExpanded")?this:(this.trigger("expand"),this.trigger("change"),this)},expandAll:function(){var b=a(this);return b.treegrid("getRootNodes").treegrid("expandRecursive"),b},expandRecursive:function(){return a(this).each(function(){var b=a(this);b.treegrid("expand"),b.treegrid("isLeaf")||b.treegrid("getChildNodes").treegrid("expandRecursive")})},collapse:function(){return a(this).each(function(){var b=a(this);b.treegrid("isLeaf")||b.treegrid("isCollapsed")||(b.trigger("collapse"),b.trigger("change"))})},collapseAll:function(){var b=a(this);return b.treegrid("getRootNodes").treegrid("collapseRecursive"),b},collapseRecursive:function(){return a(this).each(function(){var b=a(this);b.treegrid("collapse"),b.treegrid("isLeaf")||b.treegrid("getChildNodes").treegrid("collapseRecursive")})},toggle:function(){var b=a(this);return b.treegrid(b.treegrid("isExpanded")?"collapse":"expand"),b},render:function(){return a(this).each(function(){var b=a(this);b.treegrid("isOneOfParentsCollapsed")?b.hide():b.show(),b.treegrid("isLeaf")||(b.treegrid("renderExpander"),b.treegrid("getChildNodes").treegrid("render"))})},renderExpander:function(){return a(this).each(function(){var b=a(this),c=b.treegrid("getSetting","getExpander").apply(this);c?b.treegrid("isCollapsed")?(c.removeClass(b.treegrid("getSetting","expanderExpandedClass")),c.addClass(b.treegrid("getSetting","expanderCollapsedClass"))):(c.removeClass(b.treegrid("getSetting","expanderCollapsedClass")),c.addClass(b.treegrid("getSetting","expanderExpandedClass"))):(b.treegrid("initExpander"),b.treegrid("renderExpander"))})}};a.fn.treegrid=function(c){return b[c]?b[c].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof c&&c?void a.error("Method with name "+c+" does not exists for jQuery.treegrid"):b.initTree.apply(this,arguments)},a.fn.treegrid.defaults={initialState:"expanded",saveState:!1,saveStateMethod:"cookie",saveStateName:"tree-grid-state",expanderTemplate:'',indentTemplate:'',expanderExpandedClass:"treegrid-expander-expanded",expanderCollapsedClass:"treegrid-expander-collapsed",treeColumn:0,getExpander:function(){return a(this).find(".treegrid-expander")},getNodeId:function(){var b=/treegrid-([A-Za-z0-9_-]+)/;return b.test(a(this).attr("class"))?b.exec(a(this).attr("class"))[1]:null},getParentNodeId:function(){var b=/treegrid-parent-([A-Za-z0-9_-]+)/;return b.test(a(this).attr("class"))?b.exec(a(this).attr("class"))[1]:null},getNodeById:function(a,b){var c="treegrid-"+a;return b.find("tr."+c)},getChildNodes:function(a,b){var c="treegrid-parent-"+a;return b.find("tr."+c)},getTreeGridContainer:function(){return a(this).closest("table")},getRootNodes:function(b){var c=a.grep(b.find("tr"),function(b){var c=a(b).attr("class"),d=/treegrid-([A-Za-z0-9_-]+)/,e=/treegrid-parent-([A-Za-z0-9_-]+)/;return d.test(c)&&!e.test(c)});return a(c)},getAllNodes:function(b){var c=a.grep(b.find("tr"),function(b){var c=a(b).attr("class"),d=/treegrid-([A-Za-z0-9_-]+)/;return d.test(c)});return a(c)},onCollapse:null,onExpand:null,onChange:null}}(jQuery); \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/tree.table.js b/src/main/resources/static/js/plugins/jqTreeGrid/tree.table.js similarity index 96% rename from bootdo/src/main/resources/static/js/plugins/jqTreeGrid/tree.table.js rename to src/main/resources/static/js/plugins/jqTreeGrid/tree.table.js index 9a6b097fc8d23c72fb9b69b9ec22ef1dfb8381ee..5b247182c1b3929ff90240ebcebda70d2e8aefc6 100644 --- a/bootdo/src/main/resources/static/js/plugins/jqTreeGrid/tree.table.js +++ b/src/main/resources/static/js/plugins/jqTreeGrid/tree.table.js @@ -1,154 +1,154 @@ -/** - * 初始化 Tree Table 的封装 - * - * @author cyf - */ -(function () { - var TreeTable = function (tableId, url, columns) { - this.btInstance = null; //jquery和bootstrapTreeTable绑定的对象 - this.bstableId = tableId; - this.url = url; - this.method = "GET"; - this.columns = columns; - this.data = {};// ajax的参数 - this.expandColumn = null;// 展开显示的列 - this.id = 'menuId';// 选取记录返回的值 - this.code = 'menuId';// 用于设置父子关系 - this.parentCode = 'parentId';// 用于设置父子关系 - this.expandAll = false;// 是否默认全部展开 - this.toolbarId = tableId + "Toolbar"; - this.height = 430; - }; - - TreeTable.prototype = { - /** - * 初始化bootstrap table - */ - init: function () { - var tableId = this.bstableId; - this.btInstance = - $('#'+tableId).bootstrapTreeTable({ - id: this.id,// 选取记录返回的值 - code: this.code,// 用于设置父子关系 - parentCode: this.parentCode,// 用于设置父子关系 - rootCodeValue: this.rootCodeValue,//设置根节点code值----可指定根节点,默认为null,"",0,"0" - type: this.method, //请求数据的ajax类型 - url: this.url, //请求数据的ajax的url - ajaxParams: this.data, //请求数据的ajax的data属性 - expandColumn: this.expandColumn,//在哪一列上面显示展开按钮,从0开始 - striped: true, //是否各行渐变色 - expandAll: this.expandAll, //是否全部展开 - columns: this.columns, //列数组 - toolbar: "#" + this.toolbarId,//顶部工具条 - height: this.height, - }); - return this; - }, - - /** - * 设置在哪一列上面显示展开按钮,从0开始 - */ - setExpandColumn: function (expandColumn) { - this.expandColumn = expandColumn; - }, - /** - * 设置记录返回的id值 - */ - setIdField: function (id) { - this.id = id; - }, - /** - * 设置记录分级的字段 - */ - setCodeField: function (code) { - this.code = code; - }, - /** - * 设置记录分级的父级字段 - */ - setParentCodeField: function (parentCode) { - this.parentCode = parentCode; - }, - /** - * 设置根节点code值----可指定根节点,默认为null,"",0,"0" - */ - setRootCodeValue: function (rootCodeValue) { - this.rootCodeValue = rootCodeValue; - }, - /** - * 设置是否默认全部展开 - */ - setExpandAll: function (expandAll) { - this.expandAll = expandAll; - }, - /** - * 设置表格高度 - */ - setHeight: function (height) { - this.height = height; - }, - /** - * 设置ajax post请求时候附带的参数 - */ - set: function (key, value) { - if (typeof key == "object") { - for (var i in key) { - if (typeof i == "function") - continue; - this.data[i] = key[i]; - } - } else { - this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value; - } - return this; - }, - - /** - * 设置ajax get请求时候附带的参数 - */ - setData: function (data) { - this.data = data; - return this; - }, - - /** - * 清空ajax post请求参数 - */ - clear: function () { - this.data = {}; - return this; - }, - - /** - * 刷新表格 - */ - refresh: function (parms) { - if (typeof parms != "undefined") { - this.btInstance.bootstrapTreeTable('refresh', parms.query);// 为了兼容bootstrap-table的写法 - } else { - this.btInstance.bootstrapTreeTable('refresh'); - } - }, - - /** - * 设置高度 - */ - resetHeight: function(parms) { - if (typeof parms != "undefined") { - this.btInstance.bootstrapTreeTable('resetHeight', parms.height);// 为了兼容bootstrap-table的写法 - } else { - this.btInstance.bootstrapTreeTable('resetHeight'); - } - }, - - /** - * 获取选中行 - */ - getSelectedRow: function() { - return this.btInstance.bootstrapTreeTable('getSelections'); - } - }; - - window.TreeTable = TreeTable; - +/** + * 初始化 Tree Table 的封装 + * + * @author cyf + */ +(function () { + var TreeTable = function (tableId, url, columns) { + this.btInstance = null; //jquery和bootstrapTreeTable绑定的对象 + this.bstableId = tableId; + this.url = url; + this.method = "GET"; + this.columns = columns; + this.data = {};// ajax的参数 + this.expandColumn = null;// 展开显示的列 + this.id = 'menuId';// 选取记录返回的值 + this.code = 'menuId';// 用于设置父子关系 + this.parentCode = 'parentId';// 用于设置父子关系 + this.expandAll = false;// 是否默认全部展开 + this.toolbarId = tableId + "Toolbar"; + this.height = 430; + }; + + TreeTable.prototype = { + /** + * 初始化bootstrap table + */ + init: function () { + var tableId = this.bstableId; + this.btInstance = + $('#'+tableId).bootstrapTreeTable({ + id: this.id,// 选取记录返回的值 + code: this.code,// 用于设置父子关系 + parentCode: this.parentCode,// 用于设置父子关系 + rootCodeValue: this.rootCodeValue,//设置根节点code值----可指定根节点,默认为null,"",0,"0" + type: this.method, //请求数据的ajax类型 + url: this.url, //请求数据的ajax的url + ajaxParams: this.data, //请求数据的ajax的data属性 + expandColumn: this.expandColumn,//在哪一列上面显示展开按钮,从0开始 + striped: true, //是否各行渐变色 + expandAll: this.expandAll, //是否全部展开 + columns: this.columns, //列数组 + toolbar: "#" + this.toolbarId,//顶部工具条 + height: this.height, + }); + return this; + }, + + /** + * 设置在哪一列上面显示展开按钮,从0开始 + */ + setExpandColumn: function (expandColumn) { + this.expandColumn = expandColumn; + }, + /** + * 设置记录返回的id值 + */ + setIdField: function (id) { + this.id = id; + }, + /** + * 设置记录分级的字段 + */ + setCodeField: function (code) { + this.code = code; + }, + /** + * 设置记录分级的父级字段 + */ + setParentCodeField: function (parentCode) { + this.parentCode = parentCode; + }, + /** + * 设置根节点code值----可指定根节点,默认为null,"",0,"0" + */ + setRootCodeValue: function (rootCodeValue) { + this.rootCodeValue = rootCodeValue; + }, + /** + * 设置是否默认全部展开 + */ + setExpandAll: function (expandAll) { + this.expandAll = expandAll; + }, + /** + * 设置表格高度 + */ + setHeight: function (height) { + this.height = height; + }, + /** + * 设置ajax post请求时候附带的参数 + */ + set: function (key, value) { + if (typeof key == "object") { + for (var i in key) { + if (typeof i == "function") + continue; + this.data[i] = key[i]; + } + } else { + this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value; + } + return this; + }, + + /** + * 设置ajax get请求时候附带的参数 + */ + setData: function (data) { + this.data = data; + return this; + }, + + /** + * 清空ajax post请求参数 + */ + clear: function () { + this.data = {}; + return this; + }, + + /** + * 刷新表格 + */ + refresh: function (parms) { + if (typeof parms != "undefined") { + this.btInstance.bootstrapTreeTable('refresh', parms.query);// 为了兼容bootstrap-table的写法 + } else { + this.btInstance.bootstrapTreeTable('refresh'); + } + }, + + /** + * 设置高度 + */ + resetHeight: function(parms) { + if (typeof parms != "undefined") { + this.btInstance.bootstrapTreeTable('resetHeight', parms.height);// 为了兼容bootstrap-table的写法 + } else { + this.btInstance.bootstrapTreeTable('resetHeight'); + } + }, + + /** + * 获取选中行 + */ + getSelectedRow: function() { + return this.btInstance.bootstrapTreeTable('getSelections'); + } + }; + + window.TreeTable = TreeTable; + }()); \ No newline at end of file diff --git a/bootdo/src/main/resources/static/js/plugins/jqgrid/i18n/grid.locale-cn.js b/src/main/resources/static/js/plugins/jqgrid/i18n/grid.locale-cn.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jqgrid/i18n/grid.locale-cn.js rename to src/main/resources/static/js/plugins/jqgrid/i18n/grid.locale-cn.js diff --git a/bootdo/src/main/resources/static/js/plugins/jqgrid/jquery.jqGrid.min.js b/src/main/resources/static/js/plugins/jqgrid/jquery.jqGrid.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jqgrid/jquery.jqGrid.min.js rename to src/main/resources/static/js/plugins/jqgrid/jquery.jqGrid.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/jquery-ui/jquery-ui.min.js b/src/main/resources/static/js/plugins/jquery-ui/jquery-ui.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jquery-ui/jquery-ui.min.js rename to src/main/resources/static/js/plugins/jquery-ui/jquery-ui.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/jsKnob/jquery.knob.js b/src/main/resources/static/js/plugins/jsKnob/jquery.knob.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jsKnob/jquery.knob.js rename to src/main/resources/static/js/plugins/jsKnob/jquery.knob.js diff --git a/bootdo/src/main/resources/static/js/plugins/jsTree/jstree.js b/src/main/resources/static/js/plugins/jsTree/jstree.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jsTree/jstree.js rename to src/main/resources/static/js/plugins/jsTree/jstree.js diff --git a/bootdo/src/main/resources/static/js/plugins/jsTree/jstree.min.js b/src/main/resources/static/js/plugins/jsTree/jstree.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jsTree/jstree.min.js rename to src/main/resources/static/js/plugins/jsTree/jstree.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js b/src/main/resources/static/js/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js rename to src/main/resources/static/js/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/jvectormap/jquery-jvectormap-world-mill-en.js b/src/main/resources/static/js/plugins/jvectormap/jquery-jvectormap-world-mill-en.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/jvectormap/jquery-jvectormap-world-mill-en.js rename to src/main/resources/static/js/plugins/jvectormap/jquery-jvectormap-world-mill-en.js diff --git a/bootdo/src/main/resources/static/js/plugins/layer/extend/layer.ext.js b/src/main/resources/static/js/plugins/layer/extend/layer.ext.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/extend/layer.ext.js rename to src/main/resources/static/js/plugins/layer/extend/layer.ext.js diff --git a/bootdo/src/main/resources/static/js/plugins/layer/laydate/laydate.js b/src/main/resources/static/js/plugins/layer/laydate/laydate.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/laydate/laydate.js rename to src/main/resources/static/js/plugins/layer/laydate/laydate.js diff --git a/bootdo/src/main/resources/static/js/plugins/layer/laydate/need/laydate.css b/src/main/resources/static/js/plugins/layer/laydate/need/laydate.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/laydate/need/laydate.css rename to src/main/resources/static/js/plugins/layer/laydate/need/laydate.css diff --git a/bootdo/src/main/resources/static/js/plugins/layer/laydate/skins/default/icon.png b/src/main/resources/static/js/plugins/layer/laydate/skins/default/icon.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/laydate/skins/default/icon.png rename to src/main/resources/static/js/plugins/layer/laydate/skins/default/icon.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/laydate/skins/default/laydate.css b/src/main/resources/static/js/plugins/layer/laydate/skins/default/laydate.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/laydate/skins/default/laydate.css rename to src/main/resources/static/js/plugins/layer/laydate/skins/default/laydate.css diff --git a/bootdo/src/main/resources/static/js/plugins/layer/layer.js b/src/main/resources/static/js/plugins/layer/layer.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/layer.js rename to src/main/resources/static/js/plugins/layer/layer.js diff --git a/bootdo/src/main/resources/static/js/plugins/layer/layer.min.js b/src/main/resources/static/js/plugins/layer/layer.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/layer.min.js rename to src/main/resources/static/js/plugins/layer/layer.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/layer/layim/data/chatlog.json b/src/main/resources/static/js/plugins/layer/layim/data/chatlog.json similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/layim/data/chatlog.json rename to src/main/resources/static/js/plugins/layer/layim/data/chatlog.json diff --git a/bootdo/src/main/resources/static/js/plugins/layer/layim/data/friend.json b/src/main/resources/static/js/plugins/layer/layim/data/friend.json similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/layim/data/friend.json rename to src/main/resources/static/js/plugins/layer/layim/data/friend.json diff --git a/bootdo/src/main/resources/static/js/plugins/layer/layim/data/group.json b/src/main/resources/static/js/plugins/layer/layim/data/group.json similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/layim/data/group.json rename to src/main/resources/static/js/plugins/layer/layim/data/group.json diff --git a/bootdo/src/main/resources/static/js/plugins/layer/layim/data/groups.json b/src/main/resources/static/js/plugins/layer/layim/data/groups.json similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/layim/data/groups.json rename to src/main/resources/static/js/plugins/layer/layim/data/groups.json diff --git a/bootdo/src/main/resources/static/js/plugins/layer/layim/layim.css b/src/main/resources/static/js/plugins/layer/layim/layim.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/layim/layim.css rename to src/main/resources/static/js/plugins/layer/layim/layim.css diff --git a/bootdo/src/main/resources/static/js/plugins/layer/layim/layim.js b/src/main/resources/static/js/plugins/layer/layim/layim.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/layim/layim.js rename to src/main/resources/static/js/plugins/layer/layim/layim.js diff --git a/bootdo/src/main/resources/static/js/plugins/layer/layim/loading.gif b/src/main/resources/static/js/plugins/layer/layim/loading.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/layim/loading.gif rename to src/main/resources/static/js/plugins/layer/layim/loading.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/mobile/layer.js b/src/main/resources/static/js/plugins/layer/mobile/layer.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/mobile/layer.js rename to src/main/resources/static/js/plugins/layer/mobile/layer.js diff --git a/bootdo/src/main/resources/static/js/plugins/layer/mobile/need/layer.css b/src/main/resources/static/js/plugins/layer/mobile/need/layer.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/mobile/need/layer.css rename to src/main/resources/static/js/plugins/layer/mobile/need/layer.css diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/icon-ext.png b/src/main/resources/static/js/plugins/layer/skin/default/icon-ext.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/icon-ext.png rename to src/main/resources/static/js/plugins/layer/skin/default/icon-ext.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/icon.png b/src/main/resources/static/js/plugins/layer/skin/default/icon.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/icon.png rename to src/main/resources/static/js/plugins/layer/skin/default/icon.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/icon_ext.png b/src/main/resources/static/js/plugins/layer/skin/default/icon_ext.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/icon_ext.png rename to src/main/resources/static/js/plugins/layer/skin/default/icon_ext.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/loading-0.gif b/src/main/resources/static/js/plugins/layer/skin/default/loading-0.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/loading-0.gif rename to src/main/resources/static/js/plugins/layer/skin/default/loading-0.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/loading-1.gif b/src/main/resources/static/js/plugins/layer/skin/default/loading-1.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/loading-1.gif rename to src/main/resources/static/js/plugins/layer/skin/default/loading-1.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/loading-2.gif b/src/main/resources/static/js/plugins/layer/skin/default/loading-2.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/loading-2.gif rename to src/main/resources/static/js/plugins/layer/skin/default/loading-2.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/textbg.png b/src/main/resources/static/js/plugins/layer/skin/default/textbg.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/textbg.png rename to src/main/resources/static/js/plugins/layer/skin/default/textbg.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_ico0.png b/src/main/resources/static/js/plugins/layer/skin/default/xubox_ico0.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_ico0.png rename to src/main/resources/static/js/plugins/layer/skin/default/xubox_ico0.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading0.gif b/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading0.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading0.gif rename to src/main/resources/static/js/plugins/layer/skin/default/xubox_loading0.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading1.gif b/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading1.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading1.gif rename to src/main/resources/static/js/plugins/layer/skin/default/xubox_loading1.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading2.gif b/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading2.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading2.gif rename to src/main/resources/static/js/plugins/layer/skin/default/xubox_loading2.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading3.gif b/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading3.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_loading3.gif rename to src/main/resources/static/js/plugins/layer/skin/default/xubox_loading3.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_title0.png b/src/main/resources/static/js/plugins/layer/skin/default/xubox_title0.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/default/xubox_title0.png rename to src/main/resources/static/js/plugins/layer/skin/default/xubox_title0.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/layer.css b/src/main/resources/static/js/plugins/layer/skin/layer.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/layer.css rename to src/main/resources/static/js/plugins/layer/skin/layer.css diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/layer.ext.css b/src/main/resources/static/js/plugins/layer/skin/layer.ext.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/layer.ext.css rename to src/main/resources/static/js/plugins/layer/skin/layer.ext.css diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/moon/default.png b/src/main/resources/static/js/plugins/layer/skin/moon/default.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/moon/default.png rename to src/main/resources/static/js/plugins/layer/skin/moon/default.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/skin/moon/style.css b/src/main/resources/static/js/plugins/layer/skin/moon/style.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/skin/moon/style.css rename to src/main/resources/static/js/plugins/layer/skin/moon/style.css diff --git a/bootdo/src/main/resources/static/js/plugins/layer/theme/default/icon-ext.png b/src/main/resources/static/js/plugins/layer/theme/default/icon-ext.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/theme/default/icon-ext.png rename to src/main/resources/static/js/plugins/layer/theme/default/icon-ext.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/theme/default/icon.png b/src/main/resources/static/js/plugins/layer/theme/default/icon.png similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/theme/default/icon.png rename to src/main/resources/static/js/plugins/layer/theme/default/icon.png diff --git a/bootdo/src/main/resources/static/js/plugins/layer/theme/default/layer.css b/src/main/resources/static/js/plugins/layer/theme/default/layer.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/theme/default/layer.css rename to src/main/resources/static/js/plugins/layer/theme/default/layer.css diff --git a/bootdo/src/main/resources/static/js/plugins/layer/theme/default/loading-0.gif b/src/main/resources/static/js/plugins/layer/theme/default/loading-0.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/theme/default/loading-0.gif rename to src/main/resources/static/js/plugins/layer/theme/default/loading-0.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/theme/default/loading-1.gif b/src/main/resources/static/js/plugins/layer/theme/default/loading-1.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/theme/default/loading-1.gif rename to src/main/resources/static/js/plugins/layer/theme/default/loading-1.gif diff --git a/bootdo/src/main/resources/static/js/plugins/layer/theme/default/loading-2.gif b/src/main/resources/static/js/plugins/layer/theme/default/loading-2.gif similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/layer/theme/default/loading-2.gif rename to src/main/resources/static/js/plugins/layer/theme/default/loading-2.gif diff --git a/bootdo/src/main/resources/static/js/plugins/markdown/bootstrap-markdown.js b/src/main/resources/static/js/plugins/markdown/bootstrap-markdown.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/markdown/bootstrap-markdown.js rename to src/main/resources/static/js/plugins/markdown/bootstrap-markdown.js diff --git a/bootdo/src/main/resources/static/js/plugins/markdown/bootstrap-markdown.zh.js b/src/main/resources/static/js/plugins/markdown/bootstrap-markdown.zh.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/markdown/bootstrap-markdown.zh.js rename to src/main/resources/static/js/plugins/markdown/bootstrap-markdown.zh.js diff --git a/bootdo/src/main/resources/static/js/plugins/markdown/markdown.js b/src/main/resources/static/js/plugins/markdown/markdown.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/markdown/markdown.js rename to src/main/resources/static/js/plugins/markdown/markdown.js diff --git a/bootdo/src/main/resources/static/js/plugins/markdown/to-markdown.js b/src/main/resources/static/js/plugins/markdown/to-markdown.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/markdown/to-markdown.js rename to src/main/resources/static/js/plugins/markdown/to-markdown.js diff --git a/bootdo/src/main/resources/static/js/plugins/metisMenu/jquery.metisMenu.js b/src/main/resources/static/js/plugins/metisMenu/jquery.metisMenu.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/metisMenu/jquery.metisMenu.js rename to src/main/resources/static/js/plugins/metisMenu/jquery.metisMenu.js diff --git a/bootdo/src/main/resources/static/js/plugins/morris/morris.js b/src/main/resources/static/js/plugins/morris/morris.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/morris/morris.js rename to src/main/resources/static/js/plugins/morris/morris.js diff --git a/bootdo/src/main/resources/static/js/plugins/morris/raphael-2.1.0.min.js b/src/main/resources/static/js/plugins/morris/raphael-2.1.0.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/morris/raphael-2.1.0.min.js rename to src/main/resources/static/js/plugins/morris/raphael-2.1.0.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/multiselect/bootstrap-multiselect.js b/src/main/resources/static/js/plugins/multiselect/bootstrap-multiselect.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/multiselect/bootstrap-multiselect.js rename to src/main/resources/static/js/plugins/multiselect/bootstrap-multiselect.js diff --git a/bootdo/src/main/resources/static/js/plugins/nestable/jquery.nestable.js b/src/main/resources/static/js/plugins/nestable/jquery.nestable.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/nestable/jquery.nestable.js rename to src/main/resources/static/js/plugins/nestable/jquery.nestable.js diff --git a/bootdo/src/main/resources/static/js/plugins/nouslider/jquery.nouislider.min.js b/src/main/resources/static/js/plugins/nouslider/jquery.nouislider.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/nouslider/jquery.nouislider.min.js rename to src/main/resources/static/js/plugins/nouslider/jquery.nouislider.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/pace/pace.min.js b/src/main/resources/static/js/plugins/pace/pace.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/pace/pace.min.js rename to src/main/resources/static/js/plugins/pace/pace.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/peity/jquery.peity.min.js b/src/main/resources/static/js/plugins/peity/jquery.peity.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/peity/jquery.peity.min.js rename to src/main/resources/static/js/plugins/peity/jquery.peity.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/plyr/plyr.js b/src/main/resources/static/js/plugins/plyr/plyr.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/plyr/plyr.js rename to src/main/resources/static/js/plugins/plyr/plyr.js diff --git a/bootdo/src/main/resources/static/js/plugins/preetyTextDiff/jquery.pretty-text-diff.min.js b/src/main/resources/static/js/plugins/preetyTextDiff/jquery.pretty-text-diff.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/preetyTextDiff/jquery.pretty-text-diff.min.js rename to src/main/resources/static/js/plugins/preetyTextDiff/jquery.pretty-text-diff.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/prettyfile/bootstrap-prettyfile.js b/src/main/resources/static/js/plugins/prettyfile/bootstrap-prettyfile.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/prettyfile/bootstrap-prettyfile.js rename to src/main/resources/static/js/plugins/prettyfile/bootstrap-prettyfile.js diff --git a/bootdo/src/main/resources/static/js/plugins/rickshaw/rickshaw.min.js b/src/main/resources/static/js/plugins/rickshaw/rickshaw.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/rickshaw/rickshaw.min.js rename to src/main/resources/static/js/plugins/rickshaw/rickshaw.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/rickshaw/vendor/d3.v3.js b/src/main/resources/static/js/plugins/rickshaw/vendor/d3.v3.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/rickshaw/vendor/d3.v3.js rename to src/main/resources/static/js/plugins/rickshaw/vendor/d3.v3.js diff --git a/bootdo/src/main/resources/static/js/plugins/simditor/hotkeys.js b/src/main/resources/static/js/plugins/simditor/hotkeys.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/simditor/hotkeys.js rename to src/main/resources/static/js/plugins/simditor/hotkeys.js diff --git a/bootdo/src/main/resources/static/js/plugins/simditor/hotkeys.min.js b/src/main/resources/static/js/plugins/simditor/hotkeys.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/simditor/hotkeys.min.js rename to src/main/resources/static/js/plugins/simditor/hotkeys.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/simditor/jquery.min.js b/src/main/resources/static/js/plugins/simditor/jquery.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/simditor/jquery.min.js rename to src/main/resources/static/js/plugins/simditor/jquery.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/simditor/module.js b/src/main/resources/static/js/plugins/simditor/module.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/simditor/module.js rename to src/main/resources/static/js/plugins/simditor/module.js diff --git a/bootdo/src/main/resources/static/js/plugins/simditor/module.min.js b/src/main/resources/static/js/plugins/simditor/module.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/simditor/module.min.js rename to src/main/resources/static/js/plugins/simditor/module.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/simditor/simditor.js b/src/main/resources/static/js/plugins/simditor/simditor.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/simditor/simditor.js rename to src/main/resources/static/js/plugins/simditor/simditor.js diff --git a/bootdo/src/main/resources/static/js/plugins/simditor/simditor.min.js b/src/main/resources/static/js/plugins/simditor/simditor.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/simditor/simditor.min.js rename to src/main/resources/static/js/plugins/simditor/simditor.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/simditor/uploader.js b/src/main/resources/static/js/plugins/simditor/uploader.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/simditor/uploader.js rename to src/main/resources/static/js/plugins/simditor/uploader.js diff --git a/bootdo/src/main/resources/static/js/plugins/simditor/uploader.min.js b/src/main/resources/static/js/plugins/simditor/uploader.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/simditor/uploader.min.js rename to src/main/resources/static/js/plugins/simditor/uploader.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/slimscroll/jquery.slimscroll.min.js b/src/main/resources/static/js/plugins/slimscroll/jquery.slimscroll.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/slimscroll/jquery.slimscroll.min.js rename to src/main/resources/static/js/plugins/slimscroll/jquery.slimscroll.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/sparkline/jquery.sparkline.min.js b/src/main/resources/static/js/plugins/sparkline/jquery.sparkline.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/sparkline/jquery.sparkline.min.js rename to src/main/resources/static/js/plugins/sparkline/jquery.sparkline.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/staps/jquery.steps.min.js b/src/main/resources/static/js/plugins/staps/jquery.steps.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/staps/jquery.steps.min.js rename to src/main/resources/static/js/plugins/staps/jquery.steps.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/suggest/bootstrap-suggest.min.js b/src/main/resources/static/js/plugins/suggest/bootstrap-suggest.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/suggest/bootstrap-suggest.min.js rename to src/main/resources/static/js/plugins/suggest/bootstrap-suggest.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/suggest/data.json b/src/main/resources/static/js/plugins/suggest/data.json similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/suggest/data.json rename to src/main/resources/static/js/plugins/suggest/data.json diff --git a/bootdo/src/main/resources/static/js/plugins/summernote/summernote-zh-CN.js b/src/main/resources/static/js/plugins/summernote/summernote-zh-CN.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/summernote/summernote-zh-CN.js rename to src/main/resources/static/js/plugins/summernote/summernote-zh-CN.js diff --git a/bootdo/src/main/resources/static/js/plugins/summernote/summernote-zh-CN.min.js b/src/main/resources/static/js/plugins/summernote/summernote-zh-CN.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/summernote/summernote-zh-CN.min.js rename to src/main/resources/static/js/plugins/summernote/summernote-zh-CN.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/summernote/summernote.js b/src/main/resources/static/js/plugins/summernote/summernote.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/summernote/summernote.js rename to src/main/resources/static/js/plugins/summernote/summernote.js diff --git a/bootdo/src/main/resources/static/js/plugins/summernote/summernote.min.js b/src/main/resources/static/js/plugins/summernote/summernote.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/summernote/summernote.min.js rename to src/main/resources/static/js/plugins/summernote/summernote.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/sweetalert/sweetalert.min.js b/src/main/resources/static/js/plugins/sweetalert/sweetalert.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/sweetalert/sweetalert.min.js rename to src/main/resources/static/js/plugins/sweetalert/sweetalert.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/switchery/switchery.js b/src/main/resources/static/js/plugins/switchery/switchery.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/switchery/switchery.js rename to src/main/resources/static/js/plugins/switchery/switchery.js diff --git a/bootdo/src/main/resources/static/js/plugins/toastr/toastr.min.js b/src/main/resources/static/js/plugins/toastr/toastr.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/toastr/toastr.min.js rename to src/main/resources/static/js/plugins/toastr/toastr.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/treeview/bootstrap-treeview.js b/src/main/resources/static/js/plugins/treeview/bootstrap-treeview.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/treeview/bootstrap-treeview.js rename to src/main/resources/static/js/plugins/treeview/bootstrap-treeview.js diff --git a/bootdo/src/main/resources/static/js/plugins/validate/additional-methods.min.js b/src/main/resources/static/js/plugins/validate/additional-methods.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/validate/additional-methods.min.js rename to src/main/resources/static/js/plugins/validate/additional-methods.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/validate/jquery.validate.extend.js b/src/main/resources/static/js/plugins/validate/jquery.validate.extend.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/validate/jquery.validate.extend.js rename to src/main/resources/static/js/plugins/validate/jquery.validate.extend.js diff --git a/bootdo/src/main/resources/static/js/plugins/validate/jquery.validate.min.js b/src/main/resources/static/js/plugins/validate/jquery.validate.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/validate/jquery.validate.min.js rename to src/main/resources/static/js/plugins/validate/jquery.validate.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/validate/messages_zh.min.js b/src/main/resources/static/js/plugins/validate/messages_zh.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/validate/messages_zh.min.js rename to src/main/resources/static/js/plugins/validate/messages_zh.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/README.md b/src/main/resources/static/js/plugins/webuploader/README.md similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/README.md rename to src/main/resources/static/js/plugins/webuploader/README.md diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/Uploader.swf b/src/main/resources/static/js/plugins/webuploader/Uploader.swf similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/Uploader.swf rename to src/main/resources/static/js/plugins/webuploader/Uploader.swf diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.css b/src/main/resources/static/js/plugins/webuploader/webuploader.css similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.css rename to src/main/resources/static/js/plugins/webuploader/webuploader.css diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.custom.js b/src/main/resources/static/js/plugins/webuploader/webuploader.custom.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.custom.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.custom.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.custom.min.js b/src/main/resources/static/js/plugins/webuploader/webuploader.custom.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.custom.min.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.custom.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.fis.js b/src/main/resources/static/js/plugins/webuploader/webuploader.fis.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.fis.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.fis.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.flashonly.js b/src/main/resources/static/js/plugins/webuploader/webuploader.flashonly.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.flashonly.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.flashonly.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.flashonly.min.js b/src/main/resources/static/js/plugins/webuploader/webuploader.flashonly.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.flashonly.min.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.flashonly.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.html5only.js b/src/main/resources/static/js/plugins/webuploader/webuploader.html5only.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.html5only.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.html5only.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.html5only.min.js b/src/main/resources/static/js/plugins/webuploader/webuploader.html5only.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.html5only.min.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.html5only.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.js b/src/main/resources/static/js/plugins/webuploader/webuploader.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.min.js b/src/main/resources/static/js/plugins/webuploader/webuploader.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.min.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.noimage.js b/src/main/resources/static/js/plugins/webuploader/webuploader.noimage.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.noimage.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.noimage.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.noimage.min.js b/src/main/resources/static/js/plugins/webuploader/webuploader.noimage.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.noimage.min.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.noimage.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.nolog.js b/src/main/resources/static/js/plugins/webuploader/webuploader.nolog.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.nolog.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.nolog.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.nolog.min.js b/src/main/resources/static/js/plugins/webuploader/webuploader.nolog.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.nolog.min.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.nolog.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.withoutimage.js b/src/main/resources/static/js/plugins/webuploader/webuploader.withoutimage.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.withoutimage.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.withoutimage.js diff --git a/bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.withoutimage.min.js b/src/main/resources/static/js/plugins/webuploader/webuploader.withoutimage.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/webuploader/webuploader.withoutimage.min.js rename to src/main/resources/static/js/plugins/webuploader/webuploader.withoutimage.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/zTree/jquery.ztree.all.min.js b/src/main/resources/static/js/plugins/zTree/jquery.ztree.all.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/zTree/jquery.ztree.all.min.js rename to src/main/resources/static/js/plugins/zTree/jquery.ztree.all.min.js diff --git a/bootdo/src/main/resources/static/js/plugins/zTree/jquery.ztree.core.min.js b/src/main/resources/static/js/plugins/zTree/jquery.ztree.core.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/plugins/zTree/jquery.ztree.core.min.js rename to src/main/resources/static/js/plugins/zTree/jquery.ztree.core.min.js diff --git a/bootdo/src/main/resources/static/js/vue.min.js b/src/main/resources/static/js/vue.min.js similarity index 100% rename from bootdo/src/main/resources/static/js/vue.min.js rename to src/main/resources/static/js/vue.min.js diff --git a/bootdo/src/main/resources/static/js/welcome.js b/src/main/resources/static/js/welcome.js similarity index 100% rename from bootdo/src/main/resources/static/js/welcome.js rename to src/main/resources/static/js/welcome.js diff --git a/bootdo/src/main/resources/stencilset.json b/src/main/resources/stencilset.json similarity index 100% rename from bootdo/src/main/resources/stencilset.json rename to src/main/resources/stencilset.json diff --git a/bootdo/src/main/resources/templates/act/model/model.html b/src/main/resources/templates/act/model/model.html similarity index 100% rename from bootdo/src/main/resources/templates/act/model/model.html rename to src/main/resources/templates/act/model/model.html diff --git a/bootdo/src/main/resources/templates/act/modeler.html b/src/main/resources/templates/act/modeler.html similarity index 100% rename from bootdo/src/main/resources/templates/act/modeler.html rename to src/main/resources/templates/act/modeler.html diff --git a/bootdo/src/main/resources/templates/act/process/add.html b/src/main/resources/templates/act/process/add.html similarity index 100% rename from bootdo/src/main/resources/templates/act/process/add.html rename to src/main/resources/templates/act/process/add.html diff --git a/bootdo/src/main/resources/templates/act/process/process.html b/src/main/resources/templates/act/process/process.html similarity index 100% rename from bootdo/src/main/resources/templates/act/process/process.html rename to src/main/resources/templates/act/process/process.html diff --git a/bootdo/src/main/resources/templates/act/salary/add.html b/src/main/resources/templates/act/salary/add.html similarity index 100% rename from bootdo/src/main/resources/templates/act/salary/add.html rename to src/main/resources/templates/act/salary/add.html diff --git a/bootdo/src/main/resources/templates/act/salary/edit.html b/src/main/resources/templates/act/salary/edit.html similarity index 100% rename from bootdo/src/main/resources/templates/act/salary/edit.html rename to src/main/resources/templates/act/salary/edit.html diff --git a/bootdo/src/main/resources/templates/act/salary/start.html b/src/main/resources/templates/act/salary/start.html similarity index 100% rename from bootdo/src/main/resources/templates/act/salary/start.html rename to src/main/resources/templates/act/salary/start.html diff --git a/bootdo/src/main/resources/templates/act/task/gotoTask.html b/src/main/resources/templates/act/task/gotoTask.html similarity index 100% rename from bootdo/src/main/resources/templates/act/task/gotoTask.html rename to src/main/resources/templates/act/task/gotoTask.html diff --git a/bootdo/src/main/resources/templates/act/task/task.html b/src/main/resources/templates/act/task/task.html similarity index 100% rename from bootdo/src/main/resources/templates/act/task/task.html rename to src/main/resources/templates/act/task/task.html diff --git a/bootdo/src/main/resources/templates/act/task/todoTask.html b/src/main/resources/templates/act/task/todoTask.html similarity index 100% rename from bootdo/src/main/resources/templates/act/task/todoTask.html rename to src/main/resources/templates/act/task/todoTask.html diff --git a/bootdo/src/main/resources/templates/blog/bContent/add.html b/src/main/resources/templates/blog/bContent/add.html similarity index 96% rename from bootdo/src/main/resources/templates/blog/bContent/add.html rename to src/main/resources/templates/blog/bContent/add.html index d8578f4fd98abf070f19c028aa9f07df339f8ee1..395f40c9e98925c209698862b78a3c099034bce7 100644 --- a/bootdo/src/main/resources/templates/blog/bContent/add.html +++ b/src/main/resources/templates/blog/bContent/add.html @@ -1,92 +1,92 @@ - - - - - - - -
-
-
-
-
-
-

发布文章

-
-
- -
- -
- -
- -
- -
-
-
- -
-
-
-
-
-
-
- -
- -
-
-
- -
-
- -
-
- - -
-
- - -
-
- -
-
- 返回列表 - - -
-
-
-
-
-
-
-
- - - - - + + + + + + + +
+
+
+
+
+
+

发布文章

+
+
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ 返回列表 + + +
+
+
+
+
+
+
+
+ + + + + diff --git a/bootdo/src/main/resources/templates/blog/bContent/bContent.html b/src/main/resources/templates/blog/bContent/bContent.html similarity index 100% rename from bootdo/src/main/resources/templates/blog/bContent/bContent.html rename to src/main/resources/templates/blog/bContent/bContent.html diff --git a/bootdo/src/main/resources/templates/blog/bContent/edit.html b/src/main/resources/templates/blog/bContent/edit.html similarity index 97% rename from bootdo/src/main/resources/templates/blog/bContent/edit.html rename to src/main/resources/templates/blog/bContent/edit.html index 876b47e23b1d6ed5bf03d9dabb0d75dc2ec311e4..636c96593c60b2d470290b6f55eafb3924cb5648 100644 --- a/bootdo/src/main/resources/templates/blog/bContent/edit.html +++ b/src/main/resources/templates/blog/bContent/edit.html @@ -1,95 +1,95 @@ - - - - - -
-
-
-
-
-
-

发布文章

-
-
- -
- -
- -
- -
- -
-
-
- -
-
-
-
-
-
-
- -
- -
-
-
- -
-
- -
-
- - -
-
- -
-
- -
-
- 返回列表 - - -
-
-
-
-
-
-
-
- - - + + + + + +
+
+
+
+
+
+

发布文章

+
+
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ 返回列表 + + +
+
+
+
+
+
+
+
+ + + diff --git a/bootdo/src/main/resources/templates/blog/bcomments/add.html b/src/main/resources/templates/blog/bcomments/add.html similarity index 97% rename from bootdo/src/main/resources/templates/blog/bcomments/add.html rename to src/main/resources/templates/blog/bcomments/add.html index 9eed9e8a05b07ec3951adc4b76f99a675d03405b..745dd6b063549f69c84b74ff27c1e6afa7f4fabb 100644 --- a/bootdo/src/main/resources/templates/blog/bcomments/add.html +++ b/src/main/resources/templates/blog/bcomments/add.html @@ -1,107 +1,107 @@ - - - - - -
-
-
-
-
-
-

发布文章

-
-
-
- -
- -
- -
- -
-
- -
- -
- -
- -
- -
-
- - -
- -
-
-
-
-
-
- -
- - -
- -
-
-
- -
-
- -
-
- - -
-
- -
-
-
- - -
- 返回列表 - - -
-
-
-
-
-
-
- -
- - - - + + + + + +
+
+
+
+
+
+

发布文章

+
+
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ + +
+ +
+
+
+
+
+
+ +
+ + +
+ +
+
+
+ +
+
+ +
+
+ + +
+
+ +
+
+
+ + +
+ 返回列表 + + +
+
+
+
+
+
+
+ +
+ + + + diff --git a/bootdo/src/main/resources/templates/blog/bcomments/bComments.html b/src/main/resources/templates/blog/bcomments/bComments.html similarity index 100% rename from bootdo/src/main/resources/templates/blog/bcomments/bComments.html rename to src/main/resources/templates/blog/bcomments/bComments.html diff --git a/bootdo/src/main/resources/templates/blog/index/about.html b/src/main/resources/templates/blog/index/about.html similarity index 100% rename from bootdo/src/main/resources/templates/blog/index/about.html rename to src/main/resources/templates/blog/index/about.html diff --git a/bootdo/src/main/resources/templates/blog/index/include_blog.html b/src/main/resources/templates/blog/index/include_blog.html similarity index 100% rename from bootdo/src/main/resources/templates/blog/index/include_blog.html rename to src/main/resources/templates/blog/index/include_blog.html diff --git a/bootdo/src/main/resources/templates/blog/index/main.html b/src/main/resources/templates/blog/index/main.html similarity index 96% rename from bootdo/src/main/resources/templates/blog/index/main.html rename to src/main/resources/templates/blog/index/main.html index 1ada7c1678ba6de6c925dc1c62102d60492ebe0d..3ffd40a33fe5ee8ef949c9b13b6bb8c43c80f5f2 100644 --- a/bootdo/src/main/resources/templates/blog/index/main.html +++ b/src/main/resources/templates/blog/index/main.html @@ -1,85 +1,85 @@ - - - - - - -
-
-
-
-
-

BootDo Blog

- bootdo 博客 -
-
-
-
-
- - -
-
-
-
-
- - -
-
-
-
- -
- - - - + + + + + + +
+
+
+
+
+

BootDo Blog

+ bootdo 博客 +
+
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+ +
+ + + + diff --git a/bootdo/src/main/resources/templates/blog/index/page.html b/src/main/resources/templates/blog/index/page.html similarity index 100% rename from bootdo/src/main/resources/templates/blog/index/page.html rename to src/main/resources/templates/blog/index/page.html diff --git a/bootdo/src/main/resources/templates/blog/index/post.html b/src/main/resources/templates/blog/index/post.html similarity index 100% rename from bootdo/src/main/resources/templates/blog/index/post.html rename to src/main/resources/templates/blog/index/post.html diff --git a/bootdo/src/main/resources/templates/common/dict/add.html b/src/main/resources/templates/common/dict/add.html similarity index 100% rename from bootdo/src/main/resources/templates/common/dict/add.html rename to src/main/resources/templates/common/dict/add.html diff --git a/bootdo/src/main/resources/templates/common/dict/dict.html b/src/main/resources/templates/common/dict/dict.html similarity index 100% rename from bootdo/src/main/resources/templates/common/dict/dict.html rename to src/main/resources/templates/common/dict/dict.html diff --git a/bootdo/src/main/resources/templates/common/dict/edit.html b/src/main/resources/templates/common/dict/edit.html similarity index 100% rename from bootdo/src/main/resources/templates/common/dict/edit.html rename to src/main/resources/templates/common/dict/edit.html diff --git a/bootdo/src/main/resources/templates/common/file/file.html b/src/main/resources/templates/common/file/file.html similarity index 100% rename from bootdo/src/main/resources/templates/common/file/file.html rename to src/main/resources/templates/common/file/file.html diff --git a/bootdo/src/main/resources/templates/common/generator/Controller.java.vm b/src/main/resources/templates/common/generator/Controller.java.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/Controller.java.vm rename to src/main/resources/templates/common/generator/Controller.java.vm diff --git a/bootdo/src/main/resources/templates/common/generator/Dao.java.vm b/src/main/resources/templates/common/generator/Dao.java.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/Dao.java.vm rename to src/main/resources/templates/common/generator/Dao.java.vm diff --git a/bootdo/src/main/resources/templates/common/generator/Mapper.java.vm b/src/main/resources/templates/common/generator/Mapper.java.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/Mapper.java.vm rename to src/main/resources/templates/common/generator/Mapper.java.vm diff --git a/bootdo/src/main/resources/templates/common/generator/Mapper.xml.vm b/src/main/resources/templates/common/generator/Mapper.xml.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/Mapper.xml.vm rename to src/main/resources/templates/common/generator/Mapper.xml.vm diff --git a/bootdo/src/main/resources/templates/common/generator/Service.java.vm b/src/main/resources/templates/common/generator/Service.java.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/Service.java.vm rename to src/main/resources/templates/common/generator/Service.java.vm diff --git a/bootdo/src/main/resources/templates/common/generator/ServiceImpl.java.vm b/src/main/resources/templates/common/generator/ServiceImpl.java.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/ServiceImpl.java.vm rename to src/main/resources/templates/common/generator/ServiceImpl.java.vm diff --git a/bootdo/src/main/resources/templates/common/generator/add.html.vm b/src/main/resources/templates/common/generator/add.html.vm similarity index 96% rename from bootdo/src/main/resources/templates/common/generator/add.html.vm rename to src/main/resources/templates/common/generator/add.html.vm index ea3a7be324051595e3dc42a926bce34d1116241c..ce639f49fa1e3f18215c99b1c085fa6beba314ac 100644 --- a/bootdo/src/main/resources/templates/common/generator/add.html.vm +++ b/src/main/resources/templates/common/generator/add.html.vm @@ -1,37 +1,37 @@ - - - - - -
-
-
-
-
-
-#foreach($column in $columns) -#if($column.columnName != $pk.columnName) -
- -
- -
-
- #end - #end -
-
- -
-
-
-
-
-
-
-
-
- - - + + + + + +
+
+
+
+
+
+#foreach($column in $columns) +#if($column.columnName != $pk.columnName) +
+ +
+ +
+
+ #end + #end +
+
+ +
+
+
+
+
+
+
+
+
+ + + diff --git a/bootdo/src/main/resources/templates/common/generator/add.js.vm b/src/main/resources/templates/common/generator/add.js.vm similarity index 94% rename from bootdo/src/main/resources/templates/common/generator/add.js.vm rename to src/main/resources/templates/common/generator/add.js.vm index c7abccf109781fe8c9dd8e96d20b02910a802be7..ed4a1810664e7dde8e338057be5571799b6e3663 100644 --- a/bootdo/src/main/resources/templates/common/generator/add.js.vm +++ b/src/main/resources/templates/common/generator/add.js.vm @@ -1,49 +1,49 @@ -$().ready(function() { - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - save(); - } -}); -function save() { - $.ajax({ - cache : true, - type : "POST", - url : "/${pathName}/${classname}/save", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入姓名" - } - } - }) +$().ready(function() { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + save(); + } +}); +function save() { + $.ajax({ + cache : true, + type : "POST", + url : "/${pathName}/${classname}/save", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入姓名" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/templates/common/generator/domain.java.vm b/src/main/resources/templates/common/generator/domain.java.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/domain.java.vm rename to src/main/resources/templates/common/generator/domain.java.vm diff --git a/bootdo/src/main/resources/templates/common/generator/edit.html b/src/main/resources/templates/common/generator/edit.html similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/edit.html rename to src/main/resources/templates/common/generator/edit.html diff --git a/bootdo/src/main/resources/templates/common/generator/edit.html.vm b/src/main/resources/templates/common/generator/edit.html.vm similarity index 97% rename from bootdo/src/main/resources/templates/common/generator/edit.html.vm rename to src/main/resources/templates/common/generator/edit.html.vm index 42c6a6f50d0dbc737ce74debc7ddb2ab3e7eb749..3178aed7954c69fbc8f2096ef521a4b3196cb434 100644 --- a/bootdo/src/main/resources/templates/common/generator/edit.html.vm +++ b/src/main/resources/templates/common/generator/edit.html.vm @@ -1,38 +1,38 @@ - - - - - -
-
-
-
-
-
- -#foreach($column in $columns) -#if($column.columnName != $pk.columnName) -
- -
- -
-
- #end - #end -
-
- -
-
-
-
-
-
-
-
-
- - - + + + + + +
+
+
+
+
+
+ +#foreach($column in $columns) +#if($column.columnName != $pk.columnName) +
+ +
+ +
+
+ #end + #end +
+
+ +
+
+
+
+
+
+
+
+
+ + + diff --git a/bootdo/src/main/resources/templates/common/generator/edit.js.vm b/src/main/resources/templates/common/generator/edit.js.vm similarity index 94% rename from bootdo/src/main/resources/templates/common/generator/edit.js.vm rename to src/main/resources/templates/common/generator/edit.js.vm index e4b20eec472a335e5ff2d4e1115d7024622f3153..07da91864164a8496b51655bed4ada7e4e353d4d 100644 --- a/bootdo/src/main/resources/templates/common/generator/edit.js.vm +++ b/src/main/resources/templates/common/generator/edit.js.vm @@ -1,49 +1,49 @@ -$().ready(function() { - validateRule(); -}); - -$.validator.setDefaults({ - submitHandler : function() { - update(); - } -}); -function update() { - $.ajax({ - cache : true, - type : "POST", - url : "/${pathName}/${classname}/update", - data : $('#signupForm').serialize(),// 你的formid - async : false, - error : function(request) { - parent.layer.alert("Connection error"); - }, - success : function(data) { - if (data.code == 0) { - parent.layer.msg("操作成功"); - parent.reLoad(); - var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 - parent.layer.close(index); - - } else { - parent.layer.alert(data.msg) - } - - } - }); - -} -function validateRule() { - var icon = " "; - $("#signupForm").validate({ - rules : { - name : { - required : true - } - }, - messages : { - name : { - required : icon + "请输入名字" - } - } - }) +$().ready(function() { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler : function() { + update(); + } +}); +function update() { + $.ajax({ + cache : true, + type : "POST", + url : "/${pathName}/${classname}/update", + data : $('#signupForm').serialize(),// 你的formid + async : false, + error : function(request) { + parent.layer.alert("Connection error"); + }, + success : function(data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + rules : { + name : { + required : true + } + }, + messages : { + name : { + required : icon + "请输入名字" + } + } + }) } \ No newline at end of file diff --git a/bootdo/src/main/resources/templates/common/generator/list.html b/src/main/resources/templates/common/generator/list.html similarity index 96% rename from bootdo/src/main/resources/templates/common/generator/list.html rename to src/main/resources/templates/common/generator/list.html index 5c9d756ab4e21da511f567ffcf3a50facc12fac8..d6afde415714b326e557682203394cab7219ded1 100644 --- a/bootdo/src/main/resources/templates/common/generator/list.html +++ b/src/main/resources/templates/common/generator/list.html @@ -1,29 +1,29 @@ - - - - - -
-
-
-
-
- - -
- -
-
-
-
-
-
- - + + + + + +
+
+
+
+
+ + +
+ +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/bootdo/src/main/resources/templates/common/generator/list.html.vm b/src/main/resources/templates/common/generator/list.html.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/list.html.vm rename to src/main/resources/templates/common/generator/list.html.vm diff --git a/bootdo/src/main/resources/templates/common/generator/list.js.vm b/src/main/resources/templates/common/generator/list.js.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/list.js.vm rename to src/main/resources/templates/common/generator/list.js.vm diff --git a/bootdo/src/main/resources/templates/common/generator/menu.sql.vm b/src/main/resources/templates/common/generator/menu.sql.vm similarity index 100% rename from bootdo/src/main/resources/templates/common/generator/menu.sql.vm rename to src/main/resources/templates/common/generator/menu.sql.vm diff --git a/bootdo/src/main/resources/templates/common/job/add.html b/src/main/resources/templates/common/job/add.html similarity index 100% rename from bootdo/src/main/resources/templates/common/job/add.html rename to src/main/resources/templates/common/job/add.html diff --git a/bootdo/src/main/resources/templates/common/job/edit.html b/src/main/resources/templates/common/job/edit.html similarity index 100% rename from bootdo/src/main/resources/templates/common/job/edit.html rename to src/main/resources/templates/common/job/edit.html diff --git a/bootdo/src/main/resources/templates/common/job/job.html b/src/main/resources/templates/common/job/job.html similarity index 100% rename from bootdo/src/main/resources/templates/common/job/job.html rename to src/main/resources/templates/common/job/job.html diff --git a/bootdo/src/main/resources/templates/common/log/log.html b/src/main/resources/templates/common/log/log.html similarity index 97% rename from bootdo/src/main/resources/templates/common/log/log.html rename to src/main/resources/templates/common/log/log.html index 06e358da2a6520f0d2ab5daa5e103c2e6997be1f..5e0f2dab7ca270d9186419160c79cd2f05307e2d 100644 --- a/bootdo/src/main/resources/templates/common/log/log.html +++ b/src/main/resources/templates/common/log/log.html @@ -1,40 +1,40 @@ - - - - - -
-
-
-
-
-
- -
-
- -
- - -
- -
-
-
-
-
-
- - + + + + + +
+
+
+
+
+
+ +
+
+ +
+ + +
+ +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/editor/css/editormd.css b/src/main/resources/templates/editor/css/editormd.css new file mode 100644 index 0000000000000000000000000000000000000000..73cbfbe07baac9e891ed3f67da5998712cf473b5 --- /dev/null +++ b/src/main/resources/templates/editor/css/editormd.css @@ -0,0 +1,4450 @@ +/* + * Editor.md + * + * @file editormd.css + * @version v1.5.0 + * @description Open source online markdown editor. + * @license MIT License + * @author Pandao + * {@link https://github.com/pandao/editor.md} + * @updateTime 2015-06-09 + */ + +@charset "UTF-8"; +/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */ +.editormd { + width: 90%; + height: 640px; + margin: 0 auto; + text-align: left; + overflow: hidden; + position: relative; + margin-bottom: 15px; + border: 1px solid #ddd; + font-family: "Meiryo UI", "Microsoft YaHei", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, "Monaco", monospace, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif; +} +.editormd *, .editormd *:before, .editormd *:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.editormd a { + text-decoration: none; +} +.editormd img { + border: none; + vertical-align: middle; +} +.editormd > textarea, +.editormd .editormd-html-textarea, +.editormd .editormd-markdown-textarea { + width: 0; + height: 0; + outline: 0; + resize: none; +} +.editormd .editormd-html-textarea, +.editormd .editormd-markdown-textarea { + display: none; +} +.editormd input[type="text"], +.editormd input[type="button"], +.editormd input[type="submit"], +.editormd select, .editormd textarea, .editormd button { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; +} +.editormd ::-webkit-scrollbar { + height: 10px; + width: 7px; + background: rgba(0, 0, 0, 0.1); +} +.editormd ::-webkit-scrollbar:hover { + background: rgba(0, 0, 0, 0.2); +} +.editormd ::-webkit-scrollbar-thumb { + background: rgba(0, 0, 0, 0.3); + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + -ms-border-radius: 6px; + -o-border-radius: 6px; + border-radius: 6px; +} +.editormd ::-webkit-scrollbar-thumb:hover { + -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); + /* Webkit browsers */ + -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); + /* Firefox */ + -ms-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); + /* IE9 */ + -o-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); + /* Opera(Old) */ + box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25); + /* IE9+, News */ + background-color: rgba(0, 0, 0, 0.4); +} + +.editormd-user-unselect { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; +} + +.editormd-toolbar { + width: 100%; + min-height: 37px; + background: #fff; + display: none; + position: absolute; + top: 0; + left: 0; + z-index: 10; + border-bottom: 1px solid #ddd; +} + +.editormd-toolbar-container { + padding: 0 8px; + min-height: 35px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; +} + +.editormd-menu { + margin: 0; + padding: 0; + list-style: none; +} +.editormd-menu > li { + margin: 0; + padding: 5px 1px; + display: inline-block; + position: relative; +} +.editormd-menu > li.divider { + display: inline-block; + text-indent: -9999px; + margin: 0 5px; + height: 65%; + border-right: 1px solid #ddd; +} +.editormd-menu > li > a { + outline: 0; + color: #666; + display: inline-block; + min-width: 24px; + font-size: 16px; + text-decoration: none; + text-align: center; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + -ms-border-radius: 2px; + -o-border-radius: 2px; + border-radius: 2px; + border: 1px solid #fff; + -webkit-transition: all 300ms ease-out; + /* Safari, Chrome */ + -moz-transition: all 300ms ease-out; + /* Firefox 4.0~16.0 */ + transition: all 300ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-menu > li > a:hover, .editormd-menu > li > a.active { + border: 1px solid #ddd; + background: #eee; +} +.editormd-menu > li > a > .fa { + text-align: center; + display: block; + padding: 5px; +} +.editormd-menu > li > a > .editormd-bold { + padding: 5px 2px; + display: inline-block; + font-weight: bold; +} +.editormd-menu > li:hover .editormd-dropdown-menu { + display: block; +} +.editormd-menu > li + li > a { + margin-left: 3px; +} + +.editormd-dropdown-menu { + display: none; + background: #fff; + border: 1px solid #ddd; + width: 148px; + list-style: none; + position: absolute; + top: 33px; + left: 0; + z-index: 100; + -webkit-box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); + /* Webkit browsers */ + -moz-box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); + /* Firefox */ + -ms-box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); + /* IE9 */ + -o-box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); + /* Opera(Old) */ + box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.15); + /* IE9+, News */ +} +.editormd-dropdown-menu:before, .editormd-dropdown-menu:after { + width: 0; + height: 0; + display: block; + content: ""; + position: absolute; + top: -11px; + left: 8px; + border: 5px solid transparent; +} +.editormd-dropdown-menu:before { + border-bottom-color: #ccc; +} +.editormd-dropdown-menu:after { + border-bottom-color: #ffffff; + top: -10px; +} +.editormd-dropdown-menu > li > a { + color: #666; + display: block; + text-decoration: none; + padding: 8px 10px; +} +.editormd-dropdown-menu > li > a:hover { + background: #f6f6f6; + -webkit-transition: all 300ms ease-out; + /* Safari, Chrome */ + -moz-transition: all 300ms ease-out; + /* Firefox 4.0~16.0 */ + transition: all 300ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-dropdown-menu > li + li { + border-top: 1px solid #ddd; +} + +.editormd-container { + margin: 0; + width: 100%; + height: 100%; + overflow: hidden; + padding: 35px 0 0; + position: relative; + background: #fff; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.editormd-dialog { + color: #666; + position: fixed; + z-index: 99999; + display: none; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + /* Webkit browsers */ + -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + /* Firefox */ + -ms-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + /* IE9 */ + -o-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + /* Opera(Old) */ + box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + /* IE9+, News */ + background: #fff; + font-size: 14px; +} + +.editormd-dialog-container { + position: relative; + padding: 20px; + line-height: 1.4; +} +.editormd-dialog-container h1 { + font-size: 24px; + margin-bottom: 10px; +} +.editormd-dialog-container h1 .fa { + color: #2C7EEA; + padding-right: 5px; +} +.editormd-dialog-container h1 small { + padding-left: 5px; + font-weight: normal; + font-size: 12px; + color: #999; +} +.editormd-dialog-container select { + color: #999; + padding: 3px 8px; + border: 1px solid #ddd; +} + +.editormd-dialog-close { + position: absolute; + top: 12px; + right: 15px; + font-size: 18px; + color: #ccc; + -webkit-transition: color 300ms ease-out; + /* Safari, Chrome */ + -moz-transition: color 300ms ease-out; + /* Firefox 4.0~16.0 */ + transition: color 300ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-dialog-close:hover { + color: #999; +} + +.editormd-dialog-header { + padding: 11px 20px; + border-bottom: 1px solid #eee; + -webkit-transition: background 300ms ease-out; + /* Safari, Chrome */ + -moz-transition: background 300ms ease-out; + /* Firefox 4.0~16.0 */ + transition: background 300ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-dialog-header:hover { + background: #f6f6f6; +} + +.editormd-dialog-title { + font-size: 14px; +} + +.editormd-dialog-footer { + padding: 10px 0 0 0; + text-align: right; +} + +.editormd-dialog-info { + width: 420px; +} +.editormd-dialog-info h1 { + font-weight: normal; +} +.editormd-dialog-info .editormd-dialog-container { + padding: 20px 25px 25px; +} +.editormd-dialog-info .editormd-dialog-close { + top: 10px; + right: 10px; +} +.editormd-dialog-info p > a, .editormd-dialog-info .hover-link:hover { + color: #2196F3; +} +.editormd-dialog-info .hover-link { + color: #666; +} +.editormd-dialog-info a .fa-external-link { + display: none; +} +.editormd-dialog-info a:hover { + color: #2196F3; +} +.editormd-dialog-info a:hover .fa-external-link { + display: inline-block; +} + +.editormd-mask, +.editormd-container-mask, +.editormd-dialog-mask { + display: none; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; +} + +.editormd-mask, +.editormd-dialog-mask-bg { + background: #fff; + opacity: 0.5; + filter: alpha(opacity=50); +} + +.editormd-mask { + position: fixed; + background: #000; + opacity: 0.2; + /* W3C */ + filter: alpha(opacity=20); + /* IE */ + z-index: 99998; +} + +.editormd-container-mask, +.editormd-dialog-mask-con { + background: url(../images/loading.gif) no-repeat center center; + -webkit-background-size: 32px 32px; + /* Chrome, iOS, Safari */ + -moz-background-size: 32px 32px; + /* Firefox 3.6~4.0 */ + -o-background-size: 32px 32px; + /* Opera 9.5 */ + background-size: 32px 32px; + /* IE9+, New */ +} + +.editormd-container-mask { + z-index: 20; + display: block; + background-color: #fff; +} + +@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) { + .editormd-container-mask, + .editormd-dialog-mask-con { + background-image: url(../images/loading@2x.gif); + } +} +@media only screen and (-webkit-min-device-pixel-ratio: 3), only screen and (min-device-pixel-ratio: 3) { + .editormd-container-mask, + .editormd-dialog-mask-con { + background-image: url(../images/loading@3x.gif); + } +} +.editormd-code-block-dialog textarea, +.editormd-preformatted-text-dialog textarea { + width: 100%; + height: 400px; + margin-bottom: 6px; + overflow: auto; + border: 1px solid #eee; + background: #fff; + padding: 15px; + resize: none; +} + +.editormd-code-toolbar { + color: #999; + font-size: 14px; + margin: -5px 0 10px; +} + +.editormd-grid-table { + width: 99%; + display: table; + border: 1px solid #ddd; + border-collapse: collapse; +} + +.editormd-grid-table-row { + width: 100%; + display: table-row; +} +.editormd-grid-table-row a { + font-size: 1.4em; + width: 5%; + height: 36px; + color: #999; + text-align: center; + display: table-cell; + vertical-align: middle; + border: 1px solid #ddd; + text-decoration: none; + -webkit-transition: background-color 300ms ease-out, color 100ms ease-in; + /* Safari, Chrome */ + -moz-transition: background-color 300ms ease-out, color 100ms ease-in; + /* Firefox 4.0~16.0 */ + transition: background-color 300ms ease-out, color 100ms ease-in; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-grid-table-row a.selected { + color: #666; + background-color: #eee; +} +.editormd-grid-table-row a:hover { + color: #777; + background-color: #f6f6f6; +} + +.editormd-tab-head { + list-style: none; + border-bottom: 1px solid #ddd; +} +.editormd-tab-head li { + display: inline-block; +} +.editormd-tab-head li a { + color: #999; + display: block; + padding: 6px 12px 5px; + text-align: center; + text-decoration: none; + margin-bottom: -1px; + border: 1px solid #ddd; + -webkit-border-top-left-radius: 3px; + -moz-border-top-left-radius: 3px; + -ms-border-top-left-radius: 3px; + -o-border-top-left-radius: 3px; + border-top-left-radius: 3px; + -webkit-border-top-right-radius: 3px; + -moz-border-top-right-radius: 3px; + -ms-border-top-right-radius: 3px; + -o-border-top-right-radius: 3px; + border-top-right-radius: 3px; + background: #f6f6f6; + -webkit-transition: all 300ms ease-out; + /* Safari, Chrome */ + -moz-transition: all 300ms ease-out; + /* Firefox 4.0~16.0 */ + transition: all 300ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-tab-head li a:hover { + color: #666; + background: #eee; +} +.editormd-tab-head li.active a { + color: #666; + background: #fff; + border-bottom-color: #fff; +} +.editormd-tab-head li + li { + margin-left: 3px; +} + +.editormd-tab-box { + padding: 20px 0; +} + +.editormd-form { + color: #666; +} +.editormd-form label { + float: left; + display: block; + width: 75px; + text-align: left; + padding: 7px 0 15px 5px; + margin: 0 0 2px; + font-weight: normal; +} +.editormd-form br { + clear: both; +} +.editormd-form iframe { + display: none; +} +.editormd-form input:focus { + outline: 0; +} +.editormd-form input[type="text"], .editormd-form input[type="number"] { + color: #999; + padding: 8px; + border: 1px solid #ddd; +} +.editormd-form input[type="number"] { + width: 40px; + display: inline-block; + padding: 6px 8px; +} +.editormd-form input[type="text"] { + display: inline-block; + width: 264px; +} +.editormd-form .fa-btns { + display: inline-block; +} +.editormd-form .fa-btns a { + color: #999; + padding: 7px 10px 0 0; + display: inline-block; + text-decoration: none; + text-align: center; +} +.editormd-form .fa-btns .fa { + font-size: 1.3em; +} +.editormd-form .fa-btns label { + float: none; + display: inline-block; + width: auto; + text-align: left; + padding: 0 0 0 5px; + cursor: pointer; +} + +.editormd-form input[type="submit"], .editormd-form .editormd-btn, .editormd-form button, +.editormd-dialog-container input[type="submit"], +.editormd-dialog-container .editormd-btn, +.editormd-dialog-container button, +.editormd-dialog-footer input[type="submit"], +.editormd-dialog-footer .editormd-btn, +.editormd-dialog-footer button { + color: #666; + min-width: 75px; + cursor: pointer; + background: #fff; + padding: 7px 10px; + border: 1px solid #ddd; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; + -webkit-transition: background 300ms ease-out; + /* Safari, Chrome */ + -moz-transition: background 300ms ease-out; + /* Firefox 4.0~16.0 */ + transition: background 300ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-form input[type="submit"]:hover, .editormd-form .editormd-btn:hover, .editormd-form button:hover, +.editormd-dialog-container input[type="submit"]:hover, +.editormd-dialog-container .editormd-btn:hover, +.editormd-dialog-container button:hover, +.editormd-dialog-footer input[type="submit"]:hover, +.editormd-dialog-footer .editormd-btn:hover, +.editormd-dialog-footer button:hover { + background: #eee; +} +.editormd-form .editormd-btn, +.editormd-dialog-container .editormd-btn, +.editormd-dialog-footer .editormd-btn { + padding: 5px 8px 4px\0; +} +.editormd-form .editormd-btn + .editormd-btn, +.editormd-dialog-container .editormd-btn + .editormd-btn, +.editormd-dialog-footer .editormd-btn + .editormd-btn { + margin-left: 8px; +} + +.editormd-file-input { + width: 75px; + height: 32px; + margin-left: 8px; + position: relative; + display: inline-block; +} +.editormd-file-input input[type="file"] { + width: 75px; + height: 32px; + opacity: 0; + cursor: pointer; + background: #000; + display: inline-block; + position: absolute; + top: 0; + right: 0; +} +.editormd-file-input input[type="file"]::-webkit-file-upload-button { + visibility: hidden; +} +.editormd-file-input:hover input[type="submit"] { + background: #eee; +} + +.editormd .CodeMirror, .editormd-preview { + display: inline-block; + width: 50%; + height: 100%; + vertical-align: top; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin: 0; +} + +.editormd-preview { + position: absolute; + top: 35px; + right: 0; + right: -1px\0; + overflow: auto; + line-height: 1.6; + display: none; + background: #fff; +} + +.editormd .CodeMirror { + z-index: 10; + float: left; + border-right: 1px solid #ddd; + font-size: 14px; + font-family: "YaHei Consolas Hybrid", Consolas, "微软雅黑", "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, "Monaco", courier, monospace; + line-height: 1.6; + margin-top: 35px; +} +.editormd .CodeMirror pre { + font-size: 14px; + padding: 0 12px; +} +.editormd .CodeMirror-linenumbers { + padding: 0 5px; +} +.editormd .CodeMirror-selected { + background: #70B7FF; +} +.editormd .CodeMirror-focused .CodeMirror-selected { + background: #70B7FF; +} +.editormd .CodeMirror, .editormd .CodeMirror-scroll, .editormd .editormd-preview { + -webkit-overflow-scrolling: touch; +} +.editormd .styled-background { + background-color: #ff7; +} +.editormd .CodeMirror-focused .cm-matchhighlight { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==); + background-position: bottom; + background-repeat: repeat-x; +} +.editormd .CodeMirror-empty.CodeMirror-focused { + outline: none; +} +.editormd .CodeMirror pre.CodeMirror-placeholder { + color: #999; +} +.editormd .cm-trailingspace { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==); + background-position: bottom left; + background-repeat: repeat-x; +} +.editormd .cm-tab { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=); + background-position: right; + background-repeat: no-repeat; +} + +/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */ +/*! + * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */ +/* FONT PATH + * -------------------------- */ +@font-face { + font-family: 'FontAwesome'; + src: url("../fonts/fontawesome-webfont.eot?v=4.3.0"); + src: url("../fonts/fontawesome-webfont.eot?#iefix&v=4.3.0") format("embedded-opentype"), url("../fonts/fontawesome-webfont.woff2?v=4.3.0") format("woff2"), url("../fonts/fontawesome-webfont.woff?v=4.3.0") format("woff"), url("../fonts/fontawesome-webfont.ttf?v=4.3.0") format("truetype"), url("../fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular") format("svg"); + font-weight: normal; + font-style: normal; +} +.fa { + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + transform: translate(0, 0); +} + +/* makes the font 33% larger relative to the icon container */ +.fa-lg { + font-size: 1.33333333em; + line-height: 0.75em; + vertical-align: -15%; +} + +.fa-2x { + font-size: 2em; +} + +.fa-3x { + font-size: 3em; +} + +.fa-4x { + font-size: 4em; +} + +.fa-5x { + font-size: 5em; +} + +.fa-fw { + width: 1.28571429em; + text-align: center; +} + +.fa-ul { + padding-left: 0; + margin-left: 2.14285714em; + list-style-type: none; +} + +.fa-ul > li { + position: relative; +} + +.fa-li { + position: absolute; + left: -2.14285714em; + width: 2.14285714em; + top: 0.14285714em; + text-align: center; +} + +.fa-li.fa-lg { + left: -1.85714286em; +} + +.fa-border { + padding: .2em .25em .15em; + border: solid 0.08em #eeeeee; + border-radius: .1em; +} + +.pull-right { + float: right; +} + +.pull-left { + float: left; +} + +.fa.pull-left { + margin-right: .3em; +} + +.fa.pull-right { + margin-left: .3em; +} + +.fa-spin { + -webkit-animation: fa-spin 2s infinite linear; + animation: fa-spin 2s infinite linear; +} + +.fa-pulse { + -webkit-animation: fa-spin 1s infinite steps(8); + animation: fa-spin 1s infinite steps(8); +} + +@-webkit-keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +@keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +.fa-rotate-90 { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} + +.fa-rotate-180 { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.fa-rotate-270 { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); + -webkit-transform: rotate(270deg); + -ms-transform: rotate(270deg); + transform: rotate(270deg); +} + +.fa-flip-horizontal { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1); + -webkit-transform: scale(-1, 1); + -ms-transform: scale(-1, 1); + transform: scale(-1, 1); +} + +.fa-flip-vertical { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1); + -webkit-transform: scale(1, -1); + -ms-transform: scale(1, -1); + transform: scale(1, -1); +} + +:root .fa-rotate-90, +:root .fa-rotate-180, +:root .fa-rotate-270, +:root .fa-flip-horizontal, +:root .fa-flip-vertical { + filter: none; +} + +.fa-stack { + position: relative; + display: inline-block; + width: 2em; + height: 2em; + line-height: 2em; + vertical-align: middle; +} + +.fa-stack-1x, +.fa-stack-2x { + position: absolute; + left: 0; + width: 100%; + text-align: center; +} + +.fa-stack-1x { + line-height: inherit; +} + +.fa-stack-2x { + font-size: 2em; +} + +.fa-inverse { + color: #ffffff; +} + +/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen + readers do not read off random characters that represent icons */ +.fa-glass:before { + content: "\f000"; +} + +.fa-music:before { + content: "\f001"; +} + +.fa-search:before { + content: "\f002"; +} + +.fa-envelope-o:before { + content: "\f003"; +} + +.fa-heart:before { + content: "\f004"; +} + +.fa-star:before { + content: "\f005"; +} + +.fa-star-o:before { + content: "\f006"; +} + +.fa-user:before { + content: "\f007"; +} + +.fa-film:before { + content: "\f008"; +} + +.fa-th-large:before { + content: "\f009"; +} + +.fa-th:before { + content: "\f00a"; +} + +.fa-th-list:before { + content: "\f00b"; +} + +.fa-check:before { + content: "\f00c"; +} + +.fa-remove:before, +.fa-close:before, +.fa-times:before { + content: "\f00d"; +} + +.fa-search-plus:before { + content: "\f00e"; +} + +.fa-search-minus:before { + content: "\f010"; +} + +.fa-power-off:before { + content: "\f011"; +} + +.fa-signal:before { + content: "\f012"; +} + +.fa-gear:before, +.fa-cog:before { + content: "\f013"; +} + +.fa-trash-o:before { + content: "\f014"; +} + +.fa-home:before { + content: "\f015"; +} + +.fa-file-o:before { + content: "\f016"; +} + +.fa-clock-o:before { + content: "\f017"; +} + +.fa-road:before { + content: "\f018"; +} + +.fa-download:before { + content: "\f019"; +} + +.fa-arrow-circle-o-down:before { + content: "\f01a"; +} + +.fa-arrow-circle-o-up:before { + content: "\f01b"; +} + +.fa-inbox:before { + content: "\f01c"; +} + +.fa-play-circle-o:before { + content: "\f01d"; +} + +.fa-rotate-right:before, +.fa-repeat:before { + content: "\f01e"; +} + +.fa-refresh:before { + content: "\f021"; +} + +.fa-list-alt:before { + content: "\f022"; +} + +.fa-lock:before { + content: "\f023"; +} + +.fa-flag:before { + content: "\f024"; +} + +.fa-headphones:before { + content: "\f025"; +} + +.fa-volume-off:before { + content: "\f026"; +} + +.fa-volume-down:before { + content: "\f027"; +} + +.fa-volume-up:before { + content: "\f028"; +} + +.fa-qrcode:before { + content: "\f029"; +} + +.fa-barcode:before { + content: "\f02a"; +} + +.fa-tag:before { + content: "\f02b"; +} + +.fa-tags:before { + content: "\f02c"; +} + +.fa-book:before { + content: "\f02d"; +} + +.fa-bookmark:before { + content: "\f02e"; +} + +.fa-print:before { + content: "\f02f"; +} + +.fa-camera:before { + content: "\f030"; +} + +.fa-font:before { + content: "\f031"; +} + +.fa-bold:before { + content: "\f032"; +} + +.fa-italic:before { + content: "\f033"; +} + +.fa-text-height:before { + content: "\f034"; +} + +.fa-text-width:before { + content: "\f035"; +} + +.fa-align-left:before { + content: "\f036"; +} + +.fa-align-center:before { + content: "\f037"; +} + +.fa-align-right:before { + content: "\f038"; +} + +.fa-align-justify:before { + content: "\f039"; +} + +.fa-list:before { + content: "\f03a"; +} + +.fa-dedent:before, +.fa-outdent:before { + content: "\f03b"; +} + +.fa-indent:before { + content: "\f03c"; +} + +.fa-video-camera:before { + content: "\f03d"; +} + +.fa-photo:before, +.fa-image:before, +.fa-picture-o:before { + content: "\f03e"; +} + +.fa-pencil:before { + content: "\f040"; +} + +.fa-map-marker:before { + content: "\f041"; +} + +.fa-adjust:before { + content: "\f042"; +} + +.fa-tint:before { + content: "\f043"; +} + +.fa-edit:before, +.fa-pencil-square-o:before { + content: "\f044"; +} + +.fa-share-square-o:before { + content: "\f045"; +} + +.fa-check-square-o:before { + content: "\f046"; +} + +.fa-arrows:before { + content: "\f047"; +} + +.fa-step-backward:before { + content: "\f048"; +} + +.fa-fast-backward:before { + content: "\f049"; +} + +.fa-backward:before { + content: "\f04a"; +} + +.fa-play:before { + content: "\f04b"; +} + +.fa-pause:before { + content: "\f04c"; +} + +.fa-stop:before { + content: "\f04d"; +} + +.fa-forward:before { + content: "\f04e"; +} + +.fa-fast-forward:before { + content: "\f050"; +} + +.fa-step-forward:before { + content: "\f051"; +} + +.fa-eject:before { + content: "\f052"; +} + +.fa-chevron-left:before { + content: "\f053"; +} + +.fa-chevron-right:before { + content: "\f054"; +} + +.fa-plus-circle:before { + content: "\f055"; +} + +.fa-minus-circle:before { + content: "\f056"; +} + +.fa-times-circle:before { + content: "\f057"; +} + +.fa-check-circle:before { + content: "\f058"; +} + +.fa-question-circle:before { + content: "\f059"; +} + +.fa-info-circle:before { + content: "\f05a"; +} + +.fa-crosshairs:before { + content: "\f05b"; +} + +.fa-times-circle-o:before { + content: "\f05c"; +} + +.fa-check-circle-o:before { + content: "\f05d"; +} + +.fa-ban:before { + content: "\f05e"; +} + +.fa-arrow-left:before { + content: "\f060"; +} + +.fa-arrow-right:before { + content: "\f061"; +} + +.fa-arrow-up:before { + content: "\f062"; +} + +.fa-arrow-down:before { + content: "\f063"; +} + +.fa-mail-forward:before, +.fa-share:before { + content: "\f064"; +} + +.fa-expand:before { + content: "\f065"; +} + +.fa-compress:before { + content: "\f066"; +} + +.fa-plus:before { + content: "\f067"; +} + +.fa-minus:before { + content: "\f068"; +} + +.fa-asterisk:before { + content: "\f069"; +} + +.fa-exclamation-circle:before { + content: "\f06a"; +} + +.fa-gift:before { + content: "\f06b"; +} + +.fa-leaf:before { + content: "\f06c"; +} + +.fa-fire:before { + content: "\f06d"; +} + +.fa-eye:before { + content: "\f06e"; +} + +.fa-eye-slash:before { + content: "\f070"; +} + +.fa-warning:before, +.fa-exclamation-triangle:before { + content: "\f071"; +} + +.fa-plane:before { + content: "\f072"; +} + +.fa-calendar:before { + content: "\f073"; +} + +.fa-random:before { + content: "\f074"; +} + +.fa-comment:before { + content: "\f075"; +} + +.fa-magnet:before { + content: "\f076"; +} + +.fa-chevron-up:before { + content: "\f077"; +} + +.fa-chevron-down:before { + content: "\f078"; +} + +.fa-retweet:before { + content: "\f079"; +} + +.fa-shopping-cart:before { + content: "\f07a"; +} + +.fa-folder:before { + content: "\f07b"; +} + +.fa-folder-open:before { + content: "\f07c"; +} + +.fa-arrows-v:before { + content: "\f07d"; +} + +.fa-arrows-h:before { + content: "\f07e"; +} + +.fa-bar-chart-o:before, +.fa-bar-chart:before { + content: "\f080"; +} + +.fa-twitter-square:before { + content: "\f081"; +} + +.fa-facebook-square:before { + content: "\f082"; +} + +.fa-camera-retro:before { + content: "\f083"; +} + +.fa-key:before { + content: "\f084"; +} + +.fa-gears:before, +.fa-cogs:before { + content: "\f085"; +} + +.fa-comments:before { + content: "\f086"; +} + +.fa-thumbs-o-up:before { + content: "\f087"; +} + +.fa-thumbs-o-down:before { + content: "\f088"; +} + +.fa-star-half:before { + content: "\f089"; +} + +.fa-heart-o:before { + content: "\f08a"; +} + +.fa-sign-out:before { + content: "\f08b"; +} + +.fa-linkedin-square:before { + content: "\f08c"; +} + +.fa-thumb-tack:before { + content: "\f08d"; +} + +.fa-external-link:before { + content: "\f08e"; +} + +.fa-sign-in:before { + content: "\f090"; +} + +.fa-trophy:before { + content: "\f091"; +} + +.fa-github-square:before { + content: "\f092"; +} + +.fa-upload:before { + content: "\f093"; +} + +.fa-lemon-o:before { + content: "\f094"; +} + +.fa-phone:before { + content: "\f095"; +} + +.fa-square-o:before { + content: "\f096"; +} + +.fa-bookmark-o:before { + content: "\f097"; +} + +.fa-phone-square:before { + content: "\f098"; +} + +.fa-twitter:before { + content: "\f099"; +} + +.fa-facebook-f:before, +.fa-facebook:before { + content: "\f09a"; +} + +.fa-github:before { + content: "\f09b"; +} + +.fa-unlock:before { + content: "\f09c"; +} + +.fa-credit-card:before { + content: "\f09d"; +} + +.fa-rss:before { + content: "\f09e"; +} + +.fa-hdd-o:before { + content: "\f0a0"; +} + +.fa-bullhorn:before { + content: "\f0a1"; +} + +.fa-bell:before { + content: "\f0f3"; +} + +.fa-certificate:before { + content: "\f0a3"; +} + +.fa-hand-o-right:before { + content: "\f0a4"; +} + +.fa-hand-o-left:before { + content: "\f0a5"; +} + +.fa-hand-o-up:before { + content: "\f0a6"; +} + +.fa-hand-o-down:before { + content: "\f0a7"; +} + +.fa-arrow-circle-left:before { + content: "\f0a8"; +} + +.fa-arrow-circle-right:before { + content: "\f0a9"; +} + +.fa-arrow-circle-up:before { + content: "\f0aa"; +} + +.fa-arrow-circle-down:before { + content: "\f0ab"; +} + +.fa-globe:before { + content: "\f0ac"; +} + +.fa-wrench:before { + content: "\f0ad"; +} + +.fa-tasks:before { + content: "\f0ae"; +} + +.fa-filter:before { + content: "\f0b0"; +} + +.fa-briefcase:before { + content: "\f0b1"; +} + +.fa-arrows-alt:before { + content: "\f0b2"; +} + +.fa-group:before, +.fa-users:before { + content: "\f0c0"; +} + +.fa-chain:before, +.fa-link:before { + content: "\f0c1"; +} + +.fa-cloud:before { + content: "\f0c2"; +} + +.fa-flask:before { + content: "\f0c3"; +} + +.fa-cut:before, +.fa-scissors:before { + content: "\f0c4"; +} + +.fa-copy:before, +.fa-files-o:before { + content: "\f0c5"; +} + +.fa-paperclip:before { + content: "\f0c6"; +} + +.fa-save:before, +.fa-floppy-o:before { + content: "\f0c7"; +} + +.fa-square:before { + content: "\f0c8"; +} + +.fa-navicon:before, +.fa-reorder:before, +.fa-bars:before { + content: "\f0c9"; +} + +.fa-list-ul:before { + content: "\f0ca"; +} + +.fa-list-ol:before { + content: "\f0cb"; +} + +.fa-strikethrough:before { + content: "\f0cc"; +} + +.fa-underline:before { + content: "\f0cd"; +} + +.fa-table:before { + content: "\f0ce"; +} + +.fa-magic:before { + content: "\f0d0"; +} + +.fa-truck:before { + content: "\f0d1"; +} + +.fa-pinterest:before { + content: "\f0d2"; +} + +.fa-pinterest-square:before { + content: "\f0d3"; +} + +.fa-google-plus-square:before { + content: "\f0d4"; +} + +.fa-google-plus:before { + content: "\f0d5"; +} + +.fa-money:before { + content: "\f0d6"; +} + +.fa-caret-down:before { + content: "\f0d7"; +} + +.fa-caret-up:before { + content: "\f0d8"; +} + +.fa-caret-left:before { + content: "\f0d9"; +} + +.fa-caret-right:before { + content: "\f0da"; +} + +.fa-columns:before { + content: "\f0db"; +} + +.fa-unsorted:before, +.fa-sort:before { + content: "\f0dc"; +} + +.fa-sort-down:before, +.fa-sort-desc:before { + content: "\f0dd"; +} + +.fa-sort-up:before, +.fa-sort-asc:before { + content: "\f0de"; +} + +.fa-envelope:before { + content: "\f0e0"; +} + +.fa-linkedin:before { + content: "\f0e1"; +} + +.fa-rotate-left:before, +.fa-undo:before { + content: "\f0e2"; +} + +.fa-legal:before, +.fa-gavel:before { + content: "\f0e3"; +} + +.fa-dashboard:before, +.fa-tachometer:before { + content: "\f0e4"; +} + +.fa-comment-o:before { + content: "\f0e5"; +} + +.fa-comments-o:before { + content: "\f0e6"; +} + +.fa-flash:before, +.fa-bolt:before { + content: "\f0e7"; +} + +.fa-sitemap:before { + content: "\f0e8"; +} + +.fa-umbrella:before { + content: "\f0e9"; +} + +.fa-paste:before, +.fa-clipboard:before { + content: "\f0ea"; +} + +.fa-lightbulb-o:before { + content: "\f0eb"; +} + +.fa-exchange:before { + content: "\f0ec"; +} + +.fa-cloud-download:before { + content: "\f0ed"; +} + +.fa-cloud-upload:before { + content: "\f0ee"; +} + +.fa-user-md:before { + content: "\f0f0"; +} + +.fa-stethoscope:before { + content: "\f0f1"; +} + +.fa-suitcase:before { + content: "\f0f2"; +} + +.fa-bell-o:before { + content: "\f0a2"; +} + +.fa-coffee:before { + content: "\f0f4"; +} + +.fa-cutlery:before { + content: "\f0f5"; +} + +.fa-file-text-o:before { + content: "\f0f6"; +} + +.fa-building-o:before { + content: "\f0f7"; +} + +.fa-hospital-o:before { + content: "\f0f8"; +} + +.fa-ambulance:before { + content: "\f0f9"; +} + +.fa-medkit:before { + content: "\f0fa"; +} + +.fa-fighter-jet:before { + content: "\f0fb"; +} + +.fa-beer:before { + content: "\f0fc"; +} + +.fa-h-square:before { + content: "\f0fd"; +} + +.fa-plus-square:before { + content: "\f0fe"; +} + +.fa-angle-double-left:before { + content: "\f100"; +} + +.fa-angle-double-right:before { + content: "\f101"; +} + +.fa-angle-double-up:before { + content: "\f102"; +} + +.fa-angle-double-down:before { + content: "\f103"; +} + +.fa-angle-left:before { + content: "\f104"; +} + +.fa-angle-right:before { + content: "\f105"; +} + +.fa-angle-up:before { + content: "\f106"; +} + +.fa-angle-down:before { + content: "\f107"; +} + +.fa-desktop:before { + content: "\f108"; +} + +.fa-laptop:before { + content: "\f109"; +} + +.fa-tablet:before { + content: "\f10a"; +} + +.fa-mobile-phone:before, +.fa-mobile:before { + content: "\f10b"; +} + +.fa-circle-o:before { + content: "\f10c"; +} + +.fa-quote-left:before { + content: "\f10d"; +} + +.fa-quote-right:before { + content: "\f10e"; +} + +.fa-spinner:before { + content: "\f110"; +} + +.fa-circle:before { + content: "\f111"; +} + +.fa-mail-reply:before, +.fa-reply:before { + content: "\f112"; +} + +.fa-github-alt:before { + content: "\f113"; +} + +.fa-folder-o:before { + content: "\f114"; +} + +.fa-folder-open-o:before { + content: "\f115"; +} + +.fa-smile-o:before { + content: "\f118"; +} + +.fa-frown-o:before { + content: "\f119"; +} + +.fa-meh-o:before { + content: "\f11a"; +} + +.fa-gamepad:before { + content: "\f11b"; +} + +.fa-keyboard-o:before { + content: "\f11c"; +} + +.fa-flag-o:before { + content: "\f11d"; +} + +.fa-flag-checkered:before { + content: "\f11e"; +} + +.fa-terminal:before { + content: "\f120"; +} + +.fa-code:before { + content: "\f121"; +} + +.fa-mail-reply-all:before, +.fa-reply-all:before { + content: "\f122"; +} + +.fa-star-half-empty:before, +.fa-star-half-full:before, +.fa-star-half-o:before { + content: "\f123"; +} + +.fa-location-arrow:before { + content: "\f124"; +} + +.fa-crop:before { + content: "\f125"; +} + +.fa-code-fork:before { + content: "\f126"; +} + +.fa-unlink:before, +.fa-chain-broken:before { + content: "\f127"; +} + +.fa-question:before { + content: "\f128"; +} + +.fa-info:before { + content: "\f129"; +} + +.fa-exclamation:before { + content: "\f12a"; +} + +.fa-superscript:before { + content: "\f12b"; +} + +.fa-subscript:before { + content: "\f12c"; +} + +.fa-eraser:before { + content: "\f12d"; +} + +.fa-puzzle-piece:before { + content: "\f12e"; +} + +.fa-microphone:before { + content: "\f130"; +} + +.fa-microphone-slash:before { + content: "\f131"; +} + +.fa-shield:before { + content: "\f132"; +} + +.fa-calendar-o:before { + content: "\f133"; +} + +.fa-fire-extinguisher:before { + content: "\f134"; +} + +.fa-rocket:before { + content: "\f135"; +} + +.fa-maxcdn:before { + content: "\f136"; +} + +.fa-chevron-circle-left:before { + content: "\f137"; +} + +.fa-chevron-circle-right:before { + content: "\f138"; +} + +.fa-chevron-circle-up:before { + content: "\f139"; +} + +.fa-chevron-circle-down:before { + content: "\f13a"; +} + +.fa-html5:before { + content: "\f13b"; +} + +.fa-css3:before { + content: "\f13c"; +} + +.fa-anchor:before { + content: "\f13d"; +} + +.fa-unlock-alt:before { + content: "\f13e"; +} + +.fa-bullseye:before { + content: "\f140"; +} + +.fa-ellipsis-h:before { + content: "\f141"; +} + +.fa-ellipsis-v:before { + content: "\f142"; +} + +.fa-rss-square:before { + content: "\f143"; +} + +.fa-play-circle:before { + content: "\f144"; +} + +.fa-ticket:before { + content: "\f145"; +} + +.fa-minus-square:before { + content: "\f146"; +} + +.fa-minus-square-o:before { + content: "\f147"; +} + +.fa-level-up:before { + content: "\f148"; +} + +.fa-level-down:before { + content: "\f149"; +} + +.fa-check-square:before { + content: "\f14a"; +} + +.fa-pencil-square:before { + content: "\f14b"; +} + +.fa-external-link-square:before { + content: "\f14c"; +} + +.fa-share-square:before { + content: "\f14d"; +} + +.fa-compass:before { + content: "\f14e"; +} + +.fa-toggle-down:before, +.fa-caret-square-o-down:before { + content: "\f150"; +} + +.fa-toggle-up:before, +.fa-caret-square-o-up:before { + content: "\f151"; +} + +.fa-toggle-right:before, +.fa-caret-square-o-right:before { + content: "\f152"; +} + +.fa-euro:before, +.fa-eur:before { + content: "\f153"; +} + +.fa-gbp:before { + content: "\f154"; +} + +.fa-dollar:before, +.fa-usd:before { + content: "\f155"; +} + +.fa-rupee:before, +.fa-inr:before { + content: "\f156"; +} + +.fa-cny:before, +.fa-rmb:before, +.fa-yen:before, +.fa-jpy:before { + content: "\f157"; +} + +.fa-ruble:before, +.fa-rouble:before, +.fa-rub:before { + content: "\f158"; +} + +.fa-won:before, +.fa-krw:before { + content: "\f159"; +} + +.fa-bitcoin:before, +.fa-btc:before { + content: "\f15a"; +} + +.fa-file:before { + content: "\f15b"; +} + +.fa-file-text:before { + content: "\f15c"; +} + +.fa-sort-alpha-asc:before { + content: "\f15d"; +} + +.fa-sort-alpha-desc:before { + content: "\f15e"; +} + +.fa-sort-amount-asc:before { + content: "\f160"; +} + +.fa-sort-amount-desc:before { + content: "\f161"; +} + +.fa-sort-numeric-asc:before { + content: "\f162"; +} + +.fa-sort-numeric-desc:before { + content: "\f163"; +} + +.fa-thumbs-up:before { + content: "\f164"; +} + +.fa-thumbs-down:before { + content: "\f165"; +} + +.fa-youtube-square:before { + content: "\f166"; +} + +.fa-youtube:before { + content: "\f167"; +} + +.fa-xing:before { + content: "\f168"; +} + +.fa-xing-square:before { + content: "\f169"; +} + +.fa-youtube-play:before { + content: "\f16a"; +} + +.fa-dropbox:before { + content: "\f16b"; +} + +.fa-stack-overflow:before { + content: "\f16c"; +} + +.fa-instagram:before { + content: "\f16d"; +} + +.fa-flickr:before { + content: "\f16e"; +} + +.fa-adn:before { + content: "\f170"; +} + +.fa-bitbucket:before { + content: "\f171"; +} + +.fa-bitbucket-square:before { + content: "\f172"; +} + +.fa-tumblr:before { + content: "\f173"; +} + +.fa-tumblr-square:before { + content: "\f174"; +} + +.fa-long-arrow-down:before { + content: "\f175"; +} + +.fa-long-arrow-up:before { + content: "\f176"; +} + +.fa-long-arrow-left:before { + content: "\f177"; +} + +.fa-long-arrow-right:before { + content: "\f178"; +} + +.fa-apple:before { + content: "\f179"; +} + +.fa-windows:before { + content: "\f17a"; +} + +.fa-android:before { + content: "\f17b"; +} + +.fa-linux:before { + content: "\f17c"; +} + +.fa-dribbble:before { + content: "\f17d"; +} + +.fa-skype:before { + content: "\f17e"; +} + +.fa-foursquare:before { + content: "\f180"; +} + +.fa-trello:before { + content: "\f181"; +} + +.fa-female:before { + content: "\f182"; +} + +.fa-male:before { + content: "\f183"; +} + +.fa-gittip:before, +.fa-gratipay:before { + content: "\f184"; +} + +.fa-sun-o:before { + content: "\f185"; +} + +.fa-moon-o:before { + content: "\f186"; +} + +.fa-archive:before { + content: "\f187"; +} + +.fa-bug:before { + content: "\f188"; +} + +.fa-vk:before { + content: "\f189"; +} + +.fa-weibo:before { + content: "\f18a"; +} + +.fa-renren:before { + content: "\f18b"; +} + +.fa-pagelines:before { + content: "\f18c"; +} + +.fa-stack-exchange:before { + content: "\f18d"; +} + +.fa-arrow-circle-o-right:before { + content: "\f18e"; +} + +.fa-arrow-circle-o-left:before { + content: "\f190"; +} + +.fa-toggle-left:before, +.fa-caret-square-o-left:before { + content: "\f191"; +} + +.fa-dot-circle-o:before { + content: "\f192"; +} + +.fa-wheelchair:before { + content: "\f193"; +} + +.fa-vimeo-square:before { + content: "\f194"; +} + +.fa-turkish-lira:before, +.fa-try:before { + content: "\f195"; +} + +.fa-plus-square-o:before { + content: "\f196"; +} + +.fa-space-shuttle:before { + content: "\f197"; +} + +.fa-slack:before { + content: "\f198"; +} + +.fa-envelope-square:before { + content: "\f199"; +} + +.fa-wordpress:before { + content: "\f19a"; +} + +.fa-openid:before { + content: "\f19b"; +} + +.fa-institution:before, +.fa-bank:before, +.fa-university:before { + content: "\f19c"; +} + +.fa-mortar-board:before, +.fa-graduation-cap:before { + content: "\f19d"; +} + +.fa-yahoo:before { + content: "\f19e"; +} + +.fa-google:before { + content: "\f1a0"; +} + +.fa-reddit:before { + content: "\f1a1"; +} + +.fa-reddit-square:before { + content: "\f1a2"; +} + +.fa-stumbleupon-circle:before { + content: "\f1a3"; +} + +.fa-stumbleupon:before { + content: "\f1a4"; +} + +.fa-delicious:before { + content: "\f1a5"; +} + +.fa-digg:before { + content: "\f1a6"; +} + +.fa-pied-piper:before { + content: "\f1a7"; +} + +.fa-pied-piper-alt:before { + content: "\f1a8"; +} + +.fa-drupal:before { + content: "\f1a9"; +} + +.fa-joomla:before { + content: "\f1aa"; +} + +.fa-language:before { + content: "\f1ab"; +} + +.fa-fax:before { + content: "\f1ac"; +} + +.fa-building:before { + content: "\f1ad"; +} + +.fa-child:before { + content: "\f1ae"; +} + +.fa-paw:before { + content: "\f1b0"; +} + +.fa-spoon:before { + content: "\f1b1"; +} + +.fa-cube:before { + content: "\f1b2"; +} + +.fa-cubes:before { + content: "\f1b3"; +} + +.fa-behance:before { + content: "\f1b4"; +} + +.fa-behance-square:before { + content: "\f1b5"; +} + +.fa-steam:before { + content: "\f1b6"; +} + +.fa-steam-square:before { + content: "\f1b7"; +} + +.fa-recycle:before { + content: "\f1b8"; +} + +.fa-automobile:before, +.fa-car:before { + content: "\f1b9"; +} + +.fa-cab:before, +.fa-taxi:before { + content: "\f1ba"; +} + +.fa-tree:before { + content: "\f1bb"; +} + +.fa-spotify:before { + content: "\f1bc"; +} + +.fa-deviantart:before { + content: "\f1bd"; +} + +.fa-soundcloud:before { + content: "\f1be"; +} + +.fa-database:before { + content: "\f1c0"; +} + +.fa-file-pdf-o:before { + content: "\f1c1"; +} + +.fa-file-word-o:before { + content: "\f1c2"; +} + +.fa-file-excel-o:before { + content: "\f1c3"; +} + +.fa-file-powerpoint-o:before { + content: "\f1c4"; +} + +.fa-file-photo-o:before, +.fa-file-picture-o:before, +.fa-file-image-o:before { + content: "\f1c5"; +} + +.fa-file-zip-o:before, +.fa-file-archive-o:before { + content: "\f1c6"; +} + +.fa-file-sound-o:before, +.fa-file-audio-o:before { + content: "\f1c7"; +} + +.fa-file-movie-o:before, +.fa-file-video-o:before { + content: "\f1c8"; +} + +.fa-file-code-o:before { + content: "\f1c9"; +} + +.fa-vine:before { + content: "\f1ca"; +} + +.fa-codepen:before { + content: "\f1cb"; +} + +.fa-jsfiddle:before { + content: "\f1cc"; +} + +.fa-life-bouy:before, +.fa-life-buoy:before, +.fa-life-saver:before, +.fa-support:before, +.fa-life-ring:before { + content: "\f1cd"; +} + +.fa-circle-o-notch:before { + content: "\f1ce"; +} + +.fa-ra:before, +.fa-rebel:before { + content: "\f1d0"; +} + +.fa-ge:before, +.fa-empire:before { + content: "\f1d1"; +} + +.fa-git-square:before { + content: "\f1d2"; +} + +.fa-git:before { + content: "\f1d3"; +} + +.fa-hacker-news:before { + content: "\f1d4"; +} + +.fa-tencent-weibo:before { + content: "\f1d5"; +} + +.fa-qq:before { + content: "\f1d6"; +} + +.fa-wechat:before, +.fa-weixin:before { + content: "\f1d7"; +} + +.fa-send:before, +.fa-paper-plane:before { + content: "\f1d8"; +} + +.fa-send-o:before, +.fa-paper-plane-o:before { + content: "\f1d9"; +} + +.fa-history:before { + content: "\f1da"; +} + +.fa-genderless:before, +.fa-circle-thin:before { + content: "\f1db"; +} + +.fa-header:before { + content: "\f1dc"; +} + +.fa-paragraph:before { + content: "\f1dd"; +} + +.fa-sliders:before { + content: "\f1de"; +} + +.fa-share-alt:before { + content: "\f1e0"; +} + +.fa-share-alt-square:before { + content: "\f1e1"; +} + +.fa-bomb:before { + content: "\f1e2"; +} + +.fa-soccer-ball-o:before, +.fa-futbol-o:before { + content: "\f1e3"; +} + +.fa-tty:before { + content: "\f1e4"; +} + +.fa-binoculars:before { + content: "\f1e5"; +} + +.fa-plug:before { + content: "\f1e6"; +} + +.fa-slideshare:before { + content: "\f1e7"; +} + +.fa-twitch:before { + content: "\f1e8"; +} + +.fa-yelp:before { + content: "\f1e9"; +} + +.fa-newspaper-o:before { + content: "\f1ea"; +} + +.fa-wifi:before { + content: "\f1eb"; +} + +.fa-calculator:before { + content: "\f1ec"; +} + +.fa-paypal:before { + content: "\f1ed"; +} + +.fa-google-wallet:before { + content: "\f1ee"; +} + +.fa-cc-visa:before { + content: "\f1f0"; +} + +.fa-cc-mastercard:before { + content: "\f1f1"; +} + +.fa-cc-discover:before { + content: "\f1f2"; +} + +.fa-cc-amex:before { + content: "\f1f3"; +} + +.fa-cc-paypal:before { + content: "\f1f4"; +} + +.fa-cc-stripe:before { + content: "\f1f5"; +} + +.fa-bell-slash:before { + content: "\f1f6"; +} + +.fa-bell-slash-o:before { + content: "\f1f7"; +} + +.fa-trash:before { + content: "\f1f8"; +} + +.fa-copyright:before { + content: "\f1f9"; +} + +.fa-at:before { + content: "\f1fa"; +} + +.fa-eyedropper:before { + content: "\f1fb"; +} + +.fa-paint-brush:before { + content: "\f1fc"; +} + +.fa-birthday-cake:before { + content: "\f1fd"; +} + +.fa-area-chart:before { + content: "\f1fe"; +} + +.fa-pie-chart:before { + content: "\f200"; +} + +.fa-line-chart:before { + content: "\f201"; +} + +.fa-lastfm:before { + content: "\f202"; +} + +.fa-lastfm-square:before { + content: "\f203"; +} + +.fa-toggle-off:before { + content: "\f204"; +} + +.fa-toggle-on:before { + content: "\f205"; +} + +.fa-bicycle:before { + content: "\f206"; +} + +.fa-bus:before { + content: "\f207"; +} + +.fa-ioxhost:before { + content: "\f208"; +} + +.fa-angellist:before { + content: "\f209"; +} + +.fa-cc:before { + content: "\f20a"; +} + +.fa-shekel:before, +.fa-sheqel:before, +.fa-ils:before { + content: "\f20b"; +} + +.fa-meanpath:before { + content: "\f20c"; +} + +.fa-buysellads:before { + content: "\f20d"; +} + +.fa-connectdevelop:before { + content: "\f20e"; +} + +.fa-dashcube:before { + content: "\f210"; +} + +.fa-forumbee:before { + content: "\f211"; +} + +.fa-leanpub:before { + content: "\f212"; +} + +.fa-sellsy:before { + content: "\f213"; +} + +.fa-shirtsinbulk:before { + content: "\f214"; +} + +.fa-simplybuilt:before { + content: "\f215"; +} + +.fa-skyatlas:before { + content: "\f216"; +} + +.fa-cart-plus:before { + content: "\f217"; +} + +.fa-cart-arrow-down:before { + content: "\f218"; +} + +.fa-diamond:before { + content: "\f219"; +} + +.fa-ship:before { + content: "\f21a"; +} + +.fa-user-secret:before { + content: "\f21b"; +} + +.fa-motorcycle:before { + content: "\f21c"; +} + +.fa-street-view:before { + content: "\f21d"; +} + +.fa-heartbeat:before { + content: "\f21e"; +} + +.fa-venus:before { + content: "\f221"; +} + +.fa-mars:before { + content: "\f222"; +} + +.fa-mercury:before { + content: "\f223"; +} + +.fa-transgender:before { + content: "\f224"; +} + +.fa-transgender-alt:before { + content: "\f225"; +} + +.fa-venus-double:before { + content: "\f226"; +} + +.fa-mars-double:before { + content: "\f227"; +} + +.fa-venus-mars:before { + content: "\f228"; +} + +.fa-mars-stroke:before { + content: "\f229"; +} + +.fa-mars-stroke-v:before { + content: "\f22a"; +} + +.fa-mars-stroke-h:before { + content: "\f22b"; +} + +.fa-neuter:before { + content: "\f22c"; +} + +.fa-facebook-official:before { + content: "\f230"; +} + +.fa-pinterest-p:before { + content: "\f231"; +} + +.fa-whatsapp:before { + content: "\f232"; +} + +.fa-server:before { + content: "\f233"; +} + +.fa-user-plus:before { + content: "\f234"; +} + +.fa-user-times:before { + content: "\f235"; +} + +.fa-hotel:before, +.fa-bed:before { + content: "\f236"; +} + +.fa-viacoin:before { + content: "\f237"; +} + +.fa-train:before { + content: "\f238"; +} + +.fa-subway:before { + content: "\f239"; +} + +.fa-medium:before { + content: "\f23a"; +} + +/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */ +@font-face { + font-family: 'editormd-logo'; + src: url("../fonts/editormd-logo.eot?-5y8q6h"); + src: url(".../fonts/editormd-logo.eot?#iefix-5y8q6h") format("embedded-opentype"), url("../fonts/editormd-logo.woff?-5y8q6h") format("woff"), url("../fonts/editormd-logo.ttf?-5y8q6h") format("truetype"), url("../fonts/editormd-logo.svg?-5y8q6h#icomoon") format("svg"); + font-weight: normal; + font-style: normal; +} +.editormd-logo, +.editormd-logo-1x, +.editormd-logo-2x, +.editormd-logo-3x, +.editormd-logo-4x, +.editormd-logo-5x, +.editormd-logo-6x, +.editormd-logo-7x, +.editormd-logo-8x { + font-family: 'editormd-logo'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + font-size: inherit; + line-height: 1; + display: inline-block; + text-rendering: auto; + vertical-align: inherit; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +.editormd-logo:before, +.editormd-logo-1x:before, +.editormd-logo-2x:before, +.editormd-logo-3x:before, +.editormd-logo-4x:before, +.editormd-logo-5x:before, +.editormd-logo-6x:before, +.editormd-logo-7x:before, +.editormd-logo-8x:before { + content: "\e1987"; + /* + HTML Entity 󡦇 + example: + */ +} + +.editormd-logo-1x { + font-size: 1em; +} + +.editormd-logo-lg { + font-size: 1.2em; +} + +.editormd-logo-2x { + font-size: 2em; +} + +.editormd-logo-3x { + font-size: 3em; +} + +.editormd-logo-4x { + font-size: 4em; +} + +.editormd-logo-5x { + font-size: 5em; +} + +.editormd-logo-6x { + font-size: 6em; +} + +.editormd-logo-7x { + font-size: 7em; +} + +.editormd-logo-8x { + font-size: 8em; +} + +.editormd-logo-color { + color: #2196F3; +} + +/*! github-markdown-css | The MIT License (MIT) | Copyright (c) Sindre Sorhus (sindresorhus.com) | https://github.com/sindresorhus/github-markdown-css */ +@font-face { + font-family: octicons-anchor; + src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAYcAA0AAAAACjQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABMAAAABwAAAAca8vGTk9TLzIAAAFMAAAARAAAAFZG1VHVY21hcAAAAZAAAAA+AAABQgAP9AdjdnQgAAAB0AAAAAQAAAAEACICiGdhc3AAAAHUAAAACAAAAAj//wADZ2x5ZgAAAdwAAADRAAABEKyikaNoZWFkAAACsAAAAC0AAAA2AtXoA2hoZWEAAALgAAAAHAAAACQHngNFaG10eAAAAvwAAAAQAAAAEAwAACJsb2NhAAADDAAAAAoAAAAKALIAVG1heHAAAAMYAAAAHwAAACABEAB2bmFtZQAAAzgAAALBAAAFu3I9x/Nwb3N0AAAF/AAAAB0AAAAvaoFvbwAAAAEAAAAAzBdyYwAAAADP2IQvAAAAAM/bz7t4nGNgZGFgnMDAysDB1Ml0hoGBoR9CM75mMGLkYGBgYmBlZsAKAtJcUxgcPsR8iGF2+O/AEMPsznAYKMwIkgMA5REMOXicY2BgYGaAYBkGRgYQsAHyGMF8FgYFIM0ChED+h5j//yEk/3KoSgZGNgYYk4GRCUgwMaACRoZhDwCs7QgGAAAAIgKIAAAAAf//AAJ4nHWMMQrCQBBF/0zWrCCIKUQsTDCL2EXMohYGSSmorScInsRGL2DOYJe0Ntp7BK+gJ1BxF1stZvjz/v8DRghQzEc4kIgKwiAppcA9LtzKLSkdNhKFY3HF4lK69ExKslx7Xa+vPRVS43G98vG1DnkDMIBUgFN0MDXflU8tbaZOUkXUH0+U27RoRpOIyCKjbMCVejwypzJJG4jIwb43rfl6wbwanocrJm9XFYfskuVC5K/TPyczNU7b84CXcbxks1Un6H6tLH9vf2LRnn8Ax7A5WQAAAHicY2BkYGAA4teL1+yI57f5ysDNwgAC529f0kOmWRiYVgEpDgYmEA8AUzEKsQAAAHicY2BkYGB2+O/AEMPCAAJAkpEBFbAAADgKAe0EAAAiAAAAAAQAAAAEAAAAAAAAKgAqACoAiAAAeJxjYGRgYGBhsGFgYgABEMkFhAwM/xn0QAIAD6YBhwB4nI1Ty07cMBS9QwKlQapQW3VXySvEqDCZGbGaHULiIQ1FKgjWMxknMfLEke2A+IJu+wntrt/QbVf9gG75jK577Lg8K1qQPCfnnnt8fX1NRC/pmjrk/zprC+8D7tBy9DHgBXoWfQ44Av8t4Bj4Z8CLtBL9CniJluPXASf0Lm4CXqFX8Q84dOLnMB17N4c7tBo1AS/Qi+hTwBH4rwHHwN8DXqQ30XXAS7QaLwSc0Gn8NuAVWou/gFmnjLrEaEh9GmDdDGgL3B4JsrRPDU2hTOiMSuJUIdKQQayiAth69r6akSSFqIJuA19TrzCIaY8sIoxyrNIrL//pw7A2iMygkX5vDj+G+kuoLdX4GlGK/8Lnlz6/h9MpmoO9rafrz7ILXEHHaAx95s9lsI7AHNMBWEZHULnfAXwG9/ZqdzLI08iuwRloXE8kfhXYAvE23+23DU3t626rbs8/8adv+9DWknsHp3E17oCf+Z48rvEQNZ78paYM38qfk3v/u3l3u3GXN2Dmvmvpf1Srwk3pB/VSsp512bA/GG5i2WJ7wu430yQ5K3nFGiOqgtmSB5pJVSizwaacmUZzZhXLlZTq8qGGFY2YcSkqbth6aW1tRmlaCFs2016m5qn36SbJrqosG4uMV4aP2PHBmB3tjtmgN2izkGQyLWprekbIntJFing32a5rKWCN/SdSoga45EJykyQ7asZvHQ8PTm6cslIpwyeyjbVltNikc2HTR7YKh9LBl9DADC0U/jLcBZDKrMhUBfQBvXRzLtFtjU9eNHKin0x5InTqb8lNpfKv1s1xHzTXRqgKzek/mb7nB8RZTCDhGEX3kK/8Q75AmUM/eLkfA+0Hi908Kx4eNsMgudg5GLdRD7a84npi+YxNr5i5KIbW5izXas7cHXIMAau1OueZhfj+cOcP3P8MNIWLyYOBuxL6DRylJ4cAAAB4nGNgYoAALjDJyIAOWMCiTIxMLDmZedkABtIBygAAAA==) format("woff"); +} +.markdown-body { + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + color: #333; + overflow: hidden; + font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", "Monaco", monospace, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif; + font-size: 16px; + line-height: 1.6; + word-wrap: break-word; +} + +.markdown-body a { + background: transparent; +} + +.markdown-body a:active, +.markdown-body a:hover { + outline: 0; +} + +.markdown-body strong { + font-weight: bold; +} + +.markdown-body h1 { + font-size: 2em; + margin: 0.67em 0; +} + +.markdown-body img { + border: 0; +} + +.markdown-body hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +.markdown-body pre { + overflow: auto; +} + +.markdown-body code, +.markdown-body kbd, +.markdown-body pre { + font-family: "Meiryo UI", "YaHei Consolas Hybrid", Consolas, "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; + font-size: 1em; +} + +.markdown-body input { + color: inherit; + font: inherit; + margin: 0; +} + +.markdown-body html input[disabled] { + cursor: default; +} + +.markdown-body input { + line-height: normal; +} + +.markdown-body input[type="checkbox"] { + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0; +} + +.markdown-body table { + border-collapse: collapse; + border-spacing: 0; +} + +.markdown-body td, +.markdown-body th { + padding: 0; +} + +.markdown-body * { + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.markdown-body input { + font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"; +} + +.markdown-body a { + color: #4183c4; + text-decoration: none; +} + +.markdown-body a:hover, +.markdown-body a:active { + text-decoration: underline; +} + +.markdown-body hr { + height: 0; + margin: 15px 0; + overflow: hidden; + background: transparent; + border: 0; + border-bottom: 1px solid #ddd; +} + +.markdown-body hr:before { + display: table; + content: ""; +} + +.markdown-body hr:after { + display: table; + clear: both; + content: ""; +} + +.markdown-body h1, +.markdown-body h2, +.markdown-body h3, +.markdown-body h4, +.markdown-body h5, +.markdown-body h6 { + margin-top: 15px; + margin-bottom: 15px; + line-height: 1.1; +} + +.markdown-body h1 { + font-size: 30px; +} + +.markdown-body h2 { + font-size: 21px; +} + +.markdown-body h3 { + font-size: 16px; +} + +.markdown-body h4 { + font-size: 14px; +} + +.markdown-body h5 { + font-size: 12px; +} + +.markdown-body h6 { + font-size: 11px; +} + +.markdown-body blockquote { + margin: 0; +} + +.markdown-body ul, +.markdown-body ol { + padding: 0; + margin-top: 0; + margin-bottom: 0; +} + +.markdown-body ol ol, +.markdown-body ul ol { + list-style-type: lower-roman; +} + +.markdown-body ul ul ol, +.markdown-body ul ol ol, +.markdown-body ol ul ol, +.markdown-body ol ol ol { + list-style-type: lower-alpha; +} + +.markdown-body dd { + margin-left: 0; +} + +.markdown-body code { + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 12px; +} + +.markdown-body pre { + margin-top: 0; + margin-bottom: 0; + font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace; +} + +.markdown-body .octicon { + font: normal normal 16px octicons-anchor; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.markdown-body .octicon-link:before { + content: '\f05c'; +} + +.markdown-body > *:first-child { + margin-top: 0 !important; +} + +.markdown-body > *:last-child { + margin-bottom: 0 !important; +} + +.markdown-body .anchor { + position: absolute; + top: 0; + left: 0; + display: block; + padding-right: 6px; + padding-left: 30px; + margin-left: -30px; +} + +.markdown-body .anchor:focus { + outline: none; +} + +.markdown-body h1, +.markdown-body h2, +.markdown-body h3, +.markdown-body h4, +.markdown-body h5, +.markdown-body h6 { + position: relative; + margin-top: 1em; + margin-bottom: 16px; + font-weight: bold; + line-height: 1.4; +} + +.markdown-body h1 .octicon-link, +.markdown-body h2 .octicon-link, +.markdown-body h3 .octicon-link, +.markdown-body h4 .octicon-link, +.markdown-body h5 .octicon-link, +.markdown-body h6 .octicon-link { + display: none; + color: #000; + vertical-align: middle; +} + +.markdown-body h1:hover .anchor, +.markdown-body h2:hover .anchor, +.markdown-body h3:hover .anchor, +.markdown-body h4:hover .anchor, +.markdown-body h5:hover .anchor, +.markdown-body h6:hover .anchor { + padding-left: 8px; + margin-left: -30px; + text-decoration: none; +} + +.markdown-body h1:hover .anchor .octicon-link, +.markdown-body h2:hover .anchor .octicon-link, +.markdown-body h3:hover .anchor .octicon-link, +.markdown-body h4:hover .anchor .octicon-link, +.markdown-body h5:hover .anchor .octicon-link, +.markdown-body h6:hover .anchor .octicon-link { + display: inline-block; +} + +.markdown-body h1 { + padding-bottom: 0.3em; + font-size: 2.25em; + line-height: 1.2; + border-bottom: 1px solid #eee; +} + +.markdown-body h1 .anchor { + line-height: 1; +} + +.markdown-body h2 { + padding-bottom: 0.3em; + font-size: 1.75em; + line-height: 1.225; + border-bottom: 1px solid #eee; +} + +.markdown-body h2 .anchor { + line-height: 1; +} + +.markdown-body h3 { + font-size: 1.5em; + line-height: 1.43; +} + +.markdown-body h3 .anchor { + line-height: 1.2; +} + +.markdown-body h4 { + font-size: 1.25em; +} + +.markdown-body h4 .anchor { + line-height: 1.2; +} + +.markdown-body h5 { + font-size: 1em; +} + +.markdown-body h5 .anchor { + line-height: 1.1; +} + +.markdown-body h6 { + font-size: 1em; + color: #777; +} + +.markdown-body h6 .anchor { + line-height: 1.1; +} + +.markdown-body p, +.markdown-body blockquote, +.markdown-body ul, +.markdown-body ol, +.markdown-body dl, +.markdown-body table, +.markdown-body pre { + margin-top: 0; + margin-bottom: 16px; +} + +/* +.markdown-body hr { + height: 4px; + padding: 0; + margin: 16px 0; + background-color: #e7e7e7; + border: 0 none; +}*/ +.markdown-body ul, +.markdown-body ol { + padding-left: 2em; +} + +.markdown-body ul ul, +.markdown-body ul ol, +.markdown-body ol ol, +.markdown-body ol ul { + margin-top: 0; + margin-bottom: 0; +} + +.markdown-body li > p { + margin-top: 16px; +} + +.markdown-body dl { + padding: 0; +} + +.markdown-body dl dt { + padding: 0; + margin-top: 16px; + font-size: 1em; + font-style: italic; + font-weight: bold; +} + +.markdown-body dl dd { + padding: 0 16px; + margin-bottom: 16px; +} + +.markdown-body blockquote { + padding: 0 15px; + color: #777; + border-left: 4px solid #ddd; +} + +.markdown-body blockquote > :first-child { + margin-top: 0; +} + +.markdown-body blockquote > :last-child { + margin-bottom: 0; +} + +.markdown-body table { + display: block; + width: 100%; + overflow: auto; + word-break: normal; + word-break: keep-all; +} + +.markdown-body table th { + font-weight: bold; +} + +.markdown-body table th, +.markdown-body table td { + padding: 6px 13px; + border: 1px solid #ddd; +} + +.markdown-body table tr { + background-color: #fff; + border-top: 1px solid #ccc; +} + +.markdown-body table tr:nth-child(2n) { + background-color: #f8f8f8; +} + +.markdown-body img { + max-width: 100%; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.markdown-body code { + padding: 0; + padding-top: 0.2em; + padding-bottom: 0.2em; + margin: 0; + font-size: 85%; + background-color: rgba(0, 0, 0, 0.04); + border-radius: 3px; +} + +.markdown-body code:before, +.markdown-body code:after { + letter-spacing: -0.2em; + content: "\00a0"; +} + +.markdown-body pre > code { + padding: 0; + margin: 0; + font-size: 100%; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; +} + +.markdown-body .highlight { + margin-bottom: 16px; +} + +.markdown-body .highlight pre, +.markdown-body pre { + padding: 16px; + overflow: auto; + font-size: 85%; + line-height: 1.45; + background-color: #f7f7f7; + border-radius: 3px; +} + +.markdown-body .highlight pre { + margin-bottom: 0; + word-break: normal; +} + +.markdown-body pre { + word-wrap: normal; +} + +.markdown-body pre code { + display: inline; + max-width: initial; + padding: 0; + margin: 0; + overflow: initial; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; +} + +.markdown-body pre code:before, +.markdown-body pre code:after { + content: normal; +} + +.markdown-body kbd { + display: inline-block; + padding: 3px 5px; + font-size: 11px; + line-height: 10px; + color: #555; + vertical-align: middle; + background-color: #fcfcfc; + border: solid 1px #ccc; + border-bottom-color: #bbb; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #bbb; +} + +.markdown-body .pl-c { + color: #969896; +} + +.markdown-body .pl-c1, +.markdown-body .pl-mdh, +.markdown-body .pl-mm, +.markdown-body .pl-mp, +.markdown-body .pl-mr, +.markdown-body .pl-s1 .pl-v, +.markdown-body .pl-s3, +.markdown-body .pl-sc, +.markdown-body .pl-sv { + color: #0086b3; +} + +.markdown-body .pl-e, +.markdown-body .pl-en { + color: #795da3; +} + +.markdown-body .pl-s1 .pl-s2, +.markdown-body .pl-smi, +.markdown-body .pl-smp, +.markdown-body .pl-stj, +.markdown-body .pl-vo, +.markdown-body .pl-vpf { + color: #333; +} + +.markdown-body .pl-ent { + color: #63a35c; +} + +.markdown-body .pl-k, +.markdown-body .pl-s, +.markdown-body .pl-st { + color: #a71d5d; +} + +.markdown-body .pl-pds, +.markdown-body .pl-s1, +.markdown-body .pl-s1 .pl-pse .pl-s2, +.markdown-body .pl-sr, +.markdown-body .pl-sr .pl-cce, +.markdown-body .pl-sr .pl-sra, +.markdown-body .pl-sr .pl-sre, +.markdown-body .pl-src { + color: #df5000; +} + +.markdown-body .pl-mo, +.markdown-body .pl-v { + color: #1d3e81; +} + +.markdown-body .pl-id { + color: #b52a1d; +} + +.markdown-body .pl-ii { + background-color: #b52a1d; + color: #f8f8f8; +} + +.markdown-body .pl-sr .pl-cce { + color: #63a35c; + font-weight: bold; +} + +.markdown-body .pl-ml { + color: #693a17; +} + +.markdown-body .pl-mh, +.markdown-body .pl-mh .pl-en, +.markdown-body .pl-ms { + color: #1d3e81; + font-weight: bold; +} + +.markdown-body .pl-mq { + color: #008080; +} + +.markdown-body .pl-mi { + color: #333; + font-style: italic; +} + +.markdown-body .pl-mb { + color: #333; + font-weight: bold; +} + +.markdown-body .pl-md, +.markdown-body .pl-mdhf { + background-color: #ffecec; + color: #bd2c00; +} + +.markdown-body .pl-mdht, +.markdown-body .pl-mi1 { + background-color: #eaffea; + color: #55a532; +} + +.markdown-body .pl-mdr { + color: #795da3; + font-weight: bold; +} + +.markdown-body kbd { + display: inline-block; + padding: 3px 5px; + font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace; + line-height: 10px; + color: #555; + vertical-align: middle; + background-color: #fcfcfc; + border: solid 1px #ccc; + border-bottom-color: #bbb; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #bbb; +} + +.markdown-body .task-list-item { + list-style-type: none; +} + +.markdown-body .task-list-item + .task-list-item { + margin-top: 3px; +} + +.markdown-body .task-list-item input { + float: left; + margin: 0.3em 0 0.25em -1.6em; + vertical-align: middle; +} + +.markdown-body :checked + .radio-label { + z-index: 1; + position: relative; + border-color: #4183c4; +} + +.editormd-preview-container, .editormd-html-preview { + text-align: left; + font-size: 14px; + line-height: 1.6; + padding: 20px; + overflow: auto; + width: 100%; + background-color: #fff; +} +.editormd-preview-container blockquote, .editormd-html-preview blockquote { + color: #666; + border-left: 4px solid #ddd; + padding-left: 20px; + margin-left: 0; + font-size: 14px; + font-style: italic; +} +.editormd-preview-container p code, .editormd-html-preview p code { + margin-left: 5px; + margin-right: 4px; +} +.editormd-preview-container abbr, .editormd-html-preview abbr { + background: #ffffdd; +} +.editormd-preview-container hr, .editormd-html-preview hr { + height: 1px; + border: none; + border-top: 1px solid #ddd; + background: none; +} +.editormd-preview-container code, .editormd-html-preview code { + border: 1px solid #ddd; + background: #f6f6f6; + padding: 3px; + border-radius: 3px; + font-size: 14px; +} +.editormd-preview-container pre, .editormd-html-preview pre { + border: 1px solid #ddd; + background: #f6f6f6; + padding: 10px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; +} +.editormd-preview-container pre code, .editormd-html-preview pre code { + padding: 0; +} +.editormd-preview-container pre, .editormd-preview-container code, .editormd-preview-container kbd, .editormd-html-preview pre, .editormd-html-preview code, .editormd-html-preview kbd { + font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; +} +.editormd-preview-container table thead tr, .editormd-html-preview table thead tr { + background-color: #F8F8F8; +} +.editormd-preview-container p.editormd-tex, .editormd-html-preview p.editormd-tex { + text-align: center; +} +.editormd-preview-container span.editormd-tex, .editormd-html-preview span.editormd-tex { + margin: 0 5px; +} +.editormd-preview-container .emoji, .editormd-html-preview .emoji { + width: 24px; + height: 24px; +} +.editormd-preview-container .katex, .editormd-html-preview .katex { + font-size: 1.4em; +} +.editormd-preview-container .sequence-diagram, .editormd-preview-container .flowchart, .editormd-html-preview .sequence-diagram, .editormd-html-preview .flowchart { + margin: 0 auto; + text-align: center; +} +.editormd-preview-container .sequence-diagram svg, .editormd-preview-container .flowchart svg, .editormd-html-preview .sequence-diagram svg, .editormd-html-preview .flowchart svg { + margin: 0 auto; +} +.editormd-preview-container .sequence-diagram text, .editormd-preview-container .flowchart text, .editormd-html-preview .sequence-diagram text, .editormd-html-preview .flowchart text { + font-size: 15px !important; + font-family: "YaHei Consolas Hybrid", Consolas, "Microsoft YaHei", "Malgun Gothic", "Segoe UI", Helvetica, Arial !important; +} + +/*! Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +.pln { + color: #000; +} + +/* plain text */ +@media screen { + .str { + color: #080; + } + + /* string content */ + .kwd { + color: #008; + } + + /* a keyword */ + .com { + color: #800; + } + + /* a comment */ + .typ { + color: #606; + } + + /* a type name */ + .lit { + color: #066; + } + + /* a literal value */ + /* punctuation, lisp open bracket, lisp close bracket */ + .pun, .opn, .clo { + color: #660; + } + + .tag { + color: #008; + } + + /* a markup tag name */ + .atn { + color: #606; + } + + /* a markup attribute name */ + .atv { + color: #080; + } + + /* a markup attribute value */ + .dec, .var { + color: #606; + } + + /* a declaration; a variable name */ + .fun { + color: red; + } + + /* a function name */ +} +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; + } + + .kwd { + color: #006; + font-weight: bold; + } + + .com { + color: #600; + font-style: italic; + } + + .typ { + color: #404; + font-weight: bold; + } + + .lit { + color: #044; + } + + .pun, .opn, .clo { + color: #440; + } + + .tag { + color: #006; + font-weight: bold; + } + + .atn { + color: #404; + } + + .atv { + color: #060; + } +} +/* Put a border around prettyprinted code snippets. */ +pre.prettyprint { + padding: 2px; + border: 1px solid #888; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L5, +li.L6, +li.L7, +li.L8 { + list-style-type: none; +} + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + background: #eee; +} + +.editormd-preview-container pre.prettyprint, .editormd-html-preview pre.prettyprint { + padding: 10px; + border: 1px solid #ddd; + white-space: pre-wrap; + word-wrap: break-word; +} +.editormd-preview-container ol.linenums, .editormd-html-preview ol.linenums { + color: #999; + padding-left: 2.5em; +} +.editormd-preview-container ol.linenums li, .editormd-html-preview ol.linenums li { + list-style-type: decimal; +} +.editormd-preview-container ol.linenums li code, .editormd-html-preview ol.linenums li code { + border: none; + background: none; + padding: 0; +} + +.editormd-preview-container .editormd-toc-menu, .editormd-html-preview .editormd-toc-menu { + margin: 8px 0 12px 0; + display: inline-block; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc, .editormd-html-preview .editormd-toc-menu > .markdown-toc { + position: relative; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + -o-border-radius: 4px; + border-radius: 4px; + border: 1px solid #ddd; + display: inline-block; + font-size: 1em; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul, .editormd-html-preview .editormd-toc-menu > .markdown-toc > ul { + width: 160%; + min-width: 180px; + position: absolute; + left: -1px; + top: -2px; + z-index: 100; + padding: 0 10px 10px; + display: none; + background: #fff; + border: 1px solid #ddd; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + -o-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Webkit browsers */ + -moz-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Firefox */ + -ms-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* IE9 */ + -o-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Opera(Old) */ + box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* IE9+, News */ +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul > li ul, .editormd-html-preview .editormd-toc-menu > .markdown-toc > ul > li ul { + width: 100%; + min-width: 180px; + border: 1px solid #ddd; + display: none; + background: #fff; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + -o-border-radius: 4px; + border-radius: 4px; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul > li a, .editormd-html-preview .editormd-toc-menu > .markdown-toc > ul > li a { + color: #666; + padding: 6px 10px; + display: block; + -webkit-transition: background-color 500ms ease-out; + /* Safari, Chrome */ + -moz-transition: background-color 500ms ease-out; + /* Firefox 4.0~16.0 */ + transition: background-color 500ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul > li a:hover, .editormd-html-preview .editormd-toc-menu > .markdown-toc > ul > li a:hover { + background-color: #f6f6f6; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li, .editormd-html-preview .editormd-toc-menu > .markdown-toc li { + position: relative; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul { + position: absolute; + top: 32px; + left: 10%; + display: none; + -webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Webkit browsers */ + -moz-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Firefox */ + -ms-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* IE9 */ + -o-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Opera(Old) */ + box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* IE9+, News */ +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:before, .editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:after, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:before, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:after { + pointer-events: pointer-events; + position: absolute; + left: 15px; + top: -6px; + display: block; + content: ""; + width: 0; + height: 0; + border: 6px solid transparent; + border-width: 0 6px 6px; + z-index: 10; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:before, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:before { + border-bottom-color: #ccc; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:after, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:after { + border-bottom-color: #ffffff; + top: -5px; +} +.editormd-preview-container .editormd-toc-menu ul, .editormd-html-preview .editormd-toc-menu ul { + list-style: none; +} +.editormd-preview-container .editormd-toc-menu a, .editormd-html-preview .editormd-toc-menu a { + text-decoration: none; +} +.editormd-preview-container .editormd-toc-menu h1, .editormd-html-preview .editormd-toc-menu h1 { + font-size: 16px; + padding: 5px 0 10px 10px; + line-height: 1; + border-bottom: 1px solid #eee; +} +.editormd-preview-container .editormd-toc-menu h1 .fa, .editormd-html-preview .editormd-toc-menu h1 .fa { + padding-left: 10px; +} +.editormd-preview-container .editormd-toc-menu .toc-menu-btn, .editormd-html-preview .editormd-toc-menu .toc-menu-btn { + color: #666; + min-width: 180px; + padding: 5px 10px; + border-radius: 4px; + display: inline-block; + -webkit-transition: background-color 500ms ease-out; + /* Safari, Chrome */ + -moz-transition: background-color 500ms ease-out; + /* Firefox 4.0~16.0 */ + transition: background-color 500ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-preview-container .editormd-toc-menu .toc-menu-btn:hover, .editormd-html-preview .editormd-toc-menu .toc-menu-btn:hover { + background-color: #f6f6f6; +} +.editormd-preview-container .editormd-toc-menu .toc-menu-btn .fa, .editormd-html-preview .editormd-toc-menu .toc-menu-btn .fa { + float: right; + padding: 3px 0 0 10px; + font-size: 1.3em; +} + +.markdown-body .editormd-toc-menu ul { + padding-left: 0; +} +.markdown-body .highlight pre, .markdown-body pre { + line-height: 1.6; +} + +hr.editormd-page-break { + border: 1px dotted #ccc; + font-size: 0; + height: 2px; +} + +@media only print { + hr.editormd-page-break { + background: none; + border: none; + height: 0; + } +} +.editormd-html-preview textarea { + display: none; +} +.editormd-html-preview hr.editormd-page-break { + background: none; + border: none; + height: 0; +} + +.editormd-preview-close-btn { + color: #fff; + padding: 4px 6px; + font-size: 18px; + -webkit-border-radius: 500px; + -moz-border-radius: 500px; + -ms-border-radius: 500px; + -o-border-radius: 500px; + border-radius: 500px; + display: none; + background-color: #ccc; + position: absolute; + top: 25px; + right: 35px; + z-index: 19; + -webkit-transition: background-color 300ms ease-out; + /* Safari, Chrome */ + -moz-transition: background-color 300ms ease-out; + /* Firefox 4.0~16.0 */ + transition: background-color 300ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-preview-close-btn:hover { + background-color: #999; +} + +.editormd-preview-active { + width: 100%; + padding: 40px; +} + +/* Preview dark theme */ +.editormd-preview-theme-dark { + color: #777; + background: #2C2827; +} +.editormd-preview-theme-dark .editormd-preview-container { + color: #888; + background-color: #2C2827; +} +.editormd-preview-theme-dark .editormd-preview-container pre.prettyprint { + border: none; +} +.editormd-preview-theme-dark .editormd-preview-container blockquote { + color: #555; + padding: 0.5em; + background: #222; + border-color: #333; +} +.editormd-preview-theme-dark .editormd-preview-container abbr { + color: #fff; + padding: 1px 3px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; + background: #ff9900; +} +.editormd-preview-theme-dark .editormd-preview-container code { + color: #fff; + border: none; + padding: 1px 3px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; + background: #5A9600; +} +.editormd-preview-theme-dark .editormd-preview-container table { + border: none; +} +.editormd-preview-theme-dark .editormd-preview-container .fa-emoji { + color: #B4BF42; +} +.editormd-preview-theme-dark .editormd-preview-container .katex { + color: #FEC93F; +} +.editormd-preview-theme-dark .editormd-toc-menu > .markdown-toc { + background: #fff; + border: none; +} +.editormd-preview-theme-dark .editormd-toc-menu > .markdown-toc h1 { + border-color: #ddd; +} +.editormd-preview-theme-dark .markdown-body h1, .editormd-preview-theme-dark .markdown-body h2, .editormd-preview-theme-dark .markdown-body hr { + border-color: #222; +} +.editormd-preview-theme-dark pre { + color: #999; + background-color: #111; + background-color: rgba(0, 0, 0, 0.4); + /* plain text */ +} +.editormd-preview-theme-dark pre .pln { + color: #999; +} +.editormd-preview-theme-dark li.L1, .editormd-preview-theme-dark li.L3, .editormd-preview-theme-dark li.L5, .editormd-preview-theme-dark li.L7, .editormd-preview-theme-dark li.L9 { + background: none; +} +.editormd-preview-theme-dark [class*=editormd-logo] { + color: #2196F3; +} +.editormd-preview-theme-dark .sequence-diagram text { + fill: #fff; +} +.editormd-preview-theme-dark .sequence-diagram rect, .editormd-preview-theme-dark .sequence-diagram path { + color: #fff; + fill: #64D1CB; + stroke: #64D1CB; +} +.editormd-preview-theme-dark .flowchart rect, .editormd-preview-theme-dark .flowchart path { + stroke: #A6C6FF; +} +.editormd-preview-theme-dark .flowchart rect { + fill: #A6C6FF; +} +.editormd-preview-theme-dark .flowchart text { + fill: #5879B4; +} + +@media screen { + .editormd-preview-theme-dark { + /* string content */ + /* a keyword */ + /* a comment */ + /* a type name */ + /* a literal value */ + /* punctuation, lisp open bracket, lisp close bracket */ + /* a markup tag name */ + /* a markup attribute name */ + /* a markup attribute value */ + /* a declaration; a variable name */ + /* a function name */ + } + .editormd-preview-theme-dark .str { + color: #080; + } + .editormd-preview-theme-dark .kwd { + color: #ff9900; + } + .editormd-preview-theme-dark .com { + color: #444444; + } + .editormd-preview-theme-dark .typ { + color: #606; + } + .editormd-preview-theme-dark .lit { + color: #066; + } + .editormd-preview-theme-dark .pun, .editormd-preview-theme-dark .opn, .editormd-preview-theme-dark .clo { + color: #660; + } + .editormd-preview-theme-dark .tag { + color: #ff9900; + } + .editormd-preview-theme-dark .atn { + color: #6C95F5; + } + .editormd-preview-theme-dark .atv { + color: #080; + } + .editormd-preview-theme-dark .dec, .editormd-preview-theme-dark .var { + color: #008BA7; + } + .editormd-preview-theme-dark .fun { + color: red; + } +} +.editormd-onlyread .editormd-toolbar { + display: none; +} +.editormd-onlyread .CodeMirror { + margin-top: 0; +} +.editormd-onlyread .editormd-preview { + top: 0; +} + +.editormd-fullscreen { + position: fixed; + top: 0; + left: 0; + border: none; + margin: 0 auto; +} + +/* Editor.md Dark theme */ +.editormd-theme-dark { + border-color: #1a1a17; +} +.editormd-theme-dark .editormd-toolbar { + background: #1A1A17; + border-color: #1a1a17; +} +.editormd-theme-dark .editormd-menu > li > a { + color: #777; + border-color: #1a1a17; +} +.editormd-theme-dark .editormd-menu > li > a:hover, .editormd-theme-dark .editormd-menu > li > a.active { + border-color: #333; + background: #333; +} +.editormd-theme-dark .editormd-menu > li.divider { + border-right: 1px solid #111; +} +.editormd-theme-dark .CodeMirror { + border-right: 1px solid rgba(0, 0, 0, 0.1); +} diff --git a/src/main/resources/templates/editor/css/editormd.logo.css b/src/main/resources/templates/editor/css/editormd.logo.css new file mode 100644 index 0000000000000000000000000000000000000000..5f901bfa53d7e817f270a89655a135cf19f51c2b --- /dev/null +++ b/src/main/resources/templates/editor/css/editormd.logo.css @@ -0,0 +1,98 @@ +/* + * Editor.md + * + * @file editormd.logo.css + * @version v1.5.0 + * @description Open source online markdown editor. + * @license MIT License + * @author Pandao + * {@link https://github.com/pandao/editor.md} + * @updateTime 2015-06-09 + */ + +/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */ +@font-face { + font-family: 'editormd-logo'; + src: url("../fonts/editormd-logo.eot?-5y8q6h"); + src: url(".../fonts/editormd-logo.eot?#iefix-5y8q6h") format("embedded-opentype"), url("../fonts/editormd-logo.woff?-5y8q6h") format("woff"), url("../fonts/editormd-logo.ttf?-5y8q6h") format("truetype"), url("../fonts/editormd-logo.svg?-5y8q6h#icomoon") format("svg"); + font-weight: normal; + font-style: normal; +} +.editormd-logo, +.editormd-logo-1x, +.editormd-logo-2x, +.editormd-logo-3x, +.editormd-logo-4x, +.editormd-logo-5x, +.editormd-logo-6x, +.editormd-logo-7x, +.editormd-logo-8x { + font-family: 'editormd-logo'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + font-size: inherit; + line-height: 1; + display: inline-block; + text-rendering: auto; + vertical-align: inherit; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +.editormd-logo:before, +.editormd-logo-1x:before, +.editormd-logo-2x:before, +.editormd-logo-3x:before, +.editormd-logo-4x:before, +.editormd-logo-5x:before, +.editormd-logo-6x:before, +.editormd-logo-7x:before, +.editormd-logo-8x:before { + content: "\e1987"; + /* + HTML Entity 󡦇 + example: + */ +} + +.editormd-logo-1x { + font-size: 1em; +} + +.editormd-logo-lg { + font-size: 1.2em; +} + +.editormd-logo-2x { + font-size: 2em; +} + +.editormd-logo-3x { + font-size: 3em; +} + +.editormd-logo-4x { + font-size: 4em; +} + +.editormd-logo-5x { + font-size: 5em; +} + +.editormd-logo-6x { + font-size: 6em; +} + +.editormd-logo-7x { + font-size: 7em; +} + +.editormd-logo-8x { + font-size: 8em; +} + +.editormd-logo-color { + color: #2196F3; +} diff --git a/src/main/resources/templates/editor/css/editormd.logo.min.css b/src/main/resources/templates/editor/css/editormd.logo.min.css new file mode 100644 index 0000000000000000000000000000000000000000..d1699782eb0e84be30107003e9c0660716d9a5b8 --- /dev/null +++ b/src/main/resources/templates/editor/css/editormd.logo.min.css @@ -0,0 +1,2 @@ +/*! Editor.md v1.5.0 | editormd.logo.min.css | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-09 */ +/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */@font-face{font-family:editormd-logo;src:url(../fonts/editormd-logo.eot?-5y8q6h);src:url(.../fonts/editormd-logo.eot?#iefix-5y8q6h)format("embedded-opentype"),url(../fonts/editormd-logo.woff?-5y8q6h)format("woff"),url(../fonts/editormd-logo.ttf?-5y8q6h)format("truetype"),url(../fonts/editormd-logo.svg?-5y8q6h#icomoon)format("svg");font-weight:400;font-style:normal}.editormd-logo,.editormd-logo-1x,.editormd-logo-2x,.editormd-logo-3x,.editormd-logo-4x,.editormd-logo-5x,.editormd-logo-6x,.editormd-logo-7x,.editormd-logo-8x{font-family:editormd-logo;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;font-size:inherit;line-height:1;display:inline-block;text-rendering:auto;vertical-align:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.editormd-logo-1x:before,.editormd-logo-2x:before,.editormd-logo-3x:before,.editormd-logo-4x:before,.editormd-logo-5x:before,.editormd-logo-6x:before,.editormd-logo-7x:before,.editormd-logo-8x:before,.editormd-logo:before{content:"\e1987"}.editormd-logo-1x{font-size:1em}.editormd-logo-lg{font-size:1.2em}.editormd-logo-2x{font-size:2em}.editormd-logo-3x{font-size:3em}.editormd-logo-4x{font-size:4em}.editormd-logo-5x{font-size:5em}.editormd-logo-6x{font-size:6em}.editormd-logo-7x{font-size:7em}.editormd-logo-8x{font-size:8em}.editormd-logo-color{color:#2196F3} \ No newline at end of file diff --git a/src/main/resources/templates/editor/css/editormd.min.css b/src/main/resources/templates/editor/css/editormd.min.css new file mode 100644 index 0000000000000000000000000000000000000000..05abb501c6983376e60c9525bf5dfe18134058bc --- /dev/null +++ b/src/main/resources/templates/editor/css/editormd.min.css @@ -0,0 +1,5 @@ +/*! Editor.md v1.5.0 | editormd.min.css | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-09 */ +@charset "UTF-8";/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */.fa-ul,.markdown-body .task-list-item,li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}.editormd-form br,.markdown-body hr:after{clear:both}.editormd{width:90%;height:640px;margin:0 auto 15px;text-align:left;overflow:hidden;position:relative;border:1px solid #ddd;font-family:"Meiryo UI","Microsoft YaHei","Malgun Gothic","Segoe UI","Trebuchet MS",Helvetica,Monaco,monospace,Tahoma,STXihei,"华文细黑",STHeiti,"Helvetica Neue","Droid Sans","wenquanyi micro hei",FreeSans,Arimo,Arial,SimSun,"宋体",Heiti,"黑体",sans-serif}.editormd *,.editormd :after,.editormd :before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.editormd a{text-decoration:none}.editormd img{border:none;vertical-align:middle}.editormd .editormd-html-textarea,.editormd .editormd-markdown-textarea,.editormd>textarea{width:0;height:0;outline:0;resize:none}.editormd .editormd-html-textarea,.editormd .editormd-markdown-textarea{display:none}.editormd button,.editormd input[type=text],.editormd input[type=button],.editormd input[type=submit],.editormd select,.editormd textarea{-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;appearance:none}.editormd ::-webkit-scrollbar{height:10px;width:7px;background:rgba(0,0,0,.1)}.editormd ::-webkit-scrollbar:hover{background:rgba(0,0,0,.2)}.editormd ::-webkit-scrollbar-thumb{background:rgba(0,0,0,.3);-webkit-border-radius:6px;-moz-border-radius:6px;-ms-border-radius:6px;-o-border-radius:6px;border-radius:6px}.editormd ::-webkit-scrollbar-thumb:hover{-webkit-box-shadow:inset 1px 1px 1px rgba(0,0,0,.25);-moz-box-shadow:inset 1px 1px 1px rgba(0,0,0,.25);-ms-box-shadow:inset 1px 1px 1px rgba(0,0,0,.25);-o-box-shadow:inset 1px 1px 1px rgba(0,0,0,.25);box-shadow:inset 1px 1px 1px rgba(0,0,0,.25);background-color:rgba(0,0,0,.4)}.editormd-user-unselect{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.editormd-toolbar{width:100%;min-height:37px;background:#fff;display:none;position:absolute;top:0;left:0;z-index:10;border-bottom:1px solid #ddd}.editormd-toolbar-container{padding:0 8px;min-height:35px;-o-user-select:none;user-select:none}.editormd-toolbar-container,.markdown-body .octicon{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.editormd-menu,.markdown-body ol,.markdown-body td,.markdown-body th,.markdown-body ul{padding:0}.editormd-menu{margin:0;list-style:none}.editormd-menu>li{margin:0;padding:5px 1px;display:inline-block;position:relative}.editormd-menu>li.divider{display:inline-block;text-indent:-9999px;margin:0 5px;height:65%;border-right:1px solid #ddd}.editormd-menu>li>a{outline:0;color:#666;display:inline-block;min-width:24px;font-size:16px;text-decoration:none;text-align:center;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px;border-radius:2px;border:1px solid #fff;transition:all 300ms ease-out}.editormd-dropdown-menu>li>a:hover,.editormd-menu>li>a{-webkit-transition:all 300ms ease-out;-moz-transition:all 300ms ease-out}.editormd-menu>li>a.active,.editormd-menu>li>a:hover{border:1px solid #ddd;background:#eee}.editormd-menu>li>a>.fa{text-align:center;display:block;padding:5px}.editormd-menu>li>a>.editormd-bold{padding:5px 2px;display:inline-block;font-weight:700}.editormd-menu>li:hover .editormd-dropdown-menu{display:block}.editormd-menu>li+li>a{margin-left:3px}.editormd-dropdown-menu{display:none;background:#fff;border:1px solid #ddd;width:148px;list-style:none;position:absolute;top:33px;left:0;z-index:100;-webkit-box-shadow:1px 2px 6px rgba(0,0,0,.15);-moz-box-shadow:1px 2px 6px rgba(0,0,0,.15);-ms-box-shadow:1px 2px 6px rgba(0,0,0,.15);-o-box-shadow:1px 2px 6px rgba(0,0,0,.15);box-shadow:1px 2px 6px rgba(0,0,0,.15)}.editormd-dropdown-menu:after,.editormd-dropdown-menu:before{width:0;height:0;display:block;content:"";position:absolute;top:-11px;left:8px;border:5px solid transparent}.editormd-dropdown-menu:before{border-bottom-color:#ccc}.editormd-dropdown-menu:after{border-bottom-color:#fff;top:-10px}.editormd-dropdown-menu>li>a{color:#666;display:block;text-decoration:none;padding:8px 10px}.editormd-dropdown-menu>li>a:hover{background:#f6f6f6;transition:all 300ms ease-out}.editormd-dropdown-menu>li+li{border-top:1px solid #ddd}.editormd-container{margin:0;width:100%;height:100%;overflow:hidden;padding:35px 0 0;position:relative;background:#fff;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.editormd-dialog{color:#666;position:fixed;z-index:99999;display:none;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 0 10px rgba(0,0,0,.3);-moz-box-shadow:0 0 10px rgba(0,0,0,.3);-ms-box-shadow:0 0 10px rgba(0,0,0,.3);-o-box-shadow:0 0 10px rgba(0,0,0,.3);box-shadow:0 0 10px rgba(0,0,0,.3);background:#fff;font-size:14px}.editormd-dialog-container{position:relative;padding:20px;line-height:1.4}.editormd-dialog-container h1{font-size:24px;margin-bottom:10px}.editormd-dialog-container h1 .fa{color:#2C7EEA;padding-right:5px}.editormd-dialog-container h1 small{padding-left:5px;font-weight:400;font-size:12px;color:#999}.editormd-dialog-container select{color:#999;padding:3px 8px;border:1px solid #ddd}.editormd-dialog-close{position:absolute;top:12px;right:15px;font-size:18px;color:#ccc;-webkit-transition:color 300ms ease-out;-moz-transition:color 300ms ease-out;transition:color 300ms ease-out}.editormd-dialog-close:hover{color:#999}.editormd-dialog-header{padding:11px 20px;border-bottom:1px solid #eee;-webkit-transition:background 300ms ease-out;-moz-transition:background 300ms ease-out;transition:background 300ms ease-out}.editormd-dialog-header:hover{background:#f6f6f6}.editormd-dialog-title{font-size:14px}.editormd-dialog-footer{padding:10px 0 0;text-align:right}.editormd-dialog-info{width:420px}.editormd-dialog-info h1{font-weight:400}.editormd-dialog-info .editormd-dialog-container{padding:20px 25px 25px}.editormd-dialog-info .editormd-dialog-close{top:10px;right:10px}.editormd-dialog-info .hover-link:hover,.editormd-dialog-info p>a{color:#2196F3}.editormd-dialog-info .hover-link{color:#666}.editormd-dialog-info a .fa-external-link{display:none}.editormd-dialog-info a:hover{color:#2196F3}.editormd-dialog-info a:hover .fa-external-link{display:inline-block}.editormd-container-mask,.editormd-dialog-mask,.editormd-mask{display:none;width:100%;height:100%;position:absolute;top:0;left:0}.editormd-dialog-mask-bg,.editormd-mask{background:#fff;opacity:.5;filter:alpha(opacity=50)}.editormd-mask{position:fixed;background:#000;opacity:.2;filter:alpha(opacity=20);z-index:99998}.editormd-container-mask,.editormd-dialog-mask-con{background:url(../images/loading.gif)center center no-repeat;-webkit-background-size:32px 32px;-moz-background-size:32px 32px;-o-background-size:32px 32px;background-size:32px 32px}.editormd-container-mask{z-index:20;display:block;background-color:#fff}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-device-pixel-ratio:2){.editormd-container-mask,.editormd-dialog-mask-con{background-image:url(../images/loading@2x.gif)}}@media only screen and (-webkit-min-device-pixel-ratio:3),only screen and (min-device-pixel-ratio:3){.editormd-container-mask,.editormd-dialog-mask-con{background-image:url(../images/loading@3x.gif)}}.editormd-code-block-dialog textarea,.editormd-preformatted-text-dialog textarea{width:100%;height:400px;margin-bottom:6px;overflow:auto;border:1px solid #eee;background:#fff;padding:15px;resize:none}.editormd-code-toolbar{color:#999;font-size:14px;margin:-5px 0 10px}.editormd-grid-table{width:99%;display:table;border:1px solid #ddd;border-collapse:collapse}.editormd-grid-table-row{width:100%;display:table-row}.editormd-grid-table-row a{font-size:1.4em;width:5%;height:36px;color:#999;text-align:center;display:table-cell;vertical-align:middle;border:1px solid #ddd;text-decoration:none;-webkit-transition:background-color 300ms ease-out,color 100ms ease-in;-moz-transition:background-color 300ms ease-out,color 100ms ease-in;transition:background-color 300ms ease-out,color 100ms ease-in}.editormd-grid-table-row a.selected{color:#666;background-color:#eee}.editormd-grid-table-row a:hover{color:#777;background-color:#f6f6f6}.editormd-tab-head{list-style:none;border-bottom:1px solid #ddd}.editormd-tab-head li{display:inline-block}.editormd-tab-head li a{color:#999;display:block;padding:6px 12px 5px;text-align:center;text-decoration:none;margin-bottom:-1px;border:1px solid #ddd;-webkit-border-top-left-radius:3px;-moz-border-top-left-radius:3px;-ms-border-top-left-radius:3px;-o-border-top-left-radius:3px;border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-moz-border-top-right-radius:3px;-ms-border-top-right-radius:3px;-o-border-top-right-radius:3px;border-top-right-radius:3px;background:#f6f6f6;-webkit-transition:all 300ms ease-out;-moz-transition:all 300ms ease-out;transition:all 300ms ease-out}.editormd-tab-head li a:hover{color:#666;background:#eee}.editormd-tab-head li.active a{color:#666;background:#fff;border-bottom-color:#fff}.editormd-tab-head li+li{margin-left:3px}.editormd-tab-box{padding:20px 0}.editormd-form{color:#666}.editormd-form label{float:left;display:block;width:75px;text-align:left;padding:7px 0 15px 5px;margin:0 0 2px;font-weight:400}.editormd-form iframe{display:none}.editormd-form input:focus{outline:0}.editormd-form input[type=text],.editormd-form input[type=number]{color:#999;padding:8px;border:1px solid #ddd}.editormd-form input[type=number]{width:40px;display:inline-block;padding:6px 8px}.editormd-form input[type=text]{display:inline-block;width:264px}.editormd-form .fa-btns{display:inline-block}.editormd-form .fa-btns a{color:#999;padding:7px 10px 0 0;display:inline-block;text-decoration:none;text-align:center}.editormd-form .fa-btns .fa{font-size:1.3em}.editormd-form .fa-btns label{float:none;display:inline-block;width:auto;text-align:left;padding:0 0 0 5px;cursor:pointer}.fa-fw,.fa-li{text-align:center}.editormd-dialog-container .editormd-btn,.editormd-dialog-container button,.editormd-dialog-container input[type=submit],.editormd-dialog-footer .editormd-btn,.editormd-dialog-footer button,.editormd-dialog-footer input[type=submit],.editormd-form .editormd-btn,.editormd-form button,.editormd-form input[type=submit]{color:#666;min-width:75px;cursor:pointer;background:#fff;padding:7px 10px;border:1px solid #ddd;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px;-webkit-transition:background 300ms ease-out;-moz-transition:background 300ms ease-out;transition:background 300ms ease-out}.editormd-dialog-container .editormd-btn:hover,.editormd-dialog-container button:hover,.editormd-dialog-container input[type=submit]:hover,.editormd-dialog-footer .editormd-btn:hover,.editormd-dialog-footer button:hover,.editormd-dialog-footer input[type=submit]:hover,.editormd-form .editormd-btn:hover,.editormd-form button:hover,.editormd-form input[type=submit]:hover{background:#eee}.editormd-dialog-container .editormd-btn+.editormd-btn,.editormd-dialog-footer .editormd-btn+.editormd-btn,.editormd-form .editormd-btn+.editormd-btn{margin-left:8px}.editormd-file-input{width:75px;height:32px;margin-left:8px;position:relative;display:inline-block}.editormd-file-input input[type=file]{width:75px;height:32px;opacity:0;cursor:pointer;background:#000;display:inline-block;position:absolute;top:0;right:0}.editormd-file-input input[type=file]::-webkit-file-upload-button{visibility:hidden}.editormd-file-input:hover input[type=submit]{background:#eee}.editormd .CodeMirror,.editormd-preview{display:inline-block;width:50%;height:100%;vertical-align:top;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin:0}.editormd-preview{position:absolute;top:35px;right:0;overflow:auto;line-height:1.6;display:none;background:#fff}.fa,.fa-stack{display:inline-block}.editormd .CodeMirror{z-index:10;float:left;border-right:1px solid #ddd;font-size:14px;font-family:"YaHei Consolas Hybrid",Consolas,"微软雅黑","Meiryo UI","Malgun Gothic","Segoe UI","Trebuchet MS",Helvetica,Monaco,courier,monospace;line-height:1.6;margin-top:35px}.editormd .CodeMirror pre{font-size:14px;padding:0 12px}.editormd .CodeMirror-linenumbers{padding:0 5px}.editormd .CodeMirror-focused .CodeMirror-selected,.editormd .CodeMirror-selected{background:#70B7FF}.editormd .CodeMirror,.editormd .CodeMirror-scroll,.editormd .editormd-preview{-webkit-overflow-scrolling:touch}.editormd .styled-background{background-color:#ff7}.editormd .CodeMirror-focused .cm-matchhighlight{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);background-position:bottom;background-repeat:repeat-x}.editormd .CodeMirror-empty.CodeMirror-focused{outline:0}.editormd .CodeMirror pre.CodeMirror-placeholder{color:#999}.editormd .cm-trailingspace{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==);background-position:bottom left;background-repeat:repeat-x}.editormd .cm-tab{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=)right no-repeat}/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 *//*! + * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:FontAwesome;src:url(../fonts/fontawesome-webfont.eot?v=4.3.0);src:url(../fonts/fontawesome-webfont.eot?#iefix&v=4.3.0)format("embedded-opentype"),url(../fonts/fontawesome-webfont.woff2?v=4.3.0)format("woff2"),url(../fonts/fontawesome-webfont.woff?v=4.3.0)format("woff"),url(../fonts/fontawesome-webfont.ttf?v=4.3.0)format("truetype"),url(../fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular)format("svg");font-weight:400;font-style:normal}.fa{font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;transform:translate(0,0)}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em}.fa-ul{padding-left:0;margin-left:2.14285714em}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{filter:none}.fa-stack{position:relative;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-close:before,.fa-remove:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-cog:before,.fa-gear:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-repeat:before,.fa-rotate-right:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-image:before,.fa-photo:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-exclamation-triangle:before,.fa-warning:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-cogs:before,.fa-gears:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-floppy-o:before,.fa-save:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-sort:before,.fa-unsorted:before{content:"\f0dc"}.fa-sort-desc:before,.fa-sort-down:before{content:"\f0dd"}.fa-sort-asc:before,.fa-sort-up:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-gavel:before,.fa-legal:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-bolt:before,.fa-flash:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-clipboard:before,.fa-paste:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-chain-broken:before,.fa-unlink:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-caret-square-o-down:before,.fa-toggle-down:before{content:"\f150"}.fa-caret-square-o-up:before,.fa-toggle-up:before{content:"\f151"}.fa-caret-square-o-right:before,.fa-toggle-right:before{content:"\f152"}.fa-eur:before,.fa-euro:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-inr:before,.fa-rupee:before{content:"\f156"}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:"\f157"}.fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:"\f158"}.fa-krw:before,.fa-won:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-caret-square-o-left:before,.fa-toggle-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-try:before,.fa-turkish-lira:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-bank:before,.fa-institution:before,.fa-university:before{content:"\f19c"}.fa-graduation-cap:before,.fa-mortar-board:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:"\f1c5"}.fa-file-archive-o:before,.fa-file-zip-o:before{content:"\f1c6"}.fa-file-audio-o:before,.fa-file-sound-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-empire:before,.fa-ge:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-paper-plane:before,.fa-send:before{content:"\f1d8"}.fa-paper-plane-o:before,.fa-send-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before,.fa-genderless:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-futbol-o:before,.fa-soccer-ball-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-ils:before,.fa-shekel:before,.fa-sheqel:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-bed:before,.fa-hotel:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */@font-face{font-family:editormd-logo;src:url(../fonts/editormd-logo.eot?-5y8q6h);src:url(.../fonts/editormd-logo.eot?#iefix-5y8q6h)format("embedded-opentype"),url(../fonts/editormd-logo.woff?-5y8q6h)format("woff"),url(../fonts/editormd-logo.ttf?-5y8q6h)format("truetype"),url(../fonts/editormd-logo.svg?-5y8q6h#icomoon)format("svg");font-weight:400;font-style:normal}.editormd-logo,.editormd-logo-1x,.editormd-logo-2x,.editormd-logo-3x,.editormd-logo-4x,.editormd-logo-5x,.editormd-logo-6x,.editormd-logo-7x,.editormd-logo-8x{font-family:editormd-logo;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;font-size:inherit;line-height:1;display:inline-block;text-rendering:auto;vertical-align:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.markdown-body hr:after,.markdown-body hr:before{content:"";display:table}.editormd-logo-1x:before,.editormd-logo-2x:before,.editormd-logo-3x:before,.editormd-logo-4x:before,.editormd-logo-5x:before,.editormd-logo-6x:before,.editormd-logo-7x:before,.editormd-logo-8x:before,.editormd-logo:before{content:"\e1987"}.editormd-logo-1x{font-size:1em}.editormd-logo-lg{font-size:1.2em}.editormd-logo-2x{font-size:2em}.editormd-logo-3x{font-size:3em}.editormd-logo-4x{font-size:4em}.editormd-logo-5x{font-size:5em}.editormd-logo-6x{font-size:6em}.editormd-logo-7x{font-size:7em}.editormd-logo-8x{font-size:8em}.editormd-logo-color{color:#2196F3}/*! github-markdown-css | The MIT License (MIT) | Copyright (c) Sindre Sorhus (sindresorhus.com) | https://github.com/sindresorhus/github-markdown-css */@font-face{font-family:octicons-anchor;src:url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAYcAA0AAAAACjQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABMAAAABwAAAAca8vGTk9TLzIAAAFMAAAARAAAAFZG1VHVY21hcAAAAZAAAAA+AAABQgAP9AdjdnQgAAAB0AAAAAQAAAAEACICiGdhc3AAAAHUAAAACAAAAAj//wADZ2x5ZgAAAdwAAADRAAABEKyikaNoZWFkAAACsAAAAC0AAAA2AtXoA2hoZWEAAALgAAAAHAAAACQHngNFaG10eAAAAvwAAAAQAAAAEAwAACJsb2NhAAADDAAAAAoAAAAKALIAVG1heHAAAAMYAAAAHwAAACABEAB2bmFtZQAAAzgAAALBAAAFu3I9x/Nwb3N0AAAF/AAAAB0AAAAvaoFvbwAAAAEAAAAAzBdyYwAAAADP2IQvAAAAAM/bz7t4nGNgZGFgnMDAysDB1Ml0hoGBoR9CM75mMGLkYGBgYmBlZsAKAtJcUxgcPsR8iGF2+O/AEMPsznAYKMwIkgMA5REMOXicY2BgYGaAYBkGRgYQsAHyGMF8FgYFIM0ChED+h5j//yEk/3KoSgZGNgYYk4GRCUgwMaACRoZhDwCs7QgGAAAAIgKIAAAAAf//AAJ4nHWMMQrCQBBF/0zWrCCIKUQsTDCL2EXMohYGSSmorScInsRGL2DOYJe0Ntp7BK+gJ1BxF1stZvjz/v8DRghQzEc4kIgKwiAppcA9LtzKLSkdNhKFY3HF4lK69ExKslx7Xa+vPRVS43G98vG1DnkDMIBUgFN0MDXflU8tbaZOUkXUH0+U27RoRpOIyCKjbMCVejwypzJJG4jIwb43rfl6wbwanocrJm9XFYfskuVC5K/TPyczNU7b84CXcbxks1Un6H6tLH9vf2LRnn8Ax7A5WQAAAHicY2BkYGAA4teL1+yI57f5ysDNwgAC529f0kOmWRiYVgEpDgYmEA8AUzEKsQAAAHicY2BkYGB2+O/AEMPCAAJAkpEBFbAAADgKAe0EAAAiAAAAAAQAAAAEAAAAAAAAKgAqACoAiAAAeJxjYGRgYGBhsGFgYgABEMkFhAwM/xn0QAIAD6YBhwB4nI1Ty07cMBS9QwKlQapQW3VXySvEqDCZGbGaHULiIQ1FKgjWMxknMfLEke2A+IJu+wntrt/QbVf9gG75jK577Lg8K1qQPCfnnnt8fX1NRC/pmjrk/zprC+8D7tBy9DHgBXoWfQ44Av8t4Bj4Z8CLtBL9CniJluPXASf0Lm4CXqFX8Q84dOLnMB17N4c7tBo1AS/Qi+hTwBH4rwHHwN8DXqQ30XXAS7QaLwSc0Gn8NuAVWou/gFmnjLrEaEh9GmDdDGgL3B4JsrRPDU2hTOiMSuJUIdKQQayiAth69r6akSSFqIJuA19TrzCIaY8sIoxyrNIrL//pw7A2iMygkX5vDj+G+kuoLdX4GlGK/8Lnlz6/h9MpmoO9rafrz7ILXEHHaAx95s9lsI7AHNMBWEZHULnfAXwG9/ZqdzLI08iuwRloXE8kfhXYAvE23+23DU3t626rbs8/8adv+9DWknsHp3E17oCf+Z48rvEQNZ78paYM38qfk3v/u3l3u3GXN2Dmvmvpf1Srwk3pB/VSsp512bA/GG5i2WJ7wu430yQ5K3nFGiOqgtmSB5pJVSizwaacmUZzZhXLlZTq8qGGFY2YcSkqbth6aW1tRmlaCFs2016m5qn36SbJrqosG4uMV4aP2PHBmB3tjtmgN2izkGQyLWprekbIntJFing32a5rKWCN/SdSoga45EJykyQ7asZvHQ8PTm6cslIpwyeyjbVltNikc2HTR7YKh9LBl9DADC0U/jLcBZDKrMhUBfQBvXRzLtFtjU9eNHKin0x5InTqb8lNpfKv1s1xHzTXRqgKzek/mb7nB8RZTCDhGEX3kK/8Q75AmUM/eLkfA+0Hi908Kx4eNsMgudg5GLdRD7a84npi+YxNr5i5KIbW5izXas7cHXIMAau1OueZhfj+cOcP3P8MNIWLyYOBuxL6DRylJ4cAAAB4nGNgYoAALjDJyIAOWMCiTIxMLDmZedkABtIBygAAAA==)format("woff")}.markdown-body{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#333;overflow:hidden;font-family:"Microsoft YaHei",Helvetica,"Meiryo UI","Malgun Gothic","Segoe UI","Trebuchet MS",Monaco,monospace,Tahoma,STXihei,"华文细黑",STHeiti,"Helvetica Neue","Droid Sans","wenquanyi micro hei",FreeSans,Arimo,Arial,SimSun,"宋体",Heiti,"黑体",sans-serif;font-size:16px;line-height:1.6;word-wrap:break-word}.markdown-body strong{font-weight:700}.markdown-body h1{margin:.67em 0}.markdown-body img{border:0}.markdown-body hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}.markdown-body input{color:inherit;margin:0;line-height:normal;font:13px/1.4 Helvetica,arial,freesans,clean,sans-serif,"Segoe UI Emoji","Segoe UI Symbol"}.markdown-body html input[disabled]{cursor:default}.markdown-body input[type=checkbox]{-moz-box-sizing:border-box;box-sizing:border-box;padding:0}.markdown-body *{-moz-box-sizing:border-box;box-sizing:border-box}.markdown-body a{background:0 0;color:#4183c4;text-decoration:none}.markdown-body a:active,.markdown-body a:hover{outline:0;text-decoration:underline}.markdown-body hr{margin:15px 0;overflow:hidden;background:0 0;border:0;border-bottom:1px solid #ddd}.markdown-body h1,.markdown-body h2{padding-bottom:.3em;border-bottom:1px solid #eee}.markdown-body blockquote{margin:0}.markdown-body ol ol,.markdown-body ul ol{list-style-type:lower-roman}.markdown-body ol ol ol,.markdown-body ol ul ol,.markdown-body ul ol ol,.markdown-body ul ul ol{list-style-type:lower-alpha}.markdown-body dd{margin-left:0}.markdown-body code{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace}.markdown-body pre{font:12px Consolas,"Liberation Mono",Menlo,Courier,monospace;word-wrap:normal}.markdown-body .octicon{font:normal normal 16px octicons-anchor;line-height:1;display:inline-block;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;user-select:none}.markdown-body .octicon-link:before{content:'\f05c'}.markdown-body>:first-child{margin-top:0!important}.markdown-body>:last-child{margin-bottom:0!important}.markdown-body .anchor{position:absolute;top:0;left:0;display:block;padding-right:6px;padding-left:30px;margin-left:-30px}.markdown-body .anchor:focus{outline:0}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{position:relative;margin-top:1em;margin-bottom:16px;font-weight:700;line-height:1.4}.markdown-body h1 .octicon-link,.markdown-body h2 .octicon-link,.markdown-body h3 .octicon-link,.markdown-body h4 .octicon-link,.markdown-body h5 .octicon-link,.markdown-body h6 .octicon-link{display:none;color:#000;vertical-align:middle}.markdown-body h1:hover .anchor,.markdown-body h2:hover .anchor,.markdown-body h3:hover .anchor,.markdown-body h4:hover .anchor,.markdown-body h5:hover .anchor,.markdown-body h6:hover .anchor{padding-left:8px;margin-left:-30px;text-decoration:none}.markdown-body h1:hover .anchor .octicon-link,.markdown-body h2:hover .anchor .octicon-link,.markdown-body h3:hover .anchor .octicon-link,.markdown-body h4:hover .anchor .octicon-link,.markdown-body h5:hover .anchor .octicon-link,.markdown-body h6:hover .anchor .octicon-link{display:inline-block}.markdown-body h1{font-size:2.25em;line-height:1.2}.markdown-body h1 .anchor{line-height:1}.markdown-body h2{font-size:1.75em;line-height:1.225}.markdown-body h2 .anchor{line-height:1}.markdown-body h3{font-size:1.5em;line-height:1.43}.markdown-body h3 .anchor,.markdown-body h4 .anchor{line-height:1.2}.markdown-body h4{font-size:1.25em}.markdown-body h5 .anchor,.markdown-body h6 .anchor{line-height:1.1}.markdown-body h5{font-size:1em}.markdown-body h6{font-size:1em;color:#777}.markdown-body blockquote,.markdown-body dl,.markdown-body ol,.markdown-body p,.markdown-body pre,.markdown-body table,.markdown-body ul{margin-top:0;margin-bottom:16px}.markdown-body ol,.markdown-body ul{padding-left:2em}.markdown-body ol ol,.markdown-body ol ul,.markdown-body ul ol,.markdown-body ul ul{margin-top:0;margin-bottom:0}.markdown-body li>p{margin-top:16px}.markdown-body dl{padding:0}.markdown-body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:700}.markdown-body dl dd{padding:0 16px;margin-bottom:16px}.markdown-body blockquote{padding:0 15px;color:#777;border-left:4px solid #ddd}.markdown-body blockquote>:first-child{margin-top:0}.markdown-body blockquote>:last-child{margin-bottom:0}.markdown-body table{border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}.markdown-body table th{font-weight:700}.markdown-body table td,.markdown-body table th{padding:6px 13px;border:1px solid #ddd}.markdown-body table tr{background-color:#fff;border-top:1px solid #ccc}.markdown-body table tr:nth-child(2n){background-color:#f8f8f8}.markdown-body img{max-width:100%;-moz-box-sizing:border-box;box-sizing:border-box}.markdown-body code{padding:.2em 0;margin:0;font-size:85%;background-color:rgba(0,0,0,.04);border-radius:3px}.markdown-body code:after,.markdown-body code:before{letter-spacing:-.2em;content:"\00a0"}.markdown-body pre>code{padding:0;margin:0;font-size:100%;word-break:normal;white-space:pre;background:0 0;border:0}.markdown-body .highlight{margin-bottom:16px}.markdown-body .highlight pre,.markdown-body pre{padding:16px;overflow:auto;font-size:85%;background-color:#f7f7f7;border-radius:3px}.markdown-body .highlight pre{margin-bottom:0;word-break:normal}.markdown-body pre code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}.markdown-body pre code:after,.markdown-body pre code:before{content:normal}.markdown-body .pl-c{color:#969896}.markdown-body .pl-c1,.markdown-body .pl-mdh,.markdown-body .pl-mm,.markdown-body .pl-mp,.markdown-body .pl-mr,.markdown-body .pl-s1 .pl-v,.markdown-body .pl-s3,.markdown-body .pl-sc,.markdown-body .pl-sv{color:#0086b3}.markdown-body .pl-e,.markdown-body .pl-en{color:#795da3}.markdown-body .pl-s1 .pl-s2,.markdown-body .pl-smi,.markdown-body .pl-smp,.markdown-body .pl-stj,.markdown-body .pl-vo,.markdown-body .pl-vpf{color:#333}.markdown-body .pl-ent{color:#63a35c}.markdown-body .pl-k,.markdown-body .pl-s,.markdown-body .pl-st{color:#a71d5d}.markdown-body .pl-pds,.markdown-body .pl-s1,.markdown-body .pl-s1 .pl-pse .pl-s2,.markdown-body .pl-sr,.markdown-body .pl-sr .pl-cce,.markdown-body .pl-sr .pl-sra,.markdown-body .pl-sr .pl-sre,.markdown-body .pl-src{color:#df5000}.markdown-body .pl-mo,.markdown-body .pl-v{color:#1d3e81}.markdown-body .pl-id{color:#b52a1d}.markdown-body .pl-ii{background-color:#b52a1d;color:#f8f8f8}.markdown-body .pl-sr .pl-cce{color:#63a35c;font-weight:700}.markdown-body .pl-ml{color:#693a17}.markdown-body .pl-mh,.markdown-body .pl-mh .pl-en,.markdown-body .pl-ms{color:#1d3e81;font-weight:700}.markdown-body .pl-mq{color:teal}.markdown-body .pl-mi{color:#333;font-style:italic}.markdown-body .pl-mb{color:#333;font-weight:700}.markdown-body .pl-md,.markdown-body .pl-mdhf{background-color:#ffecec;color:#bd2c00}.markdown-body .pl-mdht,.markdown-body .pl-mi1{background-color:#eaffea;color:#55a532}.markdown-body .pl-mdr{color:#795da3;font-weight:700}.markdown-body kbd{display:inline-block;padding:3px 5px;font:11px Consolas,"Liberation Mono",Menlo,Courier,monospace;line-height:10px;color:#555;vertical-align:middle;background-color:#fcfcfc;border:1px solid #ccc;border-bottom-color:#bbb;border-radius:3px;box-shadow:inset 0 -1px 0 #bbb}.markdown-body .task-list-item+.task-list-item{margin-top:3px}.markdown-body .task-list-item input{float:left;margin:.3em 0 .25em -1.6em;vertical-align:middle}.markdown-body :checked+.radio-label{z-index:1;position:relative;border-color:#4183c4}.editormd-html-preview,.editormd-preview-container{text-align:left;font-size:14px;line-height:1.6;padding:20px;overflow:auto;width:100%;background-color:#fff}.editormd-html-preview blockquote,.editormd-preview-container blockquote{color:#666;border-left:4px solid #ddd;padding-left:20px;margin-left:0;font-size:14px;font-style:italic}.editormd-html-preview p code,.editormd-preview-container p code{margin-left:5px;margin-right:4px}.editormd-html-preview abbr,.editormd-preview-container abbr{background:#ffd}.editormd-html-preview hr,.editormd-preview-container hr{height:1px;border:none;border-top:1px solid #ddd;background:0 0}.editormd-html-preview code,.editormd-preview-container code{border:1px solid #ddd;background:#f6f6f6;padding:3px;border-radius:3px;font-size:14px}.editormd-html-preview pre,.editormd-preview-container pre{border:1px solid #ddd;background:#f6f6f6;padding:10px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px}.editormd-html-preview pre code,.editormd-preview-container pre code{padding:0}.editormd-html-preview code,.editormd-html-preview kbd,.editormd-html-preview pre,.editormd-preview-container code,.editormd-preview-container kbd,.editormd-preview-container pre{font-family:"YaHei Consolas Hybrid",Consolas,"Meiryo UI","Malgun Gothic","Segoe UI","Trebuchet MS",Helvetica,monospace,monospace}.editormd-html-preview table thead tr,.editormd-preview-container table thead tr{background-color:#F8F8F8}.editormd-html-preview p.editormd-tex,.editormd-preview-container p.editormd-tex{text-align:center}.editormd-html-preview span.editormd-tex,.editormd-preview-container span.editormd-tex{margin:0 5px}.editormd-html-preview .emoji,.editormd-preview-container .emoji{width:24px;height:24px}.editormd-html-preview .katex,.editormd-preview-container .katex{font-size:1.4em}.editormd-html-preview .flowchart,.editormd-html-preview .sequence-diagram,.editormd-preview-container .flowchart,.editormd-preview-container .sequence-diagram{margin:0 auto;text-align:center}.editormd-html-preview .flowchart svg,.editormd-html-preview .sequence-diagram svg,.editormd-preview-container .flowchart svg,.editormd-preview-container .sequence-diagram svg{margin:0 auto}.editormd-html-preview .flowchart text,.editormd-html-preview .sequence-diagram text,.editormd-preview-container .flowchart text,.editormd-preview-container .sequence-diagram text{font-size:15px!important;font-family:"YaHei Consolas Hybrid",Consolas,"Microsoft YaHei","Malgun Gothic","Segoe UI",Helvetica,Arial!important}/*! Pretty printing styles. Used with prettify.js. */.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}.editormd-html-preview pre.prettyprint,.editormd-preview-container pre.prettyprint{padding:10px;border:1px solid #ddd;white-space:pre-wrap;word-wrap:break-word}.editormd-html-preview ol.linenums,.editormd-preview-container ol.linenums{color:#999;padding-left:2.5em}.editormd-html-preview ol.linenums li,.editormd-preview-container ol.linenums li{list-style-type:decimal}.editormd-html-preview ol.linenums li code,.editormd-preview-container ol.linenums li code{border:none;background:0 0;padding:0}.editormd-html-preview .editormd-toc-menu,.editormd-preview-container .editormd-toc-menu{margin:8px 0 12px;display:inline-block}.editormd-html-preview .editormd-toc-menu>.markdown-toc,.editormd-preview-container .editormd-toc-menu>.markdown-toc{position:relative;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;-o-border-radius:4px;border-radius:4px;border:1px solid #ddd;display:inline-block;font-size:1em}.editormd-html-preview .editormd-toc-menu>.markdown-toc>ul,.editormd-preview-container .editormd-toc-menu>.markdown-toc>ul{width:160%;min-width:180px;position:absolute;left:-1px;top:-2px;z-index:100;padding:0 10px 10px;display:none;background:#fff;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;-o-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 3px 5px rgba(0,0,0,.2);-moz-box-shadow:0 3px 5px rgba(0,0,0,.2);-ms-box-shadow:0 3px 5px rgba(0,0,0,.2);-o-box-shadow:0 3px 5px rgba(0,0,0,.2);box-shadow:0 3px 5px rgba(0,0,0,.2)}.editormd-html-preview .editormd-toc-menu>.markdown-toc>ul>li ul,.editormd-preview-container .editormd-toc-menu>.markdown-toc>ul>li ul{width:100%;min-width:180px;border:1px solid #ddd;display:none;background:#fff;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;-o-border-radius:4px;border-radius:4px}.editormd-html-preview .editormd-toc-menu .toc-menu-btn:hover,.editormd-html-preview .editormd-toc-menu>.markdown-toc>ul>li a:hover,.editormd-preview-container .editormd-toc-menu .toc-menu-btn:hover,.editormd-preview-container .editormd-toc-menu>.markdown-toc>ul>li a:hover{background-color:#f6f6f6}.editormd-html-preview .editormd-toc-menu>.markdown-toc>ul>li a,.editormd-preview-container .editormd-toc-menu>.markdown-toc>ul>li a{color:#666;padding:6px 10px;display:block;-webkit-transition:background-color 500ms ease-out;-moz-transition:background-color 500ms ease-out;transition:background-color 500ms ease-out}.editormd-html-preview .editormd-toc-menu>.markdown-toc li,.editormd-preview-container .editormd-toc-menu>.markdown-toc li{position:relative}.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul{position:absolute;top:32px;left:10%;display:none;-webkit-box-shadow:0 3px 5px rgba(0,0,0,.2);-moz-box-shadow:0 3px 5px rgba(0,0,0,.2);-ms-box-shadow:0 3px 5px rgba(0,0,0,.2);-o-box-shadow:0 3px 5px rgba(0,0,0,.2);box-shadow:0 3px 5px rgba(0,0,0,.2)}.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul:after,.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul:before,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul:after,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul:before{pointer-events:pointer-events;position:absolute;left:15px;top:-6px;display:block;content:"";width:0;height:0;border:6px solid transparent;border-width:0 6px 6px;z-index:10}.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul:before,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul:before{border-bottom-color:#ccc}.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul:after,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul:after{border-bottom-color:#fff;top:-5px}.editormd-html-preview .editormd-toc-menu ul,.editormd-preview-container .editormd-toc-menu ul{list-style:none}.editormd-html-preview .editormd-toc-menu a,.editormd-preview-container .editormd-toc-menu a{text-decoration:none}.editormd-html-preview .editormd-toc-menu h1,.editormd-preview-container .editormd-toc-menu h1{font-size:16px;padding:5px 0 10px 10px;line-height:1;border-bottom:1px solid #eee}.editormd-html-preview .editormd-toc-menu h1 .fa,.editormd-preview-container .editormd-toc-menu h1 .fa{padding-left:10px}.editormd-html-preview .editormd-toc-menu .toc-menu-btn,.editormd-preview-container .editormd-toc-menu .toc-menu-btn{color:#666;min-width:180px;padding:5px 10px;border-radius:4px;display:inline-block;-webkit-transition:background-color 500ms ease-out;-moz-transition:background-color 500ms ease-out;transition:background-color 500ms ease-out}.editormd-html-preview textarea,.editormd-onlyread .editormd-toolbar{display:none}.editormd-html-preview .editormd-toc-menu .toc-menu-btn .fa,.editormd-preview-container .editormd-toc-menu .toc-menu-btn .fa{float:right;padding:3px 0 0 10px;font-size:1.3em}.markdown-body .editormd-toc-menu ul{padding-left:0}.markdown-body .highlight pre,.markdown-body pre{line-height:1.6}hr.editormd-page-break{border:1px dotted #ccc;font-size:0;height:2px}@media only print{hr.editormd-page-break{background:0 0;border:none;height:0}}.editormd-html-preview hr.editormd-page-break{background:0 0;border:none;height:0}.editormd-preview-close-btn{color:#fff;padding:4px 6px;font-size:18px;-webkit-border-radius:500px;-moz-border-radius:500px;-ms-border-radius:500px;-o-border-radius:500px;border-radius:500px;display:none;background-color:#ccc;position:absolute;top:25px;right:35px;z-index:19;-webkit-transition:background-color 300ms ease-out;-moz-transition:background-color 300ms ease-out;transition:background-color 300ms ease-out}.editormd-preview-close-btn:hover{background-color:#999}.editormd-preview-active{width:100%;padding:40px}.editormd-preview-theme-dark{color:#777;background:#2C2827}.editormd-preview-theme-dark .editormd-preview-container{color:#888;background-color:#2C2827}.editormd-preview-theme-dark .editormd-preview-container pre.prettyprint{border:none}.editormd-preview-theme-dark .editormd-preview-container blockquote{color:#555;padding:.5em;background:#222;border-color:#333}.editormd-preview-theme-dark .editormd-preview-container abbr{color:#fff;padding:1px 3px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px;background:#f90}.editormd-preview-theme-dark .editormd-preview-container code{color:#fff;border:none;padding:1px 3px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px;background:#5A9600}.editormd-preview-theme-dark .editormd-preview-container table{border:none}.editormd-preview-theme-dark .editormd-preview-container .fa-emoji{color:#B4BF42}.editormd-preview-theme-dark .editormd-preview-container .katex{color:#FEC93F}.editormd-preview-theme-dark .editormd-toc-menu>.markdown-toc{background:#fff;border:none}.editormd-preview-theme-dark .editormd-toc-menu>.markdown-toc h1{border-color:#ddd}.editormd-preview-theme-dark .markdown-body h1,.editormd-preview-theme-dark .markdown-body h2,.editormd-preview-theme-dark .markdown-body hr{border-color:#222}.editormd-preview-theme-dark pre{color:#999;background-color:#111;background-color:rgba(0,0,0,.4)}.editormd-preview-theme-dark pre .pln{color:#999}.editormd-preview-theme-dark li.L1,.editormd-preview-theme-dark li.L3,.editormd-preview-theme-dark li.L5,.editormd-preview-theme-dark li.L7,.editormd-preview-theme-dark li.L9{background:0 0}.editormd-preview-theme-dark [class*=editormd-logo]{color:#2196F3}.editormd-preview-theme-dark .sequence-diagram text{fill:#fff}.editormd-preview-theme-dark .sequence-diagram path,.editormd-preview-theme-dark .sequence-diagram rect{color:#fff;fill:#64D1CB;stroke:#64D1CB}.editormd-preview-theme-dark .flowchart path,.editormd-preview-theme-dark .flowchart rect{stroke:#A6C6FF}.editormd-preview-theme-dark .flowchart rect{fill:#A6C6FF}.editormd-preview-theme-dark .flowchart text{fill:#5879B4}@media screen{.editormd-preview-theme-dark .str{color:#080}.editormd-preview-theme-dark .kwd{color:#f90}.editormd-preview-theme-dark .com{color:#444}.editormd-preview-theme-dark .typ{color:#606}.editormd-preview-theme-dark .lit{color:#066}.editormd-preview-theme-dark .clo,.editormd-preview-theme-dark .opn,.editormd-preview-theme-dark .pun{color:#660}.editormd-preview-theme-dark .tag{color:#f90}.editormd-preview-theme-dark .atn{color:#6C95F5}.editormd-preview-theme-dark .atv{color:#080}.editormd-preview-theme-dark .dec,.editormd-preview-theme-dark .var{color:#008BA7}.editormd-preview-theme-dark .fun{color:red}}.editormd-onlyread .CodeMirror{margin-top:0}.editormd-onlyread .editormd-preview{top:0}.editormd-fullscreen{position:fixed;top:0;left:0;border:none;margin:0 auto}.editormd-theme-dark{border-color:#1a1a17}.editormd-theme-dark .editormd-toolbar{background:#1A1A17;border-color:#1a1a17}.editormd-theme-dark .editormd-menu>li>a{color:#777;border-color:#1a1a17}.editormd-theme-dark .editormd-menu>li>a.active,.editormd-theme-dark .editormd-menu>li>a:hover{border-color:#333;background:#333}.editormd-theme-dark .editormd-menu>li.divider{border-right:1px solid #111}.editormd-theme-dark .CodeMirror{border-right:1px solid rgba(0,0,0,.1)} \ No newline at end of file diff --git a/src/main/resources/templates/editor/css/editormd.preview.css b/src/main/resources/templates/editor/css/editormd.preview.css new file mode 100644 index 0000000000000000000000000000000000000000..60303304a5393191c9697de80b6f5d8aff59b56e --- /dev/null +++ b/src/main/resources/templates/editor/css/editormd.preview.css @@ -0,0 +1,3554 @@ +/* + * Editor.md + * + * @file editormd.preview.css + * @version v1.5.0 + * @description Open source online markdown editor. + * @license MIT License + * @author Pandao + * {@link https://github.com/pandao/editor.md} + * @updateTime 2015-06-09 + */ + +@charset "UTF-8"; +/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */ +/*! + * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */ +/* FONT PATH + * -------------------------- */ +@font-face { + font-family: 'FontAwesome'; + src: url("../fonts/fontawesome-webfont.eot?v=4.3.0"); + src: url("../fonts/fontawesome-webfont.eot?#iefix&v=4.3.0") format("embedded-opentype"), url("../fonts/fontawesome-webfont.woff2?v=4.3.0") format("woff2"), url("../fonts/fontawesome-webfont.woff?v=4.3.0") format("woff"), url("../fonts/fontawesome-webfont.ttf?v=4.3.0") format("truetype"), url("../fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular") format("svg"); + font-weight: normal; + font-style: normal; +} +.fa { + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + transform: translate(0, 0); +} + +/* makes the font 33% larger relative to the icon container */ +.fa-lg { + font-size: 1.33333333em; + line-height: 0.75em; + vertical-align: -15%; +} + +.fa-2x { + font-size: 2em; +} + +.fa-3x { + font-size: 3em; +} + +.fa-4x { + font-size: 4em; +} + +.fa-5x { + font-size: 5em; +} + +.fa-fw { + width: 1.28571429em; + text-align: center; +} + +.fa-ul { + padding-left: 0; + margin-left: 2.14285714em; + list-style-type: none; +} + +.fa-ul > li { + position: relative; +} + +.fa-li { + position: absolute; + left: -2.14285714em; + width: 2.14285714em; + top: 0.14285714em; + text-align: center; +} + +.fa-li.fa-lg { + left: -1.85714286em; +} + +.fa-border { + padding: .2em .25em .15em; + border: solid 0.08em #eeeeee; + border-radius: .1em; +} + +.pull-right { + float: right; +} + +.pull-left { + float: left; +} + +.fa.pull-left { + margin-right: .3em; +} + +.fa.pull-right { + margin-left: .3em; +} + +.fa-spin { + -webkit-animation: fa-spin 2s infinite linear; + animation: fa-spin 2s infinite linear; +} + +.fa-pulse { + -webkit-animation: fa-spin 1s infinite steps(8); + animation: fa-spin 1s infinite steps(8); +} + +@-webkit-keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +@keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} +.fa-rotate-90 { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} + +.fa-rotate-180 { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.fa-rotate-270 { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); + -webkit-transform: rotate(270deg); + -ms-transform: rotate(270deg); + transform: rotate(270deg); +} + +.fa-flip-horizontal { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1); + -webkit-transform: scale(-1, 1); + -ms-transform: scale(-1, 1); + transform: scale(-1, 1); +} + +.fa-flip-vertical { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1); + -webkit-transform: scale(1, -1); + -ms-transform: scale(1, -1); + transform: scale(1, -1); +} + +:root .fa-rotate-90, +:root .fa-rotate-180, +:root .fa-rotate-270, +:root .fa-flip-horizontal, +:root .fa-flip-vertical { + filter: none; +} + +.fa-stack { + position: relative; + display: inline-block; + width: 2em; + height: 2em; + line-height: 2em; + vertical-align: middle; +} + +.fa-stack-1x, +.fa-stack-2x { + position: absolute; + left: 0; + width: 100%; + text-align: center; +} + +.fa-stack-1x { + line-height: inherit; +} + +.fa-stack-2x { + font-size: 2em; +} + +.fa-inverse { + color: #ffffff; +} + +/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen + readers do not read off random characters that represent icons */ +.fa-glass:before { + content: "\f000"; +} + +.fa-music:before { + content: "\f001"; +} + +.fa-search:before { + content: "\f002"; +} + +.fa-envelope-o:before { + content: "\f003"; +} + +.fa-heart:before { + content: "\f004"; +} + +.fa-star:before { + content: "\f005"; +} + +.fa-star-o:before { + content: "\f006"; +} + +.fa-user:before { + content: "\f007"; +} + +.fa-film:before { + content: "\f008"; +} + +.fa-th-large:before { + content: "\f009"; +} + +.fa-th:before { + content: "\f00a"; +} + +.fa-th-list:before { + content: "\f00b"; +} + +.fa-check:before { + content: "\f00c"; +} + +.fa-remove:before, +.fa-close:before, +.fa-times:before { + content: "\f00d"; +} + +.fa-search-plus:before { + content: "\f00e"; +} + +.fa-search-minus:before { + content: "\f010"; +} + +.fa-power-off:before { + content: "\f011"; +} + +.fa-signal:before { + content: "\f012"; +} + +.fa-gear:before, +.fa-cog:before { + content: "\f013"; +} + +.fa-trash-o:before { + content: "\f014"; +} + +.fa-home:before { + content: "\f015"; +} + +.fa-file-o:before { + content: "\f016"; +} + +.fa-clock-o:before { + content: "\f017"; +} + +.fa-road:before { + content: "\f018"; +} + +.fa-download:before { + content: "\f019"; +} + +.fa-arrow-circle-o-down:before { + content: "\f01a"; +} + +.fa-arrow-circle-o-up:before { + content: "\f01b"; +} + +.fa-inbox:before { + content: "\f01c"; +} + +.fa-play-circle-o:before { + content: "\f01d"; +} + +.fa-rotate-right:before, +.fa-repeat:before { + content: "\f01e"; +} + +.fa-refresh:before { + content: "\f021"; +} + +.fa-list-alt:before { + content: "\f022"; +} + +.fa-lock:before { + content: "\f023"; +} + +.fa-flag:before { + content: "\f024"; +} + +.fa-headphones:before { + content: "\f025"; +} + +.fa-volume-off:before { + content: "\f026"; +} + +.fa-volume-down:before { + content: "\f027"; +} + +.fa-volume-up:before { + content: "\f028"; +} + +.fa-qrcode:before { + content: "\f029"; +} + +.fa-barcode:before { + content: "\f02a"; +} + +.fa-tag:before { + content: "\f02b"; +} + +.fa-tags:before { + content: "\f02c"; +} + +.fa-book:before { + content: "\f02d"; +} + +.fa-bookmark:before { + content: "\f02e"; +} + +.fa-print:before { + content: "\f02f"; +} + +.fa-camera:before { + content: "\f030"; +} + +.fa-font:before { + content: "\f031"; +} + +.fa-bold:before { + content: "\f032"; +} + +.fa-italic:before { + content: "\f033"; +} + +.fa-text-height:before { + content: "\f034"; +} + +.fa-text-width:before { + content: "\f035"; +} + +.fa-align-left:before { + content: "\f036"; +} + +.fa-align-center:before { + content: "\f037"; +} + +.fa-align-right:before { + content: "\f038"; +} + +.fa-align-justify:before { + content: "\f039"; +} + +.fa-list:before { + content: "\f03a"; +} + +.fa-dedent:before, +.fa-outdent:before { + content: "\f03b"; +} + +.fa-indent:before { + content: "\f03c"; +} + +.fa-video-camera:before { + content: "\f03d"; +} + +.fa-photo:before, +.fa-image:before, +.fa-picture-o:before { + content: "\f03e"; +} + +.fa-pencil:before { + content: "\f040"; +} + +.fa-map-marker:before { + content: "\f041"; +} + +.fa-adjust:before { + content: "\f042"; +} + +.fa-tint:before { + content: "\f043"; +} + +.fa-edit:before, +.fa-pencil-square-o:before { + content: "\f044"; +} + +.fa-share-square-o:before { + content: "\f045"; +} + +.fa-check-square-o:before { + content: "\f046"; +} + +.fa-arrows:before { + content: "\f047"; +} + +.fa-step-backward:before { + content: "\f048"; +} + +.fa-fast-backward:before { + content: "\f049"; +} + +.fa-backward:before { + content: "\f04a"; +} + +.fa-play:before { + content: "\f04b"; +} + +.fa-pause:before { + content: "\f04c"; +} + +.fa-stop:before { + content: "\f04d"; +} + +.fa-forward:before { + content: "\f04e"; +} + +.fa-fast-forward:before { + content: "\f050"; +} + +.fa-step-forward:before { + content: "\f051"; +} + +.fa-eject:before { + content: "\f052"; +} + +.fa-chevron-left:before { + content: "\f053"; +} + +.fa-chevron-right:before { + content: "\f054"; +} + +.fa-plus-circle:before { + content: "\f055"; +} + +.fa-minus-circle:before { + content: "\f056"; +} + +.fa-times-circle:before { + content: "\f057"; +} + +.fa-check-circle:before { + content: "\f058"; +} + +.fa-question-circle:before { + content: "\f059"; +} + +.fa-info-circle:before { + content: "\f05a"; +} + +.fa-crosshairs:before { + content: "\f05b"; +} + +.fa-times-circle-o:before { + content: "\f05c"; +} + +.fa-check-circle-o:before { + content: "\f05d"; +} + +.fa-ban:before { + content: "\f05e"; +} + +.fa-arrow-left:before { + content: "\f060"; +} + +.fa-arrow-right:before { + content: "\f061"; +} + +.fa-arrow-up:before { + content: "\f062"; +} + +.fa-arrow-down:before { + content: "\f063"; +} + +.fa-mail-forward:before, +.fa-share:before { + content: "\f064"; +} + +.fa-expand:before { + content: "\f065"; +} + +.fa-compress:before { + content: "\f066"; +} + +.fa-plus:before { + content: "\f067"; +} + +.fa-minus:before { + content: "\f068"; +} + +.fa-asterisk:before { + content: "\f069"; +} + +.fa-exclamation-circle:before { + content: "\f06a"; +} + +.fa-gift:before { + content: "\f06b"; +} + +.fa-leaf:before { + content: "\f06c"; +} + +.fa-fire:before { + content: "\f06d"; +} + +.fa-eye:before { + content: "\f06e"; +} + +.fa-eye-slash:before { + content: "\f070"; +} + +.fa-warning:before, +.fa-exclamation-triangle:before { + content: "\f071"; +} + +.fa-plane:before { + content: "\f072"; +} + +.fa-calendar:before { + content: "\f073"; +} + +.fa-random:before { + content: "\f074"; +} + +.fa-comment:before { + content: "\f075"; +} + +.fa-magnet:before { + content: "\f076"; +} + +.fa-chevron-up:before { + content: "\f077"; +} + +.fa-chevron-down:before { + content: "\f078"; +} + +.fa-retweet:before { + content: "\f079"; +} + +.fa-shopping-cart:before { + content: "\f07a"; +} + +.fa-folder:before { + content: "\f07b"; +} + +.fa-folder-open:before { + content: "\f07c"; +} + +.fa-arrows-v:before { + content: "\f07d"; +} + +.fa-arrows-h:before { + content: "\f07e"; +} + +.fa-bar-chart-o:before, +.fa-bar-chart:before { + content: "\f080"; +} + +.fa-twitter-square:before { + content: "\f081"; +} + +.fa-facebook-square:before { + content: "\f082"; +} + +.fa-camera-retro:before { + content: "\f083"; +} + +.fa-key:before { + content: "\f084"; +} + +.fa-gears:before, +.fa-cogs:before { + content: "\f085"; +} + +.fa-comments:before { + content: "\f086"; +} + +.fa-thumbs-o-up:before { + content: "\f087"; +} + +.fa-thumbs-o-down:before { + content: "\f088"; +} + +.fa-star-half:before { + content: "\f089"; +} + +.fa-heart-o:before { + content: "\f08a"; +} + +.fa-sign-out:before { + content: "\f08b"; +} + +.fa-linkedin-square:before { + content: "\f08c"; +} + +.fa-thumb-tack:before { + content: "\f08d"; +} + +.fa-external-link:before { + content: "\f08e"; +} + +.fa-sign-in:before { + content: "\f090"; +} + +.fa-trophy:before { + content: "\f091"; +} + +.fa-github-square:before { + content: "\f092"; +} + +.fa-upload:before { + content: "\f093"; +} + +.fa-lemon-o:before { + content: "\f094"; +} + +.fa-phone:before { + content: "\f095"; +} + +.fa-square-o:before { + content: "\f096"; +} + +.fa-bookmark-o:before { + content: "\f097"; +} + +.fa-phone-square:before { + content: "\f098"; +} + +.fa-twitter:before { + content: "\f099"; +} + +.fa-facebook-f:before, +.fa-facebook:before { + content: "\f09a"; +} + +.fa-github:before { + content: "\f09b"; +} + +.fa-unlock:before { + content: "\f09c"; +} + +.fa-credit-card:before { + content: "\f09d"; +} + +.fa-rss:before { + content: "\f09e"; +} + +.fa-hdd-o:before { + content: "\f0a0"; +} + +.fa-bullhorn:before { + content: "\f0a1"; +} + +.fa-bell:before { + content: "\f0f3"; +} + +.fa-certificate:before { + content: "\f0a3"; +} + +.fa-hand-o-right:before { + content: "\f0a4"; +} + +.fa-hand-o-left:before { + content: "\f0a5"; +} + +.fa-hand-o-up:before { + content: "\f0a6"; +} + +.fa-hand-o-down:before { + content: "\f0a7"; +} + +.fa-arrow-circle-left:before { + content: "\f0a8"; +} + +.fa-arrow-circle-right:before { + content: "\f0a9"; +} + +.fa-arrow-circle-up:before { + content: "\f0aa"; +} + +.fa-arrow-circle-down:before { + content: "\f0ab"; +} + +.fa-globe:before { + content: "\f0ac"; +} + +.fa-wrench:before { + content: "\f0ad"; +} + +.fa-tasks:before { + content: "\f0ae"; +} + +.fa-filter:before { + content: "\f0b0"; +} + +.fa-briefcase:before { + content: "\f0b1"; +} + +.fa-arrows-alt:before { + content: "\f0b2"; +} + +.fa-group:before, +.fa-users:before { + content: "\f0c0"; +} + +.fa-chain:before, +.fa-link:before { + content: "\f0c1"; +} + +.fa-cloud:before { + content: "\f0c2"; +} + +.fa-flask:before { + content: "\f0c3"; +} + +.fa-cut:before, +.fa-scissors:before { + content: "\f0c4"; +} + +.fa-copy:before, +.fa-files-o:before { + content: "\f0c5"; +} + +.fa-paperclip:before { + content: "\f0c6"; +} + +.fa-save:before, +.fa-floppy-o:before { + content: "\f0c7"; +} + +.fa-square:before { + content: "\f0c8"; +} + +.fa-navicon:before, +.fa-reorder:before, +.fa-bars:before { + content: "\f0c9"; +} + +.fa-list-ul:before { + content: "\f0ca"; +} + +.fa-list-ol:before { + content: "\f0cb"; +} + +.fa-strikethrough:before { + content: "\f0cc"; +} + +.fa-underline:before { + content: "\f0cd"; +} + +.fa-table:before { + content: "\f0ce"; +} + +.fa-magic:before { + content: "\f0d0"; +} + +.fa-truck:before { + content: "\f0d1"; +} + +.fa-pinterest:before { + content: "\f0d2"; +} + +.fa-pinterest-square:before { + content: "\f0d3"; +} + +.fa-google-plus-square:before { + content: "\f0d4"; +} + +.fa-google-plus:before { + content: "\f0d5"; +} + +.fa-money:before { + content: "\f0d6"; +} + +.fa-caret-down:before { + content: "\f0d7"; +} + +.fa-caret-up:before { + content: "\f0d8"; +} + +.fa-caret-left:before { + content: "\f0d9"; +} + +.fa-caret-right:before { + content: "\f0da"; +} + +.fa-columns:before { + content: "\f0db"; +} + +.fa-unsorted:before, +.fa-sort:before { + content: "\f0dc"; +} + +.fa-sort-down:before, +.fa-sort-desc:before { + content: "\f0dd"; +} + +.fa-sort-up:before, +.fa-sort-asc:before { + content: "\f0de"; +} + +.fa-envelope:before { + content: "\f0e0"; +} + +.fa-linkedin:before { + content: "\f0e1"; +} + +.fa-rotate-left:before, +.fa-undo:before { + content: "\f0e2"; +} + +.fa-legal:before, +.fa-gavel:before { + content: "\f0e3"; +} + +.fa-dashboard:before, +.fa-tachometer:before { + content: "\f0e4"; +} + +.fa-comment-o:before { + content: "\f0e5"; +} + +.fa-comments-o:before { + content: "\f0e6"; +} + +.fa-flash:before, +.fa-bolt:before { + content: "\f0e7"; +} + +.fa-sitemap:before { + content: "\f0e8"; +} + +.fa-umbrella:before { + content: "\f0e9"; +} + +.fa-paste:before, +.fa-clipboard:before { + content: "\f0ea"; +} + +.fa-lightbulb-o:before { + content: "\f0eb"; +} + +.fa-exchange:before { + content: "\f0ec"; +} + +.fa-cloud-download:before { + content: "\f0ed"; +} + +.fa-cloud-upload:before { + content: "\f0ee"; +} + +.fa-user-md:before { + content: "\f0f0"; +} + +.fa-stethoscope:before { + content: "\f0f1"; +} + +.fa-suitcase:before { + content: "\f0f2"; +} + +.fa-bell-o:before { + content: "\f0a2"; +} + +.fa-coffee:before { + content: "\f0f4"; +} + +.fa-cutlery:before { + content: "\f0f5"; +} + +.fa-file-text-o:before { + content: "\f0f6"; +} + +.fa-building-o:before { + content: "\f0f7"; +} + +.fa-hospital-o:before { + content: "\f0f8"; +} + +.fa-ambulance:before { + content: "\f0f9"; +} + +.fa-medkit:before { + content: "\f0fa"; +} + +.fa-fighter-jet:before { + content: "\f0fb"; +} + +.fa-beer:before { + content: "\f0fc"; +} + +.fa-h-square:before { + content: "\f0fd"; +} + +.fa-plus-square:before { + content: "\f0fe"; +} + +.fa-angle-double-left:before { + content: "\f100"; +} + +.fa-angle-double-right:before { + content: "\f101"; +} + +.fa-angle-double-up:before { + content: "\f102"; +} + +.fa-angle-double-down:before { + content: "\f103"; +} + +.fa-angle-left:before { + content: "\f104"; +} + +.fa-angle-right:before { + content: "\f105"; +} + +.fa-angle-up:before { + content: "\f106"; +} + +.fa-angle-down:before { + content: "\f107"; +} + +.fa-desktop:before { + content: "\f108"; +} + +.fa-laptop:before { + content: "\f109"; +} + +.fa-tablet:before { + content: "\f10a"; +} + +.fa-mobile-phone:before, +.fa-mobile:before { + content: "\f10b"; +} + +.fa-circle-o:before { + content: "\f10c"; +} + +.fa-quote-left:before { + content: "\f10d"; +} + +.fa-quote-right:before { + content: "\f10e"; +} + +.fa-spinner:before { + content: "\f110"; +} + +.fa-circle:before { + content: "\f111"; +} + +.fa-mail-reply:before, +.fa-reply:before { + content: "\f112"; +} + +.fa-github-alt:before { + content: "\f113"; +} + +.fa-folder-o:before { + content: "\f114"; +} + +.fa-folder-open-o:before { + content: "\f115"; +} + +.fa-smile-o:before { + content: "\f118"; +} + +.fa-frown-o:before { + content: "\f119"; +} + +.fa-meh-o:before { + content: "\f11a"; +} + +.fa-gamepad:before { + content: "\f11b"; +} + +.fa-keyboard-o:before { + content: "\f11c"; +} + +.fa-flag-o:before { + content: "\f11d"; +} + +.fa-flag-checkered:before { + content: "\f11e"; +} + +.fa-terminal:before { + content: "\f120"; +} + +.fa-code:before { + content: "\f121"; +} + +.fa-mail-reply-all:before, +.fa-reply-all:before { + content: "\f122"; +} + +.fa-star-half-empty:before, +.fa-star-half-full:before, +.fa-star-half-o:before { + content: "\f123"; +} + +.fa-location-arrow:before { + content: "\f124"; +} + +.fa-crop:before { + content: "\f125"; +} + +.fa-code-fork:before { + content: "\f126"; +} + +.fa-unlink:before, +.fa-chain-broken:before { + content: "\f127"; +} + +.fa-question:before { + content: "\f128"; +} + +.fa-info:before { + content: "\f129"; +} + +.fa-exclamation:before { + content: "\f12a"; +} + +.fa-superscript:before { + content: "\f12b"; +} + +.fa-subscript:before { + content: "\f12c"; +} + +.fa-eraser:before { + content: "\f12d"; +} + +.fa-puzzle-piece:before { + content: "\f12e"; +} + +.fa-microphone:before { + content: "\f130"; +} + +.fa-microphone-slash:before { + content: "\f131"; +} + +.fa-shield:before { + content: "\f132"; +} + +.fa-calendar-o:before { + content: "\f133"; +} + +.fa-fire-extinguisher:before { + content: "\f134"; +} + +.fa-rocket:before { + content: "\f135"; +} + +.fa-maxcdn:before { + content: "\f136"; +} + +.fa-chevron-circle-left:before { + content: "\f137"; +} + +.fa-chevron-circle-right:before { + content: "\f138"; +} + +.fa-chevron-circle-up:before { + content: "\f139"; +} + +.fa-chevron-circle-down:before { + content: "\f13a"; +} + +.fa-html5:before { + content: "\f13b"; +} + +.fa-css3:before { + content: "\f13c"; +} + +.fa-anchor:before { + content: "\f13d"; +} + +.fa-unlock-alt:before { + content: "\f13e"; +} + +.fa-bullseye:before { + content: "\f140"; +} + +.fa-ellipsis-h:before { + content: "\f141"; +} + +.fa-ellipsis-v:before { + content: "\f142"; +} + +.fa-rss-square:before { + content: "\f143"; +} + +.fa-play-circle:before { + content: "\f144"; +} + +.fa-ticket:before { + content: "\f145"; +} + +.fa-minus-square:before { + content: "\f146"; +} + +.fa-minus-square-o:before { + content: "\f147"; +} + +.fa-level-up:before { + content: "\f148"; +} + +.fa-level-down:before { + content: "\f149"; +} + +.fa-check-square:before { + content: "\f14a"; +} + +.fa-pencil-square:before { + content: "\f14b"; +} + +.fa-external-link-square:before { + content: "\f14c"; +} + +.fa-share-square:before { + content: "\f14d"; +} + +.fa-compass:before { + content: "\f14e"; +} + +.fa-toggle-down:before, +.fa-caret-square-o-down:before { + content: "\f150"; +} + +.fa-toggle-up:before, +.fa-caret-square-o-up:before { + content: "\f151"; +} + +.fa-toggle-right:before, +.fa-caret-square-o-right:before { + content: "\f152"; +} + +.fa-euro:before, +.fa-eur:before { + content: "\f153"; +} + +.fa-gbp:before { + content: "\f154"; +} + +.fa-dollar:before, +.fa-usd:before { + content: "\f155"; +} + +.fa-rupee:before, +.fa-inr:before { + content: "\f156"; +} + +.fa-cny:before, +.fa-rmb:before, +.fa-yen:before, +.fa-jpy:before { + content: "\f157"; +} + +.fa-ruble:before, +.fa-rouble:before, +.fa-rub:before { + content: "\f158"; +} + +.fa-won:before, +.fa-krw:before { + content: "\f159"; +} + +.fa-bitcoin:before, +.fa-btc:before { + content: "\f15a"; +} + +.fa-file:before { + content: "\f15b"; +} + +.fa-file-text:before { + content: "\f15c"; +} + +.fa-sort-alpha-asc:before { + content: "\f15d"; +} + +.fa-sort-alpha-desc:before { + content: "\f15e"; +} + +.fa-sort-amount-asc:before { + content: "\f160"; +} + +.fa-sort-amount-desc:before { + content: "\f161"; +} + +.fa-sort-numeric-asc:before { + content: "\f162"; +} + +.fa-sort-numeric-desc:before { + content: "\f163"; +} + +.fa-thumbs-up:before { + content: "\f164"; +} + +.fa-thumbs-down:before { + content: "\f165"; +} + +.fa-youtube-square:before { + content: "\f166"; +} + +.fa-youtube:before { + content: "\f167"; +} + +.fa-xing:before { + content: "\f168"; +} + +.fa-xing-square:before { + content: "\f169"; +} + +.fa-youtube-play:before { + content: "\f16a"; +} + +.fa-dropbox:before { + content: "\f16b"; +} + +.fa-stack-overflow:before { + content: "\f16c"; +} + +.fa-instagram:before { + content: "\f16d"; +} + +.fa-flickr:before { + content: "\f16e"; +} + +.fa-adn:before { + content: "\f170"; +} + +.fa-bitbucket:before { + content: "\f171"; +} + +.fa-bitbucket-square:before { + content: "\f172"; +} + +.fa-tumblr:before { + content: "\f173"; +} + +.fa-tumblr-square:before { + content: "\f174"; +} + +.fa-long-arrow-down:before { + content: "\f175"; +} + +.fa-long-arrow-up:before { + content: "\f176"; +} + +.fa-long-arrow-left:before { + content: "\f177"; +} + +.fa-long-arrow-right:before { + content: "\f178"; +} + +.fa-apple:before { + content: "\f179"; +} + +.fa-windows:before { + content: "\f17a"; +} + +.fa-android:before { + content: "\f17b"; +} + +.fa-linux:before { + content: "\f17c"; +} + +.fa-dribbble:before { + content: "\f17d"; +} + +.fa-skype:before { + content: "\f17e"; +} + +.fa-foursquare:before { + content: "\f180"; +} + +.fa-trello:before { + content: "\f181"; +} + +.fa-female:before { + content: "\f182"; +} + +.fa-male:before { + content: "\f183"; +} + +.fa-gittip:before, +.fa-gratipay:before { + content: "\f184"; +} + +.fa-sun-o:before { + content: "\f185"; +} + +.fa-moon-o:before { + content: "\f186"; +} + +.fa-archive:before { + content: "\f187"; +} + +.fa-bug:before { + content: "\f188"; +} + +.fa-vk:before { + content: "\f189"; +} + +.fa-weibo:before { + content: "\f18a"; +} + +.fa-renren:before { + content: "\f18b"; +} + +.fa-pagelines:before { + content: "\f18c"; +} + +.fa-stack-exchange:before { + content: "\f18d"; +} + +.fa-arrow-circle-o-right:before { + content: "\f18e"; +} + +.fa-arrow-circle-o-left:before { + content: "\f190"; +} + +.fa-toggle-left:before, +.fa-caret-square-o-left:before { + content: "\f191"; +} + +.fa-dot-circle-o:before { + content: "\f192"; +} + +.fa-wheelchair:before { + content: "\f193"; +} + +.fa-vimeo-square:before { + content: "\f194"; +} + +.fa-turkish-lira:before, +.fa-try:before { + content: "\f195"; +} + +.fa-plus-square-o:before { + content: "\f196"; +} + +.fa-space-shuttle:before { + content: "\f197"; +} + +.fa-slack:before { + content: "\f198"; +} + +.fa-envelope-square:before { + content: "\f199"; +} + +.fa-wordpress:before { + content: "\f19a"; +} + +.fa-openid:before { + content: "\f19b"; +} + +.fa-institution:before, +.fa-bank:before, +.fa-university:before { + content: "\f19c"; +} + +.fa-mortar-board:before, +.fa-graduation-cap:before { + content: "\f19d"; +} + +.fa-yahoo:before { + content: "\f19e"; +} + +.fa-google:before { + content: "\f1a0"; +} + +.fa-reddit:before { + content: "\f1a1"; +} + +.fa-reddit-square:before { + content: "\f1a2"; +} + +.fa-stumbleupon-circle:before { + content: "\f1a3"; +} + +.fa-stumbleupon:before { + content: "\f1a4"; +} + +.fa-delicious:before { + content: "\f1a5"; +} + +.fa-digg:before { + content: "\f1a6"; +} + +.fa-pied-piper:before { + content: "\f1a7"; +} + +.fa-pied-piper-alt:before { + content: "\f1a8"; +} + +.fa-drupal:before { + content: "\f1a9"; +} + +.fa-joomla:before { + content: "\f1aa"; +} + +.fa-language:before { + content: "\f1ab"; +} + +.fa-fax:before { + content: "\f1ac"; +} + +.fa-building:before { + content: "\f1ad"; +} + +.fa-child:before { + content: "\f1ae"; +} + +.fa-paw:before { + content: "\f1b0"; +} + +.fa-spoon:before { + content: "\f1b1"; +} + +.fa-cube:before { + content: "\f1b2"; +} + +.fa-cubes:before { + content: "\f1b3"; +} + +.fa-behance:before { + content: "\f1b4"; +} + +.fa-behance-square:before { + content: "\f1b5"; +} + +.fa-steam:before { + content: "\f1b6"; +} + +.fa-steam-square:before { + content: "\f1b7"; +} + +.fa-recycle:before { + content: "\f1b8"; +} + +.fa-automobile:before, +.fa-car:before { + content: "\f1b9"; +} + +.fa-cab:before, +.fa-taxi:before { + content: "\f1ba"; +} + +.fa-tree:before { + content: "\f1bb"; +} + +.fa-spotify:before { + content: "\f1bc"; +} + +.fa-deviantart:before { + content: "\f1bd"; +} + +.fa-soundcloud:before { + content: "\f1be"; +} + +.fa-database:before { + content: "\f1c0"; +} + +.fa-file-pdf-o:before { + content: "\f1c1"; +} + +.fa-file-word-o:before { + content: "\f1c2"; +} + +.fa-file-excel-o:before { + content: "\f1c3"; +} + +.fa-file-powerpoint-o:before { + content: "\f1c4"; +} + +.fa-file-photo-o:before, +.fa-file-picture-o:before, +.fa-file-image-o:before { + content: "\f1c5"; +} + +.fa-file-zip-o:before, +.fa-file-archive-o:before { + content: "\f1c6"; +} + +.fa-file-sound-o:before, +.fa-file-audio-o:before { + content: "\f1c7"; +} + +.fa-file-movie-o:before, +.fa-file-video-o:before { + content: "\f1c8"; +} + +.fa-file-code-o:before { + content: "\f1c9"; +} + +.fa-vine:before { + content: "\f1ca"; +} + +.fa-codepen:before { + content: "\f1cb"; +} + +.fa-jsfiddle:before { + content: "\f1cc"; +} + +.fa-life-bouy:before, +.fa-life-buoy:before, +.fa-life-saver:before, +.fa-support:before, +.fa-life-ring:before { + content: "\f1cd"; +} + +.fa-circle-o-notch:before { + content: "\f1ce"; +} + +.fa-ra:before, +.fa-rebel:before { + content: "\f1d0"; +} + +.fa-ge:before, +.fa-empire:before { + content: "\f1d1"; +} + +.fa-git-square:before { + content: "\f1d2"; +} + +.fa-git:before { + content: "\f1d3"; +} + +.fa-hacker-news:before { + content: "\f1d4"; +} + +.fa-tencent-weibo:before { + content: "\f1d5"; +} + +.fa-qq:before { + content: "\f1d6"; +} + +.fa-wechat:before, +.fa-weixin:before { + content: "\f1d7"; +} + +.fa-send:before, +.fa-paper-plane:before { + content: "\f1d8"; +} + +.fa-send-o:before, +.fa-paper-plane-o:before { + content: "\f1d9"; +} + +.fa-history:before { + content: "\f1da"; +} + +.fa-genderless:before, +.fa-circle-thin:before { + content: "\f1db"; +} + +.fa-header:before { + content: "\f1dc"; +} + +.fa-paragraph:before { + content: "\f1dd"; +} + +.fa-sliders:before { + content: "\f1de"; +} + +.fa-share-alt:before { + content: "\f1e0"; +} + +.fa-share-alt-square:before { + content: "\f1e1"; +} + +.fa-bomb:before { + content: "\f1e2"; +} + +.fa-soccer-ball-o:before, +.fa-futbol-o:before { + content: "\f1e3"; +} + +.fa-tty:before { + content: "\f1e4"; +} + +.fa-binoculars:before { + content: "\f1e5"; +} + +.fa-plug:before { + content: "\f1e6"; +} + +.fa-slideshare:before { + content: "\f1e7"; +} + +.fa-twitch:before { + content: "\f1e8"; +} + +.fa-yelp:before { + content: "\f1e9"; +} + +.fa-newspaper-o:before { + content: "\f1ea"; +} + +.fa-wifi:before { + content: "\f1eb"; +} + +.fa-calculator:before { + content: "\f1ec"; +} + +.fa-paypal:before { + content: "\f1ed"; +} + +.fa-google-wallet:before { + content: "\f1ee"; +} + +.fa-cc-visa:before { + content: "\f1f0"; +} + +.fa-cc-mastercard:before { + content: "\f1f1"; +} + +.fa-cc-discover:before { + content: "\f1f2"; +} + +.fa-cc-amex:before { + content: "\f1f3"; +} + +.fa-cc-paypal:before { + content: "\f1f4"; +} + +.fa-cc-stripe:before { + content: "\f1f5"; +} + +.fa-bell-slash:before { + content: "\f1f6"; +} + +.fa-bell-slash-o:before { + content: "\f1f7"; +} + +.fa-trash:before { + content: "\f1f8"; +} + +.fa-copyright:before { + content: "\f1f9"; +} + +.fa-at:before { + content: "\f1fa"; +} + +.fa-eyedropper:before { + content: "\f1fb"; +} + +.fa-paint-brush:before { + content: "\f1fc"; +} + +.fa-birthday-cake:before { + content: "\f1fd"; +} + +.fa-area-chart:before { + content: "\f1fe"; +} + +.fa-pie-chart:before { + content: "\f200"; +} + +.fa-line-chart:before { + content: "\f201"; +} + +.fa-lastfm:before { + content: "\f202"; +} + +.fa-lastfm-square:before { + content: "\f203"; +} + +.fa-toggle-off:before { + content: "\f204"; +} + +.fa-toggle-on:before { + content: "\f205"; +} + +.fa-bicycle:before { + content: "\f206"; +} + +.fa-bus:before { + content: "\f207"; +} + +.fa-ioxhost:before { + content: "\f208"; +} + +.fa-angellist:before { + content: "\f209"; +} + +.fa-cc:before { + content: "\f20a"; +} + +.fa-shekel:before, +.fa-sheqel:before, +.fa-ils:before { + content: "\f20b"; +} + +.fa-meanpath:before { + content: "\f20c"; +} + +.fa-buysellads:before { + content: "\f20d"; +} + +.fa-connectdevelop:before { + content: "\f20e"; +} + +.fa-dashcube:before { + content: "\f210"; +} + +.fa-forumbee:before { + content: "\f211"; +} + +.fa-leanpub:before { + content: "\f212"; +} + +.fa-sellsy:before { + content: "\f213"; +} + +.fa-shirtsinbulk:before { + content: "\f214"; +} + +.fa-simplybuilt:before { + content: "\f215"; +} + +.fa-skyatlas:before { + content: "\f216"; +} + +.fa-cart-plus:before { + content: "\f217"; +} + +.fa-cart-arrow-down:before { + content: "\f218"; +} + +.fa-diamond:before { + content: "\f219"; +} + +.fa-ship:before { + content: "\f21a"; +} + +.fa-user-secret:before { + content: "\f21b"; +} + +.fa-motorcycle:before { + content: "\f21c"; +} + +.fa-street-view:before { + content: "\f21d"; +} + +.fa-heartbeat:before { + content: "\f21e"; +} + +.fa-venus:before { + content: "\f221"; +} + +.fa-mars:before { + content: "\f222"; +} + +.fa-mercury:before { + content: "\f223"; +} + +.fa-transgender:before { + content: "\f224"; +} + +.fa-transgender-alt:before { + content: "\f225"; +} + +.fa-venus-double:before { + content: "\f226"; +} + +.fa-mars-double:before { + content: "\f227"; +} + +.fa-venus-mars:before { + content: "\f228"; +} + +.fa-mars-stroke:before { + content: "\f229"; +} + +.fa-mars-stroke-v:before { + content: "\f22a"; +} + +.fa-mars-stroke-h:before { + content: "\f22b"; +} + +.fa-neuter:before { + content: "\f22c"; +} + +.fa-facebook-official:before { + content: "\f230"; +} + +.fa-pinterest-p:before { + content: "\f231"; +} + +.fa-whatsapp:before { + content: "\f232"; +} + +.fa-server:before { + content: "\f233"; +} + +.fa-user-plus:before { + content: "\f234"; +} + +.fa-user-times:before { + content: "\f235"; +} + +.fa-hotel:before, +.fa-bed:before { + content: "\f236"; +} + +.fa-viacoin:before { + content: "\f237"; +} + +.fa-train:before { + content: "\f238"; +} + +.fa-subway:before { + content: "\f239"; +} + +.fa-medium:before { + content: "\f23a"; +} + +/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */ +@font-face { + font-family: 'editormd-logo'; + src: url("../fonts/editormd-logo.eot?-5y8q6h"); + src: url(".../fonts/editormd-logo.eot?#iefix-5y8q6h") format("embedded-opentype"), url("../fonts/editormd-logo.woff?-5y8q6h") format("woff"), url("../fonts/editormd-logo.ttf?-5y8q6h") format("truetype"), url("../fonts/editormd-logo.svg?-5y8q6h#icomoon") format("svg"); + font-weight: normal; + font-style: normal; +} +.editormd-logo, +.editormd-logo-1x, +.editormd-logo-2x, +.editormd-logo-3x, +.editormd-logo-4x, +.editormd-logo-5x, +.editormd-logo-6x, +.editormd-logo-7x, +.editormd-logo-8x { + font-family: 'editormd-logo'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + font-size: inherit; + line-height: 1; + display: inline-block; + text-rendering: auto; + vertical-align: inherit; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +.editormd-logo:before, +.editormd-logo-1x:before, +.editormd-logo-2x:before, +.editormd-logo-3x:before, +.editormd-logo-4x:before, +.editormd-logo-5x:before, +.editormd-logo-6x:before, +.editormd-logo-7x:before, +.editormd-logo-8x:before { + content: "\e1987"; + /* + HTML Entity 󡦇 + example: + */ +} + +.editormd-logo-1x { + font-size: 1em; +} + +.editormd-logo-lg { + font-size: 1.2em; +} + +.editormd-logo-2x { + font-size: 2em; +} + +.editormd-logo-3x { + font-size: 3em; +} + +.editormd-logo-4x { + font-size: 4em; +} + +.editormd-logo-5x { + font-size: 5em; +} + +.editormd-logo-6x { + font-size: 6em; +} + +.editormd-logo-7x { + font-size: 7em; +} + +.editormd-logo-8x { + font-size: 8em; +} + +.editormd-logo-color { + color: #2196F3; +} + +/*! github-markdown-css | The MIT License (MIT) | Copyright (c) Sindre Sorhus (sindresorhus.com) | https://github.com/sindresorhus/github-markdown-css */ +@font-face { + font-family: octicons-anchor; + src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAYcAA0AAAAACjQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABMAAAABwAAAAca8vGTk9TLzIAAAFMAAAARAAAAFZG1VHVY21hcAAAAZAAAAA+AAABQgAP9AdjdnQgAAAB0AAAAAQAAAAEACICiGdhc3AAAAHUAAAACAAAAAj//wADZ2x5ZgAAAdwAAADRAAABEKyikaNoZWFkAAACsAAAAC0AAAA2AtXoA2hoZWEAAALgAAAAHAAAACQHngNFaG10eAAAAvwAAAAQAAAAEAwAACJsb2NhAAADDAAAAAoAAAAKALIAVG1heHAAAAMYAAAAHwAAACABEAB2bmFtZQAAAzgAAALBAAAFu3I9x/Nwb3N0AAAF/AAAAB0AAAAvaoFvbwAAAAEAAAAAzBdyYwAAAADP2IQvAAAAAM/bz7t4nGNgZGFgnMDAysDB1Ml0hoGBoR9CM75mMGLkYGBgYmBlZsAKAtJcUxgcPsR8iGF2+O/AEMPsznAYKMwIkgMA5REMOXicY2BgYGaAYBkGRgYQsAHyGMF8FgYFIM0ChED+h5j//yEk/3KoSgZGNgYYk4GRCUgwMaACRoZhDwCs7QgGAAAAIgKIAAAAAf//AAJ4nHWMMQrCQBBF/0zWrCCIKUQsTDCL2EXMohYGSSmorScInsRGL2DOYJe0Ntp7BK+gJ1BxF1stZvjz/v8DRghQzEc4kIgKwiAppcA9LtzKLSkdNhKFY3HF4lK69ExKslx7Xa+vPRVS43G98vG1DnkDMIBUgFN0MDXflU8tbaZOUkXUH0+U27RoRpOIyCKjbMCVejwypzJJG4jIwb43rfl6wbwanocrJm9XFYfskuVC5K/TPyczNU7b84CXcbxks1Un6H6tLH9vf2LRnn8Ax7A5WQAAAHicY2BkYGAA4teL1+yI57f5ysDNwgAC529f0kOmWRiYVgEpDgYmEA8AUzEKsQAAAHicY2BkYGB2+O/AEMPCAAJAkpEBFbAAADgKAe0EAAAiAAAAAAQAAAAEAAAAAAAAKgAqACoAiAAAeJxjYGRgYGBhsGFgYgABEMkFhAwM/xn0QAIAD6YBhwB4nI1Ty07cMBS9QwKlQapQW3VXySvEqDCZGbGaHULiIQ1FKgjWMxknMfLEke2A+IJu+wntrt/QbVf9gG75jK577Lg8K1qQPCfnnnt8fX1NRC/pmjrk/zprC+8D7tBy9DHgBXoWfQ44Av8t4Bj4Z8CLtBL9CniJluPXASf0Lm4CXqFX8Q84dOLnMB17N4c7tBo1AS/Qi+hTwBH4rwHHwN8DXqQ30XXAS7QaLwSc0Gn8NuAVWou/gFmnjLrEaEh9GmDdDGgL3B4JsrRPDU2hTOiMSuJUIdKQQayiAth69r6akSSFqIJuA19TrzCIaY8sIoxyrNIrL//pw7A2iMygkX5vDj+G+kuoLdX4GlGK/8Lnlz6/h9MpmoO9rafrz7ILXEHHaAx95s9lsI7AHNMBWEZHULnfAXwG9/ZqdzLI08iuwRloXE8kfhXYAvE23+23DU3t626rbs8/8adv+9DWknsHp3E17oCf+Z48rvEQNZ78paYM38qfk3v/u3l3u3GXN2Dmvmvpf1Srwk3pB/VSsp512bA/GG5i2WJ7wu430yQ5K3nFGiOqgtmSB5pJVSizwaacmUZzZhXLlZTq8qGGFY2YcSkqbth6aW1tRmlaCFs2016m5qn36SbJrqosG4uMV4aP2PHBmB3tjtmgN2izkGQyLWprekbIntJFing32a5rKWCN/SdSoga45EJykyQ7asZvHQ8PTm6cslIpwyeyjbVltNikc2HTR7YKh9LBl9DADC0U/jLcBZDKrMhUBfQBvXRzLtFtjU9eNHKin0x5InTqb8lNpfKv1s1xHzTXRqgKzek/mb7nB8RZTCDhGEX3kK/8Q75AmUM/eLkfA+0Hi908Kx4eNsMgudg5GLdRD7a84npi+YxNr5i5KIbW5izXas7cHXIMAau1OueZhfj+cOcP3P8MNIWLyYOBuxL6DRylJ4cAAAB4nGNgYoAALjDJyIAOWMCiTIxMLDmZedkABtIBygAAAA==) format("woff"); +} +.markdown-body { + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + color: #333; + overflow: hidden; + font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", "Monaco", monospace, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif; + font-size: 16px; + line-height: 1.6; + word-wrap: break-word; +} + +.markdown-body a { + background: transparent; +} + +.markdown-body a:active, +.markdown-body a:hover { + outline: 0; +} + +.markdown-body strong { + font-weight: bold; +} + +.markdown-body h1 { + font-size: 2em; + margin: 0.67em 0; +} + +.markdown-body img { + border: 0; +} + +.markdown-body hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +.markdown-body pre { + overflow: auto; +} + +.markdown-body code, +.markdown-body kbd, +.markdown-body pre { + font-family: "Meiryo UI", "YaHei Consolas Hybrid", Consolas, "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; + font-size: 1em; +} + +.markdown-body input { + color: inherit; + font: inherit; + margin: 0; +} + +.markdown-body html input[disabled] { + cursor: default; +} + +.markdown-body input { + line-height: normal; +} + +.markdown-body input[type="checkbox"] { + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0; +} + +.markdown-body table { + border-collapse: collapse; + border-spacing: 0; +} + +.markdown-body td, +.markdown-body th { + padding: 0; +} + +.markdown-body * { + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.markdown-body input { + font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"; +} + +.markdown-body a { + color: #4183c4; + text-decoration: none; +} + +.markdown-body a:hover, +.markdown-body a:active { + text-decoration: underline; +} + +.markdown-body hr { + height: 0; + margin: 15px 0; + overflow: hidden; + background: transparent; + border: 0; + border-bottom: 1px solid #ddd; +} + +.markdown-body hr:before { + display: table; + content: ""; +} + +.markdown-body hr:after { + display: table; + clear: both; + content: ""; +} + +.markdown-body h1, +.markdown-body h2, +.markdown-body h3, +.markdown-body h4, +.markdown-body h5, +.markdown-body h6 { + margin-top: 15px; + margin-bottom: 15px; + line-height: 1.1; +} + +.markdown-body h1 { + font-size: 30px; +} + +.markdown-body h2 { + font-size: 21px; +} + +.markdown-body h3 { + font-size: 16px; +} + +.markdown-body h4 { + font-size: 14px; +} + +.markdown-body h5 { + font-size: 12px; +} + +.markdown-body h6 { + font-size: 11px; +} + +.markdown-body blockquote { + margin: 0; +} + +.markdown-body ul, +.markdown-body ol { + padding: 0; + margin-top: 0; + margin-bottom: 0; +} + +.markdown-body ol ol, +.markdown-body ul ol { + list-style-type: lower-roman; +} + +.markdown-body ul ul ol, +.markdown-body ul ol ol, +.markdown-body ol ul ol, +.markdown-body ol ol ol { + list-style-type: lower-alpha; +} + +.markdown-body dd { + margin-left: 0; +} + +.markdown-body code { + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 12px; +} + +.markdown-body pre { + margin-top: 0; + margin-bottom: 0; + font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace; +} + +.markdown-body .octicon { + font: normal normal 16px octicons-anchor; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.markdown-body .octicon-link:before { + content: '\f05c'; +} + +.markdown-body > *:first-child { + margin-top: 0 !important; +} + +.markdown-body > *:last-child { + margin-bottom: 0 !important; +} + +.markdown-body .anchor { + position: absolute; + top: 0; + left: 0; + display: block; + padding-right: 6px; + padding-left: 30px; + margin-left: -30px; +} + +.markdown-body .anchor:focus { + outline: none; +} + +.markdown-body h1, +.markdown-body h2, +.markdown-body h3, +.markdown-body h4, +.markdown-body h5, +.markdown-body h6 { + position: relative; + margin-top: 1em; + margin-bottom: 16px; + font-weight: bold; + line-height: 1.4; +} + +.markdown-body h1 .octicon-link, +.markdown-body h2 .octicon-link, +.markdown-body h3 .octicon-link, +.markdown-body h4 .octicon-link, +.markdown-body h5 .octicon-link, +.markdown-body h6 .octicon-link { + display: none; + color: #000; + vertical-align: middle; +} + +.markdown-body h1:hover .anchor, +.markdown-body h2:hover .anchor, +.markdown-body h3:hover .anchor, +.markdown-body h4:hover .anchor, +.markdown-body h5:hover .anchor, +.markdown-body h6:hover .anchor { + padding-left: 8px; + margin-left: -30px; + text-decoration: none; +} + +.markdown-body h1:hover .anchor .octicon-link, +.markdown-body h2:hover .anchor .octicon-link, +.markdown-body h3:hover .anchor .octicon-link, +.markdown-body h4:hover .anchor .octicon-link, +.markdown-body h5:hover .anchor .octicon-link, +.markdown-body h6:hover .anchor .octicon-link { + display: inline-block; +} + +.markdown-body h1 { + padding-bottom: 0.3em; + font-size: 2.25em; + line-height: 1.2; + border-bottom: 1px solid #eee; +} + +.markdown-body h1 .anchor { + line-height: 1; +} + +.markdown-body h2 { + padding-bottom: 0.3em; + font-size: 1.75em; + line-height: 1.225; + border-bottom: 1px solid #eee; +} + +.markdown-body h2 .anchor { + line-height: 1; +} + +.markdown-body h3 { + font-size: 1.5em; + line-height: 1.43; +} + +.markdown-body h3 .anchor { + line-height: 1.2; +} + +.markdown-body h4 { + font-size: 1.25em; +} + +.markdown-body h4 .anchor { + line-height: 1.2; +} + +.markdown-body h5 { + font-size: 1em; +} + +.markdown-body h5 .anchor { + line-height: 1.1; +} + +.markdown-body h6 { + font-size: 1em; + color: #777; +} + +.markdown-body h6 .anchor { + line-height: 1.1; +} + +.markdown-body p, +.markdown-body blockquote, +.markdown-body ul, +.markdown-body ol, +.markdown-body dl, +.markdown-body table, +.markdown-body pre { + margin-top: 0; + margin-bottom: 16px; +} + +/* +.markdown-body hr { + height: 4px; + padding: 0; + margin: 16px 0; + background-color: #e7e7e7; + border: 0 none; +}*/ +.markdown-body ul, +.markdown-body ol { + padding-left: 2em; +} + +.markdown-body ul ul, +.markdown-body ul ol, +.markdown-body ol ol, +.markdown-body ol ul { + margin-top: 0; + margin-bottom: 0; +} + +.markdown-body li > p { + margin-top: 16px; +} + +.markdown-body dl { + padding: 0; +} + +.markdown-body dl dt { + padding: 0; + margin-top: 16px; + font-size: 1em; + font-style: italic; + font-weight: bold; +} + +.markdown-body dl dd { + padding: 0 16px; + margin-bottom: 16px; +} + +.markdown-body blockquote { + padding: 0 15px; + color: #777; + border-left: 4px solid #ddd; +} + +.markdown-body blockquote > :first-child { + margin-top: 0; +} + +.markdown-body blockquote > :last-child { + margin-bottom: 0; +} + +.markdown-body table { + display: block; + width: 100%; + overflow: auto; + word-break: normal; + word-break: keep-all; +} + +.markdown-body table th { + font-weight: bold; +} + +.markdown-body table th, +.markdown-body table td { + padding: 6px 13px; + border: 1px solid #ddd; +} + +.markdown-body table tr { + background-color: #fff; + border-top: 1px solid #ccc; +} + +.markdown-body table tr:nth-child(2n) { + background-color: #f8f8f8; +} + +.markdown-body img { + max-width: 100%; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.markdown-body code { + padding: 0; + padding-top: 0.2em; + padding-bottom: 0.2em; + margin: 0; + font-size: 85%; + background-color: rgba(0, 0, 0, 0.04); + border-radius: 3px; +} + +.markdown-body code:before, +.markdown-body code:after { + letter-spacing: -0.2em; + content: "\00a0"; +} + +.markdown-body pre > code { + padding: 0; + margin: 0; + font-size: 100%; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; +} + +.markdown-body .highlight { + margin-bottom: 16px; +} + +.markdown-body .highlight pre, +.markdown-body pre { + padding: 16px; + overflow: auto; + font-size: 85%; + line-height: 1.45; + background-color: #f7f7f7; + border-radius: 3px; +} + +.markdown-body .highlight pre { + margin-bottom: 0; + word-break: normal; +} + +.markdown-body pre { + word-wrap: normal; +} + +.markdown-body pre code { + display: inline; + max-width: initial; + padding: 0; + margin: 0; + overflow: initial; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; +} + +.markdown-body pre code:before, +.markdown-body pre code:after { + content: normal; +} + +.markdown-body kbd { + display: inline-block; + padding: 3px 5px; + font-size: 11px; + line-height: 10px; + color: #555; + vertical-align: middle; + background-color: #fcfcfc; + border: solid 1px #ccc; + border-bottom-color: #bbb; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #bbb; +} + +.markdown-body .pl-c { + color: #969896; +} + +.markdown-body .pl-c1, +.markdown-body .pl-mdh, +.markdown-body .pl-mm, +.markdown-body .pl-mp, +.markdown-body .pl-mr, +.markdown-body .pl-s1 .pl-v, +.markdown-body .pl-s3, +.markdown-body .pl-sc, +.markdown-body .pl-sv { + color: #0086b3; +} + +.markdown-body .pl-e, +.markdown-body .pl-en { + color: #795da3; +} + +.markdown-body .pl-s1 .pl-s2, +.markdown-body .pl-smi, +.markdown-body .pl-smp, +.markdown-body .pl-stj, +.markdown-body .pl-vo, +.markdown-body .pl-vpf { + color: #333; +} + +.markdown-body .pl-ent { + color: #63a35c; +} + +.markdown-body .pl-k, +.markdown-body .pl-s, +.markdown-body .pl-st { + color: #a71d5d; +} + +.markdown-body .pl-pds, +.markdown-body .pl-s1, +.markdown-body .pl-s1 .pl-pse .pl-s2, +.markdown-body .pl-sr, +.markdown-body .pl-sr .pl-cce, +.markdown-body .pl-sr .pl-sra, +.markdown-body .pl-sr .pl-sre, +.markdown-body .pl-src { + color: #df5000; +} + +.markdown-body .pl-mo, +.markdown-body .pl-v { + color: #1d3e81; +} + +.markdown-body .pl-id { + color: #b52a1d; +} + +.markdown-body .pl-ii { + background-color: #b52a1d; + color: #f8f8f8; +} + +.markdown-body .pl-sr .pl-cce { + color: #63a35c; + font-weight: bold; +} + +.markdown-body .pl-ml { + color: #693a17; +} + +.markdown-body .pl-mh, +.markdown-body .pl-mh .pl-en, +.markdown-body .pl-ms { + color: #1d3e81; + font-weight: bold; +} + +.markdown-body .pl-mq { + color: #008080; +} + +.markdown-body .pl-mi { + color: #333; + font-style: italic; +} + +.markdown-body .pl-mb { + color: #333; + font-weight: bold; +} + +.markdown-body .pl-md, +.markdown-body .pl-mdhf { + background-color: #ffecec; + color: #bd2c00; +} + +.markdown-body .pl-mdht, +.markdown-body .pl-mi1 { + background-color: #eaffea; + color: #55a532; +} + +.markdown-body .pl-mdr { + color: #795da3; + font-weight: bold; +} + +.markdown-body kbd { + display: inline-block; + padding: 3px 5px; + font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace; + line-height: 10px; + color: #555; + vertical-align: middle; + background-color: #fcfcfc; + border: solid 1px #ccc; + border-bottom-color: #bbb; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #bbb; +} + +.markdown-body .task-list-item { + list-style-type: none; +} + +.markdown-body .task-list-item + .task-list-item { + margin-top: 3px; +} + +.markdown-body .task-list-item input { + float: left; + margin: 0.3em 0 0.25em -1.6em; + vertical-align: middle; +} + +.markdown-body :checked + .radio-label { + z-index: 1; + position: relative; + border-color: #4183c4; +} + +.editormd-preview-container, .editormd-html-preview { + text-align: left; + font-size: 14px; + line-height: 1.6; + padding: 20px; + overflow: auto; + width: 100%; + background-color: #fff; +} +.editormd-preview-container blockquote, .editormd-html-preview blockquote { + color: #666; + border-left: 4px solid #ddd; + padding-left: 20px; + margin-left: 0; + font-size: 14px; + font-style: italic; +} +.editormd-preview-container p code, .editormd-html-preview p code { + margin-left: 5px; + margin-right: 4px; +} +.editormd-preview-container abbr, .editormd-html-preview abbr { + background: #ffffdd; +} +.editormd-preview-container hr, .editormd-html-preview hr { + height: 1px; + border: none; + border-top: 1px solid #ddd; + background: none; +} +.editormd-preview-container code, .editormd-html-preview code { + border: 1px solid #ddd; + background: #f6f6f6; + padding: 3px; + border-radius: 3px; + font-size: 14px; +} +.editormd-preview-container pre, .editormd-html-preview pre { + border: 1px solid #ddd; + background: #f6f6f6; + padding: 10px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; +} +.editormd-preview-container pre code, .editormd-html-preview pre code { + padding: 0; +} +.editormd-preview-container pre, .editormd-preview-container code, .editormd-preview-container kbd, .editormd-html-preview pre, .editormd-html-preview code, .editormd-html-preview kbd { + font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; +} +.editormd-preview-container table thead tr, .editormd-html-preview table thead tr { + background-color: #F8F8F8; +} +.editormd-preview-container p.editormd-tex, .editormd-html-preview p.editormd-tex { + text-align: center; +} +.editormd-preview-container span.editormd-tex, .editormd-html-preview span.editormd-tex { + margin: 0 5px; +} +.editormd-preview-container .emoji, .editormd-html-preview .emoji { + width: 24px; + height: 24px; +} +.editormd-preview-container .katex, .editormd-html-preview .katex { + font-size: 1.4em; +} +.editormd-preview-container .sequence-diagram, .editormd-preview-container .flowchart, .editormd-html-preview .sequence-diagram, .editormd-html-preview .flowchart { + margin: 0 auto; + text-align: center; +} +.editormd-preview-container .sequence-diagram svg, .editormd-preview-container .flowchart svg, .editormd-html-preview .sequence-diagram svg, .editormd-html-preview .flowchart svg { + margin: 0 auto; +} +.editormd-preview-container .sequence-diagram text, .editormd-preview-container .flowchart text, .editormd-html-preview .sequence-diagram text, .editormd-html-preview .flowchart text { + font-size: 15px !important; + font-family: "YaHei Consolas Hybrid", Consolas, "Microsoft YaHei", "Malgun Gothic", "Segoe UI", Helvetica, Arial !important; +} + +/*! Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +.pln { + color: #000; +} + +/* plain text */ +@media screen { + .str { + color: #080; + } + + /* string content */ + .kwd { + color: #008; + } + + /* a keyword */ + .com { + color: #800; + } + + /* a comment */ + .typ { + color: #606; + } + + /* a type name */ + .lit { + color: #066; + } + + /* a literal value */ + /* punctuation, lisp open bracket, lisp close bracket */ + .pun, .opn, .clo { + color: #660; + } + + .tag { + color: #008; + } + + /* a markup tag name */ + .atn { + color: #606; + } + + /* a markup attribute name */ + .atv { + color: #080; + } + + /* a markup attribute value */ + .dec, .var { + color: #606; + } + + /* a declaration; a variable name */ + .fun { + color: red; + } + + /* a function name */ +} +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; + } + + .kwd { + color: #006; + font-weight: bold; + } + + .com { + color: #600; + font-style: italic; + } + + .typ { + color: #404; + font-weight: bold; + } + + .lit { + color: #044; + } + + .pun, .opn, .clo { + color: #440; + } + + .tag { + color: #006; + font-weight: bold; + } + + .atn { + color: #404; + } + + .atv { + color: #060; + } +} +/* Put a border around prettyprinted code snippets. */ +pre.prettyprint { + padding: 2px; + border: 1px solid #888; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L5, +li.L6, +li.L7, +li.L8 { + list-style-type: none; +} + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + background: #eee; +} + +.editormd-preview-container pre.prettyprint, .editormd-html-preview pre.prettyprint { + padding: 10px; + border: 1px solid #ddd; + white-space: pre-wrap; + word-wrap: break-word; +} +.editormd-preview-container ol.linenums, .editormd-html-preview ol.linenums { + color: #999; + padding-left: 2.5em; +} +.editormd-preview-container ol.linenums li, .editormd-html-preview ol.linenums li { + list-style-type: decimal; +} +.editormd-preview-container ol.linenums li code, .editormd-html-preview ol.linenums li code { + border: none; + background: none; + padding: 0; +} + +.editormd-preview-container .editormd-toc-menu, .editormd-html-preview .editormd-toc-menu { + margin: 8px 0 12px 0; + display: inline-block; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc, .editormd-html-preview .editormd-toc-menu > .markdown-toc { + position: relative; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + -o-border-radius: 4px; + border-radius: 4px; + border: 1px solid #ddd; + display: inline-block; + font-size: 1em; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul, .editormd-html-preview .editormd-toc-menu > .markdown-toc > ul { + width: 160%; + min-width: 180px; + position: absolute; + left: -1px; + top: -2px; + z-index: 100; + padding: 0 10px 10px; + display: none; + background: #fff; + border: 1px solid #ddd; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + -o-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Webkit browsers */ + -moz-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Firefox */ + -ms-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* IE9 */ + -o-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Opera(Old) */ + box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* IE9+, News */ +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul > li ul, .editormd-html-preview .editormd-toc-menu > .markdown-toc > ul > li ul { + width: 100%; + min-width: 180px; + border: 1px solid #ddd; + display: none; + background: #fff; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + -o-border-radius: 4px; + border-radius: 4px; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul > li a, .editormd-html-preview .editormd-toc-menu > .markdown-toc > ul > li a { + color: #666; + padding: 6px 10px; + display: block; + -webkit-transition: background-color 500ms ease-out; + /* Safari, Chrome */ + -moz-transition: background-color 500ms ease-out; + /* Firefox 4.0~16.0 */ + transition: background-color 500ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc > ul > li a:hover, .editormd-html-preview .editormd-toc-menu > .markdown-toc > ul > li a:hover { + background-color: #f6f6f6; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li, .editormd-html-preview .editormd-toc-menu > .markdown-toc li { + position: relative; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul { + position: absolute; + top: 32px; + left: 10%; + display: none; + -webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Webkit browsers */ + -moz-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Firefox */ + -ms-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* IE9 */ + -o-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* Opera(Old) */ + box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2); + /* IE9+, News */ +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:before, .editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:after, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:before, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:after { + pointer-events: pointer-events; + position: absolute; + left: 15px; + top: -6px; + display: block; + content: ""; + width: 0; + height: 0; + border: 6px solid transparent; + border-width: 0 6px 6px; + z-index: 10; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:before, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:before { + border-bottom-color: #ccc; +} +.editormd-preview-container .editormd-toc-menu > .markdown-toc li > ul:after, .editormd-html-preview .editormd-toc-menu > .markdown-toc li > ul:after { + border-bottom-color: #ffffff; + top: -5px; +} +.editormd-preview-container .editormd-toc-menu ul, .editormd-html-preview .editormd-toc-menu ul { + list-style: none; +} +.editormd-preview-container .editormd-toc-menu a, .editormd-html-preview .editormd-toc-menu a { + text-decoration: none; +} +.editormd-preview-container .editormd-toc-menu h1, .editormd-html-preview .editormd-toc-menu h1 { + font-size: 16px; + padding: 5px 0 10px 10px; + line-height: 1; + border-bottom: 1px solid #eee; +} +.editormd-preview-container .editormd-toc-menu h1 .fa, .editormd-html-preview .editormd-toc-menu h1 .fa { + padding-left: 10px; +} +.editormd-preview-container .editormd-toc-menu .toc-menu-btn, .editormd-html-preview .editormd-toc-menu .toc-menu-btn { + color: #666; + min-width: 180px; + padding: 5px 10px; + border-radius: 4px; + display: inline-block; + -webkit-transition: background-color 500ms ease-out; + /* Safari, Chrome */ + -moz-transition: background-color 500ms ease-out; + /* Firefox 4.0~16.0 */ + transition: background-color 500ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-preview-container .editormd-toc-menu .toc-menu-btn:hover, .editormd-html-preview .editormd-toc-menu .toc-menu-btn:hover { + background-color: #f6f6f6; +} +.editormd-preview-container .editormd-toc-menu .toc-menu-btn .fa, .editormd-html-preview .editormd-toc-menu .toc-menu-btn .fa { + float: right; + padding: 3px 0 0 10px; + font-size: 1.3em; +} + +.markdown-body .editormd-toc-menu ul { + padding-left: 0; +} +.markdown-body .highlight pre, .markdown-body pre { + line-height: 1.6; +} + +hr.editormd-page-break { + border: 1px dotted #ccc; + font-size: 0; + height: 2px; +} + +@media only print { + hr.editormd-page-break { + background: none; + border: none; + height: 0; + } +} +.editormd-html-preview textarea { + display: none; +} +.editormd-html-preview hr.editormd-page-break { + background: none; + border: none; + height: 0; +} + +.editormd-preview-close-btn { + color: #fff; + padding: 4px 6px; + font-size: 18px; + -webkit-border-radius: 500px; + -moz-border-radius: 500px; + -ms-border-radius: 500px; + -o-border-radius: 500px; + border-radius: 500px; + display: none; + background-color: #ccc; + position: absolute; + top: 25px; + right: 35px; + z-index: 19; + -webkit-transition: background-color 300ms ease-out; + /* Safari, Chrome */ + -moz-transition: background-color 300ms ease-out; + /* Firefox 4.0~16.0 */ + transition: background-color 300ms ease-out; + /* IE >9, FF >15, Opera >12.0 */ +} +.editormd-preview-close-btn:hover { + background-color: #999; +} + +.editormd-preview-active { + width: 100%; + padding: 40px; +} diff --git a/src/main/resources/templates/editor/css/editormd.preview.min.css b/src/main/resources/templates/editor/css/editormd.preview.min.css new file mode 100644 index 0000000000000000000000000000000000000000..a0f22adaea08ce28824774252535eac3c5b4665b --- /dev/null +++ b/src/main/resources/templates/editor/css/editormd.preview.min.css @@ -0,0 +1,5 @@ +/*! Editor.md v1.5.0 | editormd.preview.min.css | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-09 */ +@charset "UTF-8";/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 *//*! + * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */.fa-ul,.markdown-body .task-list-item,li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}.fa-fw,.fa-li{text-align:center}.fa,.fa-stack{display:inline-block}.fa,.markdown-body .octicon{-moz-osx-font-smoothing:grayscale}@font-face{font-family:FontAwesome;src:url(../fonts/fontawesome-webfont.eot?v=4.3.0);src:url(../fonts/fontawesome-webfont.eot?#iefix&v=4.3.0)format("embedded-opentype"),url(../fonts/fontawesome-webfont.woff2?v=4.3.0)format("woff2"),url(../fonts/fontawesome-webfont.woff?v=4.3.0)format("woff"),url(../fonts/fontawesome-webfont.ttf?v=4.3.0)format("truetype"),url(../fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular)format("svg");font-weight:400;font-style:normal}.fa{font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;transform:translate(0,0)}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em}.fa-ul{padding-left:0;margin-left:2.14285714em}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{filter:none}.fa-stack{position:relative;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-close:before,.fa-remove:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-cog:before,.fa-gear:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-repeat:before,.fa-rotate-right:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-image:before,.fa-photo:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-exclamation-triangle:before,.fa-warning:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-cogs:before,.fa-gears:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-floppy-o:before,.fa-save:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-sort:before,.fa-unsorted:before{content:"\f0dc"}.fa-sort-desc:before,.fa-sort-down:before{content:"\f0dd"}.fa-sort-asc:before,.fa-sort-up:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-gavel:before,.fa-legal:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-bolt:before,.fa-flash:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-clipboard:before,.fa-paste:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-chain-broken:before,.fa-unlink:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-caret-square-o-down:before,.fa-toggle-down:before{content:"\f150"}.fa-caret-square-o-up:before,.fa-toggle-up:before{content:"\f151"}.fa-caret-square-o-right:before,.fa-toggle-right:before{content:"\f152"}.fa-eur:before,.fa-euro:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-inr:before,.fa-rupee:before{content:"\f156"}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:"\f157"}.fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:"\f158"}.fa-krw:before,.fa-won:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-caret-square-o-left:before,.fa-toggle-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-try:before,.fa-turkish-lira:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-bank:before,.fa-institution:before,.fa-university:before{content:"\f19c"}.fa-graduation-cap:before,.fa-mortar-board:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:"\f1c5"}.fa-file-archive-o:before,.fa-file-zip-o:before{content:"\f1c6"}.fa-file-audio-o:before,.fa-file-sound-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-empire:before,.fa-ge:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-paper-plane:before,.fa-send:before{content:"\f1d8"}.fa-paper-plane-o:before,.fa-send-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before,.fa-genderless:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-futbol-o:before,.fa-soccer-ball-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-ils:before,.fa-shekel:before,.fa-sheqel:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-bed:before,.fa-hotel:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */@font-face{font-family:editormd-logo;src:url(../fonts/editormd-logo.eot?-5y8q6h);src:url(.../fonts/editormd-logo.eot?#iefix-5y8q6h)format("embedded-opentype"),url(../fonts/editormd-logo.woff?-5y8q6h)format("woff"),url(../fonts/editormd-logo.ttf?-5y8q6h)format("truetype"),url(../fonts/editormd-logo.svg?-5y8q6h#icomoon)format("svg");font-weight:400;font-style:normal}.editormd-logo,.editormd-logo-1x,.editormd-logo-2x,.editormd-logo-3x,.editormd-logo-4x,.editormd-logo-5x,.editormd-logo-6x,.editormd-logo-7x,.editormd-logo-8x{font-family:editormd-logo;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;font-size:inherit;line-height:1;display:inline-block;text-rendering:auto;vertical-align:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.markdown-body hr:after,.markdown-body hr:before{content:"";display:table}.editormd-logo-1x:before,.editormd-logo-2x:before,.editormd-logo-3x:before,.editormd-logo-4x:before,.editormd-logo-5x:before,.editormd-logo-6x:before,.editormd-logo-7x:before,.editormd-logo-8x:before,.editormd-logo:before{content:"\e1987"}.editormd-logo-1x{font-size:1em}.editormd-logo-lg{font-size:1.2em}.editormd-logo-2x{font-size:2em}.editormd-logo-3x{font-size:3em}.editormd-logo-4x{font-size:4em}.editormd-logo-5x{font-size:5em}.editormd-logo-6x{font-size:6em}.editormd-logo-7x{font-size:7em}.editormd-logo-8x{font-size:8em}.editormd-logo-color{color:#2196F3}/*! github-markdown-css | The MIT License (MIT) | Copyright (c) Sindre Sorhus (sindresorhus.com) | https://github.com/sindresorhus/github-markdown-css */@font-face{font-family:octicons-anchor;src:url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAYcAA0AAAAACjQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABMAAAABwAAAAca8vGTk9TLzIAAAFMAAAARAAAAFZG1VHVY21hcAAAAZAAAAA+AAABQgAP9AdjdnQgAAAB0AAAAAQAAAAEACICiGdhc3AAAAHUAAAACAAAAAj//wADZ2x5ZgAAAdwAAADRAAABEKyikaNoZWFkAAACsAAAAC0AAAA2AtXoA2hoZWEAAALgAAAAHAAAACQHngNFaG10eAAAAvwAAAAQAAAAEAwAACJsb2NhAAADDAAAAAoAAAAKALIAVG1heHAAAAMYAAAAHwAAACABEAB2bmFtZQAAAzgAAALBAAAFu3I9x/Nwb3N0AAAF/AAAAB0AAAAvaoFvbwAAAAEAAAAAzBdyYwAAAADP2IQvAAAAAM/bz7t4nGNgZGFgnMDAysDB1Ml0hoGBoR9CM75mMGLkYGBgYmBlZsAKAtJcUxgcPsR8iGF2+O/AEMPsznAYKMwIkgMA5REMOXicY2BgYGaAYBkGRgYQsAHyGMF8FgYFIM0ChED+h5j//yEk/3KoSgZGNgYYk4GRCUgwMaACRoZhDwCs7QgGAAAAIgKIAAAAAf//AAJ4nHWMMQrCQBBF/0zWrCCIKUQsTDCL2EXMohYGSSmorScInsRGL2DOYJe0Ntp7BK+gJ1BxF1stZvjz/v8DRghQzEc4kIgKwiAppcA9LtzKLSkdNhKFY3HF4lK69ExKslx7Xa+vPRVS43G98vG1DnkDMIBUgFN0MDXflU8tbaZOUkXUH0+U27RoRpOIyCKjbMCVejwypzJJG4jIwb43rfl6wbwanocrJm9XFYfskuVC5K/TPyczNU7b84CXcbxks1Un6H6tLH9vf2LRnn8Ax7A5WQAAAHicY2BkYGAA4teL1+yI57f5ysDNwgAC529f0kOmWRiYVgEpDgYmEA8AUzEKsQAAAHicY2BkYGB2+O/AEMPCAAJAkpEBFbAAADgKAe0EAAAiAAAAAAQAAAAEAAAAAAAAKgAqACoAiAAAeJxjYGRgYGBhsGFgYgABEMkFhAwM/xn0QAIAD6YBhwB4nI1Ty07cMBS9QwKlQapQW3VXySvEqDCZGbGaHULiIQ1FKgjWMxknMfLEke2A+IJu+wntrt/QbVf9gG75jK577Lg8K1qQPCfnnnt8fX1NRC/pmjrk/zprC+8D7tBy9DHgBXoWfQ44Av8t4Bj4Z8CLtBL9CniJluPXASf0Lm4CXqFX8Q84dOLnMB17N4c7tBo1AS/Qi+hTwBH4rwHHwN8DXqQ30XXAS7QaLwSc0Gn8NuAVWou/gFmnjLrEaEh9GmDdDGgL3B4JsrRPDU2hTOiMSuJUIdKQQayiAth69r6akSSFqIJuA19TrzCIaY8sIoxyrNIrL//pw7A2iMygkX5vDj+G+kuoLdX4GlGK/8Lnlz6/h9MpmoO9rafrz7ILXEHHaAx95s9lsI7AHNMBWEZHULnfAXwG9/ZqdzLI08iuwRloXE8kfhXYAvE23+23DU3t626rbs8/8adv+9DWknsHp3E17oCf+Z48rvEQNZ78paYM38qfk3v/u3l3u3GXN2Dmvmvpf1Srwk3pB/VSsp512bA/GG5i2WJ7wu430yQ5K3nFGiOqgtmSB5pJVSizwaacmUZzZhXLlZTq8qGGFY2YcSkqbth6aW1tRmlaCFs2016m5qn36SbJrqosG4uMV4aP2PHBmB3tjtmgN2izkGQyLWprekbIntJFing32a5rKWCN/SdSoga45EJykyQ7asZvHQ8PTm6cslIpwyeyjbVltNikc2HTR7YKh9LBl9DADC0U/jLcBZDKrMhUBfQBvXRzLtFtjU9eNHKin0x5InTqb8lNpfKv1s1xHzTXRqgKzek/mb7nB8RZTCDhGEX3kK/8Q75AmUM/eLkfA+0Hi908Kx4eNsMgudg5GLdRD7a84npi+YxNr5i5KIbW5izXas7cHXIMAau1OueZhfj+cOcP3P8MNIWLyYOBuxL6DRylJ4cAAAB4nGNgYoAALjDJyIAOWMCiTIxMLDmZedkABtIBygAAAA==)format("woff")}.markdown-body{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#333;overflow:hidden;font-family:"Microsoft YaHei",Helvetica,"Meiryo UI","Malgun Gothic","Segoe UI","Trebuchet MS",Monaco,monospace,Tahoma,STXihei,"华文细黑",STHeiti,"Helvetica Neue","Droid Sans","wenquanyi micro hei",FreeSans,Arimo,Arial,SimSun,"宋体",Heiti,"黑体",sans-serif;font-size:16px;line-height:1.6;word-wrap:break-word}.markdown-body strong{font-weight:700}.markdown-body h1{margin:.67em 0}.markdown-body img{border:0}.markdown-body hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}.markdown-body input{color:inherit;margin:0;line-height:normal;font:13px/1.4 Helvetica,arial,freesans,clean,sans-serif,"Segoe UI Emoji","Segoe UI Symbol"}.markdown-body html input[disabled]{cursor:default}.markdown-body input[type=checkbox]{-moz-box-sizing:border-box;box-sizing:border-box;padding:0}.markdown-body td,.markdown-body th{padding:0}.markdown-body *{-moz-box-sizing:border-box;box-sizing:border-box}.markdown-body a{background:0 0;color:#4183c4;text-decoration:none}.markdown-body a:active,.markdown-body a:hover{outline:0;text-decoration:underline}.markdown-body hr{margin:15px 0;overflow:hidden;background:0 0;border:0;border-bottom:1px solid #ddd}.markdown-body h1,.markdown-body h2{padding-bottom:.3em;border-bottom:1px solid #eee}.markdown-body hr:after{clear:both}.markdown-body blockquote{margin:0}.markdown-body ol,.markdown-body ul{padding:0}.markdown-body ol ol,.markdown-body ul ol{list-style-type:lower-roman}.markdown-body ol ol ol,.markdown-body ol ul ol,.markdown-body ul ol ol,.markdown-body ul ul ol{list-style-type:lower-alpha}.markdown-body dd{margin-left:0}.markdown-body code{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace}.markdown-body pre{font:12px Consolas,"Liberation Mono",Menlo,Courier,monospace;word-wrap:normal}.markdown-body .octicon{font:normal normal 16px octicons-anchor;line-height:1;display:inline-block;text-decoration:none;-webkit-font-smoothing:antialiased;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-body .octicon-link:before{content:'\f05c'}.markdown-body>:first-child{margin-top:0!important}.markdown-body>:last-child{margin-bottom:0!important}.markdown-body .anchor{position:absolute;top:0;left:0;display:block;padding-right:6px;padding-left:30px;margin-left:-30px}.markdown-body .anchor:focus{outline:0}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{position:relative;margin-top:1em;margin-bottom:16px;font-weight:700;line-height:1.4}.markdown-body h1 .octicon-link,.markdown-body h2 .octicon-link,.markdown-body h3 .octicon-link,.markdown-body h4 .octicon-link,.markdown-body h5 .octicon-link,.markdown-body h6 .octicon-link{display:none;color:#000;vertical-align:middle}.markdown-body h1:hover .anchor,.markdown-body h2:hover .anchor,.markdown-body h3:hover .anchor,.markdown-body h4:hover .anchor,.markdown-body h5:hover .anchor,.markdown-body h6:hover .anchor{padding-left:8px;margin-left:-30px;text-decoration:none}.markdown-body h1:hover .anchor .octicon-link,.markdown-body h2:hover .anchor .octicon-link,.markdown-body h3:hover .anchor .octicon-link,.markdown-body h4:hover .anchor .octicon-link,.markdown-body h5:hover .anchor .octicon-link,.markdown-body h6:hover .anchor .octicon-link{display:inline-block}.markdown-body h1{font-size:2.25em;line-height:1.2}.markdown-body h1 .anchor{line-height:1}.markdown-body h2{font-size:1.75em;line-height:1.225}.markdown-body h2 .anchor{line-height:1}.markdown-body h3{font-size:1.5em;line-height:1.43}.markdown-body h3 .anchor,.markdown-body h4 .anchor{line-height:1.2}.markdown-body h4{font-size:1.25em}.markdown-body h5 .anchor,.markdown-body h6 .anchor{line-height:1.1}.markdown-body h5{font-size:1em}.markdown-body h6{font-size:1em;color:#777}.markdown-body blockquote,.markdown-body dl,.markdown-body ol,.markdown-body p,.markdown-body pre,.markdown-body table,.markdown-body ul{margin-top:0;margin-bottom:16px}.markdown-body ol,.markdown-body ul{padding-left:2em}.markdown-body ol ol,.markdown-body ol ul,.markdown-body ul ol,.markdown-body ul ul{margin-top:0;margin-bottom:0}.markdown-body li>p{margin-top:16px}.markdown-body dl{padding:0}.markdown-body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:700}.markdown-body dl dd{padding:0 16px;margin-bottom:16px}.markdown-body blockquote{padding:0 15px;color:#777;border-left:4px solid #ddd}.markdown-body blockquote>:first-child{margin-top:0}.markdown-body blockquote>:last-child{margin-bottom:0}.markdown-body table{border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}.markdown-body table th{font-weight:700}.markdown-body table td,.markdown-body table th{padding:6px 13px;border:1px solid #ddd}.markdown-body table tr{background-color:#fff;border-top:1px solid #ccc}.markdown-body table tr:nth-child(2n){background-color:#f8f8f8}.markdown-body img{max-width:100%;-moz-box-sizing:border-box;box-sizing:border-box}.markdown-body code{padding:.2em 0;margin:0;font-size:85%;background-color:rgba(0,0,0,.04);border-radius:3px}.markdown-body code:after,.markdown-body code:before{letter-spacing:-.2em;content:"\00a0"}.markdown-body pre>code{padding:0;margin:0;font-size:100%;word-break:normal;white-space:pre;background:0 0;border:0}.markdown-body .highlight{margin-bottom:16px}.markdown-body .highlight pre,.markdown-body pre{padding:16px;overflow:auto;font-size:85%;background-color:#f7f7f7;border-radius:3px}.markdown-body .highlight pre{margin-bottom:0;word-break:normal}.markdown-body pre code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}.markdown-body pre code:after,.markdown-body pre code:before{content:normal}.markdown-body .pl-c{color:#969896}.markdown-body .pl-c1,.markdown-body .pl-mdh,.markdown-body .pl-mm,.markdown-body .pl-mp,.markdown-body .pl-mr,.markdown-body .pl-s1 .pl-v,.markdown-body .pl-s3,.markdown-body .pl-sc,.markdown-body .pl-sv{color:#0086b3}.markdown-body .pl-e,.markdown-body .pl-en{color:#795da3}.markdown-body .pl-s1 .pl-s2,.markdown-body .pl-smi,.markdown-body .pl-smp,.markdown-body .pl-stj,.markdown-body .pl-vo,.markdown-body .pl-vpf{color:#333}.markdown-body .pl-ent{color:#63a35c}.markdown-body .pl-k,.markdown-body .pl-s,.markdown-body .pl-st{color:#a71d5d}.markdown-body .pl-pds,.markdown-body .pl-s1,.markdown-body .pl-s1 .pl-pse .pl-s2,.markdown-body .pl-sr,.markdown-body .pl-sr .pl-cce,.markdown-body .pl-sr .pl-sra,.markdown-body .pl-sr .pl-sre,.markdown-body .pl-src{color:#df5000}.markdown-body .pl-mo,.markdown-body .pl-v{color:#1d3e81}.markdown-body .pl-id{color:#b52a1d}.markdown-body .pl-ii{background-color:#b52a1d;color:#f8f8f8}.markdown-body .pl-sr .pl-cce{color:#63a35c;font-weight:700}.markdown-body .pl-ml{color:#693a17}.markdown-body .pl-mh,.markdown-body .pl-mh .pl-en,.markdown-body .pl-ms{color:#1d3e81;font-weight:700}.markdown-body .pl-mq{color:teal}.markdown-body .pl-mi{color:#333;font-style:italic}.markdown-body .pl-mb{color:#333;font-weight:700}.markdown-body .pl-md,.markdown-body .pl-mdhf{background-color:#ffecec;color:#bd2c00}.markdown-body .pl-mdht,.markdown-body .pl-mi1{background-color:#eaffea;color:#55a532}.markdown-body .pl-mdr{color:#795da3;font-weight:700}.markdown-body kbd{display:inline-block;padding:3px 5px;font:11px Consolas,"Liberation Mono",Menlo,Courier,monospace;line-height:10px;color:#555;vertical-align:middle;background-color:#fcfcfc;border:1px solid #ccc;border-bottom-color:#bbb;border-radius:3px;box-shadow:inset 0 -1px 0 #bbb}.markdown-body .task-list-item+.task-list-item{margin-top:3px}.markdown-body .task-list-item input{float:left;margin:.3em 0 .25em -1.6em;vertical-align:middle}.markdown-body :checked+.radio-label{z-index:1;position:relative;border-color:#4183c4}.editormd-html-preview,.editormd-preview-container{text-align:left;font-size:14px;line-height:1.6;padding:20px;overflow:auto;width:100%;background-color:#fff}.editormd-html-preview blockquote,.editormd-preview-container blockquote{color:#666;border-left:4px solid #ddd;padding-left:20px;margin-left:0;font-size:14px;font-style:italic}.editormd-html-preview p code,.editormd-preview-container p code{margin-left:5px;margin-right:4px}.editormd-html-preview abbr,.editormd-preview-container abbr{background:#ffd}.editormd-html-preview hr,.editormd-preview-container hr{height:1px;border:none;border-top:1px solid #ddd;background:0 0}.editormd-html-preview code,.editormd-preview-container code{border:1px solid #ddd;background:#f6f6f6;padding:3px;border-radius:3px;font-size:14px}.editormd-html-preview pre,.editormd-preview-container pre{border:1px solid #ddd;background:#f6f6f6;padding:10px;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;border-radius:3px}.editormd-html-preview pre code,.editormd-preview-container pre code{padding:0}.editormd-html-preview code,.editormd-html-preview kbd,.editormd-html-preview pre,.editormd-preview-container code,.editormd-preview-container kbd,.editormd-preview-container pre{font-family:"YaHei Consolas Hybrid",Consolas,"Meiryo UI","Malgun Gothic","Segoe UI","Trebuchet MS",Helvetica,monospace,monospace}.editormd-html-preview table thead tr,.editormd-preview-container table thead tr{background-color:#F8F8F8}.editormd-html-preview p.editormd-tex,.editormd-preview-container p.editormd-tex{text-align:center}.editormd-html-preview span.editormd-tex,.editormd-preview-container span.editormd-tex{margin:0 5px}.editormd-html-preview .emoji,.editormd-preview-container .emoji{width:24px;height:24px}.editormd-html-preview .katex,.editormd-preview-container .katex{font-size:1.4em}.editormd-html-preview .flowchart,.editormd-html-preview .sequence-diagram,.editormd-preview-container .flowchart,.editormd-preview-container .sequence-diagram{margin:0 auto;text-align:center}.editormd-html-preview .flowchart svg,.editormd-html-preview .sequence-diagram svg,.editormd-preview-container .flowchart svg,.editormd-preview-container .sequence-diagram svg{margin:0 auto}.editormd-html-preview .flowchart text,.editormd-html-preview .sequence-diagram text,.editormd-preview-container .flowchart text,.editormd-preview-container .sequence-diagram text{font-size:15px!important;font-family:"YaHei Consolas Hybrid",Consolas,"Microsoft YaHei","Malgun Gothic","Segoe UI",Helvetica,Arial!important}/*! Pretty printing styles. Used with prettify.js. */.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}.editormd-html-preview pre.prettyprint,.editormd-preview-container pre.prettyprint{padding:10px;border:1px solid #ddd;white-space:pre-wrap;word-wrap:break-word}.editormd-html-preview ol.linenums,.editormd-preview-container ol.linenums{color:#999;padding-left:2.5em}.editormd-html-preview ol.linenums li,.editormd-preview-container ol.linenums li{list-style-type:decimal}.editormd-html-preview ol.linenums li code,.editormd-preview-container ol.linenums li code{border:none;background:0 0;padding:0}.editormd-html-preview .editormd-toc-menu,.editormd-preview-container .editormd-toc-menu{margin:8px 0 12px;display:inline-block}.editormd-html-preview .editormd-toc-menu>.markdown-toc,.editormd-preview-container .editormd-toc-menu>.markdown-toc{position:relative;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;-o-border-radius:4px;border-radius:4px;border:1px solid #ddd;display:inline-block;font-size:1em}.editormd-html-preview .editormd-toc-menu>.markdown-toc>ul,.editormd-preview-container .editormd-toc-menu>.markdown-toc>ul{width:160%;min-width:180px;position:absolute;left:-1px;top:-2px;z-index:100;padding:0 10px 10px;display:none;background:#fff;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;-o-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 3px 5px rgba(0,0,0,.2);-moz-box-shadow:0 3px 5px rgba(0,0,0,.2);-ms-box-shadow:0 3px 5px rgba(0,0,0,.2);-o-box-shadow:0 3px 5px rgba(0,0,0,.2);box-shadow:0 3px 5px rgba(0,0,0,.2)}.editormd-html-preview .editormd-toc-menu>.markdown-toc>ul>li ul,.editormd-preview-container .editormd-toc-menu>.markdown-toc>ul>li ul{width:100%;min-width:180px;border:1px solid #ddd;display:none;background:#fff;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;-o-border-radius:4px;border-radius:4px}.editormd-html-preview .editormd-toc-menu .toc-menu-btn:hover,.editormd-html-preview .editormd-toc-menu>.markdown-toc>ul>li a:hover,.editormd-preview-container .editormd-toc-menu .toc-menu-btn:hover,.editormd-preview-container .editormd-toc-menu>.markdown-toc>ul>li a:hover{background-color:#f6f6f6}.editormd-html-preview .editormd-toc-menu>.markdown-toc>ul>li a,.editormd-preview-container .editormd-toc-menu>.markdown-toc>ul>li a{color:#666;padding:6px 10px;display:block;-webkit-transition:background-color 500ms ease-out;-moz-transition:background-color 500ms ease-out;transition:background-color 500ms ease-out}.editormd-html-preview .editormd-toc-menu>.markdown-toc li,.editormd-preview-container .editormd-toc-menu>.markdown-toc li{position:relative}.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul{position:absolute;top:32px;left:10%;display:none;-webkit-box-shadow:0 3px 5px rgba(0,0,0,.2);-moz-box-shadow:0 3px 5px rgba(0,0,0,.2);-ms-box-shadow:0 3px 5px rgba(0,0,0,.2);-o-box-shadow:0 3px 5px rgba(0,0,0,.2);box-shadow:0 3px 5px rgba(0,0,0,.2)}.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul:after,.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul:before,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul:after,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul:before{pointer-events:pointer-events;position:absolute;left:15px;top:-6px;display:block;content:"";width:0;height:0;border:6px solid transparent;border-width:0 6px 6px;z-index:10}.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul:before,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul:before{border-bottom-color:#ccc}.editormd-html-preview .editormd-toc-menu>.markdown-toc li>ul:after,.editormd-preview-container .editormd-toc-menu>.markdown-toc li>ul:after{border-bottom-color:#fff;top:-5px}.editormd-html-preview .editormd-toc-menu ul,.editormd-preview-container .editormd-toc-menu ul{list-style:none}.editormd-html-preview .editormd-toc-menu a,.editormd-preview-container .editormd-toc-menu a{text-decoration:none}.editormd-html-preview .editormd-toc-menu h1,.editormd-preview-container .editormd-toc-menu h1{font-size:16px;padding:5px 0 10px 10px;line-height:1;border-bottom:1px solid #eee}.editormd-html-preview .editormd-toc-menu h1 .fa,.editormd-preview-container .editormd-toc-menu h1 .fa{padding-left:10px}.editormd-html-preview .editormd-toc-menu .toc-menu-btn,.editormd-preview-container .editormd-toc-menu .toc-menu-btn{color:#666;min-width:180px;padding:5px 10px;border-radius:4px;display:inline-block;-webkit-transition:background-color 500ms ease-out;-moz-transition:background-color 500ms ease-out;transition:background-color 500ms ease-out}.editormd-html-preview .editormd-toc-menu .toc-menu-btn .fa,.editormd-preview-container .editormd-toc-menu .toc-menu-btn .fa{float:right;padding:3px 0 0 10px;font-size:1.3em}.markdown-body .editormd-toc-menu ul{padding-left:0}.markdown-body .highlight pre,.markdown-body pre{line-height:1.6}hr.editormd-page-break{border:1px dotted #ccc;font-size:0;height:2px}@media only print{hr.editormd-page-break{background:0 0;border:none;height:0}}.editormd-html-preview textarea{display:none}.editormd-html-preview hr.editormd-page-break{background:0 0;border:none;height:0}.editormd-preview-close-btn{color:#fff;padding:4px 6px;font-size:18px;-webkit-border-radius:500px;-moz-border-radius:500px;-ms-border-radius:500px;-o-border-radius:500px;border-radius:500px;display:none;background-color:#ccc;position:absolute;top:25px;right:35px;z-index:19;-webkit-transition:background-color 300ms ease-out;-moz-transition:background-color 300ms ease-out;transition:background-color 300ms ease-out}.editormd-preview-close-btn:hover{background-color:#999}.editormd-preview-active{width:100%;padding:40px} \ No newline at end of file diff --git a/src/main/resources/templates/editor/css/style.css b/src/main/resources/templates/editor/css/style.css new file mode 100644 index 0000000000000000000000000000000000000000..0150e3b9acc6b9ce28b484e1585fbf9fa4e1eb4f --- /dev/null +++ b/src/main/resources/templates/editor/css/style.css @@ -0,0 +1,94 @@ +* { + padding: 0; + margin: 0; +} + +*, *:before, *:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{ + margin: 0; + padding: 0; +} + +article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary { + display: block; +} + +audio, canvas, video { + display: inline-block; +} + +img { + border: none; + vertical-align: middle; +} + +ul, ol { + /*list-style: none;*/ +} + +.clear { + *zoom: 1; /* for IE 6/7 */ +} + +.clear:before, .clear:after { + height: 0; + content: ""; + font-size: 0; + display: table; + line-height: 0; /* for Opera */ + visibility: hidden; +} + +.clear:after { + clear: both; +} + +body { + font-size: 14px; + color: #666; + font-family: "Microsoft YaHei", "微软雅黑", Helvetica, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", Helvetica, Tahoma, "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif; + background: #fff; + text-align: center; +} + +#layout { + text-align: left; +} + +#layout > header, .btns { + padding: 15px 0; + width: 90%; + margin: 0 auto; +} + +.btns { + padding-top: 0; +} + +.btns button { + padding: 2px 8px; +} + +#layout > header > h1 { + font-size: 20px; + margin-bottom: 10px; +} + +.btns button, .btn { + padding: 8px 10px; + background: #fff; + border: 1px solid #ddd; + -webkit-border-radius: 3px; + border-radius: 3px; + cursor: pointer; + -webkit-transition: background 300ms ease-out; + transition: background 300ms ease-out; +} + +.btns button:hover, .btn:hover { + background: #f6f6f6; +} \ No newline at end of file diff --git a/src/main/resources/templates/editor/editormd.min.js b/src/main/resources/templates/editor/editormd.min.js new file mode 100644 index 0000000000000000000000000000000000000000..f810e34ff524ac5707281b37f031e689f399f4f5 --- /dev/null +++ b/src/main/resources/templates/editor/editormd.min.js @@ -0,0 +1,3 @@ +/*! Editor.md v1.5.0 | editormd.min.js | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-09 */ +!function(e){"use strict";"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define?define.amd||define(["jquery"],e):window.editormd=e()}(function(){"use strict";var e="undefined"!=typeof jQuery?jQuery:Zepto;if("undefined"!=typeof e){var t=function(e,i){return new t.fn.init(e,i)};t.title=t.$name="Editor.md",t.version="1.5.0",t.homePage="https://pandao.github.io/editor.md/",t.classPrefix="editormd-",t.toolbarModes={full:["undo","redo","|","bold","del","italic","quote","ucwords","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","link","reference-link","image","code","preformatted-text","code-block","table","datetime","emoji","html-entities","pagebreak","|","goto-line","watch","preview","fullscreen","clear","search","|","help","info"],simple:["undo","redo","|","bold","del","italic","quote","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","watch","preview","fullscreen","|","help","info"],mini:["undo","redo","|","watch","preview","|","help","info"]},t.defaults={mode:"gfm",name:"",value:"",theme:"",editorTheme:"default",previewTheme:"",markdown:"",appendMarkdown:"",width:"100%",height:"100%",path:"./lib/",pluginPath:"",delay:300,autoLoadModules:!0,watch:!0,placeholder:"Enjoy Markdown! coding now...",gotoLine:!0,codeFold:!1,autoHeight:!1,autoFocus:!0,autoCloseTags:!0,searchReplace:!0,syncScrolling:!0,readOnly:!1,tabSize:4,indentUnit:4,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,showTrailingSpace:!0,matchBrackets:!0,indentWithTabs:!0,styleSelectedText:!0,matchWordHighlight:!0,styleActiveLine:!0,dialogLockScreen:!0,dialogShowMask:!0,dialogDraggable:!0,dialogMaskBgColor:"#fff",dialogMaskOpacity:.1,fontSize:"13px",saveHTMLToTextarea:!1,disabledKeyMaps:[],onload:function(){},onresize:function(){},onchange:function(){},onwatch:null,onunwatch:null,onpreviewing:function(){},onpreviewed:function(){},onfullscreen:function(){},onfullscreenExit:function(){},onscroll:function(){},onpreviewscroll:function(){},imageUpload:!1,imageFormats:["jpg","jpeg","gif","png","bmp","webp"],imageUploadURL:"",crossDomainUpload:!1,uploadCallbackURL:"",toc:!0,tocm:!1,tocTitle:"",tocDropdown:!1,tocContainer:"",tocStartLevel:1,htmlDecode:!1,pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0,toolbar:!0,toolbarAutoFixed:!0,toolbarIcons:"full",toolbarTitles:{},toolbarHandlers:{ucwords:function(){return t.toolbarHandlers.ucwords},lowercase:function(){return t.toolbarHandlers.lowercase}},toolbarCustomIcons:{lowercase:'a',ucwords:'Aa'},toolbarIconsClass:{undo:"fa-undo",redo:"fa-repeat",bold:"fa-bold",del:"fa-strikethrough",italic:"fa-italic",quote:"fa-quote-left",uppercase:"fa-font",h1:t.classPrefix+"bold",h2:t.classPrefix+"bold",h3:t.classPrefix+"bold",h4:t.classPrefix+"bold",h5:t.classPrefix+"bold",h6:t.classPrefix+"bold","list-ul":"fa-list-ul","list-ol":"fa-list-ol",hr:"fa-minus",link:"fa-link","reference-link":"fa-anchor",image:"fa-picture-o",code:"fa-code","preformatted-text":"fa-file-code-o","code-block":"fa-file-code-o",table:"fa-table",datetime:"fa-clock-o",emoji:"fa-smile-o","html-entities":"fa-copyright",pagebreak:"fa-newspaper-o","goto-line":"fa-terminal",watch:"fa-eye-slash",unwatch:"fa-eye",preview:"fa-desktop",search:"fa-search",fullscreen:"fa-arrows-alt",clear:"fa-eraser",help:"fa-question-circle",info:"fa-info-circle"},toolbarIconTexts:{},lang:{name:"zh-cn",description:"开源在线Markdown编辑器
Open source online Markdown editor.",tocTitle:"目录",toolbar:{undo:"撤销(Ctrl+Z)",redo:"重做(Ctrl+Y)",bold:"粗体",del:"删除线",italic:"斜体",quote:"引用",ucwords:"将每个单词首字母转成大写",uppercase:"将所选转换成大写",lowercase:"将所选转换成小写",h1:"标题1",h2:"标题2",h3:"标题3",h4:"标题4",h5:"标题5",h6:"标题6","list-ul":"无序列表","list-ol":"有序列表",hr:"横线",link:"链接","reference-link":"引用链接",image:"添加图片",code:"行内代码","preformatted-text":"预格式文本 / 代码块(缩进风格)","code-block":"代码块(多语言风格)",table:"添加表格",datetime:"日期时间",emoji:"Emoji表情","html-entities":"HTML实体字符",pagebreak:"插入分页符","goto-line":"跳转到行",watch:"关闭实时预览",unwatch:"开启实时预览",preview:"全窗口预览HTML(按 Shift + ESC还原)",fullscreen:"全屏(按ESC还原)",clear:"清空",search:"搜索",help:"使用帮助",info:"关于"+t.title},buttons:{enter:"确定",cancel:"取消",close:"关闭"},dialog:{link:{title:"添加链接",url:"链接地址",urlTitle:"链接标题",urlEmpty:"错误:请填写链接地址。"},referenceLink:{title:"添加引用链接",name:"引用名称",url:"链接地址",urlId:"链接ID",urlTitle:"链接标题",nameEmpty:"错误:引用链接的名称不能为空。",idEmpty:"错误:请填写引用链接的ID。",urlEmpty:"错误:请填写引用链接的URL地址。"},image:{title:"添加图片",url:"图片地址",link:"图片链接",alt:"图片描述",uploadButton:"本地上传",imageURLEmpty:"错误:图片地址不能为空。",uploadFileEmpty:"错误:上传的图片不能为空。",formatNotAllowed:"错误:只允许上传图片文件,允许上传的图片文件格式有:"},preformattedText:{title:"添加预格式文本或代码块",emptyAlert:"错误:请填写预格式文本或代码的内容。"},codeBlock:{title:"添加代码块",selectLabel:"代码语言:",selectDefaultText:"请选择代码语言",otherLanguage:"其他语言",unselectedLanguageAlert:"错误:请选择代码所属的语言类型。",codeEmptyAlert:"错误:请填写代码内容。"},htmlEntities:{title:"HTML 实体字符"},help:{title:"使用帮助"}}}},t.classNames={tex:t.classPrefix+"tex"},t.dialogZindex=99999,t.$katex=null,t.$marked=null,t.$CodeMirror=null,t.$prettyPrint=null;var i,o;t.prototype=t.fn={state:{watching:!1,loaded:!1,preview:!1,fullscreen:!1},init:function(i,o){o=o||{},"object"==typeof i&&(o=i);var r=this.classPrefix=t.classPrefix,n=this.settings=e.extend(!0,t.defaults,o);i="object"==typeof i?n.id:i;var a=this.editor=e("#"+i);this.id=i,this.lang=n.lang;var s=this.classNames={textarea:{html:r+"html-textarea",markdown:r+"markdown-textarea"}};n.pluginPath=""===n.pluginPath?n.path+"../plugins/":n.pluginPath,this.state.watching=n.watch?!0:!1,a.hasClass("editormd")||a.addClass("editormd"),a.css({width:"number"==typeof n.width?n.width+"px":n.width,height:"number"==typeof n.height?n.height+"px":n.height}),n.autoHeight&&a.css("height","auto");var l=this.markdownTextarea=a.children("textarea");l.length<1&&(a.append(""),l=this.markdownTextarea=a.children("textarea")),l.addClass(s.textarea.markdown).attr("placeholder",n.placeholder),("undefined"==typeof l.attr("name")||""===l.attr("name"))&&l.attr("name",""!==n.name?n.name:i+"-markdown-doc");var c=[n.readOnly?"":'',n.saveHTMLToTextarea?'':"",'
','
','
'].join("\n");return a.append(c).addClass(r+"vertical"),""!==n.theme&&a.addClass(r+"theme-"+n.theme),this.mask=a.children("."+r+"mask"),this.containerMask=a.children("."+r+"container-mask"),""!==n.markdown&&l.val(n.markdown),""!==n.appendMarkdown&&l.val(l.val()+n.appendMarkdown),this.htmlTextarea=a.children("."+s.textarea.html),this.preview=a.children("."+r+"preview"),this.previewContainer=this.preview.children("."+r+"preview-container"),""!==n.previewTheme&&this.preview.addClass(r+"preview-theme-"+n.previewTheme),"function"==typeof define&&define.amd&&("undefined"!=typeof katex&&(t.$katex=katex),n.searchReplace&&!n.readOnly&&(t.loadCSS(n.path+"codemirror/addon/dialog/dialog"),t.loadCSS(n.path+"codemirror/addon/search/matchesonscrollbar"))),"function"==typeof define&&define.amd||!n.autoLoadModules?("undefined"!=typeof CodeMirror&&(t.$CodeMirror=CodeMirror),"undefined"!=typeof marked&&(t.$marked=marked),this.setCodeMirror().setToolbar().loadedDisplay()):this.loadQueues(),this},loadQueues:function(){var e=this,i=this.settings,o=i.path,r=function(){return t.isIE8?void e.loadedDisplay():void(i.flowChart||i.sequenceDiagram?t.loadScript(o+"raphael.min",function(){t.loadScript(o+"underscore.min",function(){!i.flowChart&&i.sequenceDiagram?t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()}):i.flowChart&&!i.sequenceDiagram?t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){e.loadedDisplay()})}):i.flowChart&&i.sequenceDiagram&&t.loadScript(o+"flowchart.min",function(){t.loadScript(o+"jquery.flowchart.min",function(){t.loadScript(o+"sequence-diagram.min",function(){e.loadedDisplay()})})})})}):e.loadedDisplay())};return t.loadCSS(o+"codemirror/codemirror.min"),i.searchReplace&&!i.readOnly&&(t.loadCSS(o+"codemirror/addon/dialog/dialog"),t.loadCSS(o+"codemirror/addon/search/matchesonscrollbar")),i.codeFold&&t.loadCSS(o+"codemirror/addon/fold/foldgutter"),t.loadScript(o+"codemirror/codemirror.min",function(){t.$CodeMirror=CodeMirror,t.loadScript(o+"codemirror/modes.min",function(){t.loadScript(o+"codemirror/addons.min",function(){return e.setCodeMirror(),"gfm"!==i.mode&&"markdown"!==i.mode?(e.loadedDisplay(),!1):(e.setToolbar(),void t.loadScript(o+"marked.min",function(){t.$marked=marked,i.previewCodeHighlight?t.loadScript(o+"prettify.min",function(){r()}):r()}))})})}),this},setTheme:function(e){var t=this.editor,i=this.settings.theme,o=this.classPrefix+"theme-";return t.removeClass(o+i).addClass(o+e),this.settings.theme=e,this},setEditorTheme:function(e){var i=this.settings;return i.editorTheme=e,"default"!==e&&t.loadCSS(i.path+"codemirror/theme/"+i.editorTheme),this.cm.setOption("theme",e),this},setCodeMirrorTheme:function(e){return this.setEditorTheme(e),this},setPreviewTheme:function(e){var t=this.preview,i=this.settings.previewTheme,o=this.classPrefix+"preview-theme-";return t.removeClass(o+i).addClass(o+e),this.settings.previewTheme=e,this},setCodeMirror:function(){var e=this.settings,i=this.editor;"default"!==e.editorTheme&&t.loadCSS(e.path+"codemirror/theme/"+e.editorTheme);var o={mode:e.mode,theme:e.editorTheme,tabSize:e.tabSize,dragDrop:!1,autofocus:e.autoFocus,autoCloseTags:e.autoCloseTags,readOnly:e.readOnly?"nocursor":!1,indentUnit:e.indentUnit,lineNumbers:e.lineNumbers,lineWrapping:e.lineWrapping,extraKeys:{"Ctrl-Q":function(e){e.foldCode(e.getCursor())}},foldGutter:e.codeFold,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:e.matchBrackets,indentWithTabs:e.indentWithTabs,styleActiveLine:e.styleActiveLine,styleSelectedText:e.styleSelectedText,autoCloseBrackets:e.autoCloseBrackets,showTrailingSpace:e.showTrailingSpace,highlightSelectionMatches:e.matchWordHighlight?{showToken:"onselected"===e.matchWordHighlight?!1:/\w/}:!1};return this.codeEditor=this.cm=t.$CodeMirror.fromTextArea(this.markdownTextarea[0],o),this.codeMirror=this.cmElement=i.children(".CodeMirror"),""!==e.value&&this.cm.setValue(e.value),this.codeMirror.css({fontSize:e.fontSize,width:e.watch?"50%":"100%"}),e.autoHeight&&(this.codeMirror.css("height","auto"),this.cm.setOption("viewportMargin",1/0)),e.lineNumbers||this.codeMirror.find(".CodeMirror-gutters").css("border-right","none"),this},getCodeMirrorOption:function(e){return this.cm.getOption(e)},setCodeMirrorOption:function(e,t){return this.cm.setOption(e,t),this},addKeyMap:function(e,t){return this.cm.addKeyMap(e,t),this},removeKeyMap:function(e){return this.cm.removeKeyMap(e),this},gotoLine:function(t){var i=this.settings;if(!i.gotoLine)return this;var o=this.cm,r=(this.editor,o.lineCount()),n=this.preview;if("string"==typeof t&&("last"===t&&(t=r),"first"===t&&(t=1)),"number"!=typeof t)return alert("Error: The line number must be an integer."),this;if(t=parseInt(t)-1,t>r)return alert("Error: The line number range 1-"+r),this;o.setCursor({line:t,ch:0});var a=o.getScrollInfo(),s=a.clientHeight,l=o.charCoords({line:t,ch:0},"local");if(o.scrollTo(null,(l.top+l.bottom-s)/2),i.watch){var c=this.codeMirror.find(".CodeMirror-scroll")[0],h=e(c).height(),d=c.scrollTop,u=d/c.scrollHeight;n.scrollTop(0===d?0:d+h>=c.scrollHeight-16?n[0].scrollHeight:n[0].scrollHeight*u)}return o.focus(),this},extend:function(){return"undefined"!=typeof arguments[1]&&("function"==typeof arguments[1]&&(arguments[1]=e.proxy(arguments[1],this)),this[arguments[0]]=arguments[1]),"object"==typeof arguments[0]&&"undefined"==typeof arguments[0].length&&e.extend(!0,this,arguments[0]),this},set:function(t,i){return"undefined"!=typeof i&&"function"==typeof i&&(i=e.proxy(i,this)),this[t]=i,this},config:function(t,i){var o=this.settings;return"object"==typeof t&&(o=e.extend(!0,o,t)),"string"==typeof t&&(o[t]=i),this.settings=o,this.recreate(),this},on:function(t,i){var o=this.settings;return"undefined"!=typeof o["on"+t]&&(o["on"+t]=e.proxy(i,this)),this},off:function(e){var t=this.settings;return"undefined"!=typeof t["on"+e]&&(t["on"+e]=function(){}),this},showToolbar:function(t){var i=this.settings;return i.readOnly?this:(i.toolbar&&(this.toolbar.length<1||""===this.toolbar.find("."+this.classPrefix+"menu").html())&&this.setToolbar(),i.toolbar=!0,this.toolbar.show(),this.resize(),e.proxy(t||function(){},this)(),this)},hideToolbar:function(t){var i=this.settings;return i.toolbar=!1,this.toolbar.hide(),this.resize(),e.proxy(t||function(){},this)(),this},setToolbarAutoFixed:function(t){var i=this.state,o=this.editor,r=this.toolbar,n=this.settings;"undefined"!=typeof t&&(n.toolbarAutoFixed=t);var a=function(){var t=e(window),i=t.scrollTop();return n.toolbarAutoFixed?void r.css(i-o.offset().top>10&&i
    ';i.append(n),r=this.toolbar=i.children("."+o+"toolbar")}if(!e.toolbar)return r.hide(),this;r.show();for(var a="function"==typeof e.toolbarIcons?e.toolbarIcons():"string"==typeof e.toolbarIcons?t.toolbarModes[e.toolbarIcons]:e.toolbarIcons,s=r.find("."+this.classPrefix+"menu"),l="",c=!1,h=0,d=a.length;d>h;h++){var u=a[h];if("||"===u)c=!0;else if("|"===u)l+='
  • |
  • ';else{var f=/h(\d)/.test(u),g=u;"watch"!==u||e.watch||(g="unwatch");var p=e.lang.toolbar[g],m=e.toolbarIconTexts[g],w=e.toolbarIconsClass[g];p="undefined"==typeof p?"":p,m="undefined"==typeof m?"":m,w="undefined"==typeof w?"":w;var v=c?'
  • ':"
  • ";"undefined"!=typeof e.toolbarCustomIcons[u]&&"function"!=typeof e.toolbarCustomIcons[u]?v+=e.toolbarCustomIcons[u]:(v+='',v+=''+(f?u.toUpperCase():""===w?m:"")+"",v+=""),v+="
  • ",l=c?v+l:l+v}}return s.html(l),s.find('[title="Lowercase"]').attr("title",e.lang.toolbar.lowercase),s.find('[title="ucwords"]').attr("title",e.lang.toolbar.ucwords),this.setToolbarHandler(),this.setToolbarAutoFixed(),this},dialogLockScreen:function(){return e.proxy(t.dialogLockScreen,this)(),this},dialogShowMask:function(i){return e.proxy(t.dialogShowMask,this)(i),this},getToolbarHandles:function(e){var i=this.toolbarHandlers=t.toolbarHandlers;return e&&"undefined"!=typeof toolbarIconHandlers[e]?i[e]:i},setToolbarHandler:function(){var i=this,o=this.settings;if(!o.toolbar||o.readOnly)return this;var r=this.toolbar,n=this.cm,a=this.classPrefix,s=this.toolbarIcons=r.find("."+a+"menu > li > a"),l=this.getToolbarHandles();return s.bind(t.mouseOrTouch("click","touchend"),function(t){var r=e(this).children(".fa"),a=r.attr("name"),s=n.getCursor(),c=n.getSelection();return""!==a?(i.activeIcon=r,"undefined"!=typeof l[a]?e.proxy(l[a],i)(n):"undefined"!=typeof o.toolbarHandlers[a]&&e.proxy(o.toolbarHandlers[a],i)(n,r,s,c),"link"!==a&&"reference-link"!==a&&"image"!==a&&"code-block"!==a&&"preformatted-text"!==a&&"watch"!==a&&"preview"!==a&&"search"!==a&&"fullscreen"!==a&&"info"!==a&&n.focus(),!1):void 0}),this},createDialog:function(i){return e.proxy(t.createDialog,this)(i)},createInfoDialog:function(){var e=this,i=this.editor,o=this.classPrefix,r=['
    ','
    ','

    '+t.title+"v"+t.version+"

    ","

    "+this.lang.description+"

    ",'

    '+t.homePage+'

    ','

    Copyright © 2015 Pandao, The MIT License.

    ',"
    ",'',"
    "].join("\n");i.append(r);var n=this.infoDialog=i.children("."+o+"dialog-info");return n.find("."+o+"dialog-close").bind(t.mouseOrTouch("click","touchend"),function(){e.hideInfoDialog()}),n.css("border",t.isIE8?"1px solid #ddd":"").css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},infoDialogPosition:function(){var t=this.infoDialog,i=function(){t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"})};return i(),e(window).resize(i),this},showInfoDialog:function(){e("html,body").css("overflow-x","hidden");var i=this.editor,o=this.settings,r=this.infoDialog=i.children("."+this.classPrefix+"dialog-info");return r.length<1&&this.createInfoDialog(),this.lockScreen(!0),this.mask.css({opacity:o.dialogMaskOpacity,backgroundColor:o.dialogMaskBgColor}).show(),r.css("z-index",t.dialogZindex).show(),this.infoDialogPosition(),this},hideInfoDialog:function(){return e("html,body").css("overflow-x",""),this.infoDialog.hide(),this.mask.hide(),this.lockScreen(!1),this},lockScreen:function(e){return t.lockScreen(e),this.resize(),this},recreate:function(){var e=this.editor,t=this.settings;return this.codeMirror.remove(),this.setCodeMirror(),t.readOnly||(e.find(".editormd-dialog").length>0&&e.find(".editormd-dialog").remove(),t.toolbar&&(this.getToolbarHandles(),this.setToolbar())),this.loadedDisplay(!0),this},previewCodeHighlight:function(){var e=this.settings,t=this.previewContainer;return e.previewCodeHighlight&&(t.find("pre").addClass("prettyprint linenums"),"undefined"!=typeof prettyPrint&&prettyPrint()),this},katexRender:function(){return null===i?this:(this.previewContainer.find("."+t.classNames.tex).each(function(){var i=e(this);t.$katex.render(i.text(),i[0]),i.find(".katex").css("font-size","1.6em")}),this)},flowChartAndSequenceDiagramRender:function(){var i=this,r=this.settings,n=this.previewContainer;if(t.isIE8)return this;if(r.flowChart){if(null===o)return this;n.find(".flowchart").flowChart()}r.sequenceDiagram&&n.find(".sequence-diagram").sequenceDiagram({theme:"simple"});var a=i.preview,s=i.codeMirror,l=s.find(".CodeMirror-scroll"),c=l.height(),h=l.scrollTop(),d=h/l[0].scrollHeight,u=0;a.find(".markdown-toc-list").each(function(){u+=e(this).height()});var f=a.find(".editormd-toc-menu").height();return f=f?f:0,a.scrollTop(0===h?0:h+c>=l[0].scrollHeight-16?a[0].scrollHeight:(a[0].scrollHeight+u+f)*d),this},registerKeyMaps:function(i){var o=this,r=this.cm,n=this.settings,a=t.toolbarHandlers,s=n.disabledKeyMaps;if(i=i||null){for(var l in i)if(e.inArray(l,s)<0){var c={};c[l]=i[l],r.addKeyMap(i)}}else{for(var h in t.keyMaps){var d=t.keyMaps[h],u="string"==typeof d?e.proxy(a[d],o):e.proxy(d,o);if(e.inArray(h,["F9","F10","F11"])<0&&e.inArray(h,s)<0){var f={};f[h]=u,r.addKeyMap(f)}}e(window).keydown(function(t){var i={120:"F9",121:"F10",122:"F11"};if(e.inArray(i[t.keyCode],s)<0)switch(t.keyCode){case 120:return e.proxy(a.watch,o)(),!1;case 121:return e.proxy(a.preview,o)(),!1;case 122:return e.proxy(a.fullscreen,o)(),!1}})}return this},bindScrollEvent:function(){var i=this,o=this.preview,r=this.settings,n=this.codeMirror,a=t.mouseOrTouch;if(!r.syncScrolling)return this;var s=function(){n.find(".CodeMirror-scroll").bind(a("scroll","touchmove"),function(t){var n=e(this).height(),a=e(this).scrollTop(),s=a/e(this)[0].scrollHeight,l=0;o.find(".markdown-toc-list").each(function(){l+=e(this).height()});var c=o.find(".editormd-toc-menu").height();c=c?c:0,o.scrollTop(0===a?0:a+n>=e(this)[0].scrollHeight-16?o[0].scrollHeight:(o[0].scrollHeight+l+c)*s),e.proxy(r.onscroll,i)(t)})},l=function(){n.find(".CodeMirror-scroll").unbind(a("scroll","touchmove"))},c=function(){o.bind(a("scroll","touchmove"),function(t){var o=e(this).height(),a=e(this).scrollTop(),s=a/e(this)[0].scrollHeight,l=n.find(".CodeMirror-scroll");l.scrollTop(0===a?0:a+o>=e(this)[0].scrollHeight?l[0].scrollHeight:l[0].scrollHeight*s),e.proxy(r.onpreviewscroll,i)(t)})},h=function(){o.unbind(a("scroll","touchmove"))};return n.bind({mouseover:s,mouseout:l,touchstart:s,touchend:l}),"single"===r.syncScrolling?this:(o.bind({mouseover:c,mouseout:h,touchstart:c,touchend:h}),this)},bindChangeEvent:function(){var e=this,t=this.cm,o=this.settings;return o.syncScrolling?(t.on("change",function(t,r){o.watch&&e.previewContainer.css("padding",o.autoHeight?"20px 20px 50px 40px":"20px"),i=setTimeout(function(){clearTimeout(i),e.save(),i=null},o.delay)}),this):this},loadedDisplay:function(t){t=t||!1;var i=this,o=this.editor,r=this.preview,n=this.settings;return this.containerMask.hide(),this.save(),n.watch&&r.show(),o.data("oldWidth",o.width()).data("oldHeight",o.height()),this.resize(),this.registerKeyMaps(),e(window).resize(function(){i.resize()}),this.bindScrollEvent().bindChangeEvent(),t||e.proxy(n.onload,this)(),this.state.loaded=!0,this},width:function(e){return this.editor.css("width","number"==typeof e?e+"px":e),this.resize(),this},height:function(e){return this.editor.css("height","number"==typeof e?e+"px":e),this.resize(),this},resize:function(t,i){t=t||null,i=i||null;var o=this.state,r=this.editor,n=this.preview,a=this.toolbar,s=this.settings,l=this.codeMirror;if(t&&r.css("width","number"==typeof t?t+"px":t),!s.autoHeight||o.fullscreen||o.preview?(i&&r.css("height","number"==typeof i?i+"px":i),o.fullscreen&&r.height(e(window).height()),s.toolbar&&!s.readOnly?l.css("margin-top",a.height()+1).height(r.height()-a.height()):l.css("margin-top",0).height(r.height())):(r.css("height","auto"),l.css("height","auto")),s.watch)if(l.width(r.width()/2),n.width(o.preview?r.width():r.width()/2),this.previewContainer.css("padding",s.autoHeight?"20px 20px 50px 40px":"20px"),s.toolbar&&!s.readOnly?n.css("top",a.height()+1):n.css("top",0),!s.autoHeight||o.fullscreen||o.preview){var c=s.toolbar&&!s.readOnly?r.height()-a.height():r.height();n.height(c)}else n.height("");else l.width(r.width()),n.hide();return o.loaded&&e.proxy(s.onresize,this)(),this},save:function(){if(null===i)return this;var r=this,n=this.state,a=this.settings,s=this.cm,l=s.getValue(),c=this.previewContainer;if("gfm"!==a.mode&&"markdown"!==a.mode)return this.markdownTextarea.val(l),this;var h=t.$marked,d=this.markdownToC=[],u=this.markedRendererOptions={toc:a.toc,tocm:a.tocm,tocStartLevel:a.tocStartLevel,pageBreak:a.pageBreak,taskList:a.taskList,emoji:a.emoji,tex:a.tex,atLink:a.atLink,emailLink:a.emailLink,flowChart:a.flowChart,sequenceDiagram:a.sequenceDiagram,previewCodeHighlight:a.previewCodeHighlight},f=this.markedOptions={renderer:t.markedRenderer(d,u),gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:a.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};h.setOptions(f);var g=t.$marked(l,f);if(g=t.filterHTMLTags(g,a.htmlDecode),this.markdownTextarea.text(l),s.save(),a.saveHTMLToTextarea&&this.htmlTextarea.text(g),a.watch||!a.watch&&n.preview){if(c.html(g),this.previewCodeHighlight(),a.toc){var p=""===a.tocContainer?c:e(a.tocContainer),m=p.find("."+this.classPrefix+"toc-menu");p.attr("previewContainer",""===a.tocContainer?"true":"false"),""!==a.tocContainer&&m.length>0&&m.remove(),t.markdownToCRenderer(d,p,a.tocDropdown,a.tocStartLevel),(a.tocDropdown||p.find("."+this.classPrefix+"toc-menu").length>0)&&t.tocDropdownMenu(p,""!==a.tocTitle?a.tocTitle:this.lang.tocTitle),""!==a.tocContainer&&c.find(".markdown-toc").css("border","none")}a.tex&&(!t.kaTeXLoaded&&a.autoLoadModules?t.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,r.katexRender()}):(t.$katex=katex,this.katexRender())),(a.flowChart||a.sequenceDiagram)&&(o=setTimeout(function(){clearTimeout(o),r.flowChartAndSequenceDiagramRender(),o=null},10)),n.loaded&&e.proxy(a.onchange,this)()}return this},focus:function(){return this.cm.focus(),this},setCursor:function(e){return this.cm.setCursor(e),this},getCursor:function(){return this.cm.getCursor()},setSelection:function(e,t){return this.cm.setSelection(e,t),this},getSelection:function(){return this.cm.getSelection()},setSelections:function(e){return this.cm.setSelections(e),this},getSelections:function(){return this.cm.getSelections()},replaceSelection:function(e){return this.cm.replaceSelection(e),this},insertValue:function(e){return this.replaceSelection(e),this},appendMarkdown:function(e){var t=(this.settings,this.cm);return t.setValue(t.getValue()+e),this},setMarkdown:function(e){return this.cm.setValue(e||this.settings.markdown),this},getMarkdown:function(){return this.cm.getValue()},getValue:function(){return this.cm.getValue()},setValue:function(e){return this.cm.setValue(e),this},clear:function(){return this.cm.setValue(""),this},getHTML:function(){return this.settings.saveHTMLToTextarea?this.htmlTextarea.val():(alert("Error: settings.saveHTMLToTextarea == false"),!1)},getTextareaSavedHTML:function(){return this.getHTML()},getPreviewedHTML:function(){return this.settings.watch?this.previewContainer.html():(alert("Error: settings.watch == false"),!1)},watch:function(t){var o=this.settings;if(e.inArray(o.mode,["gfm","markdown"])<0)return this;if(this.state.watching=o.watch=!0,this.preview.show(),this.toolbar){var r=o.toolbarIconsClass.watch,n=o.toolbarIconsClass.unwatch,a=this.toolbar.find(".fa[name=watch]");a.parent().attr("title",o.lang.toolbar.watch),a.removeClass(n).addClass(r)}return this.codeMirror.css("border-right","1px solid #ddd").width(this.editor.width()/2),i=0,this.save().resize(),o.onwatch||(o.onwatch=t||function(){}),e.proxy(o.onwatch,this)(),this},unwatch:function(t){var i=this.settings;if(this.state.watching=i.watch=!1,this.preview.hide(),this.toolbar){var o=i.toolbarIconsClass.watch,r=i.toolbarIconsClass.unwatch,n=this.toolbar.find(".fa[name=watch]");n.parent().attr("title",i.lang.toolbar.unwatch),n.removeClass(o).addClass(r)}return this.codeMirror.css("border-right","none").width(this.editor.width()),this.resize(),i.onunwatch||(i.onunwatch=t||function(){}),e.proxy(i.onunwatch,this)(),this},show:function(t){t=t||function(){};var i=this;return this.editor.show(0,function(){e.proxy(t,i)()}),this},hide:function(t){t=t||function(){};var i=this;return this.editor.hide(0,function(){e.proxy(t,i)()}),this},previewing:function(){var i=this,o=this.editor,r=this.preview,n=this.toolbar,a=this.settings,s=this.codeMirror,l=this.previewContainer;if(e.inArray(a.mode,["gfm","markdown"])<0)return this;a.toolbar&&n&&(n.toggle(),n.find(".fa[name=preview]").toggleClass("active")),s.toggle();var c=function(e){e.shiftKey&&27===e.keyCode&&i.previewed()};"none"===s.css("display")?(this.state.preview=!0,this.state.fullscreen&&r.css("background","#fff"),o.find("."+this.classPrefix+"preview-close-btn").show().bind(t.mouseOrTouch("click","touchend"),function(){i.previewed()}),a.watch?l.css("padding",""):this.save(),l.addClass(this.classPrefix+"preview-active"),r.show().css({position:"",top:0,width:o.width(),height:a.autoHeight&&!this.state.fullscreen?"auto":o.height()}),this.state.loaded&&e.proxy(a.onpreviewing,this)(),e(window).bind("keyup",c)):(e(window).unbind("keyup",c),this.previewed())},previewed:function(){var i=this.editor,o=this.preview,r=this.toolbar,n=this.settings,a=this.previewContainer,s=i.find("."+this.classPrefix+"preview-close-btn");return this.state.preview=!1,this.codeMirror.show(),n.toolbar&&r.show(),o[n.watch?"show":"hide"](),s.hide().unbind(t.mouseOrTouch("click","touchend")),a.removeClass(this.classPrefix+"preview-active"),n.watch&&a.css("padding","20px"),o.css({background:null,position:"absolute",width:i.width()/2,height:n.autoHeight&&!this.state.fullscreen?"auto":i.height()-r.height(),top:n.toolbar?r.height():0}),this.state.loaded&&e.proxy(n.onpreviewed,this)(),this},fullscreen:function(){var t=this,i=this.state,o=this.editor,r=(this.preview,this.toolbar),n=this.settings,a=this.classPrefix+"fullscreen";r&&r.find(".fa[name=fullscreen]").parent().toggleClass("active");var s=function(e){e.shiftKey||27!==e.keyCode||i.fullscreen&&t.fullscreenExit()};return o.hasClass(a)?(e(window).unbind("keyup",s),this.fullscreenExit()):(i.fullscreen=!0,e("html,body").css("overflow","hidden"),o.css({width:e(window).width(),height:e(window).height()}).addClass(a),this.resize(),e.proxy(n.onfullscreen,this)(),e(window).bind("keyup",s)),this},fullscreenExit:function(){var t=this.editor,i=this.settings,o=this.toolbar,r=this.classPrefix+"fullscreen";return this.state.fullscreen=!1,o&&o.find(".fa[name=fullscreen]").parent().removeClass("active"),e("html,body").css("overflow",""),t.css({width:t.data("oldWidth"),height:t.data("oldHeight")}).removeClass(r),this.resize(),e.proxy(i.onfullscreenExit,this)(),this},executePlugin:function(i,o){var r=this,n=this.cm,a=this.settings;return o=a.pluginPath+o,"function"==typeof define?"undefined"==typeof this[i]?(alert("Error: "+i+" plugin is not found, you are not load this plugin."),this):(this[i](n),this):(e.inArray(o,t.loadFiles.plugin)<0?t.loadPlugin(o,function(){t.loadPlugins[i]=r[i],r[i](n)}):e.proxy(t.loadPlugins[i],this)(n),this)},search:function(e){var t=this.settings;return t.searchReplace?(t.readOnly||this.cm.execCommand(e||"find"),this):(alert("Error: settings.searchReplace == false"),this)},searchReplace:function(){return this.search("replace"),this},searchReplaceAll:function(){return this.search("replaceAll"),this}},t.fn.init.prototype=t.fn,t.dialogLockScreen=function(){var t=this.settings||{dialogLockScreen:!0};t.dialogLockScreen&&(e("html,body").css("overflow","hidden"),this.resize())},t.dialogShowMask=function(t){var i=this.editor,o=this.settings||{dialogShowMask:!0};t.css({top:(e(window).height()-t.height())/2+"px",left:(e(window).width()-t.width())/2+"px"}),o.dialogShowMask&&i.children("."+this.classPrefix+"mask").css("z-index",parseInt(t.css("z-index"))-1).show()},t.toolbarHandlers={undo:function(){this.cm.undo()},redo:function(){this.cm.redo()},bold:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("**"+i+"**"),""===i&&e.setCursor(t.line,t.ch+2)},del:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("~~"+i+"~~"),""===i&&e.setCursor(t.line,t.ch+2)},italic:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("*"+i+"*"),""===i&&e.setCursor(t.line,t.ch+1)},quote:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("> "+i),e.setCursor(t.line,t.ch+2)):e.replaceSelection("> "+i)},ucfirst:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.firstUpperCase(i)),e.setSelections(o)},ucwords:function(){var e=this.cm,i=e.getSelection(),o=e.listSelections();e.replaceSelection(t.wordsFirstUpperCase(i)),e.setSelections(o)},uppercase:function(){var e=this.cm,t=e.getSelection(),i=e.listSelections();e.replaceSelection(t.toUpperCase()),e.setSelections(i)},lowercase:function(){var e=this.cm,t=(e.getCursor(),e.getSelection()),i=e.listSelections();e.replaceSelection(t.toLowerCase()),e.setSelections(i)},h1:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("# "+i),e.setCursor(t.line,t.ch+2)):e.replaceSelection("# "+i)},h2:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0), +e.replaceSelection("## "+i),e.setCursor(t.line,t.ch+3)):e.replaceSelection("## "+i)},h3:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("### "+i),e.setCursor(t.line,t.ch+4)):e.replaceSelection("### "+i)},h4:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("#### "+i),e.setCursor(t.line,t.ch+5)):e.replaceSelection("#### "+i)},h5:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("##### "+i),e.setCursor(t.line,t.ch+6)):e.replaceSelection("##### "+i)},h6:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();0!==t.ch?(e.setCursor(t.line,0),e.replaceSelection("###### "+i),e.setCursor(t.line,t.ch+7)):e.replaceSelection("###### "+i)},"list-ul":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("- "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":"- "+i[o];e.replaceSelection(i.join("\n"))}},"list-ol":function(){var e=this.cm,t=(e.getCursor(),e.getSelection());if(""===t)e.replaceSelection("1. "+t);else{for(var i=t.split("\n"),o=0,r=i.length;r>o;o++)i[o]=""===i[o]?"":o+1+". "+i[o];e.replaceSelection(i.join("\n"))}},hr:function(){{var e=this.cm,t=e.getCursor();e.getSelection()}e.replaceSelection((0!==t.ch?"\n\n":"\n")+"------------\n\n")},tex:function(){if(!this.settings.tex)return alert("settings.tex === false"),this;var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("$$"+i+"$$"),""===i&&e.setCursor(t.line,t.ch+2)},link:function(){this.executePlugin("linkDialog","link-dialog/link-dialog")},"reference-link":function(){this.executePlugin("referenceLinkDialog","reference-link-dialog/reference-link-dialog")},pagebreak:function(){if(!this.settings.pageBreak)return alert("settings.pageBreak === false"),this;{var e=this.cm;e.getSelection()}e.replaceSelection("\r\n[========]\r\n")},image:function(){this.executePlugin("imageDialog","image-dialog/image-dialog")},code:function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection("`"+i+"`"),""===i&&e.setCursor(t.line,t.ch+1)},"code-block":function(){this.executePlugin("codeBlockDialog","code-block-dialog/code-block-dialog")},"preformatted-text":function(){this.executePlugin("preformattedTextDialog","preformatted-text-dialog/preformatted-text-dialog")},table:function(){this.executePlugin("tableDialog","table-dialog/table-dialog")},datetime:function(){var e=this.cm,i=(e.getSelection(),new Date,this.settings.lang.name),o=t.dateFormat()+" "+t.dateFormat("zh-cn"===i||"zh-tw"===i?"cn-week-day":"week-day");e.replaceSelection(o)},emoji:function(){this.executePlugin("emojiDialog","emoji-dialog/emoji-dialog")},"html-entities":function(){this.executePlugin("htmlEntitiesDialog","html-entities-dialog/html-entities-dialog")},"goto-line":function(){this.executePlugin("gotoLineDialog","goto-line-dialog/goto-line-dialog")},watch:function(){this[this.settings.watch?"unwatch":"watch"]()},preview:function(){this.previewing()},fullscreen:function(){this.fullscreen()},clear:function(){this.clear()},search:function(){this.search()},help:function(){this.executePlugin("helpDialog","help-dialog/help-dialog")},info:function(){this.showInfoDialog()}},t.keyMaps={"Ctrl-1":"h1","Ctrl-2":"h2","Ctrl-3":"h3","Ctrl-4":"h4","Ctrl-5":"h5","Ctrl-6":"h6","Ctrl-B":"bold","Ctrl-D":"datetime","Ctrl-E":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.emoji?(e.replaceSelection(":"+i+":"),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.emoji == false")},"Ctrl-Alt-G":"goto-line","Ctrl-H":"hr","Ctrl-I":"italic","Ctrl-K":"code","Ctrl-L":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+1)},"Ctrl-U":"list-ul","Shift-Ctrl-A":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();return this.settings.atLink?(e.replaceSelection("@"+i),void(""===i&&e.setCursor(t.line,t.ch+1))):void alert("Error: settings.atLink == false")},"Shift-Ctrl-C":"code","Shift-Ctrl-Q":"quote","Shift-Ctrl-S":"del","Shift-Ctrl-K":"tex","Shift-Alt-C":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection();e.replaceSelection(["```",i,"```"].join("\n")),""===i&&e.setCursor(t.line,t.ch+3)},"Shift-Ctrl-Alt-C":"code-block","Shift-Ctrl-H":"html-entities","Shift-Alt-H":"help","Shift-Ctrl-E":"emoji","Shift-Ctrl-U":"uppercase","Shift-Alt-U":"ucwords","Shift-Ctrl-Alt-U":"ucfirst","Shift-Alt-L":"lowercase","Shift-Ctrl-I":function(){var e=this.cm,t=e.getCursor(),i=e.getSelection(),o=""===i?"":' "'+i+'"';e.replaceSelection("!["+i+"]("+o+")"),""===i&&e.setCursor(t.line,t.ch+4)},"Shift-Ctrl-Alt-I":"image","Shift-Ctrl-L":"link","Shift-Ctrl-O":"list-ol","Shift-Ctrl-P":"preformatted-text","Shift-Ctrl-T":"table","Shift-Alt-P":"pagebreak",F9:"watch",F10:"preview",F11:"fullscreen"};var r=function(e){return String.prototype.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};t.trim=r;var n=function(e){return e.toLowerCase().replace(/\b(\w)|\s(\w)/g,function(e){return e.toUpperCase()})};t.ucwords=t.wordsFirstUpperCase=n;var a=function(e){return e.toLowerCase().replace(/\b(\w)/,function(e){return e.toUpperCase()})};return t.firstUpperCase=t.ucfirst=a,t.urls={atLinkBase:"https://github.com/"},t.regexs={atLink:/@(\w+)/g,email:/(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,emailLink:/(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,emoji:/:([\w\+-]+):/g,emojiDatetime:/(\d{2}:\d{2}:\d{2})/g,twemoji:/:(tw-([\w]+)-?(\w+)?):/g,fontAwesome:/:(fa-([\w]+)(-(\w+)){0,}):/g,editormdLogo:/:(editormd-logo-?(\w+)?):/g,pageBreak:/^\[[=]{8,}\]$/},t.emoji={path:"http://www.emoji-cheat-sheet.com/graphics/emojis/",ext:".png"},t.twemoji={path:"http://twemoji.maxcdn.com/36x36/",ext:".png"},t.markedRenderer=function(i,o){var n={toc:!0,tocm:!1,tocStartLevel:1,pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1},a=e.extend(n,o||{}),s=t.$marked,l=new s.Renderer;i=i||[];var c=t.regexs,h=c.atLink,d=c.emoji,u=c.email,f=c.emailLink,g=c.twemoji,p=c.fontAwesome,m=c.editormdLogo,w=c.pageBreak;return l.emoji=function(e){e=e.replace(t.regexs.emojiDatetime,function(e){return e.replace(/:/g,":")});var i=e.match(d);if(!i||!a.emoji)return e;for(var o=0,r=i.length;r>o;o++)":+1:"===i[o]&&(i[o]=":\\+1:"),e=e.replace(new RegExp(i[o]),function(e,i){var o=e.match(p),r=e.replace(/:/g,"");if(o)for(var n=0,a=o.length;a>n;n++){var s=o[n].replace(/:/g,"");return''}else{var l=e.match(m),c=e.match(g);if(l)for(var h=0,d=l.length;d>h;h++){var u=l[h].replace(/:/g,"");return''}else{if(!c){var f="+1"===r?"plus1":r;return f="black_large_square"===f?"black_square":f,f="moon"===f?"waxing_gibbous_moon":f,':'+r+':'}for(var w=0,v=c.length;v>w;w++){var k=c[w].replace(/:/g,"").replace("tw-","");return'twemoji-'+k+''}}}});return e},l.atLink=function(i){return h.test(i)?(a.atLink&&(i=i.replace(u,function(e,t,i,o){return e.replace(/@/g,"_#_@_#_")}),i=i.replace(h,function(e,i){return''+e+""}).replace(/_#_@_#_/g,"@")),a.emailLink&&(i=i.replace(f,function(t,i,o,r,n){return!i&&e.inArray(n,"jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|"))<0?''+t+"":t})),i):i},l.link=function(e,t,i){if(this.options.sanitize){try{var o=decodeURIComponent(unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(r){return""}if(0===o.indexOf("javascript:"))return""}var n=''+i.replace(/@/g,"@")+""):(t&&(n+=' title="'+t+'"'),n+=">"+i+"")},l.heading=function(e,t,o){var n=e,a=/\s*\]*)\>(.*)\<\/a\>\s*/;if(a.test(e)){var s=[];e=e.split(/\]+)\>([^\>]*)\<\/a\>/);for(var l=0,c=e.length;c>l;l++)s.push(e[l].replace(/\s*href\=\"(.*)\"\s*/g,""));e=s.join(" ")}e=r(e);var h=e.toLowerCase().replace(/[^\w]+/g,"-"),d={text:e,level:t,slug:h},u=/^[\u4e00-\u9fa5]+$/.test(e),f=u?escape(e).replace(/\%/g,""):e.toLowerCase().replace(/[^\w]+/g,"-");i.push(d);var g="';return g+='',g+='',g+=this.atLink(a?this.emoji(n):this.emoji(e)),g+=""},l.pageBreak=function(e){return w.test(e)&&a.pageBreak&&(e='
    '),e},l.paragraph=function(e){var i=/\$\$(.*)\$\$/g.test(e),o=/^\$\$(.*)\$\$$/.test(e),r=o?' class="'+t.classNames.tex+'"':"",n=a.tocm?/^(\[TOC\]|\[TOCM\])$/.test(e):/^\[TOC\]$/.test(e),s=/^\[TOCM\]$/.test(e);e=!o&&i?e.replace(/(\$\$([^\$]*)\$\$)+/g,function(e,i){return''+i.replace(/\$/g,"")+""}):o?e.replace(/\$/g,""):e;var l='
    '+e+"
    ";return n?s?'
    '+l+"

    ":l:w.test(e)?this.pageBreak(e):""+this.atLink(this.emoji(e))+"

    \n"},l.code=function(e,i,o){return"seq"===i||"sequence"===i?'
    '+e+"
    ":"flow"===i?'
    '+e+"
    ":"math"===i||"latex"===i||"katex"===i?'

    '+e+"

    ":s.Renderer.prototype.code.apply(this,arguments)},l.tablecell=function(e,t){var i=t.header?"th":"td",o=t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">";return o+this.atLink(this.emoji(e))+"\n"},l.listitem=function(e){return a.taskList&&/^\s*\[[x\s]\]\s*/.test(e)?(e=e.replace(/^\s*\[\s\]\s*/,' ').replace(/^\s*\[x\]\s*/,' '),'
  • '+this.atLink(this.emoji(e))+"
  • "):"
  • "+this.atLink(this.emoji(e))+"
  • "},l},t.markdownToCRenderer=function(e,t,i,o){var r="",n=0,a=this.classPrefix;o=o||1;for(var s=0,l=e.length;l>s;s++){var c=e[s].text,h=e[s].level;o>h||(r+=h>n?"":n>h?new Array(n-h+2).join(""):"",r+='
  • '+c+"
      ",n=h)}var d=t.find(".markdown-toc");if(d.length<1&&"false"===t.attr("previewContainer")){var u='
      ';u=i?'
      '+u+"
      ":u,t.html(u),d=t.find(".markdown-toc")}return i&&d.wrap('

      '),d.html('
        ').children(".markdown-toc-list").html(r.replace(/\r?\n?\\<\/ul\>/g,"")),d},t.tocDropdownMenu=function(t,i){i=i||"Table of Contents";var o=400,r=t.find("."+this.classPrefix+"toc-menu");return r.each(function(){var t=e(this),r=t.children(".markdown-toc"),n='',a=''+n+i+"",s=r.children("ul"),l=s.find("li");r.append(a),l.first().before("
      • "+i+" "+n+"

      • "),t.mouseover(function(){s.show(),l.each(function(){var t=e(this),i=t.children("ul");if(""===i.html()&&i.remove(),i.length>0&&""!==i.html()){var r=t.children("a").first();r.children(".fa").length<1&&r.append(e(n).css({"float":"right",paddingTop:"4px"}))}t.mouseover(function(){i.css("z-index",o).show(),o+=1}).mouseleave(function(){i.hide()})})}).mouseleave(function(){s.hide()})}),r},t.filterHTMLTags=function(t,i){if("string"!=typeof t&&(t=new String(t)),"string"!=typeof i)return t;for(var o=i.split("|"),r=o[0].split(","),n=o[1],a=0,s=r.length;s>a;a++){var l=r[a];t=t.replace(new RegExp("]*)>([^>]*)","igm"),"")}if("undefined"!=typeof n){var c=/\<(\w+)\s*([^\>]*)\>([^\>]*)\<\/(\w+)\>/gi;t="*"===n?t.replace(c,function(e,t,i,o,r){return"<"+t+">"+o+""}):"on*"===n?t.replace(c,function(t,i,o,r,n){var a=e("<"+i+">"+r+""),s=e(t)[0].attributes,l={};e.each(s,function(e,t){'"'!==t.nodeName&&(l[t.nodeName]=t.nodeValue)}),e.each(l,function(e){0===e.indexOf("on")&&delete l[e]}),a.attr(l);var c="undefined"!=typeof a[1]?e(a[1]).text():"";return a[0].outerHTML+c}):t.replace(c,function(t,i,o,r){var a=n.split(","),s=e(t);return s.html(r),e.each(a,function(e){s.attr(a[e],null)}),s[0].outerHTML})}return t},t.markdownToHTML=function(i,o){var r={gfm:!0,toc:!0,tocm:!1,tocStartLevel:1,tocTitle:"目录",tocDropdown:!1,tocContainer:"",markdown:"",markdownSourceCode:!1,htmlDecode:!1,autoLoadKaTeX:!0,pageBreak:!0,atLink:!0,emailLink:!0,tex:!1,taskList:!1,emoji:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0};t.$marked=marked;var n=e("#"+i),a=n.settings=e.extend(!0,r,o||{}),s=n.find("textarea");s.length<1&&(n.append(""),s=n.find("textarea"));var l=""===a.markdown?s.val():a.markdown,c=[],h={toc:a.toc,tocm:a.tocm,tocStartLevel:a.tocStartLevel,taskList:a.taskList,emoji:a.emoji,tex:a.tex,pageBreak:a.pageBreak,atLink:a.atLink,emailLink:a.emailLink,flowChart:a.flowChart,sequenceDiagram:a.sequenceDiagram,previewCodeHighlight:a.previewCodeHighlight},d={renderer:t.markedRenderer(c,h),gfm:a.gfm,tables:!0,breaks:!0,pedantic:!1,sanitize:a.htmlDecode?!1:!0,smartLists:!0,smartypants:!0};l=new String(l);var u=marked(l,d);u=t.filterHTMLTags(u,a.htmlDecode),a.markdownSourceCode?s.text(l):s.remove(),n.addClass("markdown-body "+this.classPrefix+"html-preview").append(u);var f=""!==a.tocContainer?e(a.tocContainer):n;if(""!==a.tocContainer&&f.attr("previewContainer",!1),a.toc&&(n.tocContainer=this.markdownToCRenderer(c,f,a.tocDropdown,a.tocStartLevel),(a.tocDropdown||n.find("."+this.classPrefix+"toc-menu").length>0)&&this.tocDropdownMenu(n,a.tocTitle),""!==a.tocContainer&&n.find(".editormd-toc-menu, .editormd-markdown-toc").remove()),a.previewCodeHighlight&&(n.find("pre").addClass("prettyprint linenums"),prettyPrint()),t.isIE8||(a.flowChart&&n.find(".flowchart").flowChart(),a.sequenceDiagram&&n.find(".sequence-diagram").sequenceDiagram({theme:"simple"})),a.tex){var g=function(){n.find("."+t.classNames.tex).each(function(){var t=e(this);katex.render(t.html().replace(/</g,"<").replace(/>/g,">"),t[0]),t.find(".katex").css("font-size","1.6em")})};!a.autoLoadKaTeX||t.$katex||t.kaTeXLoaded?g():this.loadKaTeX(function(){t.$katex=katex,t.kaTeXLoaded=!0,g()})}return n.getMarkdown=function(){return s.val()},n},t.themes=["default","dark"],t.previewThemes=["default","dark"],t.editorThemes=["default","3024-day","3024-night","ambiance","ambiance-mobile","base16-dark","base16-light","blackboard","cobalt","eclipse","elegant","erlang-dark","lesser-dark","mbo","mdn-like","midnight","monokai","neat","neo","night","paraiso-dark","paraiso-light","pastel-on-dark","rubyblue","solarized","the-matrix","tomorrow-night-eighties","twilight","vibrant-ink","xq-dark","xq-light"],t.loadPlugins={},t.loadFiles={js:[],css:[],plugin:[]},t.loadPlugin=function(e,i,o){i=i||function(){},this.loadScript(e,function(){t.loadFiles.plugin.push(e),i()},o)},t.loadCSS=function(e,i,o){o=o||"head",i=i||function(){};var r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.onload=r.onreadystatechange=function(){t.loadFiles.css.push(e),i()},r.href=e+".css","head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.isIE="Microsoft Internet Explorer"==navigator.appName,t.isIE8=t.isIE&&"8."==navigator.appVersion.match(/8./i),t.loadScript=function(e,i,o){o=o||"head",i=i||function(){};var r=null;r=document.createElement("script"),r.id=e.replace(/[\./]+/g,"-"),r.type="text/javascript",r.src=e+".js",t.isIE8?r.onreadystatechange=function(){r.readyState&&("loaded"===r.readyState||"complete"===r.readyState)&&(r.onreadystatechange=null,t.loadFiles.js.push(e),i())}:r.onload=function(){t.loadFiles.js.push(e),i()},"head"===o?document.getElementsByTagName("head")[0].appendChild(r):document.body.appendChild(r)},t.katexURL={css:"//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min",js:"//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min"},t.kaTeXLoaded=!1,t.loadKaTeX=function(e){t.loadCSS(t.katexURL.css,function(){t.loadScript(t.katexURL.js,e||function(){})})},t.lockScreen=function(t){e("html,body").css("overflow",t?"hidden":"")},t.createDialog=function(i){var o={name:"",width:420,height:240,title:"",drag:!0,closed:!0,content:"",mask:!0,maskStyle:{backgroundColor:"#fff",opacity:.1},lockScreen:!0,footer:!0,buttons:!1};i=e.extend(!0,o,i);var r=this,n=this.editor,a=t.classPrefix,s=(new Date).getTime(),l=""===i.name?a+"dialog-"+s:i.name,c=t.mouseOrTouch,h='
        ';""!==i.title&&(h+='
        ",h+=''+i.title+"",h+="
        "),i.closed&&(h+=''),h+='
        '+i.content,(i.footer||"string"==typeof i.footer)&&(h+='"),h+="
        ",h+='
        ',h+='
        ',h+="
        ",n.append(h);var d=n.find("."+l);d.lockScreen=function(t){return i.lockScreen&&(e("html,body").css("overflow",t?"hidden":""),r.resize()),d},d.showMask=function(){return i.mask&&n.find("."+a+"mask").css(i.maskStyle).css("z-index",t.dialogZindex-1).show(),d},d.hideMask=function(){return i.mask&&n.find("."+a+"mask").hide(),d},d.loading=function(e){var t=d.find("."+a+"dialog-mask");return t[e?"show":"hide"](),d},d.lockScreen(!0).showMask(),d.show().css({zIndex:t.dialogZindex,border:t.isIE8?"1px solid #ddd":"",width:"number"==typeof i.width?i.width+"px":i.width,height:"number"==typeof i.height?i.height+"px":i.height});var u=function(){d.css({top:(e(window).height()-d.height())/2+"px",left:(e(window).width()-d.width())/2+"px"})};if(u(),e(window).resize(u),d.children("."+a+"dialog-close").bind(c("click","touchend"),function(){d.hide().lockScreen(!1).hideMask()}),"object"==typeof i.buttons){var f=d.footer=d.find("."+a+"dialog-footer");for(var g in i.buttons){var p=i.buttons[g],m=a+g+"-btn";f.append('"),p[1]=e.proxy(p[1],d),f.children("."+m).bind(c("click","touchend"),p[1])}}if(""!==i.title&&i.drag){var w,v,k=d.children("."+a+"dialog-header");i.mask||k.bind(c("click","touchend"),function(){t.dialogZindex+=2,d.css("z-index",t.dialogZindex)}),k.mousedown(function(e){e=e||window.event,w=e.clientX-parseInt(d[0].style.left),v=e.clientY-parseInt(d[0].style.top),document.onmousemove=y});var b=function(e){e.removeClass(a+"user-unselect").off("selectstart")},x=function(e){e.addClass(a+"user-unselect").on("selectstart",function(e){return!1})},y=function(t){t=t||window.event;var i,o,r=parseInt(d[0].style.left),n=parseInt(d[0].style.top);r>=0?r+d.width()<=e(window).width()?i=t.clientX-w:(i=e(window).width()-d.width(),document.onmousemove=null):(i=0,document.onmousemove=null),n>=0?o=t.clientY-v:(o=0,document.onmousemove=null),document.onselectstart=function(){return!1},x(e("body")),x(d),d[0].style.left=i+"px",d[0].style.top=o+"px"};document.onmouseup=function(){b(e("body")),b(d),document.onselectstart=null,document.onmousemove=null},k.touchDraggable=function(){var t=null,i=function(i){var o=i.originalEvent,r=e(this).parent().position();t={x:o.changedTouches[0].pageX-r.left,y:o.changedTouches[0].pageY-r.top}},o=function(i){i.preventDefault();var o=i.originalEvent;e(this).parent().css({top:o.changedTouches[0].pageY-t.y,left:o.changedTouches[0].pageX-t.x})};this.bind("touchstart",i).bind("touchmove",o)},k.touchDraggable()}return t.dialogZindex+=2,d},t.mouseOrTouch=function(e,t){e=e||"click",t=t||"touchend";var i=e;try{document.createEvent("TouchEvent"),i=t}catch(o){}return i},t.dateFormat=function(e){e=e||"";var t=function(e){return 10>e?"0"+e:e},i=new Date,o=i.getFullYear(),r=o.toString().slice(2,4),n=t(i.getMonth()+1),a=t(i.getDate()),s=i.getDay(),l=t(i.getHours()),c=t(i.getMinutes()),h=t(i.getSeconds()),d=t(i.getMilliseconds()),u="",f=r+"-"+n+"-"+a,g=o+"-"+n+"-"+a,p=l+":"+c+":"+h;switch(e){case"UNIX Time":u=i.getTime();break;case"UTC":u=i.toUTCString();break;case"yy":u=r;break;case"year":case"yyyy":u=o;break;case"month":case"mm":u=n;break;case"cn-week-day":case"cn-wd":var m=["日","一","二","三","四","五","六"];u="星期"+m[s];break;case"week-day":case"wd":var w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];u=w[s];break;case"day":case"dd":u=a;break;case"hour":case"hh":u=l;break;case"min":case"ii":u=c;break;case"second":case"ss":u=h;break;case"ms":u=d;break;case"yy-mm-dd":u=f;break;case"yyyy-mm-dd":u=g;break;case"yyyy-mm-dd h:i:s ms":case"full + ms":u=g+" "+p+" "+d;break;case"full":case"yyyy-mm-dd h:i:s":default:u=g+" "+p}return u},t}}); \ No newline at end of file diff --git a/src/main/resources/templates/editor/fonts/FontAwesome.otf b/src/main/resources/templates/editor/fonts/FontAwesome.otf new file mode 100644 index 0000000000000000000000000000000000000000..f7936cc1e789eea5438d576d6b12de20191da09d Binary files /dev/null and b/src/main/resources/templates/editor/fonts/FontAwesome.otf differ diff --git a/src/main/resources/templates/editor/fonts/editormd-logo.eot b/src/main/resources/templates/editor/fonts/editormd-logo.eot new file mode 100644 index 0000000000000000000000000000000000000000..6f378fd03e8865e7ee5b321a05be3d1162ef2426 Binary files /dev/null and b/src/main/resources/templates/editor/fonts/editormd-logo.eot differ diff --git a/src/main/resources/templates/editor/fonts/editormd-logo.svg b/src/main/resources/templates/editor/fonts/editormd-logo.svg new file mode 100644 index 0000000000000000000000000000000000000000..cce729b44a1b4d7f70134542e544b5b8ba22702c --- /dev/null +++ b/src/main/resources/templates/editor/fonts/editormd-logo.svg @@ -0,0 +1,11 @@ + + + +Generated by IcoMoon + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/editor/fonts/editormd-logo.ttf b/src/main/resources/templates/editor/fonts/editormd-logo.ttf new file mode 100644 index 0000000000000000000000000000000000000000..659c1b37befb64d998d56627bbbf59c45ad4969e Binary files /dev/null and b/src/main/resources/templates/editor/fonts/editormd-logo.ttf differ diff --git a/src/main/resources/templates/editor/fonts/editormd-logo.woff b/src/main/resources/templates/editor/fonts/editormd-logo.woff new file mode 100644 index 0000000000000000000000000000000000000000..384ee49c0a162b6160542ac90c83d3f9d3e9f282 Binary files /dev/null and b/src/main/resources/templates/editor/fonts/editormd-logo.woff differ diff --git a/src/main/resources/templates/editor/fonts/fontawesome-webfont.eot b/src/main/resources/templates/editor/fonts/fontawesome-webfont.eot new file mode 100644 index 0000000000000000000000000000000000000000..33b2bb80055cc480e797de704925acaba4ba7d7d Binary files /dev/null and b/src/main/resources/templates/editor/fonts/fontawesome-webfont.eot differ diff --git a/src/main/resources/templates/editor/fonts/fontawesome-webfont.svg b/src/main/resources/templates/editor/fonts/fontawesome-webfont.svg new file mode 100644 index 0000000000000000000000000000000000000000..1ee89d4368d31a368817a842f14d53f7a64c3038 --- /dev/null +++ b/src/main/resources/templates/editor/fonts/fontawesome-webfont.svg @@ -0,0 +1,565 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/editor/fonts/fontawesome-webfont.ttf b/src/main/resources/templates/editor/fonts/fontawesome-webfont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..ed9372f8ea0fbaa04f42630a48887e4b38945345 Binary files /dev/null and b/src/main/resources/templates/editor/fonts/fontawesome-webfont.ttf differ diff --git a/src/main/resources/templates/editor/fonts/fontawesome-webfont.woff b/src/main/resources/templates/editor/fonts/fontawesome-webfont.woff new file mode 100644 index 0000000000000000000000000000000000000000..8b280b98fa2fa261aa4b0f8fd061f772073ef83e Binary files /dev/null and b/src/main/resources/templates/editor/fonts/fontawesome-webfont.woff differ diff --git a/src/main/resources/templates/editor/fonts/fontawesome-webfont.woff2 b/src/main/resources/templates/editor/fonts/fontawesome-webfont.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..3311d585145b1cc1b9581e914acbb32d8542b4f5 Binary files /dev/null and b/src/main/resources/templates/editor/fonts/fontawesome-webfont.woff2 differ diff --git a/src/main/resources/templates/editor/images/loading.gif b/src/main/resources/templates/editor/images/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..3aa9c85aec01ff026445aeaae26cabb0c3d9488d Binary files /dev/null and b/src/main/resources/templates/editor/images/loading.gif differ diff --git a/src/main/resources/templates/editor/lib/codemirror/AUTHORS b/src/main/resources/templates/editor/lib/codemirror/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..9d62d48e63098dd94f0814871f9a9cc6bfc2400d --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/AUTHORS @@ -0,0 +1,436 @@ +List of CodeMirror contributors. Updated before every release. + +4r2r +Aaron Brooks +Abdelouahab +Abe Fettig +Adam Ahmed +Adam King +adanlobato +Adán Lobato +Adrian Aichner +aeroson +Ahmad Amireh +Ahmad M. Zawawi +ahoward +Akeksandr Motsjonov +Alberto González Palomo +Alberto Pose +Albert Xing +Alexander Pavlov +Alexander Schepanovski +Alexander Shvets +Alexander Solovyov +Alexandre Bique +alexey-k +Alex Piggott +Aliaksei Chapyzhenka +Amsul +amuntean +Amy +Ananya Sen +anaran +AndersMad +Anders Nawroth +Anderson Mesquita +Andrea G +Andreas Reischuck +Andre von Houck +Andrey Fedorov +Andrey Klyuchnikov +Andrey Lushnikov +Andy Joslin +Andy Kimball +Andy Li +angelozerr +angelo.zerr@gmail.com +Ankit +Ankit Ahuja +Ansel Santosa +Anthony Grimes +Anton Kovalyov +areos +as3boyan +AtomicPages LLC +Atul Bhouraskar +Aurelian Oancea +Bastian Müller +Bem Jones-Bey +benbro +Beni Cherniavsky-Paskin +Benjamin DeCoste +Ben Keen +Bernhard Sirlinger +Bert Chang +Billy Moon +binny +B Krishna Chaitanya +Blaine G +blukat29 +boomyjee +borawjm +Brandon Frohs +Brandon Wamboldt +Brett Zamir +Brian Grinstead +Brian Sletten +Bruce Mitchener +Chandra Sekhar Pydi +Charles Skelton +Cheah Chu Yeow +Chris Coyier +Chris Granger +Chris Houseknecht +Chris Morgan +Christian Oyarzun +Christian Petrov +Christopher Brown +ciaranj +CodeAnimal +ComFreek +Curtis Gagliardi +dagsta +daines +Dale Jung +Dan Bentley +Dan Heberden +Daniel, Dao Quang Minh +Daniele Di Sarli +Daniel Faust +Daniel Huigens +Daniel KJ +Daniel Neel +Daniel Parnell +Danny Yoo +darealshinji +Darius Roberts +Dave Myers +David Mignot +David Pathakjee +David Vázquez +deebugger +Deep Thought +Devon Carew +dignifiedquire +Dimage Sapelkin +Dmitry Kiselyov +domagoj412 +Dominator008 +Domizio Demichelis +Doug Wikle +Drew Bratcher +Drew Hintz +Drew Khoury +Dror BG +duralog +eborden +edsharp +ekhaled +Enam Mijbah Noor +Eric Allam +eustas +Fabien O'Carroll +Fabio Zendhi Nagao +Faiza Alsaied +Fauntleroy +fbuchinger +feizhang365 +Felipe Lalanne +Felix Raab +Filip Noetzel +flack +ForbesLindesay +Forbes Lindesay +Ford_Lawnmower +Forrest Oliphant +Frank Wiegand +Gabriel Gheorghian +Gabriel Horner +Gabriel Nahmias +galambalazs +Gautam Mehta +gekkoe +Gerard Braad +Gergely Hegykozi +Giovanni Calò +Glenn Jorde +Glenn Ruehle +Golevka +Gordon Smith +Grant Skinner +greengiant +Gregory Koberger +Guillaume Massé +Guillaume Massé +Gustavo Rodrigues +Hakan Tunc +Hans Engel +Hardest +Hasan Karahan +Herculano Campos +Hiroyuki Makino +hitsthings +Hocdoc +Ian Beck +Ian Dickinson +Ian Wehrman +Ian Wetherbee +Ice White +ICHIKAWA, Yuji +ilvalle +Ingo Richter +Irakli Gozalishvili +Ivan Kurnosov +Jacob Lee +Jakob Miland +Jakub Vrana +Jakub Vrána +James Campos +James Thorne +Jamie Hill +Jan Jongboom +jankeromnes +Jan Keromnes +Jan Odvarko +Jan T. Sott +Jared Forsyth +Jason +Jason Barnabe +Jason Grout +Jason Johnston +Jason San Jose +Jason Siefken +Jaydeep Solanki +Jean Boussier +jeffkenton +Jeff Pickhardt +jem (graphite) +Jeremy Parmenter +Jochen Berger +Johan Ask +John Connor +John Lees-Miller +John Snelson +John Van Der Loo +Jonathan Malmaud +jongalloway +Jon Malmaud +Jon Sangster +Joost-Wim Boekesteijn +Joseph Pecoraro +Joshua Newman +Josh Watzman +jots +jsoojeon +Juan Benavides Romero +Jucovschi Constantin +Juho Vuori +Justin Hileman +jwallers@gmail.com +kaniga +Ken Newman +Ken Rockot +Kevin Sawicki +Kevin Ushey +Klaus Silveira +Koh Zi Han, Cliff +komakino +Konstantin Lopuhin +koops +ks-ifware +kubelsmieci +KwanEsq +Lanfei +Lanny +Laszlo Vidacs +leaf corcoran +Leonid Khachaturov +Leon Sorokin +Leonya Khachaturov +Liam Newman +LM +lochel +Lorenzo Stoakes +Luciano Longo +Luke Stagner +lynschinzer +Maksim Lin +Maksym Taran +Malay Majithia +Manuel Rego Casasnovas +Marat Dreizin +Marcel Gerber +Marco Aurélio +Marco Munizaga +Marcus Bointon +Marek Rudnicki +Marijn Haverbeke +Mário Gonçalves +Mario Pietsch +Mark Lentczner +Marko Bonaci +Martin Balek +Martín Gaitán +Martin Hasoň +Mason Malone +Mateusz Paprocki +Mathias Bynens +mats cronqvist +Matthew Beale +Matthias Bussonnier +Matthias BUSSONNIER +Matt McDonald +Matt Pass +Matt Sacks +mauricio +Maximilian Hils +Maxim Kraev +Max Kirsch +Max Xiantu +mbarkhau +Metatheos +Micah Dubinko +Michael Lehenbauer +Michael Zhou +Mighty Guava +Miguel Castillo +mihailik +Mike +Mike Brevoort +Mike Diaz +Mike Ivanov +Mike Kadin +MinRK +Miraculix87 +misfo +mloginov +Moritz Schwörer +mps +mtaran-google +Narciso Jaramillo +Nathan Williams +ndr +nerbert +nextrevision +ngn +nguillaumin +Ng Zhi An +Nicholas Bollweg +Nicholas Bollweg (Nick) +Nick Small +Niels van Groningen +nightwing +Nikita Beloglazov +Nikita Vasilyev +Nikolay Kostov +nilp0inter +Nisarg Jhaveri +nlwillia +Norman Rzepka +pablo +Page +Panupong Pasupat +paris +Patil Arpith +Patrick Stoica +Patrick Strawderman +Paul Garvin +Paul Ivanov +Pavel Feldman +Pavel Strashkin +Paweł Bartkiewicz +peteguhl +Peter Flynn +peterkroon +Peter Kroon +prasanthj +Prasanth J +Radek Piórkowski +Rahul +Randall Mason +Randy Burden +Randy Edmunds +Rasmus Erik Voel Jensen +Ray Ratchup +Richard van der Meer +Richard Z.H. Wang +Robert Crossfield +Roberto Abdelkader Martínez Pérez +robertop23 +Robert Plummer +Ruslan Osmanov +Ryan Prior +sabaca +Samuel Ainsworth +sandeepshetty +Sander AKA Redsandro +santec +Sascha Peilicke +satchmorun +sathyamoorthi +SCLINIC\jdecker +Scott Aikin +Scott Goodhew +Sebastian Zaha +shaund +shaun gilchrist +Shawn A +sheopory +Shiv Deepak +Shmuel Englard +Shubham Jain +silverwind +snasa +soliton4 +sonson +spastorelli +srajanpaliwal +Stanislav Oaserele +Stas Kobzar +Stefan Borsje +Steffen Beyer +Steve O'Hara +stoskov +Taha Jahangir +Takuji Shimokawa +Tarmil +tel +tfjgeorge +Thaddee Tyl +TheHowl +think +Thomas Dvornik +Thomas Schmid +Tim Alby +Tim Baumann +Timothy Farrell +Timothy Hatcher +TobiasBg +Tomas-A +Tomas Varaneckas +Tom Erik Støwer +Tom MacWright +Tony Jian +Travis Heppe +Triangle717 +twifkak +Vestimir Markov +vf +Vincent Woo +Volker Mische +wenli +Wesley Wiser +Will Binns-Smith +William Jamieson +William Stein +Willy +Wojtek Ptak +Xavier Mendez +Yassin N. Hassan +YNH Webdev +Yunchi Luo +Yuvi Panda +Zachary Dremann +Zhang Hao +zziuni +魏鹏刚 diff --git a/src/main/resources/templates/editor/lib/codemirror/LICENSE b/src/main/resources/templates/editor/lib/codemirror/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d21bbea5a6338dde8895b5293d8bc125ac2fb6c4 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2014 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/main/resources/templates/editor/lib/codemirror/README.md b/src/main/resources/templates/editor/lib/codemirror/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bc6e7f5c7132b37b1222c6efe9678f7df4848966 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/README.md @@ -0,0 +1,12 @@ +# CodeMirror +[![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror) +[![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror) +[Funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png)](https://marijnhaverbeke.nl/fund/) + +CodeMirror is a JavaScript component that provides a code editor in +the browser. When a mode is available for the language you are coding +in, it will color your code, and optionally help with indentation. + +The project page is http://codemirror.net +The manual is at http://codemirror.net/doc/manual.html +The contributing guidelines are in [CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md) diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/comment/comment.js b/src/main/resources/templates/editor/lib/codemirror/addon/comment/comment.js new file mode 100644 index 0000000000000000000000000000000000000000..2dd114d332dc9b1e0b19cfff3fc60061c7cb9fbe --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/comment/comment.js @@ -0,0 +1,183 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var noOptions = {}; + var nonWS = /[^\s\u00a0]/; + var Pos = CodeMirror.Pos; + + function firstNonWS(str) { + var found = str.search(nonWS); + return found == -1 ? 0 : found; + } + + CodeMirror.commands.toggleComment = function(cm) { + var minLine = Infinity, ranges = cm.listSelections(), mode = null; + for (var i = ranges.length - 1; i >= 0; i--) { + var from = ranges[i].from(), to = ranges[i].to(); + if (from.line >= minLine) continue; + if (to.line >= minLine) to = Pos(minLine, 0); + minLine = from.line; + if (mode == null) { + if (cm.uncomment(from, to)) mode = "un"; + else { cm.lineComment(from, to); mode = "line"; } + } else if (mode == "un") { + cm.uncomment(from, to); + } else { + cm.lineComment(from, to); + } + } + }; + + CodeMirror.defineExtension("lineComment", function(from, to, options) { + if (!options) options = noOptions; + var self = this, mode = self.getModeAt(from); + var commentString = options.lineComment || mode.lineComment; + if (!commentString) { + if (options.blockCommentStart || mode.blockCommentStart) { + options.fullLines = true; + self.blockComment(from, to, options); + } + return; + } + var firstLine = self.getLine(from.line); + if (firstLine == null) return; + var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1); + var pad = options.padding == null ? " " : options.padding; + var blankLines = options.commentBlankLines || from.line == to.line; + + self.operation(function() { + if (options.indent) { + var baseString = firstLine.slice(0, firstNonWS(firstLine)); + for (var i = from.line; i < end; ++i) { + var line = self.getLine(i), cut = baseString.length; + if (!blankLines && !nonWS.test(line)) continue; + if (line.slice(0, cut) != baseString) cut = firstNonWS(line); + self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut)); + } + } else { + for (var i = from.line; i < end; ++i) { + if (blankLines || nonWS.test(self.getLine(i))) + self.replaceRange(commentString + pad, Pos(i, 0)); + } + } + }); + }); + + CodeMirror.defineExtension("blockComment", function(from, to, options) { + if (!options) options = noOptions; + var self = this, mode = self.getModeAt(from); + var startString = options.blockCommentStart || mode.blockCommentStart; + var endString = options.blockCommentEnd || mode.blockCommentEnd; + if (!startString || !endString) { + if ((options.lineComment || mode.lineComment) && options.fullLines != false) + self.lineComment(from, to, options); + return; + } + + var end = Math.min(to.line, self.lastLine()); + if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end; + + var pad = options.padding == null ? " " : options.padding; + if (from.line > end) return; + + self.operation(function() { + if (options.fullLines != false) { + var lastLineHasText = nonWS.test(self.getLine(end)); + self.replaceRange(pad + endString, Pos(end)); + self.replaceRange(startString + pad, Pos(from.line, 0)); + var lead = options.blockCommentLead || mode.blockCommentLead; + if (lead != null) for (var i = from.line + 1; i <= end; ++i) + if (i != end || lastLineHasText) + self.replaceRange(lead + pad, Pos(i, 0)); + } else { + self.replaceRange(endString, to); + self.replaceRange(startString, from); + } + }); + }); + + CodeMirror.defineExtension("uncomment", function(from, to, options) { + if (!options) options = noOptions; + var self = this, mode = self.getModeAt(from); + var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end); + + // Try finding line comments + var lineString = options.lineComment || mode.lineComment, lines = []; + var pad = options.padding == null ? " " : options.padding, didSomething; + lineComment: { + if (!lineString) break lineComment; + for (var i = start; i <= end; ++i) { + var line = self.getLine(i); + var found = line.indexOf(lineString); + if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1; + if (found == -1 && (i != end || i == start) && nonWS.test(line)) break lineComment; + if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment; + lines.push(line); + } + self.operation(function() { + for (var i = start; i <= end; ++i) { + var line = lines[i - start]; + var pos = line.indexOf(lineString), endPos = pos + lineString.length; + if (pos < 0) continue; + if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length; + didSomething = true; + self.replaceRange("", Pos(i, pos), Pos(i, endPos)); + } + }); + if (didSomething) return true; + } + + // Try block comments + var startString = options.blockCommentStart || mode.blockCommentStart; + var endString = options.blockCommentEnd || mode.blockCommentEnd; + if (!startString || !endString) return false; + var lead = options.blockCommentLead || mode.blockCommentLead; + var startLine = self.getLine(start), endLine = end == start ? startLine : self.getLine(end); + var open = startLine.indexOf(startString), close = endLine.lastIndexOf(endString); + if (close == -1 && start != end) { + endLine = self.getLine(--end); + close = endLine.lastIndexOf(endString); + } + if (open == -1 || close == -1 || + !/comment/.test(self.getTokenTypeAt(Pos(start, open + 1))) || + !/comment/.test(self.getTokenTypeAt(Pos(end, close + 1)))) + return false; + + // Avoid killing block comments completely outside the selection. + // Positions of the last startString before the start of the selection, and the first endString after it. + var lastStart = startLine.lastIndexOf(startString, from.ch); + var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length); + if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false; + // Positions of the first endString after the end of the selection, and the last startString before it. + firstEnd = endLine.indexOf(endString, to.ch); + var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch); + lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart; + if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false; + + self.operation(function() { + self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)), + Pos(end, close + endString.length)); + var openEnd = open + startString.length; + if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length; + self.replaceRange("", Pos(start, open), Pos(start, openEnd)); + if (lead) for (var i = start + 1; i <= end; ++i) { + var line = self.getLine(i), found = line.indexOf(lead); + if (found == -1 || nonWS.test(line.slice(0, found))) continue; + var foundEnd = found + lead.length; + if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length; + self.replaceRange("", Pos(i, found), Pos(i, foundEnd)); + } + }); + return true; + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/comment/continuecomment.js b/src/main/resources/templates/editor/lib/codemirror/addon/comment/continuecomment.js new file mode 100644 index 0000000000000000000000000000000000000000..b11d51e6ca573c91184be8611c802adbd9f25c0d --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/comment/continuecomment.js @@ -0,0 +1,85 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + var modes = ["clike", "css", "javascript"]; + + for (var i = 0; i < modes.length; ++i) + CodeMirror.extendMode(modes[i], {blockCommentContinue: " * "}); + + function continueComment(cm) { + if (cm.getOption("disableInput")) return CodeMirror.Pass; + var ranges = cm.listSelections(), mode, inserts = []; + for (var i = 0; i < ranges.length; i++) { + var pos = ranges[i].head, token = cm.getTokenAt(pos); + if (token.type != "comment") return CodeMirror.Pass; + var modeHere = CodeMirror.innerMode(cm.getMode(), token.state).mode; + if (!mode) mode = modeHere; + else if (mode != modeHere) return CodeMirror.Pass; + + var insert = null; + if (mode.blockCommentStart && mode.blockCommentContinue) { + var end = token.string.indexOf(mode.blockCommentEnd); + var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found; + if (end != -1 && end == token.string.length - mode.blockCommentEnd.length && pos.ch >= end) { + // Comment ended, don't continue it + } else if (token.string.indexOf(mode.blockCommentStart) == 0) { + insert = full.slice(0, token.start); + if (!/^\s*$/.test(insert)) { + insert = ""; + for (var j = 0; j < token.start; ++j) insert += " "; + } + } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 && + found + mode.blockCommentContinue.length > token.start && + /^\s*$/.test(full.slice(0, found))) { + insert = full.slice(0, found); + } + if (insert != null) insert += mode.blockCommentContinue; + } + if (insert == null && mode.lineComment && continueLineCommentEnabled(cm)) { + var line = cm.getLine(pos.line), found = line.indexOf(mode.lineComment); + if (found > -1) { + insert = line.slice(0, found); + if (/\S/.test(insert)) insert = null; + else insert += mode.lineComment + line.slice(found + mode.lineComment.length).match(/^\s*/)[0]; + } + } + if (insert == null) return CodeMirror.Pass; + inserts[i] = "\n" + insert; + } + + cm.operation(function() { + for (var i = ranges.length - 1; i >= 0; i--) + cm.replaceRange(inserts[i], ranges[i].from(), ranges[i].to(), "+insert"); + }); + } + + function continueLineCommentEnabled(cm) { + var opt = cm.getOption("continueComments"); + if (opt && typeof opt == "object") + return opt.continueLineComment !== false; + return true; + } + + CodeMirror.defineOption("continueComments", null, function(cm, val, prev) { + if (prev && prev != CodeMirror.Init) + cm.removeKeyMap("continueComment"); + if (val) { + var key = "Enter"; + if (typeof val == "string") + key = val; + else if (typeof val == "object" && val.key) + key = val.key; + var map = {name: "continueComment"}; + map[key] = continueComment; + cm.addKeyMap(map); + } + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/dialog/dialog.css b/src/main/resources/templates/editor/lib/codemirror/addon/dialog/dialog.css new file mode 100644 index 0000000000000000000000000000000000000000..2e7c0fc9b809b65a245a1645d954c4140cd1a408 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/dialog/dialog.css @@ -0,0 +1,32 @@ +.CodeMirror-dialog { + position: absolute; + left: 0; right: 0; + background: white; + z-index: 15; + padding: .1em .8em; + overflow: hidden; + color: #333; +} + +.CodeMirror-dialog-top { + border-bottom: 1px solid #eee; + top: 0; +} + +.CodeMirror-dialog-bottom { + border-top: 1px solid #eee; + bottom: 0; +} + +.CodeMirror-dialog input { + border: none; + outline: none; + background: transparent; + width: 20em; + color: inherit; + font-family: monospace; +} + +.CodeMirror-dialog button { + font-size: 70%; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/dialog/dialog.js b/src/main/resources/templates/editor/lib/codemirror/addon/dialog/dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..e0e8ad4eb70f3944e0568e081d3509b0bb1242fe --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/dialog/dialog.js @@ -0,0 +1,155 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Open simple dialogs on top of an editor. Relies on dialog.css. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + function dialogDiv(cm, template, bottom) { + var wrap = cm.getWrapperElement(); + var dialog; + dialog = wrap.appendChild(document.createElement("div")); + if (bottom) + dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom"; + else + dialog.className = "CodeMirror-dialog CodeMirror-dialog-top"; + + if (typeof template == "string") { + dialog.innerHTML = template; + } else { // Assuming it's a detached DOM element. + dialog.appendChild(template); + } + return dialog; + } + + function closeNotification(cm, newVal) { + if (cm.state.currentNotificationClose) + cm.state.currentNotificationClose(); + cm.state.currentNotificationClose = newVal; + } + + CodeMirror.defineExtension("openDialog", function(template, callback, options) { + if (!options) options = {}; + + closeNotification(this, null); + + var dialog = dialogDiv(this, template, options.bottom); + var closed = false, me = this; + function close(newVal) { + if (typeof newVal == 'string') { + inp.value = newVal; + } else { + if (closed) return; + closed = true; + dialog.parentNode.removeChild(dialog); + me.focus(); + + if (options.onClose) options.onClose(dialog); + } + } + + var inp = dialog.getElementsByTagName("input")[0], button; + if (inp) { + if (options.value) { + inp.value = options.value; + inp.select(); + } + + if (options.onInput) + CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);}); + if (options.onKeyUp) + CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);}); + + CodeMirror.on(inp, "keydown", function(e) { + if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } + if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { + inp.blur(); + CodeMirror.e_stop(e); + close(); + } + if (e.keyCode == 13) callback(inp.value, e); + }); + + if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close); + + inp.focus(); + } else if (button = dialog.getElementsByTagName("button")[0]) { + CodeMirror.on(button, "click", function() { + close(); + me.focus(); + }); + + if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close); + + button.focus(); + } + return close; + }); + + CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) { + closeNotification(this, null); + var dialog = dialogDiv(this, template, options && options.bottom); + var buttons = dialog.getElementsByTagName("button"); + var closed = false, me = this, blurring = 1; + function close() { + if (closed) return; + closed = true; + dialog.parentNode.removeChild(dialog); + me.focus(); + } + buttons[0].focus(); + for (var i = 0; i < buttons.length; ++i) { + var b = buttons[i]; + (function(callback) { + CodeMirror.on(b, "click", function(e) { + CodeMirror.e_preventDefault(e); + close(); + if (callback) callback(me); + }); + })(callbacks[i]); + CodeMirror.on(b, "blur", function() { + --blurring; + setTimeout(function() { if (blurring <= 0) close(); }, 200); + }); + CodeMirror.on(b, "focus", function() { ++blurring; }); + } + }); + + /* + * openNotification + * Opens a notification, that can be closed with an optional timer + * (default 5000ms timer) and always closes on click. + * + * If a notification is opened while another is opened, it will close the + * currently opened one and open the new one immediately. + */ + CodeMirror.defineExtension("openNotification", function(template, options) { + closeNotification(this, close); + var dialog = dialogDiv(this, template, options && options.bottom); + var closed = false, doneTimer; + var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000; + + function close() { + if (closed) return; + closed = true; + clearTimeout(doneTimer); + dialog.parentNode.removeChild(dialog); + } + + CodeMirror.on(dialog, 'click', function(e) { + CodeMirror.e_preventDefault(e); + close(); + }); + + if (duration) + doneTimer = setTimeout(close, duration); + + return close; + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/display/fullscreen.css b/src/main/resources/templates/editor/lib/codemirror/addon/display/fullscreen.css new file mode 100644 index 0000000000000000000000000000000000000000..437acd89be8c3173079d7d966bd965bd69f94289 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/display/fullscreen.css @@ -0,0 +1,6 @@ +.CodeMirror-fullscreen { + position: fixed; + top: 0; left: 0; right: 0; bottom: 0; + height: auto; + z-index: 9; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/display/fullscreen.js b/src/main/resources/templates/editor/lib/codemirror/addon/display/fullscreen.js new file mode 100644 index 0000000000000000000000000000000000000000..cd3673b96c33db349576bbd39b3cd8f0fd9050bb --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/display/fullscreen.js @@ -0,0 +1,41 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineOption("fullScreen", false, function(cm, val, old) { + if (old == CodeMirror.Init) old = false; + if (!old == !val) return; + if (val) setFullscreen(cm); + else setNormal(cm); + }); + + function setFullscreen(cm) { + var wrap = cm.getWrapperElement(); + cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, + width: wrap.style.width, height: wrap.style.height}; + wrap.style.width = ""; + wrap.style.height = "auto"; + wrap.className += " CodeMirror-fullscreen"; + document.documentElement.style.overflow = "hidden"; + cm.refresh(); + } + + function setNormal(cm) { + var wrap = cm.getWrapperElement(); + wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, ""); + document.documentElement.style.overflow = ""; + var info = cm.state.fullScreenRestore; + wrap.style.width = info.width; wrap.style.height = info.height; + window.scrollTo(info.scrollLeft, info.scrollTop); + cm.refresh(); + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/display/panel.js b/src/main/resources/templates/editor/lib/codemirror/addon/display/panel.js new file mode 100644 index 0000000000000000000000000000000000000000..22c0453e8ff908773135085165633c004c9d26e5 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/display/panel.js @@ -0,0 +1,94 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + CodeMirror.defineExtension("addPanel", function(node, options) { + if (!this.state.panels) initPanels(this); + + var info = this.state.panels; + if (options && options.position == "bottom") + info.wrapper.appendChild(node); + else + info.wrapper.insertBefore(node, info.wrapper.firstChild); + var height = (options && options.height) || node.offsetHeight; + this._setSize(null, info.heightLeft -= height); + info.panels++; + return new Panel(this, node, options, height); + }); + + function Panel(cm, node, options, height) { + this.cm = cm; + this.node = node; + this.options = options; + this.height = height; + this.cleared = false; + } + + Panel.prototype.clear = function() { + if (this.cleared) return; + this.cleared = true; + var info = this.cm.state.panels; + this.cm._setSize(null, info.heightLeft += this.height); + info.wrapper.removeChild(this.node); + if (--info.panels == 0) removePanels(this.cm); + }; + + Panel.prototype.changed = function(height) { + var newHeight = height == null ? this.node.offsetHeight : height; + var info = this.cm.state.panels; + this.cm._setSize(null, info.height += (newHeight - this.height)); + this.height = newHeight; + }; + + function initPanels(cm) { + var wrap = cm.getWrapperElement(); + var style = window.getComputedStyle ? window.getComputedStyle(wrap) : wrap.currentStyle; + var height = parseInt(style.height); + var info = cm.state.panels = { + setHeight: wrap.style.height, + heightLeft: height, + panels: 0, + wrapper: document.createElement("div") + }; + wrap.parentNode.insertBefore(info.wrapper, wrap); + var hasFocus = cm.hasFocus(); + info.wrapper.appendChild(wrap); + if (hasFocus) cm.focus(); + + cm._setSize = cm.setSize; + if (height != null) cm.setSize = function(width, newHeight) { + if (newHeight == null) return this._setSize(width, newHeight); + info.setHeight = newHeight; + if (typeof newHeight != "number") { + var px = /^(\d+\.?\d*)px$/.exec(newHeight); + if (px) { + newHeight = Number(px[1]); + } else { + info.wrapper.style.height = newHeight; + newHeight = info.wrapper.offsetHeight; + info.wrapper.style.height = ""; + } + } + cm._setSize(width, info.heightLeft += (newHeight - height)); + height = newHeight; + }; + } + + function removePanels(cm) { + var info = cm.state.panels; + cm.state.panels = null; + + var wrap = cm.getWrapperElement(); + info.wrapper.parentNode.replaceChild(wrap, info.wrapper); + wrap.style.height = info.setHeight; + cm.setSize = cm._setSize; + cm.setSize(); + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/display/placeholder.js b/src/main/resources/templates/editor/lib/codemirror/addon/display/placeholder.js new file mode 100644 index 0000000000000000000000000000000000000000..bb0c3931e499cdc0f5e7c88c5e0b781ed70f5e80 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/display/placeholder.js @@ -0,0 +1,58 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + CodeMirror.defineOption("placeholder", "", function(cm, val, old) { + var prev = old && old != CodeMirror.Init; + if (val && !prev) { + cm.on("blur", onBlur); + cm.on("change", onChange); + onChange(cm); + } else if (!val && prev) { + cm.off("blur", onBlur); + cm.off("change", onChange); + clearPlaceholder(cm); + var wrapper = cm.getWrapperElement(); + wrapper.className = wrapper.className.replace(" CodeMirror-empty", ""); + } + + if (val && !cm.hasFocus()) onBlur(cm); + }); + + function clearPlaceholder(cm) { + if (cm.state.placeholder) { + cm.state.placeholder.parentNode.removeChild(cm.state.placeholder); + cm.state.placeholder = null; + } + } + function setPlaceholder(cm) { + clearPlaceholder(cm); + var elt = cm.state.placeholder = document.createElement("pre"); + elt.style.cssText = "height: 0; overflow: visible"; + elt.className = "CodeMirror-placeholder"; + elt.appendChild(document.createTextNode(cm.getOption("placeholder"))); + cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild); + } + + function onBlur(cm) { + if (isEmpty(cm)) setPlaceholder(cm); + } + function onChange(cm) { + var wrapper = cm.getWrapperElement(), empty = isEmpty(cm); + wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : ""); + + if (empty) setPlaceholder(cm); + else clearPlaceholder(cm); + } + + function isEmpty(cm) { + return (cm.lineCount() === 1) && (cm.getLine(0) === ""); + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/display/rulers.js b/src/main/resources/templates/editor/lib/codemirror/addon/display/rulers.js new file mode 100644 index 0000000000000000000000000000000000000000..13185d30b4e890f0ab0e61b13377918f12f4d2f2 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/display/rulers.js @@ -0,0 +1,64 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineOption("rulers", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + clearRulers(cm); + cm.off("refresh", refreshRulers); + } + if (val && val.length) { + setRulers(cm); + cm.on("refresh", refreshRulers); + } + }); + + function clearRulers(cm) { + for (var i = cm.display.lineSpace.childNodes.length - 1; i >= 0; i--) { + var node = cm.display.lineSpace.childNodes[i]; + if (/(^|\s)CodeMirror-ruler($|\s)/.test(node.className)) + node.parentNode.removeChild(node); + } + } + + function setRulers(cm) { + var val = cm.getOption("rulers"); + var cw = cm.defaultCharWidth(); + var left = cm.charCoords(CodeMirror.Pos(cm.firstLine(), 0), "div").left; + var minH = cm.display.scroller.offsetHeight + 30; + for (var i = 0; i < val.length; i++) { + var elt = document.createElement("div"); + elt.className = "CodeMirror-ruler"; + var col, cls = null, conf = val[i]; + if (typeof conf == "number") { + col = conf; + } else { + col = conf.column; + if (conf.className) elt.className += " " + conf.className; + if (conf.color) elt.style.borderColor = conf.color; + if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle; + if (conf.width) elt.style.borderLeftWidth = conf.width; + cls = val[i].className; + } + elt.style.left = (left + col * cw) + "px"; + elt.style.top = "-50px"; + elt.style.bottom = "-20px"; + elt.style.minHeight = minH + "px"; + cm.display.lineSpace.insertBefore(elt, cm.display.cursorDiv); + } + } + + function refreshRulers(cm) { + clearRulers(cm); + setRulers(cm); + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/edit/closebrackets.js b/src/main/resources/templates/editor/lib/codemirror/addon/edit/closebrackets.js new file mode 100644 index 0000000000000000000000000000000000000000..ff4bb3f7336271f9016af9bac6ae451c4328a3b0 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/edit/closebrackets.js @@ -0,0 +1,161 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + var DEFAULT_BRACKETS = "()[]{}''\"\""; + var DEFAULT_TRIPLES = "'\""; + var DEFAULT_EXPLODE_ON_ENTER = "[]{}"; + var SPACE_CHAR_REGEX = /\s/; + + var Pos = CodeMirror.Pos; + + CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) { + if (old != CodeMirror.Init && old) + cm.removeKeyMap("autoCloseBrackets"); + if (!val) return; + var pairs = DEFAULT_BRACKETS, triples = DEFAULT_TRIPLES, explode = DEFAULT_EXPLODE_ON_ENTER; + if (typeof val == "string") pairs = val; + else if (typeof val == "object") { + if (val.pairs != null) pairs = val.pairs; + if (val.triples != null) triples = val.triples; + if (val.explode != null) explode = val.explode; + } + var map = buildKeymap(pairs, triples); + if (explode) map.Enter = buildExplodeHandler(explode); + cm.addKeyMap(map); + }); + + function charsAround(cm, pos) { + var str = cm.getRange(Pos(pos.line, pos.ch - 1), + Pos(pos.line, pos.ch + 1)); + return str.length == 2 ? str : null; + } + + // Project the token type that will exists after the given char is + // typed, and use it to determine whether it would cause the start + // of a string token. + function enteringString(cm, pos, ch) { + var line = cm.getLine(pos.line); + var token = cm.getTokenAt(pos); + if (/\bstring2?\b/.test(token.type)) return false; + var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4); + stream.pos = stream.start = token.start; + for (;;) { + var type1 = cm.getMode().token(stream, token.state); + if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1); + stream.start = stream.pos; + } + } + + function buildKeymap(pairs, triples) { + var map = { + name : "autoCloseBrackets", + Backspace: function(cm) { + if (cm.getOption("disableInput")) return CodeMirror.Pass; + var ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + if (!ranges[i].empty()) return CodeMirror.Pass; + var around = charsAround(cm, ranges[i].head); + if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; + } + for (var i = ranges.length - 1; i >= 0; i--) { + var cur = ranges[i].head; + cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1)); + } + } + }; + var closingBrackets = ""; + for (var i = 0; i < pairs.length; i += 2) (function(left, right) { + closingBrackets += right; + map["'" + left + "'"] = function(cm) { + if (cm.getOption("disableInput")) return CodeMirror.Pass; + var ranges = cm.listSelections(), type, next; + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i], cur = range.head, curType; + var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); + if (!range.empty()) { + curType = "surround"; + } else if (left == right && next == right) { + if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + left) + curType = "skipThree"; + else + curType = "skip"; + } else if (left == right && cur.ch > 1 && triples.indexOf(left) >= 0 && + cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left && + (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left)) { + curType = "addFour"; + } else if (left == '"' || left == "'") { + if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both"; + else return CodeMirror.Pass; + } else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) { + curType = "both"; + } else { + return CodeMirror.Pass; + } + if (!type) type = curType; + else if (type != curType) return CodeMirror.Pass; + } + + cm.operation(function() { + if (type == "skip") { + cm.execCommand("goCharRight"); + } else if (type == "skipThree") { + for (var i = 0; i < 3; i++) + cm.execCommand("goCharRight"); + } else if (type == "surround") { + var sels = cm.getSelections(); + for (var i = 0; i < sels.length; i++) + sels[i] = left + sels[i] + right; + cm.replaceSelections(sels, "around"); + } else if (type == "both") { + cm.replaceSelection(left + right, null); + cm.execCommand("goCharLeft"); + } else if (type == "addFour") { + cm.replaceSelection(left + left + left + left, "before"); + cm.execCommand("goCharRight"); + } + }); + }; + if (left != right) map["'" + right + "'"] = function(cm) { + var ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (!range.empty() || + cm.getRange(range.head, Pos(range.head.line, range.head.ch + 1)) != right) + return CodeMirror.Pass; + } + cm.execCommand("goCharRight"); + }; + })(pairs.charAt(i), pairs.charAt(i + 1)); + return map; + } + + function buildExplodeHandler(pairs) { + return function(cm) { + if (cm.getOption("disableInput")) return CodeMirror.Pass; + var ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + if (!ranges[i].empty()) return CodeMirror.Pass; + var around = charsAround(cm, ranges[i].head); + if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; + } + cm.operation(function() { + cm.replaceSelection("\n\n", null); + cm.execCommand("goCharLeft"); + ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + var line = ranges[i].head.line; + cm.indentLine(line, null, true); + cm.indentLine(line + 1, null, true); + } + }); + }; + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/edit/closetag.js b/src/main/resources/templates/editor/lib/codemirror/addon/edit/closetag.js new file mode 100644 index 0000000000000000000000000000000000000000..e68d52d9dcd76f080e56cf143bf9314ce60a6211 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/edit/closetag.js @@ -0,0 +1,166 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/** + * Tag-closer extension for CodeMirror. + * + * This extension adds an "autoCloseTags" option that can be set to + * either true to get the default behavior, or an object to further + * configure its behavior. + * + * These are supported options: + * + * `whenClosing` (default true) + * Whether to autoclose when the '/' of a closing tag is typed. + * `whenOpening` (default true) + * Whether to autoclose the tag when the final '>' of an opening + * tag is typed. + * `dontCloseTags` (default is empty tags for HTML, none for XML) + * An array of tag names that should not be autoclosed. + * `indentTags` (default is block tags for HTML, none for XML) + * An array of tag names that should, when opened, cause a + * blank line to be added inside the tag, and the blank line and + * closing line to be indented. + * + * See demos/closetag.html for a usage example. + */ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../fold/xml-fold")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../fold/xml-fold"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) { + if (old != CodeMirror.Init && old) + cm.removeKeyMap("autoCloseTags"); + if (!val) return; + var map = {name: "autoCloseTags"}; + if (typeof val != "object" || val.whenClosing) + map["'/'"] = function(cm) { return autoCloseSlash(cm); }; + if (typeof val != "object" || val.whenOpening) + map["'>'"] = function(cm) { return autoCloseGT(cm); }; + cm.addKeyMap(map); + }); + + var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", + "source", "track", "wbr"]; + var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4", + "h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"]; + + function autoCloseGT(cm) { + if (cm.getOption("disableInput")) return CodeMirror.Pass; + var ranges = cm.listSelections(), replacements = []; + for (var i = 0; i < ranges.length; i++) { + if (!ranges[i].empty()) return CodeMirror.Pass; + var pos = ranges[i].head, tok = cm.getTokenAt(pos); + var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state; + if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass; + + var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html"; + var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose); + var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent); + + var tagName = state.tagName; + if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch); + var lowerTagName = tagName.toLowerCase(); + // Don't process the '>' at the end of an end-tag or self-closing tag + if (!tagName || + tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) || + tok.type == "tag" && state.type == "closeTag" || + tok.string.indexOf("/") == (tok.string.length - 1) || // match something like + dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 || + closingTagExists(cm, tagName, pos, state, true)) + return CodeMirror.Pass; + + var indent = indentTags && indexOf(indentTags, lowerTagName) > -1; + replacements[i] = {indent: indent, + text: ">" + (indent ? "\n\n" : "") + "", + newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)}; + } + + for (var i = ranges.length - 1; i >= 0; i--) { + var info = replacements[i]; + cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert"); + var sel = cm.listSelections().slice(0); + sel[i] = {head: info.newPos, anchor: info.newPos}; + cm.setSelections(sel); + if (info.indent) { + cm.indentLine(info.newPos.line, null, true); + cm.indentLine(info.newPos.line + 1, null, true); + } + } + } + + function autoCloseCurrent(cm, typingSlash) { + var ranges = cm.listSelections(), replacements = []; + var head = typingSlash ? "/" : ""; + else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css") + replacements[i] = head + "style>"; + else + return CodeMirror.Pass; + } else { + if (!state.context || !state.context.tagName || + closingTagExists(cm, state.context.tagName, pos, state)) + return CodeMirror.Pass; + replacements[i] = head + state.context.tagName + ">"; + } + } + cm.replaceSelections(replacements); + ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) + if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line) + cm.indentLine(ranges[i].head.line); + } + + function autoCloseSlash(cm) { + if (cm.getOption("disableInput")) return CodeMirror.Pass; + return autoCloseCurrent(cm, true); + } + + CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); }; + + function indexOf(collection, elt) { + if (collection.indexOf) return collection.indexOf(elt); + for (var i = 0, e = collection.length; i < e; ++i) + if (collection[i] == elt) return i; + return -1; + } + + // If xml-fold is loaded, we use its functionality to try and verify + // whether a given tag is actually unclosed. + function closingTagExists(cm, tagName, pos, state, newTag) { + if (!CodeMirror.scanForClosingTag) return false; + var end = Math.min(cm.lastLine() + 1, pos.line + 500); + var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end); + if (!nextClose || nextClose.tag != tagName) return false; + var cx = state.context; + // If the immediate wrapping context contains onCx instances of + // the same tag, a closing tag only exists if there are at least + // that many closing tags of that type following. + for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx; + pos = nextClose.to; + for (var i = 1; i < onCx; i++) { + var next = CodeMirror.scanForClosingTag(cm, pos, null, end); + if (!next || next.tag != tagName) return false; + pos = next.to; + } + return true; + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/edit/continuelist.js b/src/main/resources/templates/editor/lib/codemirror/addon/edit/continuelist.js new file mode 100644 index 0000000000000000000000000000000000000000..ca8d26751ac01ad3d36a0f3328ed33ab835729c7 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/edit/continuelist.js @@ -0,0 +1,51 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var listRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)\.)(\s*)/, + emptyListRE = /^(\s*)(>[> ]*|[*+-]|(\d+)\.)(\s*)$/, + unorderedListRE = /[*+-]\s/; + + CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) { + if (cm.getOption("disableInput")) return CodeMirror.Pass; + var ranges = cm.listSelections(), replacements = []; + for (var i = 0; i < ranges.length; i++) { + var pos = ranges[i].head, match; + var eolState = cm.getStateAfter(pos.line); + var inList = eolState.list !== false; + var inQuote = eolState.quote !== false; + + if (!ranges[i].empty() || (!inList && !inQuote) || !(match = cm.getLine(pos.line).match(listRE))) { + cm.execCommand("newlineAndIndent"); + return; + } + if (cm.getLine(pos.line).match(emptyListRE)) { + cm.replaceRange("", { + line: pos.line, ch: 0 + }, { + line: pos.line, ch: pos.ch + 1 + }); + replacements[i] = "\n"; + + } else { + var indent = match[1], after = match[4]; + var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0 + ? match[2] + : (parseInt(match[3], 10) + 1) + "."; + + replacements[i] = "\n" + indent + bullet + after; + } + } + + cm.replaceSelections(replacements); + }; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/edit/matchbrackets.js b/src/main/resources/templates/editor/lib/codemirror/addon/edit/matchbrackets.js new file mode 100644 index 0000000000000000000000000000000000000000..70e1ae18c7481742598c8b2069b8a6c717f47257 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/edit/matchbrackets.js @@ -0,0 +1,120 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + var ie_lt8 = /MSIE \d/.test(navigator.userAgent) && + (document.documentMode == null || document.documentMode < 8); + + var Pos = CodeMirror.Pos; + + var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; + + function findMatchingBracket(cm, where, strict, config) { + var line = cm.getLineHandle(where.line), pos = where.ch - 1; + var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; + if (!match) return null; + var dir = match.charAt(1) == ">" ? 1 : -1; + if (strict && (dir > 0) != (pos == where.ch)) return null; + var style = cm.getTokenTypeAt(Pos(where.line, pos + 1)); + + var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config); + if (found == null) return null; + return {from: Pos(where.line, pos), to: found && found.pos, + match: found && found.ch == match.charAt(0), forward: dir > 0}; + } + + // bracketRegex is used to specify which type of bracket to scan + // should be a regexp, e.g. /[[\]]/ + // + // Note: If "where" is on an open bracket, then this bracket is ignored. + // + // Returns false when no bracket was found, null when it reached + // maxScanLines and gave up + function scanForBracket(cm, where, dir, style, config) { + var maxScanLen = (config && config.maxScanLineLength) || 10000; + var maxScanLines = (config && config.maxScanLines) || 1000; + + var stack = []; + var re = config && config.bracketRegex ? config.bracketRegex : /[(){}[\]]/; + var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1) + : Math.max(cm.firstLine() - 1, where.line - maxScanLines); + for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) { + var line = cm.getLine(lineNo); + if (!line) continue; + var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1; + if (line.length > maxScanLen) continue; + if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0); + for (; pos != end; pos += dir) { + var ch = line.charAt(pos); + if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) { + var match = matching[ch]; + if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch); + else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch}; + else stack.pop(); + } + } + } + return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null; + } + + function matchBrackets(cm, autoclear, config) { + // Disable brace matching in long lines, since it'll cause hugely slow updates + var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000; + var marks = [], ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) { + var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, false, config); + if (match && cm.getLine(match.from.line).length <= maxHighlightLen) { + var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; + marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style})); + if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen) + marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style})); + } + } + + if (marks.length) { + // Kludge to work around the IE bug from issue #1193, where text + // input stops going to the textare whever this fires. + if (ie_lt8 && cm.state.focused) cm.focus(); + + var clear = function() { + cm.operation(function() { + for (var i = 0; i < marks.length; i++) marks[i].clear(); + }); + }; + if (autoclear) setTimeout(clear, 800); + else return clear; + } + } + + var currentlyHighlighted = null; + function doMatchBrackets(cm) { + cm.operation(function() { + if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;} + currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets); + }); + } + + CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) + cm.off("cursorActivity", doMatchBrackets); + if (val) { + cm.state.matchBrackets = typeof val == "object" ? val : {}; + cm.on("cursorActivity", doMatchBrackets); + } + }); + + CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);}); + CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config){ + return findMatchingBracket(this, pos, strict, config); + }); + CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){ + return scanForBracket(this, pos, dir, style, config); + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/edit/matchtags.js b/src/main/resources/templates/editor/lib/codemirror/addon/edit/matchtags.js new file mode 100644 index 0000000000000000000000000000000000000000..fb1911a8db73c4a0b87114140f4cde2d7bf40b70 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/edit/matchtags.js @@ -0,0 +1,66 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../fold/xml-fold")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../fold/xml-fold"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineOption("matchTags", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + cm.off("cursorActivity", doMatchTags); + cm.off("viewportChange", maybeUpdateMatch); + clear(cm); + } + if (val) { + cm.state.matchBothTags = typeof val == "object" && val.bothTags; + cm.on("cursorActivity", doMatchTags); + cm.on("viewportChange", maybeUpdateMatch); + doMatchTags(cm); + } + }); + + function clear(cm) { + if (cm.state.tagHit) cm.state.tagHit.clear(); + if (cm.state.tagOther) cm.state.tagOther.clear(); + cm.state.tagHit = cm.state.tagOther = null; + } + + function doMatchTags(cm) { + cm.state.failedTagMatch = false; + cm.operation(function() { + clear(cm); + if (cm.somethingSelected()) return; + var cur = cm.getCursor(), range = cm.getViewport(); + range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to); + var match = CodeMirror.findMatchingTag(cm, cur, range); + if (!match) return; + if (cm.state.matchBothTags) { + var hit = match.at == "open" ? match.open : match.close; + if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"}); + } + var other = match.at == "close" ? match.open : match.close; + if (other) + cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"}); + else + cm.state.failedTagMatch = true; + }); + } + + function maybeUpdateMatch(cm) { + if (cm.state.failedTagMatch) doMatchTags(cm); + } + + CodeMirror.commands.toMatchingTag = function(cm) { + var found = CodeMirror.findMatchingTag(cm, cm.getCursor()); + if (found) { + var other = found.at == "close" ? found.open : found.close; + if (other) cm.extendSelection(other.to, other.from); + } + }; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/edit/trailingspace.js b/src/main/resources/templates/editor/lib/codemirror/addon/edit/trailingspace.js new file mode 100644 index 0000000000000000000000000000000000000000..fa7b56be51017983fcd3587833892946beff688a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/edit/trailingspace.js @@ -0,0 +1,27 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) { + if (prev == CodeMirror.Init) prev = false; + if (prev && !val) + cm.removeOverlay("trailingspace"); + else if (!prev && val) + cm.addOverlay({ + token: function(stream) { + for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {} + if (i > stream.pos) { stream.pos = i; return null; } + stream.pos = l; + return "trailingspace"; + }, + name: "trailingspace" + }); + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/fold/brace-fold.js b/src/main/resources/templates/editor/lib/codemirror/addon/fold/brace-fold.js new file mode 100644 index 0000000000000000000000000000000000000000..1605f6c2a91e0260adc97f4c586fb3327c7763d7 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/fold/brace-fold.js @@ -0,0 +1,105 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.registerHelper("fold", "brace", function(cm, start) { + var line = start.line, lineText = cm.getLine(line); + var startCh, tokenType; + + function findOpening(openCh) { + for (var at = start.ch, pass = 0;;) { + var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1); + if (found == -1) { + if (pass == 1) break; + pass = 1; + at = lineText.length; + continue; + } + if (pass == 1 && found < start.ch) break; + tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)); + if (!/^(comment|string)/.test(tokenType)) return found + 1; + at = found - 1; + } + } + + var startToken = "{", endToken = "}", startCh = findOpening("{"); + if (startCh == null) { + startToken = "[", endToken = "]"; + startCh = findOpening("["); + } + + if (startCh == null) return; + var count = 1, lastLine = cm.lastLine(), end, endCh; + outer: for (var i = line; i <= lastLine; ++i) { + var text = cm.getLine(i), pos = i == line ? startCh : 0; + for (;;) { + var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); + if (nextOpen < 0) nextOpen = text.length; + if (nextClose < 0) nextClose = text.length; + pos = Math.min(nextOpen, nextClose); + if (pos == text.length) break; + if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) { + if (pos == nextOpen) ++count; + else if (!--count) { end = i; endCh = pos; break outer; } + } + ++pos; + } + } + if (end == null || line == end && endCh == startCh) return; + return {from: CodeMirror.Pos(line, startCh), + to: CodeMirror.Pos(end, endCh)}; +}); + +CodeMirror.registerHelper("fold", "import", function(cm, start) { + function hasImport(line) { + if (line < cm.firstLine() || line > cm.lastLine()) return null; + var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); + if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); + if (start.type != "keyword" || start.string != "import") return null; + // Now find closing semicolon, return its position + for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) { + var text = cm.getLine(i), semi = text.indexOf(";"); + if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)}; + } + } + + var start = start.line, has = hasImport(start), prev; + if (!has || hasImport(start - 1) || ((prev = hasImport(start - 2)) && prev.end.line == start - 1)) + return null; + for (var end = has.end;;) { + var next = hasImport(end.line + 1); + if (next == null) break; + end = next.end; + } + return {from: cm.clipPos(CodeMirror.Pos(start, has.startCh + 1)), to: end}; +}); + +CodeMirror.registerHelper("fold", "include", function(cm, start) { + function hasInclude(line) { + if (line < cm.firstLine() || line > cm.lastLine()) return null; + var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); + if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); + if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8; + } + + var start = start.line, has = hasInclude(start); + if (has == null || hasInclude(start - 1) != null) return null; + for (var end = start;;) { + var next = hasInclude(end + 1); + if (next == null) break; + ++end; + } + return {from: CodeMirror.Pos(start, has + 1), + to: cm.clipPos(CodeMirror.Pos(end))}; +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/fold/comment-fold.js b/src/main/resources/templates/editor/lib/codemirror/addon/fold/comment-fold.js new file mode 100644 index 0000000000000000000000000000000000000000..b75db7ea25b211e639d8ea80d59a7e43abb28a62 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/fold/comment-fold.js @@ -0,0 +1,57 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.registerGlobalHelper("fold", "comment", function(mode) { + return mode.blockCommentStart && mode.blockCommentEnd; +}, function(cm, start) { + var mode = cm.getModeAt(start), startToken = mode.blockCommentStart, endToken = mode.blockCommentEnd; + if (!startToken || !endToken) return; + var line = start.line, lineText = cm.getLine(line); + + var startCh; + for (var at = start.ch, pass = 0;;) { + var found = at <= 0 ? -1 : lineText.lastIndexOf(startToken, at - 1); + if (found == -1) { + if (pass == 1) return; + pass = 1; + at = lineText.length; + continue; + } + if (pass == 1 && found < start.ch) return; + if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)))) { + startCh = found + startToken.length; + break; + } + at = found - 1; + } + + var depth = 1, lastLine = cm.lastLine(), end, endCh; + outer: for (var i = line; i <= lastLine; ++i) { + var text = cm.getLine(i), pos = i == line ? startCh : 0; + for (;;) { + var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); + if (nextOpen < 0) nextOpen = text.length; + if (nextClose < 0) nextClose = text.length; + pos = Math.min(nextOpen, nextClose); + if (pos == text.length) break; + if (pos == nextOpen) ++depth; + else if (!--depth) { end = i; endCh = pos; break outer; } + ++pos; + } + } + if (end == null || line == end && endCh == startCh) return; + return {from: CodeMirror.Pos(line, startCh), + to: CodeMirror.Pos(end, endCh)}; +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/fold/foldcode.js b/src/main/resources/templates/editor/lib/codemirror/addon/fold/foldcode.js new file mode 100644 index 0000000000000000000000000000000000000000..62911f93526c51495aedbbbd10cd6aa2c385cbe1 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/fold/foldcode.js @@ -0,0 +1,149 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function doFold(cm, pos, options, force) { + if (options && options.call) { + var finder = options; + options = null; + } else { + var finder = getOption(cm, options, "rangeFinder"); + } + if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0); + var minSize = getOption(cm, options, "minFoldSize"); + + function getRange(allowFolded) { + var range = finder(cm, pos); + if (!range || range.to.line - range.from.line < minSize) return null; + var marks = cm.findMarksAt(range.from); + for (var i = 0; i < marks.length; ++i) { + if (marks[i].__isFold && force !== "fold") { + if (!allowFolded) return null; + range.cleared = true; + marks[i].clear(); + } + } + return range; + } + + var range = getRange(true); + if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) { + pos = CodeMirror.Pos(pos.line - 1, 0); + range = getRange(false); + } + if (!range || range.cleared || force === "unfold") return; + + var myWidget = makeWidget(cm, options); + CodeMirror.on(myWidget, "mousedown", function(e) { + myRange.clear(); + CodeMirror.e_preventDefault(e); + }); + var myRange = cm.markText(range.from, range.to, { + replacedWith: myWidget, + clearOnEnter: true, + __isFold: true + }); + myRange.on("clear", function(from, to) { + CodeMirror.signal(cm, "unfold", cm, from, to); + }); + CodeMirror.signal(cm, "fold", cm, range.from, range.to); + } + + function makeWidget(cm, options) { + var widget = getOption(cm, options, "widget"); + if (typeof widget == "string") { + var text = document.createTextNode(widget); + widget = document.createElement("span"); + widget.appendChild(text); + widget.className = "CodeMirror-foldmarker"; + } + return widget; + } + + // Clumsy backwards-compatible interface + CodeMirror.newFoldFunction = function(rangeFinder, widget) { + return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); }; + }; + + // New-style interface + CodeMirror.defineExtension("foldCode", function(pos, options, force) { + doFold(this, pos, options, force); + }); + + CodeMirror.defineExtension("isFolded", function(pos) { + var marks = this.findMarksAt(pos); + for (var i = 0; i < marks.length; ++i) + if (marks[i].__isFold) return true; + }); + + CodeMirror.commands.toggleFold = function(cm) { + cm.foldCode(cm.getCursor()); + }; + CodeMirror.commands.fold = function(cm) { + cm.foldCode(cm.getCursor(), null, "fold"); + }; + CodeMirror.commands.unfold = function(cm) { + cm.foldCode(cm.getCursor(), null, "unfold"); + }; + CodeMirror.commands.foldAll = function(cm) { + cm.operation(function() { + for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) + cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); + }); + }; + CodeMirror.commands.unfoldAll = function(cm) { + cm.operation(function() { + for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) + cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold"); + }); + }; + + CodeMirror.registerHelper("fold", "combine", function() { + var funcs = Array.prototype.slice.call(arguments, 0); + return function(cm, start) { + for (var i = 0; i < funcs.length; ++i) { + var found = funcs[i](cm, start); + if (found) return found; + } + }; + }); + + CodeMirror.registerHelper("fold", "auto", function(cm, start) { + var helpers = cm.getHelpers(start, "fold"); + for (var i = 0; i < helpers.length; i++) { + var cur = helpers[i](cm, start); + if (cur) return cur; + } + }); + + var defaultOptions = { + rangeFinder: CodeMirror.fold.auto, + widget: "\u2194", + minFoldSize: 0, + scanUp: false + }; + + CodeMirror.defineOption("foldOptions", null); + + function getOption(cm, options, name) { + if (options && options[name] !== undefined) + return options[name]; + var editorOptions = cm.options.foldOptions; + if (editorOptions && editorOptions[name] !== undefined) + return editorOptions[name]; + return defaultOptions[name]; + } + + CodeMirror.defineExtension("foldOption", function(options, name) { + return getOption(this, options, name); + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/fold/foldgutter.css b/src/main/resources/templates/editor/lib/codemirror/addon/fold/foldgutter.css new file mode 100644 index 0000000000000000000000000000000000000000..ad19ae2d3ee19e83124c683ebc85410055920d80 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/fold/foldgutter.css @@ -0,0 +1,20 @@ +.CodeMirror-foldmarker { + color: blue; + text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; + font-family: arial; + line-height: .3; + cursor: pointer; +} +.CodeMirror-foldgutter { + width: .7em; +} +.CodeMirror-foldgutter-open, +.CodeMirror-foldgutter-folded { + cursor: pointer; +} +.CodeMirror-foldgutter-open:after { + content: "\25BE"; +} +.CodeMirror-foldgutter-folded:after { + content: "\25B8"; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/fold/foldgutter.js b/src/main/resources/templates/editor/lib/codemirror/addon/fold/foldgutter.js new file mode 100644 index 0000000000000000000000000000000000000000..199120c726015c951b5b097f74ad83b9fa68ce95 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/fold/foldgutter.js @@ -0,0 +1,144 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("./foldcode")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "./foldcode"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineOption("foldGutter", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + cm.clearGutter(cm.state.foldGutter.options.gutter); + cm.state.foldGutter = null; + cm.off("gutterClick", onGutterClick); + cm.off("change", onChange); + cm.off("viewportChange", onViewportChange); + cm.off("fold", onFold); + cm.off("unfold", onFold); + cm.off("swapDoc", updateInViewport); + } + if (val) { + cm.state.foldGutter = new State(parseOptions(val)); + updateInViewport(cm); + cm.on("gutterClick", onGutterClick); + cm.on("change", onChange); + cm.on("viewportChange", onViewportChange); + cm.on("fold", onFold); + cm.on("unfold", onFold); + cm.on("swapDoc", updateInViewport); + } + }); + + var Pos = CodeMirror.Pos; + + function State(options) { + this.options = options; + this.from = this.to = 0; + } + + function parseOptions(opts) { + if (opts === true) opts = {}; + if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter"; + if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open"; + if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded"; + return opts; + } + + function isFolded(cm, line) { + var marks = cm.findMarksAt(Pos(line)); + for (var i = 0; i < marks.length; ++i) + if (marks[i].__isFold && marks[i].find().from.line == line) return true; + } + + function marker(spec) { + if (typeof spec == "string") { + var elt = document.createElement("div"); + elt.className = spec + " CodeMirror-guttermarker-subtle"; + return elt; + } else { + return spec.cloneNode(true); + } + } + + function updateFoldInfo(cm, from, to) { + var opts = cm.state.foldGutter.options, cur = from; + var minSize = cm.foldOption(opts, "minFoldSize"); + var func = cm.foldOption(opts, "rangeFinder"); + cm.eachLine(from, to, function(line) { + var mark = null; + if (isFolded(cm, cur)) { + mark = marker(opts.indicatorFolded); + } else { + var pos = Pos(cur, 0); + var range = func && func(cm, pos); + if (range && range.to.line - range.from.line >= minSize) + mark = marker(opts.indicatorOpen); + } + cm.setGutterMarker(line, opts.gutter, mark); + ++cur; + }); + } + + function updateInViewport(cm) { + var vp = cm.getViewport(), state = cm.state.foldGutter; + if (!state) return; + cm.operation(function() { + updateFoldInfo(cm, vp.from, vp.to); + }); + state.from = vp.from; state.to = vp.to; + } + + function onGutterClick(cm, line, gutter) { + var state = cm.state.foldGutter; + if (!state) return; + var opts = state.options; + if (gutter != opts.gutter) return; + cm.foldCode(Pos(line, 0), opts.rangeFinder); + } + + function onChange(cm) { + var state = cm.state.foldGutter; + if (!state) return; + var opts = state.options; + state.from = state.to = 0; + clearTimeout(state.changeUpdate); + state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600); + } + + function onViewportChange(cm) { + var state = cm.state.foldGutter; + if (!state) return; + var opts = state.options; + clearTimeout(state.changeUpdate); + state.changeUpdate = setTimeout(function() { + var vp = cm.getViewport(); + if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) { + updateInViewport(cm); + } else { + cm.operation(function() { + if (vp.from < state.from) { + updateFoldInfo(cm, vp.from, state.from); + state.from = vp.from; + } + if (vp.to > state.to) { + updateFoldInfo(cm, state.to, vp.to); + state.to = vp.to; + } + }); + } + }, opts.updateViewportTimeSpan || 400); + } + + function onFold(cm, from) { + var state = cm.state.foldGutter; + if (!state) return; + var line = from.line; + if (line >= state.from && line < state.to) + updateFoldInfo(cm, line, line + 1); + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/fold/indent-fold.js b/src/main/resources/templates/editor/lib/codemirror/addon/fold/indent-fold.js new file mode 100644 index 0000000000000000000000000000000000000000..e29f15e9daf804b847dc9a14b12c3ba4a67d156e --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/fold/indent-fold.js @@ -0,0 +1,44 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.registerHelper("fold", "indent", function(cm, start) { + var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line); + if (!/\S/.test(firstLine)) return; + var getIndent = function(line) { + return CodeMirror.countColumn(line, null, tabSize); + }; + var myIndent = getIndent(firstLine); + var lastLineInFold = null; + // Go through lines until we find a line that definitely doesn't belong in + // the block we're folding, or to the end. + for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) { + var curLine = cm.getLine(i); + var curIndent = getIndent(curLine); + if (curIndent > myIndent) { + // Lines with a greater indent are considered part of the block. + lastLineInFold = i; + } else if (!/\S/.test(curLine)) { + // Empty lines might be breaks within the block we're trying to fold. + } else { + // A non-empty line at an indent equal to or less than ours marks the + // start of another block. + break; + } + } + if (lastLineInFold) return { + from: CodeMirror.Pos(start.line, firstLine.length), + to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length) + }; +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/fold/markdown-fold.js b/src/main/resources/templates/editor/lib/codemirror/addon/fold/markdown-fold.js new file mode 100644 index 0000000000000000000000000000000000000000..ce84c946ce8c9e6be5eab32f87f8df450d065519 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/fold/markdown-fold.js @@ -0,0 +1,49 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.registerHelper("fold", "markdown", function(cm, start) { + var maxDepth = 100; + + function isHeader(lineNo) { + var tokentype = cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0)); + return tokentype && /\bheader\b/.test(tokentype); + } + + function headerLevel(lineNo, line, nextLine) { + var match = line && line.match(/^#+/); + if (match && isHeader(lineNo)) return match[0].length; + match = nextLine && nextLine.match(/^[=\-]+\s*$/); + if (match && isHeader(lineNo + 1)) return nextLine[0] == "=" ? 1 : 2; + return maxDepth; + } + + var firstLine = cm.getLine(start.line), nextLine = cm.getLine(start.line + 1); + var level = headerLevel(start.line, firstLine, nextLine); + if (level === maxDepth) return undefined; + + var lastLineNo = cm.lastLine(); + var end = start.line, nextNextLine = cm.getLine(end + 2); + while (end < lastLineNo) { + if (headerLevel(end + 1, nextLine, nextNextLine) <= level) break; + ++end; + nextLine = nextNextLine; + nextNextLine = cm.getLine(end + 2); + } + + return { + from: CodeMirror.Pos(start.line, firstLine.length), + to: CodeMirror.Pos(end, cm.getLine(end).length) + }; +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/fold/xml-fold.js b/src/main/resources/templates/editor/lib/codemirror/addon/fold/xml-fold.js new file mode 100644 index 0000000000000000000000000000000000000000..504727f38c57974f10d8f02ae794b27a0cf3a4ff --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/fold/xml-fold.js @@ -0,0 +1,182 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var Pos = CodeMirror.Pos; + function cmp(a, b) { return a.line - b.line || a.ch - b.ch; } + + var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; + var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; + var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g"); + + function Iter(cm, line, ch, range) { + this.line = line; this.ch = ch; + this.cm = cm; this.text = cm.getLine(line); + this.min = range ? range.from : cm.firstLine(); + this.max = range ? range.to - 1 : cm.lastLine(); + } + + function tagAt(iter, ch) { + var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch)); + return type && /\btag\b/.test(type); + } + + function nextLine(iter) { + if (iter.line >= iter.max) return; + iter.ch = 0; + iter.text = iter.cm.getLine(++iter.line); + return true; + } + function prevLine(iter) { + if (iter.line <= iter.min) return; + iter.text = iter.cm.getLine(--iter.line); + iter.ch = iter.text.length; + return true; + } + + function toTagEnd(iter) { + for (;;) { + var gt = iter.text.indexOf(">", iter.ch); + if (gt == -1) { if (nextLine(iter)) continue; else return; } + if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; } + var lastSlash = iter.text.lastIndexOf("/", gt); + var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); + iter.ch = gt + 1; + return selfClose ? "selfClose" : "regular"; + } + } + function toTagStart(iter) { + for (;;) { + var lt = iter.ch ? iter.text.lastIndexOf("<", iter.ch - 1) : -1; + if (lt == -1) { if (prevLine(iter)) continue; else return; } + if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; } + xmlTagStart.lastIndex = lt; + iter.ch = lt; + var match = xmlTagStart.exec(iter.text); + if (match && match.index == lt) return match; + } + } + + function toNextTag(iter) { + for (;;) { + xmlTagStart.lastIndex = iter.ch; + var found = xmlTagStart.exec(iter.text); + if (!found) { if (nextLine(iter)) continue; else return; } + if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; } + iter.ch = found.index + found[0].length; + return found; + } + } + function toPrevTag(iter) { + for (;;) { + var gt = iter.ch ? iter.text.lastIndexOf(">", iter.ch - 1) : -1; + if (gt == -1) { if (prevLine(iter)) continue; else return; } + if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; } + var lastSlash = iter.text.lastIndexOf("/", gt); + var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); + iter.ch = gt + 1; + return selfClose ? "selfClose" : "regular"; + } + } + + function findMatchingClose(iter, tag) { + var stack = []; + for (;;) { + var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0); + if (!next || !(end = toTagEnd(iter))) return; + if (end == "selfClose") continue; + if (next[1]) { // closing tag + for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) { + stack.length = i; + break; + } + if (i < 0 && (!tag || tag == next[2])) return { + tag: next[2], + from: Pos(startLine, startCh), + to: Pos(iter.line, iter.ch) + }; + } else { // opening tag + stack.push(next[2]); + } + } + } + function findMatchingOpen(iter, tag) { + var stack = []; + for (;;) { + var prev = toPrevTag(iter); + if (!prev) return; + if (prev == "selfClose") { toTagStart(iter); continue; } + var endLine = iter.line, endCh = iter.ch; + var start = toTagStart(iter); + if (!start) return; + if (start[1]) { // closing tag + stack.push(start[2]); + } else { // opening tag + for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) { + stack.length = i; + break; + } + if (i < 0 && (!tag || tag == start[2])) return { + tag: start[2], + from: Pos(iter.line, iter.ch), + to: Pos(endLine, endCh) + }; + } + } + } + + CodeMirror.registerHelper("fold", "xml", function(cm, start) { + var iter = new Iter(cm, start.line, 0); + for (;;) { + var openTag = toNextTag(iter), end; + if (!openTag || iter.line != start.line || !(end = toTagEnd(iter))) return; + if (!openTag[1] && end != "selfClose") { + var start = Pos(iter.line, iter.ch); + var close = findMatchingClose(iter, openTag[2]); + return close && {from: start, to: close.from}; + } + } + }); + CodeMirror.findMatchingTag = function(cm, pos, range) { + var iter = new Iter(cm, pos.line, pos.ch, range); + if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return; + var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch); + var start = end && toTagStart(iter); + if (!end || !start || cmp(iter, pos) > 0) return; + var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]}; + if (end == "selfClose") return {open: here, close: null, at: "open"}; + + if (start[1]) { // closing tag + return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"}; + } else { // opening tag + iter = new Iter(cm, to.line, to.ch, range); + return {open: here, close: findMatchingClose(iter, start[2]), at: "open"}; + } + }; + + CodeMirror.findEnclosingTag = function(cm, pos, range) { + var iter = new Iter(cm, pos.line, pos.ch, range); + for (;;) { + var open = findMatchingOpen(iter); + if (!open) break; + var forward = new Iter(cm, pos.line, pos.ch, range); + var close = findMatchingClose(forward, open.tag); + if (close) return {open: open, close: close}; + } + }; + + // Used by addon/edit/closetag.js + CodeMirror.scanForClosingTag = function(cm, pos, name, end) { + var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null); + return findMatchingClose(iter, name); + }; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/hint/anyword-hint.js b/src/main/resources/templates/editor/lib/codemirror/addon/hint/anyword-hint.js new file mode 100644 index 0000000000000000000000000000000000000000..8e74a920804774dcf9f451772bdf654dcc797b03 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/hint/anyword-hint.js @@ -0,0 +1,41 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var WORD = /[\w$]+/, RANGE = 500; + + CodeMirror.registerHelper("hint", "anyword", function(editor, options) { + var word = options && options.word || WORD; + var range = options && options.range || RANGE; + var cur = editor.getCursor(), curLine = editor.getLine(cur.line); + var end = cur.ch, start = end; + while (start && word.test(curLine.charAt(start - 1))) --start; + var curWord = start != end && curLine.slice(start, end); + + var list = [], seen = {}; + var re = new RegExp(word.source, "g"); + for (var dir = -1; dir <= 1; dir += 2) { + var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir; + for (; line != endLine; line += dir) { + var text = editor.getLine(line), m; + while (m = re.exec(text)) { + if (line == cur.line && m[0] === curWord) continue; + if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) { + seen[m[0]] = true; + list.push(m[0]); + } + } + } + } + return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)}; + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/hint/css-hint.js b/src/main/resources/templates/editor/lib/codemirror/addon/hint/css-hint.js new file mode 100644 index 0000000000000000000000000000000000000000..488da3449e8c45285fafccdbcee5e3391057ecb1 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/hint/css-hint.js @@ -0,0 +1,56 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../../mode/css/css")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../../mode/css/css"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var pseudoClasses = {link: 1, visited: 1, active: 1, hover: 1, focus: 1, + "first-letter": 1, "first-line": 1, "first-child": 1, + before: 1, after: 1, lang: 1}; + + CodeMirror.registerHelper("hint", "css", function(cm) { + var cur = cm.getCursor(), token = cm.getTokenAt(cur); + var inner = CodeMirror.innerMode(cm.getMode(), token.state); + if (inner.mode.name != "css") return; + + var start = token.start, end = cur.ch, word = token.string.slice(0, end - start); + if (/[^\w$_-]/.test(word)) { + word = ""; start = end = cur.ch; + } + + var spec = CodeMirror.resolveMode("text/css"); + + var result = []; + function add(keywords) { + for (var name in keywords) + if (!word || name.lastIndexOf(word, 0) == 0) + result.push(name); + } + + var st = inner.state.state; + if (st == "pseudo" || token.type == "variable-3") { + add(pseudoClasses); + } else if (st == "block" || st == "maybeprop") { + add(spec.propertyKeywords); + } else if (st == "prop" || st == "parens" || st == "at" || st == "params") { + add(spec.valueKeywords); + add(spec.colorKeywords); + } else if (st == "media" || st == "media_parens") { + add(spec.mediaTypes); + add(spec.mediaFeatures); + } + + if (result.length) return { + list: result, + from: CodeMirror.Pos(cur.line, start), + to: CodeMirror.Pos(cur.line, end) + }; + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/hint/html-hint.js b/src/main/resources/templates/editor/lib/codemirror/addon/hint/html-hint.js new file mode 100644 index 0000000000000000000000000000000000000000..c6769bcae5e260184eb64d1ce24ee3dcc5c271e6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/hint/html-hint.js @@ -0,0 +1,348 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("./xml-hint")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "./xml-hint"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var langs = "ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" "); + var targets = ["_blank", "_self", "_top", "_parent"]; + var charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"]; + var methods = ["get", "post", "put", "delete"]; + var encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]; + var media = ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech", + "3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait", + "orientation:landscape", "device-height: [X]", "device-width: [X]"]; + var s = { attrs: {} }; // Simple tag, reused for a whole lot of tags + + var data = { + a: { + attrs: { + href: null, ping: null, type: null, + media: media, + target: targets, + hreflang: langs + } + }, + abbr: s, + acronym: s, + address: s, + applet: s, + area: { + attrs: { + alt: null, coords: null, href: null, target: null, ping: null, + media: media, hreflang: langs, type: null, + shape: ["default", "rect", "circle", "poly"] + } + }, + article: s, + aside: s, + audio: { + attrs: { + src: null, mediagroup: null, + crossorigin: ["anonymous", "use-credentials"], + preload: ["none", "metadata", "auto"], + autoplay: ["", "autoplay"], + loop: ["", "loop"], + controls: ["", "controls"] + } + }, + b: s, + base: { attrs: { href: null, target: targets } }, + basefont: s, + bdi: s, + bdo: s, + big: s, + blockquote: { attrs: { cite: null } }, + body: s, + br: s, + button: { + attrs: { + form: null, formaction: null, name: null, value: null, + autofocus: ["", "autofocus"], + disabled: ["", "autofocus"], + formenctype: encs, + formmethod: methods, + formnovalidate: ["", "novalidate"], + formtarget: targets, + type: ["submit", "reset", "button"] + } + }, + canvas: { attrs: { width: null, height: null } }, + caption: s, + center: s, + cite: s, + code: s, + col: { attrs: { span: null } }, + colgroup: { attrs: { span: null } }, + command: { + attrs: { + type: ["command", "checkbox", "radio"], + label: null, icon: null, radiogroup: null, command: null, title: null, + disabled: ["", "disabled"], + checked: ["", "checked"] + } + }, + data: { attrs: { value: null } }, + datagrid: { attrs: { disabled: ["", "disabled"], multiple: ["", "multiple"] } }, + datalist: { attrs: { data: null } }, + dd: s, + del: { attrs: { cite: null, datetime: null } }, + details: { attrs: { open: ["", "open"] } }, + dfn: s, + dir: s, + div: s, + dl: s, + dt: s, + em: s, + embed: { attrs: { src: null, type: null, width: null, height: null } }, + eventsource: { attrs: { src: null } }, + fieldset: { attrs: { disabled: ["", "disabled"], form: null, name: null } }, + figcaption: s, + figure: s, + font: s, + footer: s, + form: { + attrs: { + action: null, name: null, + "accept-charset": charsets, + autocomplete: ["on", "off"], + enctype: encs, + method: methods, + novalidate: ["", "novalidate"], + target: targets + } + }, + frame: s, + frameset: s, + h1: s, h2: s, h3: s, h4: s, h5: s, h6: s, + head: { + attrs: {}, + children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"] + }, + header: s, + hgroup: s, + hr: s, + html: { + attrs: { manifest: null }, + children: ["head", "body"] + }, + i: s, + iframe: { + attrs: { + src: null, srcdoc: null, name: null, width: null, height: null, + sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"], + seamless: ["", "seamless"] + } + }, + img: { + attrs: { + alt: null, src: null, ismap: null, usemap: null, width: null, height: null, + crossorigin: ["anonymous", "use-credentials"] + } + }, + input: { + attrs: { + alt: null, dirname: null, form: null, formaction: null, + height: null, list: null, max: null, maxlength: null, min: null, + name: null, pattern: null, placeholder: null, size: null, src: null, + step: null, value: null, width: null, + accept: ["audio/*", "video/*", "image/*"], + autocomplete: ["on", "off"], + autofocus: ["", "autofocus"], + checked: ["", "checked"], + disabled: ["", "disabled"], + formenctype: encs, + formmethod: methods, + formnovalidate: ["", "novalidate"], + formtarget: targets, + multiple: ["", "multiple"], + readonly: ["", "readonly"], + required: ["", "required"], + type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month", + "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio", + "file", "submit", "image", "reset", "button"] + } + }, + ins: { attrs: { cite: null, datetime: null } }, + kbd: s, + keygen: { + attrs: { + challenge: null, form: null, name: null, + autofocus: ["", "autofocus"], + disabled: ["", "disabled"], + keytype: ["RSA"] + } + }, + label: { attrs: { "for": null, form: null } }, + legend: s, + li: { attrs: { value: null } }, + link: { + attrs: { + href: null, type: null, + hreflang: langs, + media: media, + sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"] + } + }, + map: { attrs: { name: null } }, + mark: s, + menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } }, + meta: { + attrs: { + content: null, + charset: charsets, + name: ["viewport", "application-name", "author", "description", "generator", "keywords"], + "http-equiv": ["content-language", "content-type", "default-style", "refresh"] + } + }, + meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } }, + nav: s, + noframes: s, + noscript: s, + object: { + attrs: { + data: null, type: null, name: null, usemap: null, form: null, width: null, height: null, + typemustmatch: ["", "typemustmatch"] + } + }, + ol: { attrs: { reversed: ["", "reversed"], start: null, type: ["1", "a", "A", "i", "I"] } }, + optgroup: { attrs: { disabled: ["", "disabled"], label: null } }, + option: { attrs: { disabled: ["", "disabled"], label: null, selected: ["", "selected"], value: null } }, + output: { attrs: { "for": null, form: null, name: null } }, + p: s, + param: { attrs: { name: null, value: null } }, + pre: s, + progress: { attrs: { value: null, max: null } }, + q: { attrs: { cite: null } }, + rp: s, + rt: s, + ruby: s, + s: s, + samp: s, + script: { + attrs: { + type: ["text/javascript"], + src: null, + async: ["", "async"], + defer: ["", "defer"], + charset: charsets + } + }, + section: s, + select: { + attrs: { + form: null, name: null, size: null, + autofocus: ["", "autofocus"], + disabled: ["", "disabled"], + multiple: ["", "multiple"] + } + }, + small: s, + source: { attrs: { src: null, type: null, media: null } }, + span: s, + strike: s, + strong: s, + style: { + attrs: { + type: ["text/css"], + media: media, + scoped: null + } + }, + sub: s, + summary: s, + sup: s, + table: s, + tbody: s, + td: { attrs: { colspan: null, rowspan: null, headers: null } }, + textarea: { + attrs: { + dirname: null, form: null, maxlength: null, name: null, placeholder: null, + rows: null, cols: null, + autofocus: ["", "autofocus"], + disabled: ["", "disabled"], + readonly: ["", "readonly"], + required: ["", "required"], + wrap: ["soft", "hard"] + } + }, + tfoot: s, + th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } }, + thead: s, + time: { attrs: { datetime: null } }, + title: s, + tr: s, + track: { + attrs: { + src: null, label: null, "default": null, + kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"], + srclang: langs + } + }, + tt: s, + u: s, + ul: s, + "var": s, + video: { + attrs: { + src: null, poster: null, width: null, height: null, + crossorigin: ["anonymous", "use-credentials"], + preload: ["auto", "metadata", "none"], + autoplay: ["", "autoplay"], + mediagroup: ["movie"], + muted: ["", "muted"], + controls: ["", "controls"] + } + }, + wbr: s + }; + + var globalAttrs = { + accesskey: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + "class": null, + contenteditable: ["true", "false"], + contextmenu: null, + dir: ["ltr", "rtl", "auto"], + draggable: ["true", "false", "auto"], + dropzone: ["copy", "move", "link", "string:", "file:"], + hidden: ["hidden"], + id: null, + inert: ["inert"], + itemid: null, + itemprop: null, + itemref: null, + itemscope: ["itemscope"], + itemtype: null, + lang: ["en", "es"], + spellcheck: ["true", "false"], + style: null, + tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"], + title: null, + translate: ["yes", "no"], + onclick: null, + rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"] + }; + function populate(obj) { + for (var attr in globalAttrs) if (globalAttrs.hasOwnProperty(attr)) + obj.attrs[attr] = globalAttrs[attr]; + } + + populate(s); + for (var tag in data) if (data.hasOwnProperty(tag) && data[tag] != s) + populate(data[tag]); + + CodeMirror.htmlSchema = data; + function htmlHint(cm, options) { + var local = {schemaInfo: data}; + if (options) for (var opt in options) local[opt] = options[opt]; + return CodeMirror.hint.xml(cm, local); + } + CodeMirror.registerHelper("hint", "html", htmlHint); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/hint/javascript-hint.js b/src/main/resources/templates/editor/lib/codemirror/addon/hint/javascript-hint.js new file mode 100644 index 0000000000000000000000000000000000000000..7bcbf4a057db2ee6cc84ca057ab2804e5bce7620 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/hint/javascript-hint.js @@ -0,0 +1,146 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + var Pos = CodeMirror.Pos; + + function forEach(arr, f) { + for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); + } + + function arrayContains(arr, item) { + if (!Array.prototype.indexOf) { + var i = arr.length; + while (i--) { + if (arr[i] === item) { + return true; + } + } + return false; + } + return arr.indexOf(item) != -1; + } + + function scriptHint(editor, keywords, getToken, options) { + // Find the token at the cursor + var cur = editor.getCursor(), token = getToken(editor, cur); + if (/\b(?:string|comment)\b/.test(token.type)) return; + token.state = CodeMirror.innerMode(editor.getMode(), token.state).state; + + // If it's not a 'word-style' token, ignore the token. + if (!/^[\w$_]*$/.test(token.string)) { + token = {start: cur.ch, end: cur.ch, string: "", state: token.state, + type: token.string == "." ? "property" : null}; + } else if (token.end > cur.ch) { + token.end = cur.ch; + token.string = token.string.slice(0, cur.ch - token.start); + } + + var tprop = token; + // If it is a property, find out what it is a property of. + while (tprop.type == "property") { + tprop = getToken(editor, Pos(cur.line, tprop.start)); + if (tprop.string != ".") return; + tprop = getToken(editor, Pos(cur.line, tprop.start)); + if (!context) var context = []; + context.push(tprop); + } + return {list: getCompletions(token, context, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end)}; + } + + function javascriptHint(editor, options) { + return scriptHint(editor, javascriptKeywords, + function (e, cur) {return e.getTokenAt(cur);}, + options); + }; + CodeMirror.registerHelper("hint", "javascript", javascriptHint); + + function getCoffeeScriptToken(editor, cur) { + // This getToken, it is for coffeescript, imitates the behavior of + // getTokenAt method in javascript.js, that is, returning "property" + // type and treat "." as indepenent token. + var token = editor.getTokenAt(cur); + if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') { + token.end = token.start; + token.string = '.'; + token.type = "property"; + } + else if (/^\.[\w$_]*$/.test(token.string)) { + token.type = "property"; + token.start++; + token.string = token.string.replace(/\./, ''); + } + return token; + } + + function coffeescriptHint(editor, options) { + return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options); + } + CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint); + + var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " + + "toUpperCase toLowerCase split concat match replace search").split(" "); + var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " + + "lastIndexOf every some filter forEach map reduce reduceRight ").split(" "); + var funcProps = "prototype apply call bind".split(" "); + var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " + + "if in instanceof new null return switch throw true try typeof var void while with").split(" "); + var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " + + "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" "); + + function getCompletions(token, context, keywords, options) { + var found = [], start = token.string, global = options && options.globalScope || window; + function maybeAdd(str) { + if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str); + } + function gatherCompletions(obj) { + if (typeof obj == "string") forEach(stringProps, maybeAdd); + else if (obj instanceof Array) forEach(arrayProps, maybeAdd); + else if (obj instanceof Function) forEach(funcProps, maybeAdd); + for (var name in obj) maybeAdd(name); + } + + if (context && context.length) { + // If this is a property, see if it belongs to some object we can + // find in the current environment. + var obj = context.pop(), base; + if (obj.type && obj.type.indexOf("variable") === 0) { + if (options && options.additionalContext) + base = options.additionalContext[obj.string]; + if (!options || options.useGlobalScope !== false) + base = base || global[obj.string]; + } else if (obj.type == "string") { + base = ""; + } else if (obj.type == "atom") { + base = 1; + } else if (obj.type == "function") { + if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') && + (typeof global.jQuery == 'function')) + base = global.jQuery(); + else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function')) + base = global._(); + } + while (base != null && context.length) + base = base[context.pop().string]; + if (base != null) gatherCompletions(base); + } else { + // If not, just look in the global object and any local scope + // (reading into JS mode internals to get at the local and global variables) + for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name); + for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name); + if (!options || options.useGlobalScope !== false) + gatherCompletions(global); + forEach(keywords, maybeAdd); + } + return found; + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/hint/show-hint.css b/src/main/resources/templates/editor/lib/codemirror/addon/hint/show-hint.css new file mode 100644 index 0000000000000000000000000000000000000000..924e638f7f7bb690809225c2ac28650fe4596938 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/hint/show-hint.css @@ -0,0 +1,38 @@ +.CodeMirror-hints { + position: absolute; + z-index: 10; + overflow: hidden; + list-style: none; + + margin: 0; + padding: 2px; + + -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + box-shadow: 2px 3px 5px rgba(0,0,0,.2); + border-radius: 3px; + border: 1px solid silver; + + background: white; + font-size: 90%; + font-family: monospace; + + max-height: 20em; + overflow-y: auto; +} + +.CodeMirror-hint { + margin: 0; + padding: 0 4px; + border-radius: 2px; + max-width: 19em; + overflow: hidden; + white-space: pre; + color: black; + cursor: pointer; +} + +li.CodeMirror-hint-active { + background: #08f; + color: white; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/hint/show-hint.js b/src/main/resources/templates/editor/lib/codemirror/addon/hint/show-hint.js new file mode 100644 index 0000000000000000000000000000000000000000..f5446194288f961f371222ba16a96fabd271c45f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/hint/show-hint.js @@ -0,0 +1,394 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var HINT_ELEMENT_CLASS = "CodeMirror-hint"; + var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active"; + + // This is the old interface, kept around for now to stay + // backwards-compatible. + CodeMirror.showHint = function(cm, getHints, options) { + if (!getHints) return cm.showHint(options); + if (options && options.async) getHints.async = true; + var newOpts = {hint: getHints}; + if (options) for (var prop in options) newOpts[prop] = options[prop]; + return cm.showHint(newOpts); + }; + + var asyncRunID = 0; + function retrieveHints(getter, cm, options, then) { + if (getter.async) { + var id = ++asyncRunID; + getter(cm, function(hints) { + if (asyncRunID == id) then(hints); + }, options); + } else { + then(getter(cm, options)); + } + } + + CodeMirror.defineExtension("showHint", function(options) { + // We want a single cursor position. + if (this.listSelections().length > 1 || this.somethingSelected()) return; + + if (this.state.completionActive) this.state.completionActive.close(); + var completion = this.state.completionActive = new Completion(this, options); + var getHints = completion.options.hint; + if (!getHints) return; + + CodeMirror.signal(this, "startCompletion", this); + return retrieveHints(getHints, this, completion.options, function(hints) { completion.showHints(hints); }); + }); + + function Completion(cm, options) { + this.cm = cm; + this.options = this.buildOptions(options); + this.widget = this.onClose = null; + } + + Completion.prototype = { + close: function() { + if (!this.active()) return; + this.cm.state.completionActive = null; + + if (this.widget) this.widget.close(); + if (this.onClose) this.onClose(); + CodeMirror.signal(this.cm, "endCompletion", this.cm); + }, + + active: function() { + return this.cm.state.completionActive == this; + }, + + pick: function(data, i) { + var completion = data.list[i]; + if (completion.hint) completion.hint(this.cm, data, completion); + else this.cm.replaceRange(getText(completion), completion.from || data.from, + completion.to || data.to, "complete"); + CodeMirror.signal(data, "pick", completion); + this.close(); + }, + + showHints: function(data) { + if (!data || !data.list.length || !this.active()) return this.close(); + + if (this.options.completeSingle && data.list.length == 1) + this.pick(data, 0); + else + this.showWidget(data); + }, + + showWidget: function(data) { + this.widget = new Widget(this, data); + CodeMirror.signal(data, "shown"); + + var debounce = 0, completion = this, finished; + var closeOn = this.options.closeCharacters; + var startPos = this.cm.getCursor(), startLen = this.cm.getLine(startPos.line).length; + + var requestAnimationFrame = window.requestAnimationFrame || function(fn) { + return setTimeout(fn, 1000/60); + }; + var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout; + + function done() { + if (finished) return; + finished = true; + completion.close(); + completion.cm.off("cursorActivity", activity); + if (data) CodeMirror.signal(data, "close"); + } + + function update() { + if (finished) return; + CodeMirror.signal(data, "update"); + retrieveHints(completion.options.hint, completion.cm, completion.options, finishUpdate); + } + function finishUpdate(data_) { + data = data_; + if (finished) return; + if (!data || !data.list.length) return done(); + if (completion.widget) completion.widget.close(); + completion.widget = new Widget(completion, data); + } + + function clearDebounce() { + if (debounce) { + cancelAnimationFrame(debounce); + debounce = 0; + } + } + + function activity() { + clearDebounce(); + var pos = completion.cm.getCursor(), line = completion.cm.getLine(pos.line); + if (pos.line != startPos.line || line.length - pos.ch != startLen - startPos.ch || + pos.ch < startPos.ch || completion.cm.somethingSelected() || + (pos.ch && closeOn.test(line.charAt(pos.ch - 1)))) { + completion.close(); + } else { + debounce = requestAnimationFrame(update); + if (completion.widget) completion.widget.close(); + } + } + this.cm.on("cursorActivity", activity); + this.onClose = done; + }, + + buildOptions: function(options) { + var editor = this.cm.options.hintOptions; + var out = {}; + for (var prop in defaultOptions) out[prop] = defaultOptions[prop]; + if (editor) for (var prop in editor) + if (editor[prop] !== undefined) out[prop] = editor[prop]; + if (options) for (var prop in options) + if (options[prop] !== undefined) out[prop] = options[prop]; + return out; + } + }; + + function getText(completion) { + if (typeof completion == "string") return completion; + else return completion.text; + } + + function buildKeyMap(completion, handle) { + var baseMap = { + Up: function() {handle.moveFocus(-1);}, + Down: function() {handle.moveFocus(1);}, + PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);}, + PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);}, + Home: function() {handle.setFocus(0);}, + End: function() {handle.setFocus(handle.length - 1);}, + Enter: handle.pick, + Tab: handle.pick, + Esc: handle.close + }; + var custom = completion.options.customKeys; + var ourMap = custom ? {} : baseMap; + function addBinding(key, val) { + var bound; + if (typeof val != "string") + bound = function(cm) { return val(cm, handle); }; + // This mechanism is deprecated + else if (baseMap.hasOwnProperty(val)) + bound = baseMap[val]; + else + bound = val; + ourMap[key] = bound; + } + if (custom) + for (var key in custom) if (custom.hasOwnProperty(key)) + addBinding(key, custom[key]); + var extra = completion.options.extraKeys; + if (extra) + for (var key in extra) if (extra.hasOwnProperty(key)) + addBinding(key, extra[key]); + return ourMap; + } + + function getHintElement(hintsElement, el) { + while (el && el != hintsElement) { + if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el; + el = el.parentNode; + } + } + + function Widget(completion, data) { + this.completion = completion; + this.data = data; + var widget = this, cm = completion.cm; + + var hints = this.hints = document.createElement("ul"); + hints.className = "CodeMirror-hints"; + this.selectedHint = data.selectedHint || 0; + + var completions = data.list; + for (var i = 0; i < completions.length; ++i) { + var elt = hints.appendChild(document.createElement("li")), cur = completions[i]; + var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS); + if (cur.className != null) className = cur.className + " " + className; + elt.className = className; + if (cur.render) cur.render(elt, data, cur); + else elt.appendChild(document.createTextNode(cur.displayText || getText(cur))); + elt.hintId = i; + } + + var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null); + var left = pos.left, top = pos.bottom, below = true; + hints.style.left = left + "px"; + hints.style.top = top + "px"; + // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor. + var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth); + var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight); + (completion.options.container || document.body).appendChild(hints); + var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH; + if (overlapY > 0) { + var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top); + if (curTop - height > 0) { // Fits above cursor + hints.style.top = (top = pos.top - height) + "px"; + below = false; + } else if (height > winH) { + hints.style.height = (winH - 5) + "px"; + hints.style.top = (top = pos.bottom - box.top) + "px"; + var cursor = cm.getCursor(); + if (data.from.ch != cursor.ch) { + pos = cm.cursorCoords(cursor); + hints.style.left = (left = pos.left) + "px"; + box = hints.getBoundingClientRect(); + } + } + } + var overlapX = box.right - winW; + if (overlapX > 0) { + if (box.right - box.left > winW) { + hints.style.width = (winW - 5) + "px"; + overlapX -= (box.right - box.left) - winW; + } + hints.style.left = (left = pos.left - overlapX) + "px"; + } + + cm.addKeyMap(this.keyMap = buildKeyMap(completion, { + moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); }, + setFocus: function(n) { widget.changeActive(n); }, + menuSize: function() { return widget.screenAmount(); }, + length: completions.length, + close: function() { completion.close(); }, + pick: function() { widget.pick(); }, + data: data + })); + + if (completion.options.closeOnUnfocus) { + var closingOnBlur; + cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); }); + cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); }); + } + + var startScroll = cm.getScrollInfo(); + cm.on("scroll", this.onScroll = function() { + var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect(); + var newTop = top + startScroll.top - curScroll.top; + var point = newTop - (window.pageYOffset || (document.documentElement || document.body).scrollTop); + if (!below) point += hints.offsetHeight; + if (point <= editor.top || point >= editor.bottom) return completion.close(); + hints.style.top = newTop + "px"; + hints.style.left = (left + startScroll.left - curScroll.left) + "px"; + }); + + CodeMirror.on(hints, "dblclick", function(e) { + var t = getHintElement(hints, e.target || e.srcElement); + if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();} + }); + + CodeMirror.on(hints, "click", function(e) { + var t = getHintElement(hints, e.target || e.srcElement); + if (t && t.hintId != null) { + widget.changeActive(t.hintId); + if (completion.options.completeOnSingleClick) widget.pick(); + } + }); + + CodeMirror.on(hints, "mousedown", function() { + setTimeout(function(){cm.focus();}, 20); + }); + + CodeMirror.signal(data, "select", completions[0], hints.firstChild); + return true; + } + + Widget.prototype = { + close: function() { + if (this.completion.widget != this) return; + this.completion.widget = null; + this.hints.parentNode.removeChild(this.hints); + this.completion.cm.removeKeyMap(this.keyMap); + + var cm = this.completion.cm; + if (this.completion.options.closeOnUnfocus) { + cm.off("blur", this.onBlur); + cm.off("focus", this.onFocus); + } + cm.off("scroll", this.onScroll); + }, + + pick: function() { + this.completion.pick(this.data, this.selectedHint); + }, + + changeActive: function(i, avoidWrap) { + if (i >= this.data.list.length) + i = avoidWrap ? this.data.list.length - 1 : 0; + else if (i < 0) + i = avoidWrap ? 0 : this.data.list.length - 1; + if (this.selectedHint == i) return; + var node = this.hints.childNodes[this.selectedHint]; + node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); + node = this.hints.childNodes[this.selectedHint = i]; + node.className += " " + ACTIVE_HINT_ELEMENT_CLASS; + if (node.offsetTop < this.hints.scrollTop) + this.hints.scrollTop = node.offsetTop - 3; + else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) + this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3; + CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node); + }, + + screenAmount: function() { + return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1; + } + }; + + CodeMirror.registerHelper("hint", "auto", function(cm, options) { + var helpers = cm.getHelpers(cm.getCursor(), "hint"), words; + if (helpers.length) { + for (var i = 0; i < helpers.length; i++) { + var cur = helpers[i](cm, options); + if (cur && cur.list.length) return cur; + } + } else if (words = cm.getHelper(cm.getCursor(), "hintWords")) { + if (words) return CodeMirror.hint.fromList(cm, {words: words}); + } else if (CodeMirror.hint.anyword) { + return CodeMirror.hint.anyword(cm, options); + } + }); + + CodeMirror.registerHelper("hint", "fromList", function(cm, options) { + var cur = cm.getCursor(), token = cm.getTokenAt(cur); + var found = []; + for (var i = 0; i < options.words.length; i++) { + var word = options.words[i]; + if (word.slice(0, token.string.length) == token.string) + found.push(word); + } + + if (found.length) return { + list: found, + from: CodeMirror.Pos(cur.line, token.start), + to: CodeMirror.Pos(cur.line, token.end) + }; + }); + + CodeMirror.commands.autocomplete = CodeMirror.showHint; + + var defaultOptions = { + hint: CodeMirror.hint.auto, + completeSingle: true, + alignWithWord: true, + closeCharacters: /[\s()\[\]{};:>,]/, + closeOnUnfocus: true, + completeOnSingleClick: false, + container: null, + customKeys: null, + extraKeys: null + }; + + CodeMirror.defineOption("hintOptions", null); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/hint/sql-hint.js b/src/main/resources/templates/editor/lib/codemirror/addon/hint/sql-hint.js new file mode 100644 index 0000000000000000000000000000000000000000..5b0cc7696f2a18eb61779863153639c39d37b40c --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/hint/sql-hint.js @@ -0,0 +1,240 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../../mode/sql/sql")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../../mode/sql/sql"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var tables; + var defaultTable; + var keywords; + var CONS = { + QUERY_DIV: ";", + ALIAS_KEYWORD: "AS" + }; + var Pos = CodeMirror.Pos; + + function getKeywords(editor) { + var mode = editor.doc.modeOption; + if (mode === "sql") mode = "text/x-sql"; + return CodeMirror.resolveMode(mode).keywords; + } + + function getText(item) { + return typeof item == "string" ? item : item.text; + } + + function getItem(list, item) { + if (!list.slice) return list[item]; + for (var i = list.length - 1; i >= 0; i--) if (getText(list[i]) == item) + return list[i]; + } + + function shallowClone(object) { + var result = {}; + for (var key in object) if (object.hasOwnProperty(key)) + result[key] = object[key]; + return result; + } + + function match(string, word) { + var len = string.length; + var sub = getText(word).substr(0, len); + return string.toUpperCase() === sub.toUpperCase(); + } + + function addMatches(result, search, wordlist, formatter) { + for (var word in wordlist) { + if (!wordlist.hasOwnProperty(word)) continue; + if (Array.isArray(wordlist)) { + word = wordlist[word]; + } + if (match(search, word)) { + result.push(formatter(word)); + } + } + } + + function cleanName(name) { + // Get rid name from backticks(`) and preceding dot(.) + if (name.charAt(0) == ".") { + name = name.substr(1); + } + return name.replace(/`/g, ""); + } + + function insertBackticks(name) { + var nameParts = getText(name).split("."); + for (var i = 0; i < nameParts.length; i++) + nameParts[i] = "`" + nameParts[i] + "`"; + var escaped = nameParts.join("."); + if (typeof name == "string") return escaped; + name = shallowClone(name); + name.text = escaped; + return name; + } + + function nameCompletion(cur, token, result, editor) { + // Try to complete table, colunm names and return start position of completion + var useBacktick = false; + var nameParts = []; + var start = token.start; + var cont = true; + while (cont) { + cont = (token.string.charAt(0) == "."); + useBacktick = useBacktick || (token.string.charAt(0) == "`"); + + start = token.start; + nameParts.unshift(cleanName(token.string)); + + token = editor.getTokenAt(Pos(cur.line, token.start)); + if (token.string == ".") { + cont = true; + token = editor.getTokenAt(Pos(cur.line, token.start)); + } + } + + // Try to complete table names + var string = nameParts.join("."); + addMatches(result, string, tables, function(w) { + return useBacktick ? insertBackticks(w) : w; + }); + + // Try to complete columns from defaultTable + addMatches(result, string, defaultTable, function(w) { + return useBacktick ? insertBackticks(w) : w; + }); + + // Try to complete columns + string = nameParts.pop(); + var table = nameParts.join("."); + + // Check if table is available. If not, find table by Alias + if (!getItem(tables, table)) + table = findTableByAlias(table, editor); + + var columns = getItem(tables, table); + if (columns && Array.isArray(tables) && columns.columns) + columns = columns.columns; + + if (columns) { + addMatches(result, string, columns, function(w) { + if (typeof w == "string") { + w = table + "." + w; + } else { + w = shallowClone(w); + w.text = table + "." + w.text; + } + return useBacktick ? insertBackticks(w) : w; + }); + } + + return start; + } + + function eachWord(lineText, f) { + if (!lineText) return; + var excepted = /[,;]/g; + var words = lineText.split(" "); + for (var i = 0; i < words.length; i++) { + f(words[i]?words[i].replace(excepted, '') : ''); + } + } + + function convertCurToNumber(cur) { + // max characters of a line is 999,999. + return cur.line + cur.ch / Math.pow(10, 6); + } + + function convertNumberToCur(num) { + return Pos(Math.floor(num), +num.toString().split('.').pop()); + } + + function findTableByAlias(alias, editor) { + var doc = editor.doc; + var fullQuery = doc.getValue(); + var aliasUpperCase = alias.toUpperCase(); + var previousWord = ""; + var table = ""; + var separator = []; + var validRange = { + start: Pos(0, 0), + end: Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).length) + }; + + //add separator + var indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV); + while(indexOfSeparator != -1) { + separator.push(doc.posFromIndex(indexOfSeparator)); + indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV, indexOfSeparator+1); + } + separator.unshift(Pos(0, 0)); + separator.push(Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).text.length)); + + //find valid range + var prevItem = 0; + var current = convertCurToNumber(editor.getCursor()); + for (var i=0; i< separator.length; i++) { + var _v = convertCurToNumber(separator[i]); + if (current > prevItem && current <= _v) { + validRange = { start: convertNumberToCur(prevItem), end: convertNumberToCur(_v) }; + break; + } + prevItem = _v; + } + + var query = doc.getRange(validRange.start, validRange.end, false); + + for (var i = 0; i < query.length; i++) { + var lineText = query[i]; + eachWord(lineText, function(word) { + var wordUpperCase = word.toUpperCase(); + if (wordUpperCase === aliasUpperCase && getItem(tables, previousWord)) + table = previousWord; + if (wordUpperCase !== CONS.ALIAS_KEYWORD) + previousWord = word; + }); + if (table) break; + } + return table; + } + + CodeMirror.registerHelper("hint", "sql", function(editor, options) { + tables = (options && options.tables) || {}; + var defaultTableName = options && options.defaultTable; + defaultTable = (defaultTableName && getItem(tables, defaultTableName)) || []; + keywords = keywords || getKeywords(editor); + + var cur = editor.getCursor(); + var result = []; + var token = editor.getTokenAt(cur), start, end, search; + if (token.end > cur.ch) { + token.end = cur.ch; + token.string = token.string.slice(0, cur.ch - token.start); + } + + if (token.string.match(/^[.`\w@]\w*$/)) { + search = token.string; + start = token.start; + end = token.end; + } else { + start = end = cur.ch; + search = ""; + } + if (search.charAt(0) == "." || search.charAt(0) == "`") { + start = nameCompletion(cur, token, result, editor); + } else { + addMatches(result, search, tables, function(w) {return w;}); + addMatches(result, search, defaultTable, function(w) {return w;}); + addMatches(result, search, keywords, function(w) {return w.toUpperCase();}); + } + + return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)}; + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/hint/xml-hint.js b/src/main/resources/templates/editor/lib/codemirror/addon/hint/xml-hint.js new file mode 100644 index 0000000000000000000000000000000000000000..9b9baa0c674ef9b11d5a46a7da4c0ddbf8e5f5ed --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/hint/xml-hint.js @@ -0,0 +1,110 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var Pos = CodeMirror.Pos; + + function getHints(cm, options) { + var tags = options && options.schemaInfo; + var quote = (options && options.quoteChar) || '"'; + if (!tags) return; + var cur = cm.getCursor(), token = cm.getTokenAt(cur); + if (token.end > cur.ch) { + token.end = cur.ch; + token.string = token.string.slice(0, cur.ch - token.start); + } + var inner = CodeMirror.innerMode(cm.getMode(), token.state); + if (inner.mode.name != "xml") return; + var result = [], replaceToken = false, prefix; + var tag = /\btag\b/.test(token.type) && !/>$/.test(token.string); + var tagName = tag && /^\w/.test(token.string), tagStart; + + if (tagName) { + var before = cm.getLine(cur.line).slice(Math.max(0, token.start - 2), token.start); + var tagType = /<\/$/.test(before) ? "close" : /<$/.test(before) ? "open" : null; + if (tagType) tagStart = token.start - (tagType == "close" ? 2 : 1); + } else if (tag && token.string == "<") { + tagType = "open"; + } else if (tag && token.string == ""); + } else { + // Attribute completion + var curTag = tags[inner.state.tagName], attrs = curTag && curTag.attrs; + var globalAttrs = tags["!attrs"]; + if (!attrs && !globalAttrs) return; + if (!attrs) { + attrs = globalAttrs; + } else if (globalAttrs) { // Combine tag-local and global attributes + var set = {}; + for (var nm in globalAttrs) if (globalAttrs.hasOwnProperty(nm)) set[nm] = globalAttrs[nm]; + for (var nm in attrs) if (attrs.hasOwnProperty(nm)) set[nm] = attrs[nm]; + attrs = set; + } + if (token.type == "string" || token.string == "=") { // A value + var before = cm.getRange(Pos(cur.line, Math.max(0, cur.ch - 60)), + Pos(cur.line, token.type == "string" ? token.start : token.end)); + var atName = before.match(/([^\s\u00a0=<>\"\']+)=$/), atValues; + if (!atName || !attrs.hasOwnProperty(atName[1]) || !(atValues = attrs[atName[1]])) return; + if (typeof atValues == 'function') atValues = atValues.call(this, cm); // Functions can be used to supply values for autocomplete widget + if (token.type == "string") { + prefix = token.string; + var n = 0; + if (/['"]/.test(token.string.charAt(0))) { + quote = token.string.charAt(0); + prefix = token.string.slice(1); + n++; + } + var len = token.string.length; + if (/['"]/.test(token.string.charAt(len - 1))) { + quote = token.string.charAt(len - 1); + prefix = token.string.substr(n, len - 2); + } + replaceToken = true; + } + for (var i = 0; i < atValues.length; ++i) if (!prefix || atValues[i].lastIndexOf(prefix, 0) == 0) + result.push(quote + atValues[i] + quote); + } else { // An attribute name + if (token.type == "attribute") { + prefix = token.string; + replaceToken = true; + } + for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || attr.lastIndexOf(prefix, 0) == 0)) + result.push(attr); + } + } + return { + list: result, + from: replaceToken ? Pos(cur.line, tagStart == null ? token.start : tagStart) : cur, + to: replaceToken ? Pos(cur.line, token.end) : cur + }; + } + + CodeMirror.registerHelper("hint", "xml", getHints); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/lint/coffeescript-lint.js b/src/main/resources/templates/editor/lib/codemirror/addon/lint/coffeescript-lint.js new file mode 100644 index 0000000000000000000000000000000000000000..7e39428f7a6640ce26d9839febd24c14b356d932 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/lint/coffeescript-lint.js @@ -0,0 +1,41 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js + +// declare global: coffeelint + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.registerHelper("lint", "coffeescript", function(text) { + var found = []; + var parseError = function(err) { + var loc = err.lineNumber; + found.push({from: CodeMirror.Pos(loc-1, 0), + to: CodeMirror.Pos(loc, 0), + severity: err.level, + message: err.message}); + }; + try { + var res = coffeelint.lint(text); + for(var i = 0; i < res.length; i++) { + parseError(res[i]); + } + } catch(e) { + found.push({from: CodeMirror.Pos(e.location.first_line, 0), + to: CodeMirror.Pos(e.location.last_line, e.location.last_column), + severity: 'error', + message: e.message}); + } + return found; +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/lint/css-lint.js b/src/main/resources/templates/editor/lib/codemirror/addon/lint/css-lint.js new file mode 100644 index 0000000000000000000000000000000000000000..1f61b479b2afd95483d5a8b66b6a393f79128933 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/lint/css-lint.js @@ -0,0 +1,35 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Depends on csslint.js from https://github.com/stubbornella/csslint + +// declare global: CSSLint + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.registerHelper("lint", "css", function(text) { + var found = []; + if (!window.CSSLint) return found; + var results = CSSLint.verify(text), messages = results.messages, message = null; + for ( var i = 0; i < messages.length; i++) { + message = messages[i]; + var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col; + found.push({ + from: CodeMirror.Pos(startLine, startCol), + to: CodeMirror.Pos(endLine, endCol), + message: message.message, + severity : message.type + }); + } + return found; +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/lint/javascript-lint.js b/src/main/resources/templates/editor/lib/codemirror/addon/lint/javascript-lint.js new file mode 100644 index 0000000000000000000000000000000000000000..3d65ba695bc03ebc3831530a450323195b2208c6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/lint/javascript-lint.js @@ -0,0 +1,136 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + // declare global: JSHINT + + var bogus = [ "Dangerous comment" ]; + + var warnings = [ [ "Expected '{'", + "Statement body should be inside '{ }' braces." ] ]; + + var errors = [ "Missing semicolon", "Extra comma", "Missing property name", + "Unmatched ", " and instead saw", " is not defined", + "Unclosed string", "Stopping, unable to continue" ]; + + function validator(text, options) { + if (!window.JSHINT) return []; + JSHINT(text, options); + var errors = JSHINT.data().errors, result = []; + if (errors) parseErrors(errors, result); + return result; + } + + CodeMirror.registerHelper("lint", "javascript", validator); + + function cleanup(error) { + // All problems are warnings by default + fixWith(error, warnings, "warning", true); + fixWith(error, errors, "error"); + + return isBogus(error) ? null : error; + } + + function fixWith(error, fixes, severity, force) { + var description, fix, find, replace, found; + + description = error.description; + + for ( var i = 0; i < fixes.length; i++) { + fix = fixes[i]; + find = (typeof fix === "string" ? fix : fix[0]); + replace = (typeof fix === "string" ? null : fix[1]); + found = description.indexOf(find) !== -1; + + if (force || found) { + error.severity = severity; + } + if (found && replace) { + error.description = replace; + } + } + } + + function isBogus(error) { + var description = error.description; + for ( var i = 0; i < bogus.length; i++) { + if (description.indexOf(bogus[i]) !== -1) { + return true; + } + } + return false; + } + + function parseErrors(errors, output) { + for ( var i = 0; i < errors.length; i++) { + var error = errors[i]; + if (error) { + var linetabpositions, index; + + linetabpositions = []; + + // This next block is to fix a problem in jshint. Jshint + // replaces + // all tabs with spaces then performs some checks. The error + // positions (character/space) are then reported incorrectly, + // not taking the replacement step into account. Here we look + // at the evidence line and try to adjust the character position + // to the correct value. + if (error.evidence) { + // Tab positions are computed once per line and cached + var tabpositions = linetabpositions[error.line]; + if (!tabpositions) { + var evidence = error.evidence; + tabpositions = []; + // ugggh phantomjs does not like this + // forEachChar(evidence, function(item, index) { + Array.prototype.forEach.call(evidence, function(item, + index) { + if (item === '\t') { + // First col is 1 (not 0) to match error + // positions + tabpositions.push(index + 1); + } + }); + linetabpositions[error.line] = tabpositions; + } + if (tabpositions.length > 0) { + var pos = error.character; + tabpositions.forEach(function(tabposition) { + if (pos > tabposition) pos -= 1; + }); + error.character = pos; + } + } + + var start = error.character - 1, end = start + 1; + if (error.evidence) { + index = error.evidence.substring(start).search(/.\b/); + if (index > -1) { + end += index; + } + } + + // Convert to format expected by validation service + error.description = error.reason;// + "(jshint)"; + error.start = error.character; + error.end = end; + error = cleanup(error); + + if (error) + output.push({message: error.description, + severity: error.severity, + from: CodeMirror.Pos(error.line - 1, start), + to: CodeMirror.Pos(error.line - 1, end)}); + } + } + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/lint/json-lint.js b/src/main/resources/templates/editor/lib/codemirror/addon/lint/json-lint.js new file mode 100644 index 0000000000000000000000000000000000000000..9dbb616b3b440ef1bc9f8193e2dd7f4801845e2e --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/lint/json-lint.js @@ -0,0 +1,31 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Depends on jsonlint.js from https://github.com/zaach/jsonlint + +// declare global: jsonlint + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.registerHelper("lint", "json", function(text) { + var found = []; + jsonlint.parseError = function(str, hash) { + var loc = hash.loc; + found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column), + to: CodeMirror.Pos(loc.last_line - 1, loc.last_column), + message: str}); + }; + try { jsonlint.parse(text); } + catch(e) {} + return found; +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/lint/lint.css b/src/main/resources/templates/editor/lib/codemirror/addon/lint/lint.css new file mode 100644 index 0000000000000000000000000000000000000000..414a9a0e0666a13f03f3f7ed084e0deb29b56eec --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/lint/lint.css @@ -0,0 +1,73 @@ +/* The lint marker gutter */ +.CodeMirror-lint-markers { + width: 16px; +} + +.CodeMirror-lint-tooltip { + background-color: infobackground; + border: 1px solid black; + border-radius: 4px 4px 4px 4px; + color: infotext; + font-family: monospace; + font-size: 10pt; + overflow: hidden; + padding: 2px 5px; + position: fixed; + white-space: pre; + white-space: pre-wrap; + z-index: 100; + max-width: 600px; + opacity: 0; + transition: opacity .4s; + -moz-transition: opacity .4s; + -webkit-transition: opacity .4s; + -o-transition: opacity .4s; + -ms-transition: opacity .4s; +} + +.CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning { + background-position: left bottom; + background-repeat: repeat-x; +} + +.CodeMirror-lint-mark-error { + background-image: + url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==") + ; +} + +.CodeMirror-lint-mark-warning { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII="); +} + +.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning { + background-position: center center; + background-repeat: no-repeat; + cursor: pointer; + display: inline-block; + height: 16px; + width: 16px; + vertical-align: middle; + position: relative; +} + +.CodeMirror-lint-message-error, .CodeMirror-lint-message-warning { + padding-left: 18px; + background-position: top left; + background-repeat: no-repeat; +} + +.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII="); +} + +.CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII="); +} + +.CodeMirror-lint-marker-multiple { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC"); + background-repeat: no-repeat; + background-position: right bottom; + width: 100%; height: 100%; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/lint/lint.js b/src/main/resources/templates/editor/lib/codemirror/addon/lint/lint.js new file mode 100644 index 0000000000000000000000000000000000000000..18eb709016689f0d6e21105cee20b3cc8170718e --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/lint/lint.js @@ -0,0 +1,205 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + var GUTTER_ID = "CodeMirror-lint-markers"; + + function showTooltip(e, content) { + var tt = document.createElement("div"); + tt.className = "CodeMirror-lint-tooltip"; + tt.appendChild(content.cloneNode(true)); + document.body.appendChild(tt); + + function position(e) { + if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position); + tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + "px"; + tt.style.left = (e.clientX + 5) + "px"; + } + CodeMirror.on(document, "mousemove", position); + position(e); + if (tt.style.opacity != null) tt.style.opacity = 1; + return tt; + } + function rm(elt) { + if (elt.parentNode) elt.parentNode.removeChild(elt); + } + function hideTooltip(tt) { + if (!tt.parentNode) return; + if (tt.style.opacity == null) rm(tt); + tt.style.opacity = 0; + setTimeout(function() { rm(tt); }, 600); + } + + function showTooltipFor(e, content, node) { + var tooltip = showTooltip(e, content); + function hide() { + CodeMirror.off(node, "mouseout", hide); + if (tooltip) { hideTooltip(tooltip); tooltip = null; } + } + var poll = setInterval(function() { + if (tooltip) for (var n = node;; n = n.parentNode) { + if (n && n.nodeType == 11) n = n.host; + if (n == document.body) return; + if (!n) { hide(); break; } + } + if (!tooltip) return clearInterval(poll); + }, 400); + CodeMirror.on(node, "mouseout", hide); + } + + function LintState(cm, options, hasGutter) { + this.marked = []; + this.options = options; + this.timeout = null; + this.hasGutter = hasGutter; + this.onMouseOver = function(e) { onMouseOver(cm, e); }; + } + + function parseOptions(cm, options) { + if (options instanceof Function) return {getAnnotations: options}; + if (!options || options === true) options = {}; + if (!options.getAnnotations) options.getAnnotations = cm.getHelper(CodeMirror.Pos(0, 0), "lint"); + if (!options.getAnnotations) throw new Error("Required option 'getAnnotations' missing (lint addon)"); + return options; + } + + function clearMarks(cm) { + var state = cm.state.lint; + if (state.hasGutter) cm.clearGutter(GUTTER_ID); + for (var i = 0; i < state.marked.length; ++i) + state.marked[i].clear(); + state.marked.length = 0; + } + + function makeMarker(labels, severity, multiple, tooltips) { + var marker = document.createElement("div"), inner = marker; + marker.className = "CodeMirror-lint-marker-" + severity; + if (multiple) { + inner = marker.appendChild(document.createElement("div")); + inner.className = "CodeMirror-lint-marker-multiple"; + } + + if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) { + showTooltipFor(e, labels, inner); + }); + + return marker; + } + + function getMaxSeverity(a, b) { + if (a == "error") return a; + else return b; + } + + function groupByLine(annotations) { + var lines = []; + for (var i = 0; i < annotations.length; ++i) { + var ann = annotations[i], line = ann.from.line; + (lines[line] || (lines[line] = [])).push(ann); + } + return lines; + } + + function annotationTooltip(ann) { + var severity = ann.severity; + if (!severity) severity = "error"; + var tip = document.createElement("div"); + tip.className = "CodeMirror-lint-message-" + severity; + tip.appendChild(document.createTextNode(ann.message)); + return tip; + } + + function startLinting(cm) { + var state = cm.state.lint, options = state.options; + var passOptions = options.options || options; // Support deprecated passing of `options` property in options + if (options.async || options.getAnnotations.async) + options.getAnnotations(cm.getValue(), updateLinting, passOptions, cm); + else + updateLinting(cm, options.getAnnotations(cm.getValue(), passOptions, cm)); + } + + function updateLinting(cm, annotationsNotSorted) { + clearMarks(cm); + var state = cm.state.lint, options = state.options; + + var annotations = groupByLine(annotationsNotSorted); + + for (var line = 0; line < annotations.length; ++line) { + var anns = annotations[line]; + if (!anns) continue; + + var maxSeverity = null; + var tipLabel = state.hasGutter && document.createDocumentFragment(); + + for (var i = 0; i < anns.length; ++i) { + var ann = anns[i]; + var severity = ann.severity; + if (!severity) severity = "error"; + maxSeverity = getMaxSeverity(maxSeverity, severity); + + if (options.formatAnnotation) ann = options.formatAnnotation(ann); + if (state.hasGutter) tipLabel.appendChild(annotationTooltip(ann)); + + if (ann.to) state.marked.push(cm.markText(ann.from, ann.to, { + className: "CodeMirror-lint-mark-" + severity, + __annotation: ann + })); + } + + if (state.hasGutter) + cm.setGutterMarker(line, GUTTER_ID, makeMarker(tipLabel, maxSeverity, anns.length > 1, + state.options.tooltips)); + } + if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm); + } + + function onChange(cm) { + var state = cm.state.lint; + clearTimeout(state.timeout); + state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); + } + + function popupSpanTooltip(ann, e) { + var target = e.target || e.srcElement; + showTooltipFor(e, annotationTooltip(ann), target); + } + + function onMouseOver(cm, e) { + var target = e.target || e.srcElement; + if (!/\bCodeMirror-lint-mark-/.test(target.className)) return; + var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2; + var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client")); + for (var i = 0; i < spans.length; ++i) { + var ann = spans[i].__annotation; + if (ann) return popupSpanTooltip(ann, e); + } + } + + CodeMirror.defineOption("lint", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + clearMarks(cm); + cm.off("change", onChange); + CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver); + delete cm.state.lint; + } + + if (val) { + var gutters = cm.getOption("gutters"), hasLintGutter = false; + for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true; + var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter); + cm.on("change", onChange); + if (state.options.tooltips != false) + CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver); + + startLinting(cm); + } + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/lint/yaml-lint.js b/src/main/resources/templates/editor/lib/codemirror/addon/lint/yaml-lint.js new file mode 100644 index 0000000000000000000000000000000000000000..3f77e525b78152eeb871e6701e0a1f6a50427cc7 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/lint/yaml-lint.js @@ -0,0 +1,28 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +// Depends on js-yaml.js from https://github.com/nodeca/js-yaml + +// declare global: jsyaml + +CodeMirror.registerHelper("lint", "yaml", function(text) { + var found = []; + try { jsyaml.load(text); } + catch(e) { + var loc = e.mark; + found.push({ from: CodeMirror.Pos(loc.line, loc.column), to: CodeMirror.Pos(loc.line, loc.column), message: e.message }); + } + return found; +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/merge/merge.css b/src/main/resources/templates/editor/lib/codemirror/addon/merge/merge.css new file mode 100644 index 0000000000000000000000000000000000000000..a6a80e43e075a5e98d4171350e1b3973c53b0a65 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/merge/merge.css @@ -0,0 +1,112 @@ +.CodeMirror-merge { + position: relative; + border: 1px solid #ddd; + white-space: pre; +} + +.CodeMirror-merge, .CodeMirror-merge .CodeMirror { + height: 350px; +} + +.CodeMirror-merge-2pane .CodeMirror-merge-pane { width: 47%; } +.CodeMirror-merge-2pane .CodeMirror-merge-gap { width: 6%; } +.CodeMirror-merge-3pane .CodeMirror-merge-pane { width: 31%; } +.CodeMirror-merge-3pane .CodeMirror-merge-gap { width: 3.5%; } + +.CodeMirror-merge-pane { + display: inline-block; + white-space: normal; + vertical-align: top; +} +.CodeMirror-merge-pane-rightmost { + position: absolute; + right: 0px; + z-index: 1; +} + +.CodeMirror-merge-gap { + z-index: 2; + display: inline-block; + height: 100%; + -moz-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + border-left: 1px solid #ddd; + border-right: 1px solid #ddd; + position: relative; + background: #f8f8f8; +} + +.CodeMirror-merge-scrolllock-wrap { + position: absolute; + bottom: 0; left: 50%; +} +.CodeMirror-merge-scrolllock { + position: relative; + left: -50%; + cursor: pointer; + color: #555; + line-height: 1; +} + +.CodeMirror-merge-copybuttons-left, .CodeMirror-merge-copybuttons-right { + position: absolute; + left: 0; top: 0; + right: 0; bottom: 0; + line-height: 1; +} + +.CodeMirror-merge-copy { + position: absolute; + cursor: pointer; + color: #44c; +} + +.CodeMirror-merge-copy-reverse { + position: absolute; + cursor: pointer; + color: #44c; +} + +.CodeMirror-merge-copybuttons-left .CodeMirror-merge-copy { left: 2px; } +.CodeMirror-merge-copybuttons-right .CodeMirror-merge-copy { right: 2px; } + +.CodeMirror-merge-r-inserted, .CodeMirror-merge-l-inserted { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12MwuCXy3+CWyH8GBgYGJgYkAABZbAQ9ELXurwAAAABJRU5ErkJggg==); + background-position: bottom left; + background-repeat: repeat-x; +} + +.CodeMirror-merge-r-deleted, .CodeMirror-merge-l-deleted { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12M4Kyb2/6yY2H8GBgYGJgYkAABURgPz6Ks7wQAAAABJRU5ErkJggg==); + background-position: bottom left; + background-repeat: repeat-x; +} + +.CodeMirror-merge-r-chunk { background: #ffffe0; } +.CodeMirror-merge-r-chunk-start { border-top: 1px solid #ee8; } +.CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #ee8; } +.CodeMirror-merge-r-connect { fill: #ffffe0; stroke: #ee8; stroke-width: 1px; } + +.CodeMirror-merge-l-chunk { background: #eef; } +.CodeMirror-merge-l-chunk-start { border-top: 1px solid #88e; } +.CodeMirror-merge-l-chunk-end { border-bottom: 1px solid #88e; } +.CodeMirror-merge-l-connect { fill: #eef; stroke: #88e; stroke-width: 1px; } + +.CodeMirror-merge-l-chunk.CodeMirror-merge-r-chunk { background: #dfd; } +.CodeMirror-merge-l-chunk-start.CodeMirror-merge-r-chunk-start { border-top: 1px solid #4e4; } +.CodeMirror-merge-l-chunk-end.CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #4e4; } + +.CodeMirror-merge-collapsed-widget:before { + content: "(...)"; +} +.CodeMirror-merge-collapsed-widget { + cursor: pointer; + color: #88b; + background: #eef; + border: 1px solid #ddf; + font-size: 90%; + padding: 0 3px; + border-radius: 4px; +} +.CodeMirror-merge-collapsed-line .CodeMirror-gutter-elt { display: none; } diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/merge/merge.js b/src/main/resources/templates/editor/lib/codemirror/addon/merge/merge.js new file mode 100644 index 0000000000000000000000000000000000000000..f1f3aafc494f25e1d7ed125a8044557640df3d52 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/merge/merge.js @@ -0,0 +1,735 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// declare global: diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("diff_match_patch")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "diff_match_patch"], mod); + else // Plain browser env + mod(CodeMirror, diff_match_patch); +})(function(CodeMirror, diff_match_patch) { + "use strict"; + var Pos = CodeMirror.Pos; + var svgNS = "http://www.w3.org/2000/svg"; + + function DiffView(mv, type) { + this.mv = mv; + this.type = type; + this.classes = type == "left" + ? {chunk: "CodeMirror-merge-l-chunk", + start: "CodeMirror-merge-l-chunk-start", + end: "CodeMirror-merge-l-chunk-end", + insert: "CodeMirror-merge-l-inserted", + del: "CodeMirror-merge-l-deleted", + connect: "CodeMirror-merge-l-connect"} + : {chunk: "CodeMirror-merge-r-chunk", + start: "CodeMirror-merge-r-chunk-start", + end: "CodeMirror-merge-r-chunk-end", + insert: "CodeMirror-merge-r-inserted", + del: "CodeMirror-merge-r-deleted", + connect: "CodeMirror-merge-r-connect"}; + } + + DiffView.prototype = { + constructor: DiffView, + init: function(pane, orig, options) { + this.edit = this.mv.edit; + this.orig = CodeMirror(pane, copyObj({value: orig, readOnly: !this.mv.options.allowEditingOriginals}, copyObj(options))); + + this.diff = getDiff(asString(orig), asString(options.value)); + this.chunks = getChunks(this.diff); + this.diffOutOfDate = this.dealigned = false; + + this.showDifferences = options.showDifferences !== false; + this.forceUpdate = registerUpdate(this); + setScrollLock(this, true, false); + registerScroll(this); + }, + setShowDifferences: function(val) { + val = val !== false; + if (val != this.showDifferences) { + this.showDifferences = val; + this.forceUpdate("full"); + } + } + }; + + function ensureDiff(dv) { + if (dv.diffOutOfDate) { + dv.diff = getDiff(dv.orig.getValue(), dv.edit.getValue()); + dv.chunks = getChunks(dv.diff); + dv.diffOutOfDate = false; + CodeMirror.signal(dv.edit, "updateDiff", dv.diff); + } + } + + var updating = false; + function registerUpdate(dv) { + var edit = {from: 0, to: 0, marked: []}; + var orig = {from: 0, to: 0, marked: []}; + var debounceChange, updatingFast = false; + function update(mode) { + updating = true; + updatingFast = false; + if (mode == "full") { + if (dv.svg) clear(dv.svg); + if (dv.copyButtons) clear(dv.copyButtons); + clearMarks(dv.edit, edit.marked, dv.classes); + clearMarks(dv.orig, orig.marked, dv.classes); + edit.from = edit.to = orig.from = orig.to = 0; + } + ensureDiff(dv); + if (dv.showDifferences) { + updateMarks(dv.edit, dv.diff, edit, DIFF_INSERT, dv.classes); + updateMarks(dv.orig, dv.diff, orig, DIFF_DELETE, dv.classes); + } + makeConnections(dv); + + if (dv.mv.options.connect == "align") + alignChunks(dv); + updating = false; + } + function setDealign(fast) { + if (updating) return; + dv.dealigned = true; + set(fast); + } + function set(fast) { + if (updating || updatingFast) return; + clearTimeout(debounceChange); + if (fast === true) updatingFast = true; + debounceChange = setTimeout(update, fast === true ? 20 : 250); + } + function change(_cm, change) { + if (!dv.diffOutOfDate) { + dv.diffOutOfDate = true; + edit.from = edit.to = orig.from = orig.to = 0; + } + // Update faster when a line was added/removed + setDealign(change.text.length - 1 != change.to.line - change.from.line); + } + dv.edit.on("change", change); + dv.orig.on("change", change); + dv.edit.on("markerAdded", setDealign); + dv.edit.on("markerCleared", setDealign); + dv.orig.on("markerAdded", setDealign); + dv.orig.on("markerCleared", setDealign); + dv.edit.on("viewportChange", function() { set(false); }); + dv.orig.on("viewportChange", function() { set(false); }); + update(); + return update; + } + + function registerScroll(dv) { + dv.edit.on("scroll", function() { + syncScroll(dv, DIFF_INSERT) && makeConnections(dv); + }); + dv.orig.on("scroll", function() { + syncScroll(dv, DIFF_DELETE) && makeConnections(dv); + }); + } + + function syncScroll(dv, type) { + // Change handler will do a refresh after a timeout when diff is out of date + if (dv.diffOutOfDate) return false; + if (!dv.lockScroll) return true; + var editor, other, now = +new Date; + if (type == DIFF_INSERT) { editor = dv.edit; other = dv.orig; } + else { editor = dv.orig; other = dv.edit; } + // Don't take action if the position of this editor was recently set + // (to prevent feedback loops) + if (editor.state.scrollSetBy == dv && (editor.state.scrollSetAt || 0) + 50 > now) return false; + + var sInfo = editor.getScrollInfo(); + if (dv.mv.options.connect == "align") { + targetPos = sInfo.top; + } else { + var halfScreen = .5 * sInfo.clientHeight, midY = sInfo.top + halfScreen; + var mid = editor.lineAtHeight(midY, "local"); + var around = chunkBoundariesAround(dv.chunks, mid, type == DIFF_INSERT); + var off = getOffsets(editor, type == DIFF_INSERT ? around.edit : around.orig); + var offOther = getOffsets(other, type == DIFF_INSERT ? around.orig : around.edit); + var ratio = (midY - off.top) / (off.bot - off.top); + var targetPos = (offOther.top - halfScreen) + ratio * (offOther.bot - offOther.top); + + var botDist, mix; + // Some careful tweaking to make sure no space is left out of view + // when scrolling to top or bottom. + if (targetPos > sInfo.top && (mix = sInfo.top / halfScreen) < 1) { + targetPos = targetPos * mix + sInfo.top * (1 - mix); + } else if ((botDist = sInfo.height - sInfo.clientHeight - sInfo.top) < halfScreen) { + var otherInfo = other.getScrollInfo(); + var botDistOther = otherInfo.height - otherInfo.clientHeight - targetPos; + if (botDistOther > botDist && (mix = botDist / halfScreen) < 1) + targetPos = targetPos * mix + (otherInfo.height - otherInfo.clientHeight - botDist) * (1 - mix); + } + } + + other.scrollTo(sInfo.left, targetPos); + other.state.scrollSetAt = now; + other.state.scrollSetBy = dv; + return true; + } + + function getOffsets(editor, around) { + var bot = around.after; + if (bot == null) bot = editor.lastLine() + 1; + return {top: editor.heightAtLine(around.before || 0, "local"), + bot: editor.heightAtLine(bot, "local")}; + } + + function setScrollLock(dv, val, action) { + dv.lockScroll = val; + if (val && action != false) syncScroll(dv, DIFF_INSERT) && makeConnections(dv); + dv.lockButton.innerHTML = val ? "\u21db\u21da" : "\u21db  \u21da"; + } + + // Updating the marks for editor content + + function clearMarks(editor, arr, classes) { + for (var i = 0; i < arr.length; ++i) { + var mark = arr[i]; + if (mark instanceof CodeMirror.TextMarker) { + mark.clear(); + } else if (mark.parent) { + editor.removeLineClass(mark, "background", classes.chunk); + editor.removeLineClass(mark, "background", classes.start); + editor.removeLineClass(mark, "background", classes.end); + } + } + arr.length = 0; + } + + // FIXME maybe add a margin around viewport to prevent too many updates + function updateMarks(editor, diff, state, type, classes) { + var vp = editor.getViewport(); + editor.operation(function() { + if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) { + clearMarks(editor, state.marked, classes); + markChanges(editor, diff, type, state.marked, vp.from, vp.to, classes); + state.from = vp.from; state.to = vp.to; + } else { + if (vp.from < state.from) { + markChanges(editor, diff, type, state.marked, vp.from, state.from, classes); + state.from = vp.from; + } + if (vp.to > state.to) { + markChanges(editor, diff, type, state.marked, state.to, vp.to, classes); + state.to = vp.to; + } + } + }); + } + + function markChanges(editor, diff, type, marks, from, to, classes) { + var pos = Pos(0, 0); + var top = Pos(from, 0), bot = editor.clipPos(Pos(to - 1)); + var cls = type == DIFF_DELETE ? classes.del : classes.insert; + function markChunk(start, end) { + var bfrom = Math.max(from, start), bto = Math.min(to, end); + for (var i = bfrom; i < bto; ++i) { + var line = editor.addLineClass(i, "background", classes.chunk); + if (i == start) editor.addLineClass(line, "background", classes.start); + if (i == end - 1) editor.addLineClass(line, "background", classes.end); + marks.push(line); + } + // When the chunk is empty, make sure a horizontal line shows up + if (start == end && bfrom == end && bto == end) { + if (bfrom) + marks.push(editor.addLineClass(bfrom - 1, "background", classes.end)); + else + marks.push(editor.addLineClass(bfrom, "background", classes.start)); + } + } + + var chunkStart = 0; + for (var i = 0; i < diff.length; ++i) { + var part = diff[i], tp = part[0], str = part[1]; + if (tp == DIFF_EQUAL) { + var cleanFrom = pos.line + (startOfLineClean(diff, i) ? 0 : 1); + moveOver(pos, str); + var cleanTo = pos.line + (endOfLineClean(diff, i) ? 1 : 0); + if (cleanTo > cleanFrom) { + if (i) markChunk(chunkStart, cleanFrom); + chunkStart = cleanTo; + } + } else { + if (tp == type) { + var end = moveOver(pos, str, true); + var a = posMax(top, pos), b = posMin(bot, end); + if (!posEq(a, b)) + marks.push(editor.markText(a, b, {className: cls})); + pos = end; + } + } + } + if (chunkStart <= pos.line) markChunk(chunkStart, pos.line + 1); + } + + // Updating the gap between editor and original + + function makeConnections(dv) { + if (!dv.showDifferences) return; + + if (dv.svg) { + clear(dv.svg); + var w = dv.gap.offsetWidth; + attrs(dv.svg, "width", w, "height", dv.gap.offsetHeight); + } + if (dv.copyButtons) clear(dv.copyButtons); + + var vpEdit = dv.edit.getViewport(), vpOrig = dv.orig.getViewport(); + var sTopEdit = dv.edit.getScrollInfo().top, sTopOrig = dv.orig.getScrollInfo().top; + for (var i = 0; i < dv.chunks.length; i++) { + var ch = dv.chunks[i]; + if (ch.editFrom <= vpEdit.to && ch.editTo >= vpEdit.from && + ch.origFrom <= vpOrig.to && ch.origTo >= vpOrig.from) + drawConnectorsForChunk(dv, ch, sTopOrig, sTopEdit, w); + } + } + + function getMatchingOrigLine(editLine, chunks) { + var editStart = 0, origStart = 0; + for (var i = 0; i < chunks.length; i++) { + var chunk = chunks[i]; + if (chunk.editTo > editLine && chunk.editFrom <= editLine) return null; + if (chunk.editFrom > editLine) break; + editStart = chunk.editTo; + origStart = chunk.origTo; + } + return origStart + (editLine - editStart); + } + + function findAlignedLines(dv, other) { + var linesToAlign = []; + for (var i = 0; i < dv.chunks.length; i++) { + var chunk = dv.chunks[i]; + linesToAlign.push([chunk.origTo, chunk.editTo, other ? getMatchingOrigLine(chunk.editTo, other.chunks) : null]); + } + if (other) { + for (var i = 0; i < other.chunks.length; i++) { + var chunk = other.chunks[i]; + for (var j = 0; j < linesToAlign.length; j++) { + var align = linesToAlign[j]; + if (align[1] == chunk.editTo) { + j = -1; + break; + } else if (align[1] > chunk.editTo) { + break; + } + } + if (j > -1) + linesToAlign.splice(j - 1, 0, [getMatchingOrigLine(chunk.editTo, dv.chunks), chunk.editTo, chunk.origTo]); + } + } + return linesToAlign; + } + + function alignChunks(dv, force) { + if (!dv.dealigned && !force) return; + if (!dv.orig.curOp) return dv.orig.operation(function() { + alignChunks(dv, force); + }); + + dv.dealigned = false; + var other = dv.mv.left == dv ? dv.mv.right : dv.mv.left; + if (other) { + ensureDiff(other); + other.dealigned = false; + } + var linesToAlign = findAlignedLines(dv, other); + + // Clear old aligners + var aligners = dv.mv.aligners; + for (var i = 0; i < aligners.length; i++) + aligners[i].clear(); + aligners.length = 0; + + var cm = [dv.orig, dv.edit], scroll = []; + if (other) cm.push(other.orig); + for (var i = 0; i < cm.length; i++) + scroll.push(cm[i].getScrollInfo().top); + + for (var ln = 0; ln < linesToAlign.length; ln++) + alignLines(cm, linesToAlign[ln], aligners); + + for (var i = 0; i < cm.length; i++) + cm[i].scrollTo(null, scroll[i]); + } + + function alignLines(cm, lines, aligners) { + var maxOffset = 0, offset = []; + for (var i = 0; i < cm.length; i++) if (lines[i] != null) { + var off = cm[i].heightAtLine(lines[i], "local"); + offset[i] = off; + maxOffset = Math.max(maxOffset, off); + } + for (var i = 0; i < cm.length; i++) if (lines[i] != null) { + var diff = maxOffset - offset[i]; + if (diff > 1) + aligners.push(padAbove(cm[i], lines[i], diff)); + } + } + + function padAbove(cm, line, size) { + var above = true; + if (line > cm.lastLine()) { + line--; + above = false; + } + var elt = document.createElement("div"); + elt.className = "CodeMirror-merge-spacer"; + elt.style.height = size + "px"; elt.style.minWidth = "1px"; + return cm.addLineWidget(line, elt, {height: size, above: above}); + } + + function drawConnectorsForChunk(dv, chunk, sTopOrig, sTopEdit, w) { + var flip = dv.type == "left"; + var top = dv.orig.heightAtLine(chunk.origFrom, "local") - sTopOrig; + if (dv.svg) { + var topLpx = top; + var topRpx = dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit; + if (flip) { var tmp = topLpx; topLpx = topRpx; topRpx = tmp; } + var botLpx = dv.orig.heightAtLine(chunk.origTo, "local") - sTopOrig; + var botRpx = dv.edit.heightAtLine(chunk.editTo, "local") - sTopEdit; + if (flip) { var tmp = botLpx; botLpx = botRpx; botRpx = tmp; } + var curveTop = " C " + w/2 + " " + topRpx + " " + w/2 + " " + topLpx + " " + (w + 2) + " " + topLpx; + var curveBot = " C " + w/2 + " " + botLpx + " " + w/2 + " " + botRpx + " -1 " + botRpx; + attrs(dv.svg.appendChild(document.createElementNS(svgNS, "path")), + "d", "M -1 " + topRpx + curveTop + " L " + (w + 2) + " " + botLpx + curveBot + " z", + "class", dv.classes.connect); + } + if (dv.copyButtons) { + var copy = dv.copyButtons.appendChild(elt("div", dv.type == "left" ? "\u21dd" : "\u21dc", + "CodeMirror-merge-copy")); + var editOriginals = dv.mv.options.allowEditingOriginals; + copy.title = editOriginals ? "Push to left" : "Revert chunk"; + copy.chunk = chunk; + copy.style.top = top + "px"; + + if (editOriginals) { + var topReverse = dv.orig.heightAtLine(chunk.editFrom, "local") - sTopEdit; + var copyReverse = dv.copyButtons.appendChild(elt("div", dv.type == "right" ? "\u21dd" : "\u21dc", + "CodeMirror-merge-copy-reverse")); + copyReverse.title = "Push to right"; + copyReverse.chunk = {editFrom: chunk.origFrom, editTo: chunk.origTo, + origFrom: chunk.editFrom, origTo: chunk.editTo}; + copyReverse.style.top = topReverse + "px"; + dv.type == "right" ? copyReverse.style.left = "2px" : copyReverse.style.right = "2px"; + } + } + } + + function copyChunk(dv, to, from, chunk) { + if (dv.diffOutOfDate) return; + to.replaceRange(from.getRange(Pos(chunk.origFrom, 0), Pos(chunk.origTo, 0)), + Pos(chunk.editFrom, 0), Pos(chunk.editTo, 0)); + } + + // Merge view, containing 0, 1, or 2 diff views. + + var MergeView = CodeMirror.MergeView = function(node, options) { + if (!(this instanceof MergeView)) return new MergeView(node, options); + + this.options = options; + var origLeft = options.origLeft, origRight = options.origRight == null ? options.orig : options.origRight; + + var hasLeft = origLeft != null, hasRight = origRight != null; + var panes = 1 + (hasLeft ? 1 : 0) + (hasRight ? 1 : 0); + var wrap = [], left = this.left = null, right = this.right = null; + var self = this; + + if (hasLeft) { + left = this.left = new DiffView(this, "left"); + var leftPane = elt("div", null, "CodeMirror-merge-pane"); + wrap.push(leftPane); + wrap.push(buildGap(left)); + } + + var editPane = elt("div", null, "CodeMirror-merge-pane"); + wrap.push(editPane); + + if (hasRight) { + right = this.right = new DiffView(this, "right"); + wrap.push(buildGap(right)); + var rightPane = elt("div", null, "CodeMirror-merge-pane"); + wrap.push(rightPane); + } + + (hasRight ? rightPane : editPane).className += " CodeMirror-merge-pane-rightmost"; + + wrap.push(elt("div", null, null, "height: 0; clear: both;")); + + var wrapElt = this.wrap = node.appendChild(elt("div", wrap, "CodeMirror-merge CodeMirror-merge-" + panes + "pane")); + this.edit = CodeMirror(editPane, copyObj(options)); + + if (left) left.init(leftPane, origLeft, options); + if (right) right.init(rightPane, origRight, options); + + if (options.collapseIdentical) { + updating = true; + this.editor().operation(function() { + collapseIdenticalStretches(self, options.collapseIdentical); + }); + updating = false; + } + if (options.connect == "align") { + this.aligners = []; + alignChunks(this.left || this.right, true); + } + + var onResize = function() { + if (left) makeConnections(left); + if (right) makeConnections(right); + }; + CodeMirror.on(window, "resize", onResize); + var resizeInterval = setInterval(function() { + for (var p = wrapElt.parentNode; p && p != document.body; p = p.parentNode) {} + if (!p) { clearInterval(resizeInterval); CodeMirror.off(window, "resize", onResize); } + }, 5000); + }; + + function buildGap(dv) { + var lock = dv.lockButton = elt("div", null, "CodeMirror-merge-scrolllock"); + lock.title = "Toggle locked scrolling"; + var lockWrap = elt("div", [lock], "CodeMirror-merge-scrolllock-wrap"); + CodeMirror.on(lock, "click", function() { setScrollLock(dv, !dv.lockScroll); }); + var gapElts = [lockWrap]; + if (dv.mv.options.revertButtons !== false) { + dv.copyButtons = elt("div", null, "CodeMirror-merge-copybuttons-" + dv.type); + CodeMirror.on(dv.copyButtons, "click", function(e) { + var node = e.target || e.srcElement; + if (!node.chunk) return; + if (node.className == "CodeMirror-merge-copy-reverse") { + copyChunk(dv, dv.orig, dv.edit, node.chunk); + return; + } + copyChunk(dv, dv.edit, dv.orig, node.chunk); + }); + gapElts.unshift(dv.copyButtons); + } + if (dv.mv.options.connect != "align") { + var svg = document.createElementNS && document.createElementNS(svgNS, "svg"); + if (svg && !svg.createSVGRect) svg = null; + dv.svg = svg; + if (svg) gapElts.push(svg); + } + + return dv.gap = elt("div", gapElts, "CodeMirror-merge-gap"); + } + + MergeView.prototype = { + constuctor: MergeView, + editor: function() { return this.edit; }, + rightOriginal: function() { return this.right && this.right.orig; }, + leftOriginal: function() { return this.left && this.left.orig; }, + setShowDifferences: function(val) { + if (this.right) this.right.setShowDifferences(val); + if (this.left) this.left.setShowDifferences(val); + }, + rightChunks: function() { + if (this.right) { ensureDiff(this.right); return this.right.chunks; } + }, + leftChunks: function() { + if (this.left) { ensureDiff(this.left); return this.left.chunks; } + } + }; + + function asString(obj) { + if (typeof obj == "string") return obj; + else return obj.getValue(); + } + + // Operations on diffs + + var dmp = new diff_match_patch(); + function getDiff(a, b) { + var diff = dmp.diff_main(a, b); + dmp.diff_cleanupSemantic(diff); + // The library sometimes leaves in empty parts, which confuse the algorithm + for (var i = 0; i < diff.length; ++i) { + var part = diff[i]; + if (!part[1]) { + diff.splice(i--, 1); + } else if (i && diff[i - 1][0] == part[0]) { + diff.splice(i--, 1); + diff[i][1] += part[1]; + } + } + return diff; + } + + function getChunks(diff) { + var chunks = []; + var startEdit = 0, startOrig = 0; + var edit = Pos(0, 0), orig = Pos(0, 0); + for (var i = 0; i < diff.length; ++i) { + var part = diff[i], tp = part[0]; + if (tp == DIFF_EQUAL) { + var startOff = startOfLineClean(diff, i) ? 0 : 1; + var cleanFromEdit = edit.line + startOff, cleanFromOrig = orig.line + startOff; + moveOver(edit, part[1], null, orig); + var endOff = endOfLineClean(diff, i) ? 1 : 0; + var cleanToEdit = edit.line + endOff, cleanToOrig = orig.line + endOff; + if (cleanToEdit > cleanFromEdit) { + if (i) chunks.push({origFrom: startOrig, origTo: cleanFromOrig, + editFrom: startEdit, editTo: cleanFromEdit}); + startEdit = cleanToEdit; startOrig = cleanToOrig; + } + } else { + moveOver(tp == DIFF_INSERT ? edit : orig, part[1]); + } + } + if (startEdit <= edit.line || startOrig <= orig.line) + chunks.push({origFrom: startOrig, origTo: orig.line + 1, + editFrom: startEdit, editTo: edit.line + 1}); + return chunks; + } + + function endOfLineClean(diff, i) { + if (i == diff.length - 1) return true; + var next = diff[i + 1][1]; + if (next.length == 1 || next.charCodeAt(0) != 10) return false; + if (i == diff.length - 2) return true; + next = diff[i + 2][1]; + return next.length > 1 && next.charCodeAt(0) == 10; + } + + function startOfLineClean(diff, i) { + if (i == 0) return true; + var last = diff[i - 1][1]; + if (last.charCodeAt(last.length - 1) != 10) return false; + if (i == 1) return true; + last = diff[i - 2][1]; + return last.charCodeAt(last.length - 1) == 10; + } + + function chunkBoundariesAround(chunks, n, nInEdit) { + var beforeE, afterE, beforeO, afterO; + for (var i = 0; i < chunks.length; i++) { + var chunk = chunks[i]; + var fromLocal = nInEdit ? chunk.editFrom : chunk.origFrom; + var toLocal = nInEdit ? chunk.editTo : chunk.origTo; + if (afterE == null) { + if (fromLocal > n) { afterE = chunk.editFrom; afterO = chunk.origFrom; } + else if (toLocal > n) { afterE = chunk.editTo; afterO = chunk.origTo; } + } + if (toLocal <= n) { beforeE = chunk.editTo; beforeO = chunk.origTo; } + else if (fromLocal <= n) { beforeE = chunk.editFrom; beforeO = chunk.origFrom; } + } + return {edit: {before: beforeE, after: afterE}, orig: {before: beforeO, after: afterO}}; + } + + function collapseSingle(cm, from, to) { + cm.addLineClass(from, "wrap", "CodeMirror-merge-collapsed-line"); + var widget = document.createElement("span"); + widget.className = "CodeMirror-merge-collapsed-widget"; + widget.title = "Identical text collapsed. Click to expand."; + var mark = cm.markText(Pos(from, 0), Pos(to - 1), { + inclusiveLeft: true, + inclusiveRight: true, + replacedWith: widget, + clearOnEnter: true + }); + function clear() { + mark.clear(); + cm.removeLineClass(from, "wrap", "CodeMirror-merge-collapsed-line"); + } + widget.addEventListener("click", clear); + return {mark: mark, clear: clear}; + } + + function collapseStretch(size, editors) { + var marks = []; + function clear() { + for (var i = 0; i < marks.length; i++) marks[i].clear(); + } + for (var i = 0; i < editors.length; i++) { + var editor = editors[i]; + var mark = collapseSingle(editor.cm, editor.line, editor.line + size); + marks.push(mark); + mark.mark.on("clear", clear); + } + return marks[0].mark; + } + + function unclearNearChunks(dv, margin, off, clear) { + for (var i = 0; i < dv.chunks.length; i++) { + var chunk = dv.chunks[i]; + for (var l = chunk.editFrom - margin; l < chunk.editTo + margin; l++) { + var pos = l + off; + if (pos >= 0 && pos < clear.length) clear[pos] = false; + } + } + } + + function collapseIdenticalStretches(mv, margin) { + if (typeof margin != "number") margin = 2; + var clear = [], edit = mv.editor(), off = edit.firstLine(); + for (var l = off, e = edit.lastLine(); l <= e; l++) clear.push(true); + if (mv.left) unclearNearChunks(mv.left, margin, off, clear); + if (mv.right) unclearNearChunks(mv.right, margin, off, clear); + + for (var i = 0; i < clear.length; i++) { + if (clear[i]) { + var line = i + off; + for (var size = 1; i < clear.length - 1 && clear[i + 1]; i++, size++) {} + if (size > margin) { + var editors = [{line: line, cm: edit}]; + if (mv.left) editors.push({line: getMatchingOrigLine(line, mv.left.chunks), cm: mv.left.orig}); + if (mv.right) editors.push({line: getMatchingOrigLine(line, mv.right.chunks), cm: mv.right.orig}); + var mark = collapseStretch(size, editors); + if (mv.options.onCollapse) mv.options.onCollapse(mv, line, size, mark); + } + } + } + } + + // General utilities + + function elt(tag, content, className, style) { + var e = document.createElement(tag); + if (className) e.className = className; + if (style) e.style.cssText = style; + if (typeof content == "string") e.appendChild(document.createTextNode(content)); + else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]); + return e; + } + + function clear(node) { + for (var count = node.childNodes.length; count > 0; --count) + node.removeChild(node.firstChild); + } + + function attrs(elt) { + for (var i = 1; i < arguments.length; i += 2) + elt.setAttribute(arguments[i], arguments[i+1]); + } + + function copyObj(obj, target) { + if (!target) target = {}; + for (var prop in obj) if (obj.hasOwnProperty(prop)) target[prop] = obj[prop]; + return target; + } + + function moveOver(pos, str, copy, other) { + var out = copy ? Pos(pos.line, pos.ch) : pos, at = 0; + for (;;) { + var nl = str.indexOf("\n", at); + if (nl == -1) break; + ++out.line; + if (other) ++other.line; + at = nl + 1; + } + out.ch = (at ? 0 : out.ch) + (str.length - at); + if (other) other.ch = (at ? 0 : other.ch) + (str.length - at); + return out; + } + + function posMin(a, b) { return (a.line - b.line || a.ch - b.ch) < 0 ? a : b; } + function posMax(a, b) { return (a.line - b.line || a.ch - b.ch) > 0 ? a : b; } + function posEq(a, b) { return a.line == b.line && a.ch == b.ch; } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/mode/loadmode.js b/src/main/resources/templates/editor/lib/codemirror/addon/mode/loadmode.js new file mode 100644 index 0000000000000000000000000000000000000000..10117ec22f250eb64c0e68688ca8c8c066fce2e7 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/mode/loadmode.js @@ -0,0 +1,64 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), "cjs"); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], function(CM) { mod(CM, "amd"); }); + else // Plain browser env + mod(CodeMirror, "plain"); +})(function(CodeMirror, env) { + if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; + + var loading = {}; + function splitCallback(cont, n) { + var countDown = n; + return function() { if (--countDown == 0) cont(); }; + } + function ensureDeps(mode, cont) { + var deps = CodeMirror.modes[mode].dependencies; + if (!deps) return cont(); + var missing = []; + for (var i = 0; i < deps.length; ++i) { + if (!CodeMirror.modes.hasOwnProperty(deps[i])) + missing.push(deps[i]); + } + if (!missing.length) return cont(); + var split = splitCallback(cont, missing.length); + for (var i = 0; i < missing.length; ++i) + CodeMirror.requireMode(missing[i], split); + } + + CodeMirror.requireMode = function(mode, cont) { + if (typeof mode != "string") mode = mode.name; + if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); + if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); + + var file = CodeMirror.modeURL.replace(/%N/g, mode); + if (env == "plain") { + var script = document.createElement("script"); + script.src = file; + var others = document.getElementsByTagName("script")[0]; + var list = loading[mode] = [cont]; + CodeMirror.on(script, "load", function() { + ensureDeps(mode, function() { + for (var i = 0; i < list.length; ++i) list[i](); + }); + }); + others.parentNode.insertBefore(script, others); + } else if (env == "cjs") { + require(file); + cont(); + } else if (env == "amd") { + requirejs([file], cont); + } + }; + + CodeMirror.autoLoadMode = function(instance, mode) { + if (!CodeMirror.modes.hasOwnProperty(mode)) + CodeMirror.requireMode(mode, function() { + instance.setOption("mode", instance.getOption("mode")); + }); + }; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/mode/multiplex.js b/src/main/resources/templates/editor/lib/codemirror/addon/mode/multiplex.js new file mode 100644 index 0000000000000000000000000000000000000000..6a95b323c161c95d68a56a4bff5d82c9307e15bb --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/mode/multiplex.js @@ -0,0 +1,118 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.multiplexingMode = function(outer /*, others */) { + // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects + var others = Array.prototype.slice.call(arguments, 1); + var n_others = others.length; + + function indexOf(string, pattern, from) { + if (typeof pattern == "string") return string.indexOf(pattern, from); + var m = pattern.exec(from ? string.slice(from) : string); + return m ? m.index + from : -1; + } + + return { + startState: function() { + return { + outer: CodeMirror.startState(outer), + innerActive: null, + inner: null + }; + }, + + copyState: function(state) { + return { + outer: CodeMirror.copyState(outer, state.outer), + innerActive: state.innerActive, + inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner) + }; + }, + + token: function(stream, state) { + if (!state.innerActive) { + var cutOff = Infinity, oldContent = stream.string; + for (var i = 0; i < n_others; ++i) { + var other = others[i]; + var found = indexOf(oldContent, other.open, stream.pos); + if (found == stream.pos) { + stream.match(other.open); + state.innerActive = other; + state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0); + return other.delimStyle; + } else if (found != -1 && found < cutOff) { + cutOff = found; + } + } + if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff); + var outerToken = outer.token(stream, state.outer); + if (cutOff != Infinity) stream.string = oldContent; + return outerToken; + } else { + var curInner = state.innerActive, oldContent = stream.string; + if (!curInner.close && stream.sol()) { + state.innerActive = state.inner = null; + return this.token(stream, state); + } + var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos) : -1; + if (found == stream.pos) { + stream.match(curInner.close); + state.innerActive = state.inner = null; + return curInner.delimStyle; + } + if (found > -1) stream.string = oldContent.slice(0, found); + var innerToken = curInner.mode.token(stream, state.inner); + if (found > -1) stream.string = oldContent; + + if (curInner.innerStyle) { + if (innerToken) innerToken = innerToken + ' ' + curInner.innerStyle; + else innerToken = curInner.innerStyle; + } + + return innerToken; + } + }, + + indent: function(state, textAfter) { + var mode = state.innerActive ? state.innerActive.mode : outer; + if (!mode.indent) return CodeMirror.Pass; + return mode.indent(state.innerActive ? state.inner : state.outer, textAfter); + }, + + blankLine: function(state) { + var mode = state.innerActive ? state.innerActive.mode : outer; + if (mode.blankLine) { + mode.blankLine(state.innerActive ? state.inner : state.outer); + } + if (!state.innerActive) { + for (var i = 0; i < n_others; ++i) { + var other = others[i]; + if (other.open === "\n") { + state.innerActive = other; + state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "") : 0); + } + } + } else if (state.innerActive.close === "\n") { + state.innerActive = state.inner = null; + } + }, + + electricChars: outer.electricChars, + + innerMode: function(state) { + return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer}; + } + }; +}; + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/mode/multiplex_test.js b/src/main/resources/templates/editor/lib/codemirror/addon/mode/multiplex_test.js new file mode 100644 index 0000000000000000000000000000000000000000..d33943420e523396cbd79ad4142672d65057eeef --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/mode/multiplex_test.js @@ -0,0 +1,33 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + CodeMirror.defineMode("markdown_with_stex", function(){ + var inner = CodeMirror.getMode({}, "stex"); + var outer = CodeMirror.getMode({}, "markdown"); + + var innerOptions = { + open: '$', + close: '$', + mode: inner, + delimStyle: 'delim', + innerStyle: 'inner' + }; + + return CodeMirror.multiplexingMode(outer, innerOptions); + }); + + var mode = CodeMirror.getMode({}, "markdown_with_stex"); + + function MT(name) { + test.mode( + name, + mode, + Array.prototype.slice.call(arguments, 1), + 'multiplexing'); + } + + MT( + "stexInsideMarkdown", + "[strong **Equation:**] [delim $][inner&tag \\pi][delim $]"); +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/mode/overlay.js b/src/main/resources/templates/editor/lib/codemirror/addon/mode/overlay.js new file mode 100644 index 0000000000000000000000000000000000000000..e1b9ed37530ad824e23d50a0c4c91057c8e9fb41 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/mode/overlay.js @@ -0,0 +1,85 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Utility function that allows modes to be combined. The mode given +// as the base argument takes care of most of the normal mode +// functionality, but a second (typically simple) mode is used, which +// can override the style of text. Both modes get to parse all of the +// text, but when both assign a non-null style to a piece of code, the +// overlay wins, unless the combine argument was true and not overridden, +// or state.overlay.combineTokens was true, in which case the styles are +// combined. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.overlayMode = function(base, overlay, combine) { + return { + startState: function() { + return { + base: CodeMirror.startState(base), + overlay: CodeMirror.startState(overlay), + basePos: 0, baseCur: null, + overlayPos: 0, overlayCur: null, + streamSeen: null + }; + }, + copyState: function(state) { + return { + base: CodeMirror.copyState(base, state.base), + overlay: CodeMirror.copyState(overlay, state.overlay), + basePos: state.basePos, baseCur: null, + overlayPos: state.overlayPos, overlayCur: null + }; + }, + + token: function(stream, state) { + if (stream != state.streamSeen || + Math.min(state.basePos, state.overlayPos) < stream.start) { + state.streamSeen = stream; + state.basePos = state.overlayPos = stream.start; + } + + if (stream.start == state.basePos) { + state.baseCur = base.token(stream, state.base); + state.basePos = stream.pos; + } + if (stream.start == state.overlayPos) { + stream.pos = stream.start; + state.overlayCur = overlay.token(stream, state.overlay); + state.overlayPos = stream.pos; + } + stream.pos = Math.min(state.basePos, state.overlayPos); + + // state.overlay.combineTokens always takes precedence over combine, + // unless set to null + if (state.overlayCur == null) return state.baseCur; + else if (state.baseCur != null && + state.overlay.combineTokens || + combine && state.overlay.combineTokens == null) + return state.baseCur + " " + state.overlayCur; + else return state.overlayCur; + }, + + indent: base.indent && function(state, textAfter) { + return base.indent(state.base, textAfter); + }, + electricChars: base.electricChars, + + innerMode: function(state) { return {state: state.base, mode: base}; }, + + blankLine: function(state) { + if (base.blankLine) base.blankLine(state.base); + if (overlay.blankLine) overlay.blankLine(state.overlay); + } + }; +}; + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/mode/simple.js b/src/main/resources/templates/editor/lib/codemirror/addon/mode/simple.js new file mode 100644 index 0000000000000000000000000000000000000000..795328b83df4ed8675a2cff64937e332dbe31275 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/mode/simple.js @@ -0,0 +1,213 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineSimpleMode = function(name, states) { + CodeMirror.defineMode(name, function(config) { + return CodeMirror.simpleMode(config, states); + }); + }; + + CodeMirror.simpleMode = function(config, states) { + ensureState(states, "start"); + var states_ = {}, meta = states.meta || {}, hasIndentation = false; + for (var state in states) if (state != meta && states.hasOwnProperty(state)) { + var list = states_[state] = [], orig = states[state]; + for (var i = 0; i < orig.length; i++) { + var data = orig[i]; + list.push(new Rule(data, states)); + if (data.indent || data.dedent) hasIndentation = true; + } + } + var mode = { + startState: function() { + return {state: "start", pending: null, + local: null, localState: null, + indent: hasIndentation ? [] : null}; + }, + copyState: function(state) { + var s = {state: state.state, pending: state.pending, + local: state.local, localState: null, + indent: state.indent && state.indent.slice(0)}; + if (state.localState) + s.localState = CodeMirror.copyState(state.local.mode, state.localState); + if (state.stack) + s.stack = state.stack.slice(0); + for (var pers = state.persistentStates; pers; pers = pers.next) + s.persistentStates = {mode: pers.mode, + spec: pers.spec, + state: pers.state == state.localState ? s.localState : CodeMirror.copyState(pers.mode, pers.state), + next: s.persistentStates}; + return s; + }, + token: tokenFunction(states_, config), + innerMode: function(state) { return state.local && {mode: state.local.mode, state: state.localState}; }, + indent: indentFunction(states_, meta) + }; + if (meta) for (var prop in meta) if (meta.hasOwnProperty(prop)) + mode[prop] = meta[prop]; + return mode; + }; + + function ensureState(states, name) { + if (!states.hasOwnProperty(name)) + throw new Error("Undefined state " + name + "in simple mode"); + } + + function toRegex(val, caret) { + if (!val) return /(?:)/; + var flags = ""; + if (val instanceof RegExp) { + if (val.ignoreCase) flags = "i"; + val = val.source; + } else { + val = String(val); + } + return new RegExp((caret === false ? "" : "^") + "(?:" + val + ")", flags); + } + + function asToken(val) { + if (!val) return null; + if (typeof val == "string") return val.replace(/\./g, " "); + var result = []; + for (var i = 0; i < val.length; i++) + result.push(val[i] && val[i].replace(/\./g, " ")); + return result; + } + + function Rule(data, states) { + if (data.next || data.push) ensureState(states, data.next || data.push); + this.regex = toRegex(data.regex); + this.token = asToken(data.token); + this.data = data; + } + + function tokenFunction(states, config) { + return function(stream, state) { + if (state.pending) { + var pend = state.pending.shift(); + if (state.pending.length == 0) state.pending = null; + stream.pos += pend.text.length; + return pend.token; + } + + if (state.local) { + if (state.local.end && stream.match(state.local.end)) { + var tok = state.local.endToken || null; + state.local = state.localState = null; + return tok; + } else { + var tok = state.local.mode.token(stream, state.localState), m; + if (state.local.endScan && (m = state.local.endScan.exec(stream.current()))) + stream.pos = stream.start + m.index; + return tok; + } + } + + var curState = states[state.state]; + for (var i = 0; i < curState.length; i++) { + var rule = curState[i]; + var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex); + if (matches) { + if (rule.data.next) { + state.state = rule.data.next; + } else if (rule.data.push) { + (state.stack || (state.stack = [])).push(state.state); + state.state = rule.data.push; + } else if (rule.data.pop && state.stack && state.stack.length) { + state.state = state.stack.pop(); + } + + if (rule.data.mode) + enterLocalMode(config, state, rule.data.mode, rule.token); + if (rule.data.indent) + state.indent.push(stream.indentation() + config.indentUnit); + if (rule.data.dedent) + state.indent.pop(); + if (matches.length > 2) { + state.pending = []; + for (var j = 2; j < matches.length; j++) + if (matches[j]) + state.pending.push({text: matches[j], token: rule.token[j - 1]}); + stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0)); + return rule.token[0]; + } else if (rule.token && rule.token.join) { + return rule.token[0]; + } else { + return rule.token; + } + } + } + stream.next(); + return null; + }; + } + + function cmp(a, b) { + if (a === b) return true; + if (!a || typeof a != "object" || !b || typeof b != "object") return false; + var props = 0; + for (var prop in a) if (a.hasOwnProperty(prop)) { + if (!b.hasOwnProperty(prop) || !cmp(a[prop], b[prop])) return false; + props++; + } + for (var prop in b) if (b.hasOwnProperty(prop)) props--; + return props == 0; + } + + function enterLocalMode(config, state, spec, token) { + var pers; + if (spec.persistent) for (var p = state.persistentStates; p && !pers; p = p.next) + if (spec.spec ? cmp(spec.spec, p.spec) : spec.mode == p.mode) pers = p; + var mode = pers ? pers.mode : spec.mode || CodeMirror.getMode(config, spec.spec); + var lState = pers ? pers.state : CodeMirror.startState(mode); + if (spec.persistent && !pers) + state.persistentStates = {mode: mode, spec: spec.spec, state: lState, next: state.persistentStates}; + + state.localState = lState; + state.local = {mode: mode, + end: spec.end && toRegex(spec.end), + endScan: spec.end && spec.forceEnd !== false && toRegex(spec.end, false), + endToken: token && token.join ? token[token.length - 1] : token}; + } + + function indexOf(val, arr) { + for (var i = 0; i < arr.length; i++) if (arr[i] === val) return true; + } + + function indentFunction(states, meta) { + return function(state, textAfter, line) { + if (state.local && state.local.mode.indent) + return state.local.mode.indent(state.localState, textAfter, line); + if (state.indent == null || state.local || meta.dontIndentStates && indexOf(state.state, meta.dontIndentStates) > -1) + return CodeMirror.Pass; + + var pos = state.indent.length - 1, rules = states[state.state]; + scan: for (;;) { + for (var i = 0; i < rules.length; i++) { + var rule = rules[i]; + if (rule.data.dedent && rule.data.dedentIfLineStart !== false) { + var m = rule.regex.exec(textAfter); + if (m && m[0]) { + pos--; + if (rule.next || rule.push) rules = states[rule.next || rule.push]; + textAfter = textAfter.slice(m[0].length); + continue scan; + } + } + } + break; + } + return pos < 0 ? 0 : state.indent[pos]; + }; + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/runmode/colorize.js b/src/main/resources/templates/editor/lib/codemirror/addon/runmode/colorize.js new file mode 100644 index 0000000000000000000000000000000000000000..eb7060d0a295b467f690fc4a10b14e14728f8f63 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/runmode/colorize.js @@ -0,0 +1,40 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("./runmode")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "./runmode"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/; + + function textContent(node, out) { + if (node.nodeType == 3) return out.push(node.nodeValue); + for (var ch = node.firstChild; ch; ch = ch.nextSibling) { + textContent(ch, out); + if (isBlock.test(node.nodeType)) out.push("\n"); + } + } + + CodeMirror.colorize = function(collection, defaultMode) { + if (!collection) collection = document.body.getElementsByTagName("pre"); + + for (var i = 0; i < collection.length; ++i) { + var node = collection[i]; + var mode = node.getAttribute("data-lang") || defaultMode; + if (!mode) continue; + + var text = []; + textContent(node, text); + node.innerHTML = ""; + CodeMirror.runMode(text.join(""), mode, node); + + node.className += " cm-s-default"; + } + }; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/runmode/runmode-standalone.js b/src/main/resources/templates/editor/lib/codemirror/addon/runmode/runmode-standalone.js new file mode 100644 index 0000000000000000000000000000000000000000..f4f352c80352448cd6de3746853c3fdaa2c4fa99 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/runmode/runmode-standalone.js @@ -0,0 +1,157 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +window.CodeMirror = {}; + +(function() { +"use strict"; + +function splitLines(string){ return string.split(/\r?\n|\r/); }; + +function StringStream(string) { + this.pos = this.start = 0; + this.string = string; + this.lineStart = 0; +} +StringStream.prototype = { + eol: function() {return this.pos >= this.string.length;}, + sol: function() {return this.pos == 0;}, + peek: function() {return this.string.charAt(this.pos) || null;}, + next: function() { + if (this.pos < this.string.length) + return this.string.charAt(this.pos++); + }, + eat: function(match) { + var ch = this.string.charAt(this.pos); + if (typeof match == "string") var ok = ch == match; + else var ok = ch && (match.test ? match.test(ch) : match(ch)); + if (ok) {++this.pos; return ch;} + }, + eatWhile: function(match) { + var start = this.pos; + while (this.eat(match)){} + return this.pos > start; + }, + eatSpace: function() { + var start = this.pos; + while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; + return this.pos > start; + }, + skipToEnd: function() {this.pos = this.string.length;}, + skipTo: function(ch) { + var found = this.string.indexOf(ch, this.pos); + if (found > -1) {this.pos = found; return true;} + }, + backUp: function(n) {this.pos -= n;}, + column: function() {return this.start - this.lineStart;}, + indentation: function() {return 0;}, + match: function(pattern, consume, caseInsensitive) { + if (typeof pattern == "string") { + var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;}; + var substr = this.string.substr(this.pos, pattern.length); + if (cased(substr) == cased(pattern)) { + if (consume !== false) this.pos += pattern.length; + return true; + } + } else { + var match = this.string.slice(this.pos).match(pattern); + if (match && match.index > 0) return null; + if (match && consume !== false) this.pos += match[0].length; + return match; + } + }, + current: function(){return this.string.slice(this.start, this.pos);}, + hideFirstChars: function(n, inner) { + this.lineStart += n; + try { return inner(); } + finally { this.lineStart -= n; } + } +}; +CodeMirror.StringStream = StringStream; + +CodeMirror.startState = function (mode, a1, a2) { + return mode.startState ? mode.startState(a1, a2) : true; +}; + +var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {}; +CodeMirror.defineMode = function (name, mode) { + if (arguments.length > 2) + mode.dependencies = Array.prototype.slice.call(arguments, 2); + modes[name] = mode; +}; +CodeMirror.defineMIME = function (mime, spec) { mimeModes[mime] = spec; }; +CodeMirror.resolveMode = function(spec) { + if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { + spec = mimeModes[spec]; + } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { + spec = mimeModes[spec.name]; + } + if (typeof spec == "string") return {name: spec}; + else return spec || {name: "null"}; +}; +CodeMirror.getMode = function (options, spec) { + spec = CodeMirror.resolveMode(spec); + var mfactory = modes[spec.name]; + if (!mfactory) throw new Error("Unknown mode: " + spec); + return mfactory(options, spec); +}; +CodeMirror.registerHelper = CodeMirror.registerGlobalHelper = Math.min; +CodeMirror.defineMode("null", function() { + return {token: function(stream) {stream.skipToEnd();}}; +}); +CodeMirror.defineMIME("text/plain", "null"); + +CodeMirror.runMode = function (string, modespec, callback, options) { + var mode = CodeMirror.getMode({ indentUnit: 2 }, modespec); + + if (callback.nodeType == 1) { + var tabSize = (options && options.tabSize) || 4; + var node = callback, col = 0; + node.innerHTML = ""; + callback = function (text, style) { + if (text == "\n") { + node.appendChild(document.createElement("br")); + col = 0; + return; + } + var content = ""; + // replace tabs + for (var pos = 0; ;) { + var idx = text.indexOf("\t", pos); + if (idx == -1) { + content += text.slice(pos); + col += text.length - pos; + break; + } else { + col += idx - pos; + content += text.slice(pos, idx); + var size = tabSize - col % tabSize; + col += size; + for (var i = 0; i < size; ++i) content += " "; + pos = idx + 1; + } + } + + if (style) { + var sp = node.appendChild(document.createElement("span")); + sp.className = "cm-" + style.replace(/ +/g, " cm-"); + sp.appendChild(document.createTextNode(content)); + } else { + node.appendChild(document.createTextNode(content)); + } + }; + } + + var lines = splitLines(string), state = (options && options.state) || CodeMirror.startState(mode); + for (var i = 0, e = lines.length; i < e; ++i) { + if (i) callback("\n"); + var stream = new CodeMirror.StringStream(lines[i]); + if (!stream.string && mode.blankLine) mode.blankLine(state); + while (!stream.eol()) { + var style = mode.token(stream, state); + callback(stream.current(), style, i, stream.start, state); + stream.start = stream.pos; + } + } +}; +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/runmode/runmode.js b/src/main/resources/templates/editor/lib/codemirror/addon/runmode/runmode.js new file mode 100644 index 0000000000000000000000000000000000000000..07d2279f747b09ac0babbd51163089f1863a560a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/runmode/runmode.js @@ -0,0 +1,72 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.runMode = function(string, modespec, callback, options) { + var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); + var ie = /MSIE \d/.test(navigator.userAgent); + var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9); + + if (callback.nodeType == 1) { + var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; + var node = callback, col = 0; + node.innerHTML = ""; + callback = function(text, style) { + if (text == "\n") { + // Emitting LF or CRLF on IE8 or earlier results in an incorrect display. + // Emitting a carriage return makes everything ok. + node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text)); + col = 0; + return; + } + var content = ""; + // replace tabs + for (var pos = 0;;) { + var idx = text.indexOf("\t", pos); + if (idx == -1) { + content += text.slice(pos); + col += text.length - pos; + break; + } else { + col += idx - pos; + content += text.slice(pos, idx); + var size = tabSize - col % tabSize; + col += size; + for (var i = 0; i < size; ++i) content += " "; + pos = idx + 1; + } + } + + if (style) { + var sp = node.appendChild(document.createElement("span")); + sp.className = "cm-" + style.replace(/ +/g, " cm-"); + sp.appendChild(document.createTextNode(content)); + } else { + node.appendChild(document.createTextNode(content)); + } + }; + } + + var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode); + for (var i = 0, e = lines.length; i < e; ++i) { + if (i) callback("\n"); + var stream = new CodeMirror.StringStream(lines[i]); + if (!stream.string && mode.blankLine) mode.blankLine(state); + while (!stream.eol()) { + var style = mode.token(stream, state); + callback(stream.current(), style, i, stream.start, state); + stream.start = stream.pos; + } + } +}; + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/runmode/runmode.node.js b/src/main/resources/templates/editor/lib/codemirror/addon/runmode/runmode.node.js new file mode 100644 index 0000000000000000000000000000000000000000..8b8140b4c1ae4d98615f9a3950150c8153d055e3 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/runmode/runmode.node.js @@ -0,0 +1,120 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/* Just enough of CodeMirror to run runMode under node.js */ + +// declare global: StringStream + +function splitLines(string){ return string.split(/\r?\n|\r/); }; + +function StringStream(string) { + this.pos = this.start = 0; + this.string = string; + this.lineStart = 0; +} +StringStream.prototype = { + eol: function() {return this.pos >= this.string.length;}, + sol: function() {return this.pos == 0;}, + peek: function() {return this.string.charAt(this.pos) || null;}, + next: function() { + if (this.pos < this.string.length) + return this.string.charAt(this.pos++); + }, + eat: function(match) { + var ch = this.string.charAt(this.pos); + if (typeof match == "string") var ok = ch == match; + else var ok = ch && (match.test ? match.test(ch) : match(ch)); + if (ok) {++this.pos; return ch;} + }, + eatWhile: function(match) { + var start = this.pos; + while (this.eat(match)){} + return this.pos > start; + }, + eatSpace: function() { + var start = this.pos; + while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; + return this.pos > start; + }, + skipToEnd: function() {this.pos = this.string.length;}, + skipTo: function(ch) { + var found = this.string.indexOf(ch, this.pos); + if (found > -1) {this.pos = found; return true;} + }, + backUp: function(n) {this.pos -= n;}, + column: function() {return this.start - this.lineStart;}, + indentation: function() {return 0;}, + match: function(pattern, consume, caseInsensitive) { + if (typeof pattern == "string") { + var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;}; + var substr = this.string.substr(this.pos, pattern.length); + if (cased(substr) == cased(pattern)) { + if (consume !== false) this.pos += pattern.length; + return true; + } + } else { + var match = this.string.slice(this.pos).match(pattern); + if (match && match.index > 0) return null; + if (match && consume !== false) this.pos += match[0].length; + return match; + } + }, + current: function(){return this.string.slice(this.start, this.pos);}, + hideFirstChars: function(n, inner) { + this.lineStart += n; + try { return inner(); } + finally { this.lineStart -= n; } + } +}; +exports.StringStream = StringStream; + +exports.startState = function(mode, a1, a2) { + return mode.startState ? mode.startState(a1, a2) : true; +}; + +var modes = exports.modes = {}, mimeModes = exports.mimeModes = {}; +exports.defineMode = function(name, mode) { + if (arguments.length > 2) + mode.dependencies = Array.prototype.slice.call(arguments, 2); + modes[name] = mode; +}; +exports.defineMIME = function(mime, spec) { mimeModes[mime] = spec; }; + +exports.defineMode("null", function() { + return {token: function(stream) {stream.skipToEnd();}}; +}); +exports.defineMIME("text/plain", "null"); + +exports.resolveMode = function(spec) { + if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { + spec = mimeModes[spec]; + } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { + spec = mimeModes[spec.name]; + } + if (typeof spec == "string") return {name: spec}; + else return spec || {name: "null"}; +}; +exports.getMode = function(options, spec) { + spec = exports.resolveMode(spec); + var mfactory = modes[spec.name]; + if (!mfactory) throw new Error("Unknown mode: " + spec); + return mfactory(options, spec); +}; +exports.registerHelper = exports.registerGlobalHelper = Math.min; + +exports.runMode = function(string, modespec, callback, options) { + var mode = exports.getMode({indentUnit: 2}, modespec); + var lines = splitLines(string), state = (options && options.state) || exports.startState(mode); + for (var i = 0, e = lines.length; i < e; ++i) { + if (i) callback("\n"); + var stream = new exports.StringStream(lines[i]); + if (!stream.string && mode.blankLine) mode.blankLine(state); + while (!stream.eol()) { + var style = mode.token(stream, state); + callback(stream.current(), style, i, stream.start, state); + stream.start = stream.pos; + } + } +}; + +require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")]; diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/scroll/annotatescrollbar.js b/src/main/resources/templates/editor/lib/codemirror/addon/scroll/annotatescrollbar.js new file mode 100644 index 0000000000000000000000000000000000000000..54aeacf271884c817c2fc69fd2469c2217f5a347 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/scroll/annotatescrollbar.js @@ -0,0 +1,100 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineExtension("annotateScrollbar", function(options) { + if (typeof options == "string") options = {className: options}; + return new Annotation(this, options); + }); + + CodeMirror.defineOption("scrollButtonHeight", 0); + + function Annotation(cm, options) { + this.cm = cm; + this.options = options; + this.buttonHeight = options.scrollButtonHeight || cm.getOption("scrollButtonHeight"); + this.annotations = []; + this.doRedraw = this.doUpdate = null; + this.div = cm.getWrapperElement().appendChild(document.createElement("div")); + this.div.style.cssText = "position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none"; + this.computeScale(); + + function scheduleRedraw(delay) { + clearTimeout(self.doRedraw); + self.doRedraw = setTimeout(function() { self.redraw(); }, delay); + } + + var self = this; + cm.on("refresh", this.resizeHandler = function() { + clearTimeout(self.doUpdate); + self.doUpdate = setTimeout(function() { + if (self.computeScale()) scheduleRedraw(20); + }, 100); + }); + cm.on("markerAdded", this.resizeHandler); + cm.on("markerCleared", this.resizeHandler); + if (options.listenForChanges !== false) + cm.on("change", this.changeHandler = function() { + scheduleRedraw(250); + }); + } + + Annotation.prototype.computeScale = function() { + var cm = this.cm; + var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight - this.buttonHeight * 2) / + cm.heightAtLine(cm.lastLine() + 1, "local"); + if (hScale != this.hScale) { + this.hScale = hScale; + return true; + } + }; + + Annotation.prototype.update = function(annotations) { + this.annotations = annotations; + this.redraw(); + }; + + Annotation.prototype.redraw = function(compute) { + if (compute !== false) this.computeScale(); + var cm = this.cm, hScale = this.hScale; + + var frag = document.createDocumentFragment(), anns = this.annotations; + if (cm.display.barWidth) for (var i = 0, nextTop; i < anns.length; i++) { + var ann = anns[i]; + var top = nextTop || cm.charCoords(ann.from, "local").top * hScale; + var bottom = cm.charCoords(ann.to, "local").bottom * hScale; + while (i < anns.length - 1) { + nextTop = cm.charCoords(anns[i + 1].from, "local").top * hScale; + if (nextTop > bottom + .9) break; + ann = anns[++i]; + bottom = cm.charCoords(ann.to, "local").bottom * hScale; + } + if (bottom == top) continue; + var height = Math.max(bottom - top, 3); + + var elt = frag.appendChild(document.createElement("div")); + elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: " + + (top + this.buttonHeight) + "px; height: " + height + "px"; + elt.className = this.options.className; + } + this.div.textContent = ""; + this.div.appendChild(frag); + }; + + Annotation.prototype.clear = function() { + this.cm.off("refresh", this.resizeHandler); + this.cm.off("markerAdded", this.resizeHandler); + this.cm.off("markerCleared", this.resizeHandler); + if (this.changeHandler) this.cm.off("change", this.changeHandler); + this.div.parentNode.removeChild(this.div); + }; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/scroll/scrollpastend.js b/src/main/resources/templates/editor/lib/codemirror/addon/scroll/scrollpastend.js new file mode 100644 index 0000000000000000000000000000000000000000..008ae4c7ba79d65594494212f269b260eb98b522 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/scroll/scrollpastend.js @@ -0,0 +1,46 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + cm.off("change", onChange); + cm.off("refresh", updateBottomMargin); + cm.display.lineSpace.parentNode.style.paddingBottom = ""; + cm.state.scrollPastEndPadding = null; + } + if (val) { + cm.on("change", onChange); + cm.on("refresh", updateBottomMargin); + updateBottomMargin(cm); + } + }); + + function onChange(cm, change) { + if (CodeMirror.changeEnd(change).line == cm.lastLine()) + updateBottomMargin(cm); + } + + function updateBottomMargin(cm) { + var padding = ""; + if (cm.lineCount() > 1) { + var totalH = cm.display.scroller.clientHeight - 30, + lastLineH = cm.getLineHandle(cm.lastLine()).height; + padding = (totalH - lastLineH) + "px"; + } + if (cm.state.scrollPastEndPadding != padding) { + cm.state.scrollPastEndPadding = padding; + cm.display.lineSpace.parentNode.style.paddingBottom = padding; + cm.setSize(); + } + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/scroll/simplescrollbars.css b/src/main/resources/templates/editor/lib/codemirror/addon/scroll/simplescrollbars.css new file mode 100644 index 0000000000000000000000000000000000000000..5eea7aa1b3c5549b9f799c20289cef3b8ec4fac3 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/scroll/simplescrollbars.css @@ -0,0 +1,66 @@ +.CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div { + position: absolute; + background: #ccc; + -moz-box-sizing: border-box; + box-sizing: border-box; + border: 1px solid #bbb; + border-radius: 2px; +} + +.CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical { + position: absolute; + z-index: 6; + background: #eee; +} + +.CodeMirror-simplescroll-horizontal { + bottom: 0; left: 0; + height: 8px; +} +.CodeMirror-simplescroll-horizontal div { + bottom: 0; + height: 100%; +} + +.CodeMirror-simplescroll-vertical { + right: 0; top: 0; + width: 8px; +} +.CodeMirror-simplescroll-vertical div { + right: 0; + width: 100%; +} + + +.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler { + display: none; +} + +.CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div { + position: absolute; + background: #bcd; + border-radius: 3px; +} + +.CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical { + position: absolute; + z-index: 6; +} + +.CodeMirror-overlayscroll-horizontal { + bottom: 0; left: 0; + height: 6px; +} +.CodeMirror-overlayscroll-horizontal div { + bottom: 0; + height: 100%; +} + +.CodeMirror-overlayscroll-vertical { + right: 0; top: 0; + width: 6px; +} +.CodeMirror-overlayscroll-vertical div { + right: 0; + width: 100%; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/scroll/simplescrollbars.js b/src/main/resources/templates/editor/lib/codemirror/addon/scroll/simplescrollbars.js new file mode 100644 index 0000000000000000000000000000000000000000..bb06adb86a11a8f29f640d9e637e36dd5ee1c5c1 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/scroll/simplescrollbars.js @@ -0,0 +1,141 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function Bar(cls, orientation, scroll) { + this.orientation = orientation; + this.scroll = scroll; + this.screen = this.total = this.size = 1; + this.pos = 0; + + this.node = document.createElement("div"); + this.node.className = cls + "-" + orientation; + this.inner = this.node.appendChild(document.createElement("div")); + + var self = this; + CodeMirror.on(this.inner, "mousedown", function(e) { + if (e.which != 1) return; + CodeMirror.e_preventDefault(e); + var axis = self.orientation == "horizontal" ? "pageX" : "pageY"; + var start = e[axis], startpos = self.pos; + function done() { + CodeMirror.off(document, "mousemove", move); + CodeMirror.off(document, "mouseup", done); + } + function move(e) { + if (e.which != 1) return done(); + self.moveTo(startpos + (e[axis] - start) * (self.total / self.size)); + } + CodeMirror.on(document, "mousemove", move); + CodeMirror.on(document, "mouseup", done); + }); + + CodeMirror.on(this.node, "click", function(e) { + CodeMirror.e_preventDefault(e); + var innerBox = self.inner.getBoundingClientRect(), where; + if (self.orientation == "horizontal") + where = e.clientX < innerBox.left ? -1 : e.clientX > innerBox.right ? 1 : 0; + else + where = e.clientY < innerBox.top ? -1 : e.clientY > innerBox.bottom ? 1 : 0; + self.moveTo(self.pos + where * self.screen); + }); + + function onWheel(e) { + var moved = CodeMirror.wheelEventPixels(e)[self.orientation == "horizontal" ? "x" : "y"]; + var oldPos = self.pos; + self.moveTo(self.pos + moved); + if (self.pos != oldPos) CodeMirror.e_preventDefault(e); + } + CodeMirror.on(this.node, "mousewheel", onWheel); + CodeMirror.on(this.node, "DOMMouseScroll", onWheel); + } + + Bar.prototype.moveTo = function(pos, update) { + if (pos < 0) pos = 0; + if (pos > this.total - this.screen) pos = this.total - this.screen; + if (pos == this.pos) return; + this.pos = pos; + this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = + (pos * (this.size / this.total)) + "px"; + if (update !== false) this.scroll(pos, this.orientation); + }; + + Bar.prototype.update = function(scrollSize, clientSize, barSize) { + this.screen = clientSize; + this.total = scrollSize; + this.size = barSize; + + // FIXME clip to min size? + this.inner.style[this.orientation == "horizontal" ? "width" : "height"] = + this.screen * (this.size / this.total) + "px"; + this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = + this.pos * (this.size / this.total) + "px"; + }; + + function SimpleScrollbars(cls, place, scroll) { + this.addClass = cls; + this.horiz = new Bar(cls, "horizontal", scroll); + place(this.horiz.node); + this.vert = new Bar(cls, "vertical", scroll); + place(this.vert.node); + this.width = null; + } + + SimpleScrollbars.prototype.update = function(measure) { + if (this.width == null) { + var style = window.getComputedStyle ? window.getComputedStyle(this.horiz.node) : this.horiz.node.currentStyle; + if (style) this.width = parseInt(style.height); + } + var width = this.width || 0; + + var needsH = measure.scrollWidth > measure.clientWidth + 1; + var needsV = measure.scrollHeight > measure.clientHeight + 1; + this.vert.node.style.display = needsV ? "block" : "none"; + this.horiz.node.style.display = needsH ? "block" : "none"; + + if (needsV) { + this.vert.update(measure.scrollHeight, measure.clientHeight, + measure.viewHeight - (needsH ? width : 0)); + this.vert.node.style.display = "block"; + this.vert.node.style.bottom = needsH ? width + "px" : "0"; + } + if (needsH) { + this.horiz.update(measure.scrollWidth, measure.clientWidth, + measure.viewWidth - (needsV ? width : 0) - measure.barLeft); + this.horiz.node.style.right = needsV ? width + "px" : "0"; + this.horiz.node.style.left = measure.barLeft + "px"; + } + + return {right: needsV ? width : 0, bottom: needsH ? width : 0}; + }; + + SimpleScrollbars.prototype.setScrollTop = function(pos) { + this.vert.moveTo(pos, false); + }; + + SimpleScrollbars.prototype.setScrollLeft = function(pos) { + this.horiz.moveTo(pos, false); + }; + + SimpleScrollbars.prototype.clear = function() { + var parent = this.horiz.node.parentNode; + parent.removeChild(this.horiz.node); + parent.removeChild(this.vert.node); + }; + + CodeMirror.scrollbarModel.simple = function(place, scroll) { + return new SimpleScrollbars("CodeMirror-simplescroll", place, scroll); + }; + CodeMirror.scrollbarModel.overlay = function(place, scroll) { + return new SimpleScrollbars("CodeMirror-overlayscroll", place, scroll); + }; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/search/match-highlighter.js b/src/main/resources/templates/editor/lib/codemirror/addon/search/match-highlighter.js new file mode 100644 index 0000000000000000000000000000000000000000..e9a22721f7808db765bf64658549aa7583aa40d6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/search/match-highlighter.js @@ -0,0 +1,128 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Highlighting text that matches the selection +// +// Defines an option highlightSelectionMatches, which, when enabled, +// will style strings that match the selection throughout the +// document. +// +// The option can be set to true to simply enable it, or to a +// {minChars, style, wordsOnly, showToken, delay} object to explicitly +// configure it. minChars is the minimum amount of characters that should be +// selected for the behavior to occur, and style is the token style to +// apply to the matches. This will be prefixed by "cm-" to create an +// actual CSS class name. If wordsOnly is enabled, the matches will be +// highlighted only if the selected text is a word. showToken, when enabled, +// will cause the current token to be highlighted when nothing is selected. +// delay is used to specify how much time to wait, in milliseconds, before +// highlighting the matches. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var DEFAULT_MIN_CHARS = 2; + var DEFAULT_TOKEN_STYLE = "matchhighlight"; + var DEFAULT_DELAY = 100; + var DEFAULT_WORDS_ONLY = false; + + function State(options) { + if (typeof options == "object") { + this.minChars = options.minChars; + this.style = options.style; + this.showToken = options.showToken; + this.delay = options.delay; + this.wordsOnly = options.wordsOnly; + } + if (this.style == null) this.style = DEFAULT_TOKEN_STYLE; + if (this.minChars == null) this.minChars = DEFAULT_MIN_CHARS; + if (this.delay == null) this.delay = DEFAULT_DELAY; + if (this.wordsOnly == null) this.wordsOnly = DEFAULT_WORDS_ONLY; + this.overlay = this.timeout = null; + } + + CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + var over = cm.state.matchHighlighter.overlay; + if (over) cm.removeOverlay(over); + clearTimeout(cm.state.matchHighlighter.timeout); + cm.state.matchHighlighter = null; + cm.off("cursorActivity", cursorActivity); + } + if (val) { + cm.state.matchHighlighter = new State(val); + highlightMatches(cm); + cm.on("cursorActivity", cursorActivity); + } + }); + + function cursorActivity(cm) { + var state = cm.state.matchHighlighter; + clearTimeout(state.timeout); + state.timeout = setTimeout(function() {highlightMatches(cm);}, state.delay); + } + + function highlightMatches(cm) { + cm.operation(function() { + var state = cm.state.matchHighlighter; + if (state.overlay) { + cm.removeOverlay(state.overlay); + state.overlay = null; + } + if (!cm.somethingSelected() && state.showToken) { + var re = state.showToken === true ? /[\w$]/ : state.showToken; + var cur = cm.getCursor(), line = cm.getLine(cur.line), start = cur.ch, end = start; + while (start && re.test(line.charAt(start - 1))) --start; + while (end < line.length && re.test(line.charAt(end))) ++end; + if (start < end) + cm.addOverlay(state.overlay = makeOverlay(line.slice(start, end), re, state.style)); + return; + } + var from = cm.getCursor("from"), to = cm.getCursor("to"); + if (from.line != to.line) return; + if (state.wordsOnly && !isWord(cm, from, to)) return; + var selection = cm.getRange(from, to).replace(/^\s+|\s+$/g, ""); + if (selection.length >= state.minChars) + cm.addOverlay(state.overlay = makeOverlay(selection, false, state.style)); + }); + } + + function isWord(cm, from, to) { + var str = cm.getRange(from, to); + if (str.match(/^\w+$/) !== null) { + if (from.ch > 0) { + var pos = {line: from.line, ch: from.ch - 1}; + var chr = cm.getRange(pos, from); + if (chr.match(/\W/) === null) return false; + } + if (to.ch < cm.getLine(from.line).length) { + var pos = {line: to.line, ch: to.ch + 1}; + var chr = cm.getRange(to, pos); + if (chr.match(/\W/) === null) return false; + } + return true; + } else return false; + } + + function boundariesAround(stream, re) { + return (!stream.start || !re.test(stream.string.charAt(stream.start - 1))) && + (stream.pos == stream.string.length || !re.test(stream.string.charAt(stream.pos))); + } + + function makeOverlay(query, hasBoundary, style) { + return {token: function(stream) { + if (stream.match(query) && + (!hasBoundary || boundariesAround(stream, hasBoundary))) + return style; + stream.next(); + stream.skipTo(query.charAt(0)) || stream.skipToEnd(); + }}; + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/search/matchesonscrollbar.css b/src/main/resources/templates/editor/lib/codemirror/addon/search/matchesonscrollbar.css new file mode 100644 index 0000000000000000000000000000000000000000..77932cc9081a3e0d3334afd2c609ddaa4e904480 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/search/matchesonscrollbar.css @@ -0,0 +1,8 @@ +.CodeMirror-search-match { + background: gold; + border-top: 1px solid orange; + border-bottom: 1px solid orange; + -moz-box-sizing: border-box; + box-sizing: border-box; + opacity: .5; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/search/matchesonscrollbar.js b/src/main/resources/templates/editor/lib/codemirror/addon/search/matchesonscrollbar.js new file mode 100644 index 0000000000000000000000000000000000000000..dbd67a4a5d6b3c1b7ad1ebbf69499a04de9c5c20 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/search/matchesonscrollbar.js @@ -0,0 +1,95 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("./searchcursor"), require("../scroll/annotatescrollbar")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "./searchcursor", "../scroll/annotatescrollbar"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineExtension("showMatchesOnScrollbar", function(query, caseFold, options) { + if (typeof options == "string") options = {className: options}; + if (!options) options = {}; + return new SearchAnnotation(this, query, caseFold, options); + }); + + function SearchAnnotation(cm, query, caseFold, options) { + this.cm = cm; + var annotateOptions = {listenForChanges: false}; + for (var prop in options) annotateOptions[prop] = options[prop]; + if (!annotateOptions.className) annotateOptions.className = "CodeMirror-search-match"; + this.annotation = cm.annotateScrollbar(annotateOptions); + this.query = query; + this.caseFold = caseFold; + this.gap = {from: cm.firstLine(), to: cm.lastLine() + 1}; + this.matches = []; + this.update = null; + + this.findMatches(); + this.annotation.update(this.matches); + + var self = this; + cm.on("change", this.changeHandler = function(_cm, change) { self.onChange(change); }); + } + + var MAX_MATCHES = 1000; + + SearchAnnotation.prototype.findMatches = function() { + if (!this.gap) return; + for (var i = 0; i < this.matches.length; i++) { + var match = this.matches[i]; + if (match.from.line >= this.gap.to) break; + if (match.to.line >= this.gap.from) this.matches.splice(i--, 1); + } + var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), this.caseFold); + while (cursor.findNext()) { + var match = {from: cursor.from(), to: cursor.to()}; + if (match.from.line >= this.gap.to) break; + this.matches.splice(i++, 0, match); + if (this.matches.length > MAX_MATCHES) break; + } + this.gap = null; + }; + + function offsetLine(line, changeStart, sizeChange) { + if (line <= changeStart) return line; + return Math.max(changeStart, line + sizeChange); + } + + SearchAnnotation.prototype.onChange = function(change) { + var startLine = change.from.line; + var endLine = CodeMirror.changeEnd(change).line; + var sizeChange = endLine - change.to.line; + if (this.gap) { + this.gap.from = Math.min(offsetLine(this.gap.from, startLine, sizeChange), change.from.line); + this.gap.to = Math.max(offsetLine(this.gap.to, startLine, sizeChange), change.from.line); + } else { + this.gap = {from: change.from.line, to: endLine + 1}; + } + + if (sizeChange) for (var i = 0; i < this.matches.length; i++) { + var match = this.matches[i]; + var newFrom = offsetLine(match.from.line, startLine, sizeChange); + if (newFrom != match.from.line) match.from = CodeMirror.Pos(newFrom, match.from.ch); + var newTo = offsetLine(match.to.line, startLine, sizeChange); + if (newTo != match.to.line) match.to = CodeMirror.Pos(newTo, match.to.ch); + } + clearTimeout(this.update); + var self = this; + this.update = setTimeout(function() { self.updateAfterChange(); }, 250); + }; + + SearchAnnotation.prototype.updateAfterChange = function() { + this.findMatches(); + this.annotation.update(this.matches); + }; + + SearchAnnotation.prototype.clear = function() { + this.cm.off("change", this.changeHandler); + this.annotation.clear(); + }; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/search/search.js b/src/main/resources/templates/editor/lib/codemirror/addon/search/search.js new file mode 100644 index 0000000000000000000000000000000000000000..0251067a73be68c7d3c2c1e18e7e1be5b78f928d --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/search/search.js @@ -0,0 +1,164 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Define search commands. Depends on dialog.js or another +// implementation of the openDialog method. + +// Replace works a little oddly -- it will do the replace on the next +// Ctrl-G (or whatever is bound to findNext) press. You prevent a +// replace by making sure the match is no longer selected when hitting +// Ctrl-G. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + function searchOverlay(query, caseInsensitive) { + if (typeof query == "string") + query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g"); + else if (!query.global) + query = new RegExp(query.source, query.ignoreCase ? "gi" : "g"); + + return {token: function(stream) { + query.lastIndex = stream.pos; + var match = query.exec(stream.string); + if (match && match.index == stream.pos) { + stream.pos += match[0].length; + return "searching"; + } else if (match) { + stream.pos = match.index; + } else { + stream.skipToEnd(); + } + }}; + } + + function SearchState() { + this.posFrom = this.posTo = this.query = null; + this.overlay = null; + } + function getSearchState(cm) { + return cm.state.search || (cm.state.search = new SearchState()); + } + function queryCaseInsensitive(query) { + return typeof query == "string" && query == query.toLowerCase(); + } + function getSearchCursor(cm, query, pos) { + // Heuristic: if the query string is all lowercase, do a case insensitive search. + return cm.getSearchCursor(query, pos, queryCaseInsensitive(query)); + } + function dialog(cm, text, shortText, deflt, f) { + if (cm.openDialog) cm.openDialog(text, f, {value: deflt}); + else f(prompt(shortText, deflt)); + } + function confirmDialog(cm, text, shortText, fs) { + if (cm.openConfirm) cm.openConfirm(text, fs); + else if (confirm(shortText)) fs[0](); + } + function parseQuery(query) { + var isRE = query.match(/^\/(.*)\/([a-z]*)$/); + if (isRE) { + try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); } + catch(e) {} // Not a regular expression after all, do a string search + } + if (typeof query == "string" ? query == "" : query.test("")) + query = /x^/; + return query; + } + var queryDialog = + 'Search: (Use /re/ syntax for regexp search)'; + function doSearch(cm, rev) { + var state = getSearchState(cm); + if (state.query) return findNext(cm, rev); + dialog(cm, queryDialog, "Search for:", cm.getSelection(), function(query) { + cm.operation(function() { + if (!query || state.query) return; + state.query = parseQuery(query); + cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query)); + state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query)); + cm.addOverlay(state.overlay); + if (cm.showMatchesOnScrollbar) { + if (state.annotate) { state.annotate.clear(); state.annotate = null; } + state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query)); + } + state.posFrom = state.posTo = cm.getCursor(); + findNext(cm, rev); + }); + }); + } + function findNext(cm, rev) {cm.operation(function() { + var state = getSearchState(cm); + var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo); + if (!cursor.find(rev)) { + cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0)); + if (!cursor.find(rev)) return; + } + cm.setSelection(cursor.from(), cursor.to()); + cm.scrollIntoView({from: cursor.from(), to: cursor.to()}); + state.posFrom = cursor.from(); state.posTo = cursor.to(); + });} + function clearSearch(cm) {cm.operation(function() { + var state = getSearchState(cm); + if (!state.query) return; + state.query = null; + cm.removeOverlay(state.overlay); + if (state.annotate) { state.annotate.clear(); state.annotate = null; } + });} + + var replaceQueryDialog = + 'Replace: (Use /re/ syntax for regexp search)'; + var replacementQueryDialog = 'With: '; + var doReplaceConfirm = "Replace? "; + function replace(cm, all) { + if (cm.getOption("readOnly")) return; + dialog(cm, replaceQueryDialog, "Replace:", cm.getSelection(), function(query) { + if (!query) return; + query = parseQuery(query); + dialog(cm, replacementQueryDialog, "Replace with:", "", function(text) { + if (all) { + cm.operation(function() { + for (var cursor = getSearchCursor(cm, query); cursor.findNext();) { + if (typeof query != "string") { + var match = cm.getRange(cursor.from(), cursor.to()).match(query); + cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];})); + } else cursor.replace(text); + } + }); + } else { + clearSearch(cm); + var cursor = getSearchCursor(cm, query, cm.getCursor()); + var advance = function() { + var start = cursor.from(), match; + if (!(match = cursor.findNext())) { + cursor = getSearchCursor(cm, query); + if (!(match = cursor.findNext()) || + (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return; + } + cm.setSelection(cursor.from(), cursor.to()); + cm.scrollIntoView({from: cursor.from(), to: cursor.to()}); + confirmDialog(cm, doReplaceConfirm, "Replace?", + [function() {doReplace(match);}, advance]); + }; + var doReplace = function(match) { + cursor.replace(typeof query == "string" ? text : + text.replace(/\$(\d)/g, function(_, i) {return match[i];})); + advance(); + }; + advance(); + } + }); + }); + } + + CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);}; + CodeMirror.commands.findNext = doSearch; + CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);}; + CodeMirror.commands.clearSearch = clearSearch; + CodeMirror.commands.replace = replace; + CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);}; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/search/searchcursor.js b/src/main/resources/templates/editor/lib/codemirror/addon/search/searchcursor.js new file mode 100644 index 0000000000000000000000000000000000000000..55c108b5a3c4100d02ad5e9fce3b886761b51acb --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/search/searchcursor.js @@ -0,0 +1,189 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + var Pos = CodeMirror.Pos; + + function SearchCursor(doc, query, pos, caseFold) { + this.atOccurrence = false; this.doc = doc; + if (caseFold == null && typeof query == "string") caseFold = false; + + pos = pos ? doc.clipPos(pos) : Pos(0, 0); + this.pos = {from: pos, to: pos}; + + // The matches method is filled in based on the type of query. + // It takes a position and a direction, and returns an object + // describing the next occurrence of the query, or null if no + // more matches were found. + if (typeof query != "string") { // Regexp match + if (!query.global) query = new RegExp(query.source, query.ignoreCase ? "ig" : "g"); + this.matches = function(reverse, pos) { + if (reverse) { + query.lastIndex = 0; + var line = doc.getLine(pos.line).slice(0, pos.ch), cutOff = 0, match, start; + for (;;) { + query.lastIndex = cutOff; + var newMatch = query.exec(line); + if (!newMatch) break; + match = newMatch; + start = match.index; + cutOff = match.index + (match[0].length || 1); + if (cutOff == line.length) break; + } + var matchLen = (match && match[0].length) || 0; + if (!matchLen) { + if (start == 0 && line.length == 0) {match = undefined;} + else if (start != doc.getLine(pos.line).length) { + matchLen++; + } + } + } else { + query.lastIndex = pos.ch; + var line = doc.getLine(pos.line), match = query.exec(line); + var matchLen = (match && match[0].length) || 0; + var start = match && match.index; + if (start + matchLen != line.length && !matchLen) matchLen = 1; + } + if (match && matchLen) + return {from: Pos(pos.line, start), + to: Pos(pos.line, start + matchLen), + match: match}; + }; + } else { // String query + var origQuery = query; + if (caseFold) query = query.toLowerCase(); + var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;}; + var target = query.split("\n"); + // Different methods for single-line and multi-line queries + if (target.length == 1) { + if (!query.length) { + // Empty string would match anything and never progress, so + // we define it to match nothing instead. + this.matches = function() {}; + } else { + this.matches = function(reverse, pos) { + if (reverse) { + var orig = doc.getLine(pos.line).slice(0, pos.ch), line = fold(orig); + var match = line.lastIndexOf(query); + if (match > -1) { + match = adjustPos(orig, line, match); + return {from: Pos(pos.line, match), to: Pos(pos.line, match + origQuery.length)}; + } + } else { + var orig = doc.getLine(pos.line).slice(pos.ch), line = fold(orig); + var match = line.indexOf(query); + if (match > -1) { + match = adjustPos(orig, line, match) + pos.ch; + return {from: Pos(pos.line, match), to: Pos(pos.line, match + origQuery.length)}; + } + } + }; + } + } else { + var origTarget = origQuery.split("\n"); + this.matches = function(reverse, pos) { + var last = target.length - 1; + if (reverse) { + if (pos.line - (target.length - 1) < doc.firstLine()) return; + if (fold(doc.getLine(pos.line).slice(0, origTarget[last].length)) != target[target.length - 1]) return; + var to = Pos(pos.line, origTarget[last].length); + for (var ln = pos.line - 1, i = last - 1; i >= 1; --i, --ln) + if (target[i] != fold(doc.getLine(ln))) return; + var line = doc.getLine(ln), cut = line.length - origTarget[0].length; + if (fold(line.slice(cut)) != target[0]) return; + return {from: Pos(ln, cut), to: to}; + } else { + if (pos.line + (target.length - 1) > doc.lastLine()) return; + var line = doc.getLine(pos.line), cut = line.length - origTarget[0].length; + if (fold(line.slice(cut)) != target[0]) return; + var from = Pos(pos.line, cut); + for (var ln = pos.line + 1, i = 1; i < last; ++i, ++ln) + if (target[i] != fold(doc.getLine(ln))) return; + if (fold(doc.getLine(ln).slice(0, origTarget[last].length)) != target[last]) return; + return {from: from, to: Pos(ln, origTarget[last].length)}; + } + }; + } + } + } + + SearchCursor.prototype = { + findNext: function() {return this.find(false);}, + findPrevious: function() {return this.find(true);}, + + find: function(reverse) { + var self = this, pos = this.doc.clipPos(reverse ? this.pos.from : this.pos.to); + function savePosAndFail(line) { + var pos = Pos(line, 0); + self.pos = {from: pos, to: pos}; + self.atOccurrence = false; + return false; + } + + for (;;) { + if (this.pos = this.matches(reverse, pos)) { + this.atOccurrence = true; + return this.pos.match || true; + } + if (reverse) { + if (!pos.line) return savePosAndFail(0); + pos = Pos(pos.line-1, this.doc.getLine(pos.line-1).length); + } + else { + var maxLine = this.doc.lineCount(); + if (pos.line == maxLine - 1) return savePosAndFail(maxLine); + pos = Pos(pos.line + 1, 0); + } + } + }, + + from: function() {if (this.atOccurrence) return this.pos.from;}, + to: function() {if (this.atOccurrence) return this.pos.to;}, + + replace: function(newText) { + if (!this.atOccurrence) return; + var lines = CodeMirror.splitLines(newText); + this.doc.replaceRange(lines, this.pos.from, this.pos.to); + this.pos.to = Pos(this.pos.from.line + lines.length - 1, + lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0)); + } + }; + + // Maps a position in a case-folded line back to a position in the original line + // (compensating for codepoints increasing in number during folding) + function adjustPos(orig, folded, pos) { + if (orig.length == folded.length) return pos; + for (var pos1 = Math.min(pos, orig.length);;) { + var len1 = orig.slice(0, pos1).toLowerCase().length; + if (len1 < pos) ++pos1; + else if (len1 > pos) --pos1; + else return pos1; + } + } + + CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) { + return new SearchCursor(this.doc, query, pos, caseFold); + }); + CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) { + return new SearchCursor(this, query, pos, caseFold); + }); + + CodeMirror.defineExtension("selectMatches", function(query, caseFold) { + var ranges = [], next; + var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold); + while (next = cur.findNext()) { + if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break; + ranges.push({anchor: cur.from(), head: cur.to()}); + } + if (ranges.length) + this.setSelections(ranges, 0); + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/selection/active-line.js b/src/main/resources/templates/editor/lib/codemirror/addon/selection/active-line.js new file mode 100644 index 0000000000000000000000000000000000000000..22da2e0aace1e527a8c71b67604714849c663de0 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/selection/active-line.js @@ -0,0 +1,71 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Because sometimes you need to style the cursor's line. +// +// Adds an option 'styleActiveLine' which, when enabled, gives the +// active line's wrapping
        the CSS class "CodeMirror-activeline", +// and gives its background
        the class "CodeMirror-activeline-background". + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + var WRAP_CLASS = "CodeMirror-activeline"; + var BACK_CLASS = "CodeMirror-activeline-background"; + + CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) { + var prev = old && old != CodeMirror.Init; + if (val && !prev) { + cm.state.activeLines = []; + updateActiveLines(cm, cm.listSelections()); + cm.on("beforeSelectionChange", selectionChange); + } else if (!val && prev) { + cm.off("beforeSelectionChange", selectionChange); + clearActiveLines(cm); + delete cm.state.activeLines; + } + }); + + function clearActiveLines(cm) { + for (var i = 0; i < cm.state.activeLines.length; i++) { + cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS); + cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS); + } + } + + function sameArray(a, b) { + if (a.length != b.length) return false; + for (var i = 0; i < a.length; i++) + if (a[i] != b[i]) return false; + return true; + } + + function updateActiveLines(cm, ranges) { + var active = []; + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (!range.empty()) continue; + var line = cm.getLineHandleVisualStart(range.head.line); + if (active[active.length - 1] != line) active.push(line); + } + if (sameArray(cm.state.activeLines, active)) return; + cm.operation(function() { + clearActiveLines(cm); + for (var i = 0; i < active.length; i++) { + cm.addLineClass(active[i], "wrap", WRAP_CLASS); + cm.addLineClass(active[i], "background", BACK_CLASS); + } + cm.state.activeLines = active; + }); + } + + function selectionChange(cm, sel) { + updateActiveLines(cm, sel.ranges); + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/selection/mark-selection.js b/src/main/resources/templates/editor/lib/codemirror/addon/selection/mark-selection.js new file mode 100644 index 0000000000000000000000000000000000000000..5c42d21eb2d0d00e65d7a1fe139cf767f2ead084 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/selection/mark-selection.js @@ -0,0 +1,118 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Because sometimes you need to mark the selected *text*. +// +// Adds an option 'styleSelectedText' which, when enabled, gives +// selected text the CSS class given as option value, or +// "CodeMirror-selectedtext" when the value is not a string. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineOption("styleSelectedText", false, function(cm, val, old) { + var prev = old && old != CodeMirror.Init; + if (val && !prev) { + cm.state.markedSelection = []; + cm.state.markedSelectionStyle = typeof val == "string" ? val : "CodeMirror-selectedtext"; + reset(cm); + cm.on("cursorActivity", onCursorActivity); + cm.on("change", onChange); + } else if (!val && prev) { + cm.off("cursorActivity", onCursorActivity); + cm.off("change", onChange); + clear(cm); + cm.state.markedSelection = cm.state.markedSelectionStyle = null; + } + }); + + function onCursorActivity(cm) { + cm.operation(function() { update(cm); }); + } + + function onChange(cm) { + if (cm.state.markedSelection.length) + cm.operation(function() { clear(cm); }); + } + + var CHUNK_SIZE = 8; + var Pos = CodeMirror.Pos; + var cmp = CodeMirror.cmpPos; + + function coverRange(cm, from, to, addAt) { + if (cmp(from, to) == 0) return; + var array = cm.state.markedSelection; + var cls = cm.state.markedSelectionStyle; + for (var line = from.line;;) { + var start = line == from.line ? from : Pos(line, 0); + var endLine = line + CHUNK_SIZE, atEnd = endLine >= to.line; + var end = atEnd ? to : Pos(endLine, 0); + var mark = cm.markText(start, end, {className: cls}); + if (addAt == null) array.push(mark); + else array.splice(addAt++, 0, mark); + if (atEnd) break; + line = endLine; + } + } + + function clear(cm) { + var array = cm.state.markedSelection; + for (var i = 0; i < array.length; ++i) array[i].clear(); + array.length = 0; + } + + function reset(cm) { + clear(cm); + var ranges = cm.listSelections(); + for (var i = 0; i < ranges.length; i++) + coverRange(cm, ranges[i].from(), ranges[i].to()); + } + + function update(cm) { + if (!cm.somethingSelected()) return clear(cm); + if (cm.listSelections().length > 1) return reset(cm); + + var from = cm.getCursor("start"), to = cm.getCursor("end"); + + var array = cm.state.markedSelection; + if (!array.length) return coverRange(cm, from, to); + + var coverStart = array[0].find(), coverEnd = array[array.length - 1].find(); + if (!coverStart || !coverEnd || to.line - from.line < CHUNK_SIZE || + cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0) + return reset(cm); + + while (cmp(from, coverStart.from) > 0) { + array.shift().clear(); + coverStart = array[0].find(); + } + if (cmp(from, coverStart.from) < 0) { + if (coverStart.to.line - from.line < CHUNK_SIZE) { + array.shift().clear(); + coverRange(cm, from, coverStart.to, 0); + } else { + coverRange(cm, from, coverStart.from, 0); + } + } + + while (cmp(to, coverEnd.to) < 0) { + array.pop().clear(); + coverEnd = array[array.length - 1].find(); + } + if (cmp(to, coverEnd.to) > 0) { + if (to.line - coverEnd.from.line < CHUNK_SIZE) { + array.pop().clear(); + coverRange(cm, coverEnd.from, to); + } else { + coverRange(cm, coverEnd.to, to); + } + } + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/selection/selection-pointer.js b/src/main/resources/templates/editor/lib/codemirror/addon/selection/selection-pointer.js new file mode 100644 index 0000000000000000000000000000000000000000..ef5e404ad360ac8f7578ab3e274067b1ce50bcfe --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/selection/selection-pointer.js @@ -0,0 +1,98 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineOption("selectionPointer", false, function(cm, val) { + var data = cm.state.selectionPointer; + if (data) { + CodeMirror.off(cm.getWrapperElement(), "mousemove", data.mousemove); + CodeMirror.off(cm.getWrapperElement(), "mouseout", data.mouseout); + CodeMirror.off(window, "scroll", data.windowScroll); + cm.off("cursorActivity", reset); + cm.off("scroll", reset); + cm.state.selectionPointer = null; + cm.display.lineDiv.style.cursor = ""; + } + if (val) { + data = cm.state.selectionPointer = { + value: typeof val == "string" ? val : "default", + mousemove: function(event) { mousemove(cm, event); }, + mouseout: function(event) { mouseout(cm, event); }, + windowScroll: function() { reset(cm); }, + rects: null, + mouseX: null, mouseY: null, + willUpdate: false + }; + CodeMirror.on(cm.getWrapperElement(), "mousemove", data.mousemove); + CodeMirror.on(cm.getWrapperElement(), "mouseout", data.mouseout); + CodeMirror.on(window, "scroll", data.windowScroll); + cm.on("cursorActivity", reset); + cm.on("scroll", reset); + } + }); + + function mousemove(cm, event) { + var data = cm.state.selectionPointer; + if (event.buttons == null ? event.which : event.buttons) { + data.mouseX = data.mouseY = null; + } else { + data.mouseX = event.clientX; + data.mouseY = event.clientY; + } + scheduleUpdate(cm); + } + + function mouseout(cm, event) { + if (!cm.getWrapperElement().contains(event.relatedTarget)) { + var data = cm.state.selectionPointer; + data.mouseX = data.mouseY = null; + scheduleUpdate(cm); + } + } + + function reset(cm) { + cm.state.selectionPointer.rects = null; + scheduleUpdate(cm); + } + + function scheduleUpdate(cm) { + if (!cm.state.selectionPointer.willUpdate) { + cm.state.selectionPointer.willUpdate = true; + setTimeout(function() { + update(cm); + cm.state.selectionPointer.willUpdate = false; + }, 50); + } + } + + function update(cm) { + var data = cm.state.selectionPointer; + if (!data) return; + if (data.rects == null && data.mouseX != null) { + data.rects = []; + if (cm.somethingSelected()) { + for (var sel = cm.display.selectionDiv.firstChild; sel; sel = sel.nextSibling) + data.rects.push(sel.getBoundingClientRect()); + } + } + var inside = false; + if (data.mouseX != null) for (var i = 0; i < data.rects.length; i++) { + var rect = data.rects[i]; + if (rect.left <= data.mouseX && rect.right >= data.mouseX && + rect.top <= data.mouseY && rect.bottom >= data.mouseY) + inside = true; + } + var cursor = inside ? data.value : ""; + if (cm.display.lineDiv.style.cursor != cursor) + cm.display.lineDiv.style.cursor = cursor; + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/tern/tern.css b/src/main/resources/templates/editor/lib/codemirror/addon/tern/tern.css new file mode 100644 index 0000000000000000000000000000000000000000..76fba33d4a774e09ea2dae7a3111d48419ca616f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/tern/tern.css @@ -0,0 +1,86 @@ +.CodeMirror-Tern-completion { + padding-left: 22px; + position: relative; +} +.CodeMirror-Tern-completion:before { + position: absolute; + left: 2px; + bottom: 2px; + border-radius: 50%; + font-size: 12px; + font-weight: bold; + height: 15px; + width: 15px; + line-height: 16px; + text-align: center; + color: white; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.CodeMirror-Tern-completion-unknown:before { + content: "?"; + background: #4bb; +} +.CodeMirror-Tern-completion-object:before { + content: "O"; + background: #77c; +} +.CodeMirror-Tern-completion-fn:before { + content: "F"; + background: #7c7; +} +.CodeMirror-Tern-completion-array:before { + content: "A"; + background: #c66; +} +.CodeMirror-Tern-completion-number:before { + content: "1"; + background: #999; +} +.CodeMirror-Tern-completion-string:before { + content: "S"; + background: #999; +} +.CodeMirror-Tern-completion-bool:before { + content: "B"; + background: #999; +} + +.CodeMirror-Tern-completion-guess { + color: #999; +} + +.CodeMirror-Tern-tooltip { + border: 1px solid silver; + border-radius: 3px; + color: #444; + padding: 2px 5px; + font-size: 90%; + font-family: monospace; + background-color: white; + white-space: pre-wrap; + + max-width: 40em; + position: absolute; + z-index: 10; + -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); + box-shadow: 2px 3px 5px rgba(0,0,0,.2); + + transition: opacity 1s; + -moz-transition: opacity 1s; + -webkit-transition: opacity 1s; + -o-transition: opacity 1s; + -ms-transition: opacity 1s; +} + +.CodeMirror-Tern-hint-doc { + max-width: 25em; + margin-top: -3px; +} + +.CodeMirror-Tern-fname { color: black; } +.CodeMirror-Tern-farg { color: #70a; } +.CodeMirror-Tern-farg-current { text-decoration: underline; } +.CodeMirror-Tern-type { color: #07c; } +.CodeMirror-Tern-fhint-guess { opacity: .7; } diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/tern/tern.js b/src/main/resources/templates/editor/lib/codemirror/addon/tern/tern.js new file mode 100644 index 0000000000000000000000000000000000000000..b049549d35c6d92a3e65f792131047ff85d04144 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/tern/tern.js @@ -0,0 +1,697 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Glue code between CodeMirror and Tern. +// +// Create a CodeMirror.TernServer to wrap an actual Tern server, +// register open documents (CodeMirror.Doc instances) with it, and +// call its methods to activate the assisting functions that Tern +// provides. +// +// Options supported (all optional): +// * defs: An array of JSON definition data structures. +// * plugins: An object mapping plugin names to configuration +// options. +// * getFile: A function(name, c) that can be used to access files in +// the project that haven't been loaded yet. Simply do c(null) to +// indicate that a file is not available. +// * fileFilter: A function(value, docName, doc) that will be applied +// to documents before passing them on to Tern. +// * switchToDoc: A function(name, doc) that should, when providing a +// multi-file view, switch the view or focus to the named file. +// * showError: A function(editor, message) that can be used to +// override the way errors are displayed. +// * completionTip: Customize the content in tooltips for completions. +// Is passed a single argument—the completion's data as returned by +// Tern—and may return a string, DOM node, or null to indicate that +// no tip should be shown. By default the docstring is shown. +// * typeTip: Like completionTip, but for the tooltips shown for type +// queries. +// * responseFilter: A function(doc, query, request, error, data) that +// will be applied to the Tern responses before treating them +// +// +// It is possible to run the Tern server in a web worker by specifying +// these additional options: +// * useWorker: Set to true to enable web worker mode. You'll probably +// want to feature detect the actual value you use here, for example +// !!window.Worker. +// * workerScript: The main script of the worker. Point this to +// wherever you are hosting worker.js from this directory. +// * workerDeps: An array of paths pointing (relative to workerScript) +// to the Acorn and Tern libraries and any Tern plugins you want to +// load. Or, if you minified those into a single script and included +// them in the workerScript, simply leave this undefined. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + // declare global: tern + + CodeMirror.TernServer = function(options) { + var self = this; + this.options = options || {}; + var plugins = this.options.plugins || (this.options.plugins = {}); + if (!plugins.doc_comment) plugins.doc_comment = true; + if (this.options.useWorker) { + this.server = new WorkerServer(this); + } else { + this.server = new tern.Server({ + getFile: function(name, c) { return getFile(self, name, c); }, + async: true, + defs: this.options.defs || [], + plugins: plugins + }); + } + this.docs = Object.create(null); + this.trackChange = function(doc, change) { trackChange(self, doc, change); }; + + this.cachedArgHints = null; + this.activeArgHints = null; + this.jumpStack = []; + + this.getHint = function(cm, c) { return hint(self, cm, c); }; + this.getHint.async = true; + }; + + CodeMirror.TernServer.prototype = { + addDoc: function(name, doc) { + var data = {doc: doc, name: name, changed: null}; + this.server.addFile(name, docValue(this, data)); + CodeMirror.on(doc, "change", this.trackChange); + return this.docs[name] = data; + }, + + delDoc: function(id) { + var found = resolveDoc(this, id); + if (!found) return; + CodeMirror.off(found.doc, "change", this.trackChange); + delete this.docs[found.name]; + this.server.delFile(found.name); + }, + + hideDoc: function(id) { + closeArgHints(this); + var found = resolveDoc(this, id); + if (found && found.changed) sendDoc(this, found); + }, + + complete: function(cm) { + cm.showHint({hint: this.getHint}); + }, + + showType: function(cm, pos, c) { showContextInfo(this, cm, pos, "type", c); }, + + showDocs: function(cm, pos, c) { showContextInfo(this, cm, pos, "documentation", c); }, + + updateArgHints: function(cm) { updateArgHints(this, cm); }, + + jumpToDef: function(cm) { jumpToDef(this, cm); }, + + jumpBack: function(cm) { jumpBack(this, cm); }, + + rename: function(cm) { rename(this, cm); }, + + selectName: function(cm) { selectName(this, cm); }, + + request: function (cm, query, c, pos) { + var self = this; + var doc = findDoc(this, cm.getDoc()); + var request = buildRequest(this, doc, query, pos); + + this.server.request(request, function (error, data) { + if (!error && self.options.responseFilter) + data = self.options.responseFilter(doc, query, request, error, data); + c(error, data); + }); + }, + + destroy: function () { + if (this.worker) { + this.worker.terminate(); + this.worker = null; + } + } + }; + + var Pos = CodeMirror.Pos; + var cls = "CodeMirror-Tern-"; + var bigDoc = 250; + + function getFile(ts, name, c) { + var buf = ts.docs[name]; + if (buf) + c(docValue(ts, buf)); + else if (ts.options.getFile) + ts.options.getFile(name, c); + else + c(null); + } + + function findDoc(ts, doc, name) { + for (var n in ts.docs) { + var cur = ts.docs[n]; + if (cur.doc == doc) return cur; + } + if (!name) for (var i = 0;; ++i) { + n = "[doc" + (i || "") + "]"; + if (!ts.docs[n]) { name = n; break; } + } + return ts.addDoc(name, doc); + } + + function resolveDoc(ts, id) { + if (typeof id == "string") return ts.docs[id]; + if (id instanceof CodeMirror) id = id.getDoc(); + if (id instanceof CodeMirror.Doc) return findDoc(ts, id); + } + + function trackChange(ts, doc, change) { + var data = findDoc(ts, doc); + + var argHints = ts.cachedArgHints; + if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) <= 0) + ts.cachedArgHints = null; + + var changed = data.changed; + if (changed == null) + data.changed = changed = {from: change.from.line, to: change.from.line}; + var end = change.from.line + (change.text.length - 1); + if (change.from.line < changed.to) changed.to = changed.to - (change.to.line - end); + if (end >= changed.to) changed.to = end + 1; + if (changed.from > change.from.line) changed.from = change.from.line; + + if (doc.lineCount() > bigDoc && change.to - changed.from > 100) setTimeout(function() { + if (data.changed && data.changed.to - data.changed.from > 100) sendDoc(ts, data); + }, 200); + } + + function sendDoc(ts, doc) { + ts.server.request({files: [{type: "full", name: doc.name, text: docValue(ts, doc)}]}, function(error) { + if (error) window.console.error(error); + else doc.changed = null; + }); + } + + // Completion + + function hint(ts, cm, c) { + ts.request(cm, {type: "completions", types: true, docs: true, urls: true}, function(error, data) { + if (error) return showError(ts, cm, error); + var completions = [], after = ""; + var from = data.start, to = data.end; + if (cm.getRange(Pos(from.line, from.ch - 2), from) == "[\"" && + cm.getRange(to, Pos(to.line, to.ch + 2)) != "\"]") + after = "\"]"; + + for (var i = 0; i < data.completions.length; ++i) { + var completion = data.completions[i], className = typeToIcon(completion.type); + if (data.guess) className += " " + cls + "guess"; + completions.push({text: completion.name + after, + displayText: completion.name, + className: className, + data: completion}); + } + + var obj = {from: from, to: to, list: completions}; + var tooltip = null; + CodeMirror.on(obj, "close", function() { remove(tooltip); }); + CodeMirror.on(obj, "update", function() { remove(tooltip); }); + CodeMirror.on(obj, "select", function(cur, node) { + remove(tooltip); + var content = ts.options.completionTip ? ts.options.completionTip(cur.data) : cur.data.doc; + if (content) { + tooltip = makeTooltip(node.parentNode.getBoundingClientRect().right + window.pageXOffset, + node.getBoundingClientRect().top + window.pageYOffset, content); + tooltip.className += " " + cls + "hint-doc"; + } + }); + c(obj); + }); + } + + function typeToIcon(type) { + var suffix; + if (type == "?") suffix = "unknown"; + else if (type == "number" || type == "string" || type == "bool") suffix = type; + else if (/^fn\(/.test(type)) suffix = "fn"; + else if (/^\[/.test(type)) suffix = "array"; + else suffix = "object"; + return cls + "completion " + cls + "completion-" + suffix; + } + + // Type queries + + function showContextInfo(ts, cm, pos, queryName, c) { + ts.request(cm, queryName, function(error, data) { + if (error) return showError(ts, cm, error); + if (ts.options.typeTip) { + var tip = ts.options.typeTip(data); + } else { + var tip = elt("span", null, elt("strong", null, data.type || "not found")); + if (data.doc) + tip.appendChild(document.createTextNode(" — " + data.doc)); + if (data.url) { + tip.appendChild(document.createTextNode(" ")); + var child = tip.appendChild(elt("a", null, "[docs]")); + child.href = data.url; + child.target = "_blank"; + } + } + tempTooltip(cm, tip); + if (c) c(); + }, pos); + } + + // Maintaining argument hints + + function updateArgHints(ts, cm) { + closeArgHints(ts); + + if (cm.somethingSelected()) return; + var state = cm.getTokenAt(cm.getCursor()).state; + var inner = CodeMirror.innerMode(cm.getMode(), state); + if (inner.mode.name != "javascript") return; + var lex = inner.state.lexical; + if (lex.info != "call") return; + + var ch, argPos = lex.pos || 0, tabSize = cm.getOption("tabSize"); + for (var line = cm.getCursor().line, e = Math.max(0, line - 9), found = false; line >= e; --line) { + var str = cm.getLine(line), extra = 0; + for (var pos = 0;;) { + var tab = str.indexOf("\t", pos); + if (tab == -1) break; + extra += tabSize - (tab + extra) % tabSize - 1; + pos = tab + 1; + } + ch = lex.column - extra; + if (str.charAt(ch) == "(") {found = true; break;} + } + if (!found) return; + + var start = Pos(line, ch); + var cache = ts.cachedArgHints; + if (cache && cache.doc == cm.getDoc() && cmpPos(start, cache.start) == 0) + return showArgHints(ts, cm, argPos); + + ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) { + if (error || !data.type || !(/^fn\(/).test(data.type)) return; + ts.cachedArgHints = { + start: pos, + type: parseFnType(data.type), + name: data.exprName || data.name || "fn", + guess: data.guess, + doc: cm.getDoc() + }; + showArgHints(ts, cm, argPos); + }); + } + + function showArgHints(ts, cm, pos) { + closeArgHints(ts); + + var cache = ts.cachedArgHints, tp = cache.type; + var tip = elt("span", cache.guess ? cls + "fhint-guess" : null, + elt("span", cls + "fname", cache.name), "("); + for (var i = 0; i < tp.args.length; ++i) { + if (i) tip.appendChild(document.createTextNode(", ")); + var arg = tp.args[i]; + tip.appendChild(elt("span", cls + "farg" + (i == pos ? " " + cls + "farg-current" : ""), arg.name || "?")); + if (arg.type != "?") { + tip.appendChild(document.createTextNode(":\u00a0")); + tip.appendChild(elt("span", cls + "type", arg.type)); + } + } + tip.appendChild(document.createTextNode(tp.rettype ? ") ->\u00a0" : ")")); + if (tp.rettype) tip.appendChild(elt("span", cls + "type", tp.rettype)); + var place = cm.cursorCoords(null, "page"); + ts.activeArgHints = makeTooltip(place.right + 1, place.bottom, tip); + } + + function parseFnType(text) { + var args = [], pos = 3; + + function skipMatching(upto) { + var depth = 0, start = pos; + for (;;) { + var next = text.charAt(pos); + if (upto.test(next) && !depth) return text.slice(start, pos); + if (/[{\[\(]/.test(next)) ++depth; + else if (/[}\]\)]/.test(next)) --depth; + ++pos; + } + } + + // Parse arguments + if (text.charAt(pos) != ")") for (;;) { + var name = text.slice(pos).match(/^([^, \(\[\{]+): /); + if (name) { + pos += name[0].length; + name = name[1]; + } + args.push({name: name, type: skipMatching(/[\),]/)}); + if (text.charAt(pos) == ")") break; + pos += 2; + } + + var rettype = text.slice(pos).match(/^\) -> (.*)$/); + + return {args: args, rettype: rettype && rettype[1]}; + } + + // Moving to the definition of something + + function jumpToDef(ts, cm) { + function inner(varName) { + var req = {type: "definition", variable: varName || null}; + var doc = findDoc(ts, cm.getDoc()); + ts.server.request(buildRequest(ts, doc, req), function(error, data) { + if (error) return showError(ts, cm, error); + if (!data.file && data.url) { window.open(data.url); return; } + + if (data.file) { + var localDoc = ts.docs[data.file], found; + if (localDoc && (found = findContext(localDoc.doc, data))) { + ts.jumpStack.push({file: doc.name, + start: cm.getCursor("from"), + end: cm.getCursor("to")}); + moveTo(ts, doc, localDoc, found.start, found.end); + return; + } + } + showError(ts, cm, "Could not find a definition."); + }); + } + + if (!atInterestingExpression(cm)) + dialog(cm, "Jump to variable", function(name) { if (name) inner(name); }); + else + inner(); + } + + function jumpBack(ts, cm) { + var pos = ts.jumpStack.pop(), doc = pos && ts.docs[pos.file]; + if (!doc) return; + moveTo(ts, findDoc(ts, cm.getDoc()), doc, pos.start, pos.end); + } + + function moveTo(ts, curDoc, doc, start, end) { + doc.doc.setSelection(start, end); + if (curDoc != doc && ts.options.switchToDoc) { + closeArgHints(ts); + ts.options.switchToDoc(doc.name, doc.doc); + } + } + + // The {line,ch} representation of positions makes this rather awkward. + function findContext(doc, data) { + var before = data.context.slice(0, data.contextOffset).split("\n"); + var startLine = data.start.line - (before.length - 1); + var start = Pos(startLine, (before.length == 1 ? data.start.ch : doc.getLine(startLine).length) - before[0].length); + + var text = doc.getLine(startLine).slice(start.ch); + for (var cur = startLine + 1; cur < doc.lineCount() && text.length < data.context.length; ++cur) + text += "\n" + doc.getLine(cur); + if (text.slice(0, data.context.length) == data.context) return data; + + var cursor = doc.getSearchCursor(data.context, 0, false); + var nearest, nearestDist = Infinity; + while (cursor.findNext()) { + var from = cursor.from(), dist = Math.abs(from.line - start.line) * 10000; + if (!dist) dist = Math.abs(from.ch - start.ch); + if (dist < nearestDist) { nearest = from; nearestDist = dist; } + } + if (!nearest) return null; + + if (before.length == 1) + nearest.ch += before[0].length; + else + nearest = Pos(nearest.line + (before.length - 1), before[before.length - 1].length); + if (data.start.line == data.end.line) + var end = Pos(nearest.line, nearest.ch + (data.end.ch - data.start.ch)); + else + var end = Pos(nearest.line + (data.end.line - data.start.line), data.end.ch); + return {start: nearest, end: end}; + } + + function atInterestingExpression(cm) { + var pos = cm.getCursor("end"), tok = cm.getTokenAt(pos); + if (tok.start < pos.ch && (tok.type == "comment" || tok.type == "string")) return false; + return /\w/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1)); + } + + // Variable renaming + + function rename(ts, cm) { + var token = cm.getTokenAt(cm.getCursor()); + if (!/\w/.test(token.string)) return showError(ts, cm, "Not at a variable"); + dialog(cm, "New name for " + token.string, function(newName) { + ts.request(cm, {type: "rename", newName: newName, fullDocs: true}, function(error, data) { + if (error) return showError(ts, cm, error); + applyChanges(ts, data.changes); + }); + }); + } + + function selectName(ts, cm) { + var name = findDoc(ts, cm.doc).name; + ts.request(cm, {type: "refs"}, function(error, data) { + if (error) return showError(ts, cm, error); + var ranges = [], cur = 0; + for (var i = 0; i < data.refs.length; i++) { + var ref = data.refs[i]; + if (ref.file == name) { + ranges.push({anchor: ref.start, head: ref.end}); + if (cmpPos(cur, ref.start) >= 0 && cmpPos(cur, ref.end) <= 0) + cur = ranges.length - 1; + } + } + cm.setSelections(ranges, cur); + }); + } + + var nextChangeOrig = 0; + function applyChanges(ts, changes) { + var perFile = Object.create(null); + for (var i = 0; i < changes.length; ++i) { + var ch = changes[i]; + (perFile[ch.file] || (perFile[ch.file] = [])).push(ch); + } + for (var file in perFile) { + var known = ts.docs[file], chs = perFile[file];; + if (!known) continue; + chs.sort(function(a, b) { return cmpPos(b.start, a.start); }); + var origin = "*rename" + (++nextChangeOrig); + for (var i = 0; i < chs.length; ++i) { + var ch = chs[i]; + known.doc.replaceRange(ch.text, ch.start, ch.end, origin); + } + } + } + + // Generic request-building helper + + function buildRequest(ts, doc, query, pos) { + var files = [], offsetLines = 0, allowFragments = !query.fullDocs; + if (!allowFragments) delete query.fullDocs; + if (typeof query == "string") query = {type: query}; + query.lineCharPositions = true; + if (query.end == null) { + query.end = pos || doc.doc.getCursor("end"); + if (doc.doc.somethingSelected()) + query.start = doc.doc.getCursor("start"); + } + var startPos = query.start || query.end; + + if (doc.changed) { + if (doc.doc.lineCount() > bigDoc && allowFragments !== false && + doc.changed.to - doc.changed.from < 100 && + doc.changed.from <= startPos.line && doc.changed.to > query.end.line) { + files.push(getFragmentAround(doc, startPos, query.end)); + query.file = "#0"; + var offsetLines = files[0].offsetLines; + if (query.start != null) query.start = Pos(query.start.line - -offsetLines, query.start.ch); + query.end = Pos(query.end.line - offsetLines, query.end.ch); + } else { + files.push({type: "full", + name: doc.name, + text: docValue(ts, doc)}); + query.file = doc.name; + doc.changed = null; + } + } else { + query.file = doc.name; + } + for (var name in ts.docs) { + var cur = ts.docs[name]; + if (cur.changed && cur != doc) { + files.push({type: "full", name: cur.name, text: docValue(ts, cur)}); + cur.changed = null; + } + } + + return {query: query, files: files}; + } + + function getFragmentAround(data, start, end) { + var doc = data.doc; + var minIndent = null, minLine = null, endLine, tabSize = 4; + for (var p = start.line - 1, min = Math.max(0, p - 50); p >= min; --p) { + var line = doc.getLine(p), fn = line.search(/\bfunction\b/); + if (fn < 0) continue; + var indent = CodeMirror.countColumn(line, null, tabSize); + if (minIndent != null && minIndent <= indent) continue; + minIndent = indent; + minLine = p; + } + if (minLine == null) minLine = min; + var max = Math.min(doc.lastLine(), end.line + 20); + if (minIndent == null || minIndent == CodeMirror.countColumn(doc.getLine(start.line), null, tabSize)) + endLine = max; + else for (endLine = end.line + 1; endLine < max; ++endLine) { + var indent = CodeMirror.countColumn(doc.getLine(endLine), null, tabSize); + if (indent <= minIndent) break; + } + var from = Pos(minLine, 0); + + return {type: "part", + name: data.name, + offsetLines: from.line, + text: doc.getRange(from, Pos(endLine, 0))}; + } + + // Generic utilities + + var cmpPos = CodeMirror.cmpPos; + + function elt(tagname, cls /*, ... elts*/) { + var e = document.createElement(tagname); + if (cls) e.className = cls; + for (var i = 2; i < arguments.length; ++i) { + var elt = arguments[i]; + if (typeof elt == "string") elt = document.createTextNode(elt); + e.appendChild(elt); + } + return e; + } + + function dialog(cm, text, f) { + if (cm.openDialog) + cm.openDialog(text + ": ", f); + else + f(prompt(text, "")); + } + + // Tooltips + + function tempTooltip(cm, content) { + if (cm.state.ternTooltip) remove(cm.state.ternTooltip); + var where = cm.cursorCoords(); + var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content); + function maybeClear() { + old = true; + if (!mouseOnTip) clear(); + } + function clear() { + cm.state.ternTooltip = null; + if (!tip.parentNode) return; + cm.off("cursorActivity", clear); + cm.off('blur', clear); + cm.off('scroll', clear); + fadeOut(tip); + } + var mouseOnTip = false, old = false; + CodeMirror.on(tip, "mousemove", function() { mouseOnTip = true; }); + CodeMirror.on(tip, "mouseout", function(e) { + if (!CodeMirror.contains(tip, e.relatedTarget || e.toElement)) { + if (old) clear(); + else mouseOnTip = false; + } + }); + setTimeout(maybeClear, 1700); + cm.on("cursorActivity", clear); + cm.on('blur', clear); + cm.on('scroll', clear); + } + + function makeTooltip(x, y, content) { + var node = elt("div", cls + "tooltip", content); + node.style.left = x + "px"; + node.style.top = y + "px"; + document.body.appendChild(node); + return node; + } + + function remove(node) { + var p = node && node.parentNode; + if (p) p.removeChild(node); + } + + function fadeOut(tooltip) { + tooltip.style.opacity = "0"; + setTimeout(function() { remove(tooltip); }, 1100); + } + + function showError(ts, cm, msg) { + if (ts.options.showError) + ts.options.showError(cm, msg); + else + tempTooltip(cm, String(msg)); + } + + function closeArgHints(ts) { + if (ts.activeArgHints) { remove(ts.activeArgHints); ts.activeArgHints = null; } + } + + function docValue(ts, doc) { + var val = doc.doc.getValue(); + if (ts.options.fileFilter) val = ts.options.fileFilter(val, doc.name, doc.doc); + return val; + } + + // Worker wrapper + + function WorkerServer(ts) { + var worker = ts.worker = new Worker(ts.options.workerScript); + worker.postMessage({type: "init", + defs: ts.options.defs, + plugins: ts.options.plugins, + scripts: ts.options.workerDeps}); + var msgId = 0, pending = {}; + + function send(data, c) { + if (c) { + data.id = ++msgId; + pending[msgId] = c; + } + worker.postMessage(data); + } + worker.onmessage = function(e) { + var data = e.data; + if (data.type == "getFile") { + getFile(ts, data.name, function(err, text) { + send({type: "getFile", err: String(err), text: text, id: data.id}); + }); + } else if (data.type == "debug") { + window.console.log(data.message); + } else if (data.id && pending[data.id]) { + pending[data.id](data.err, data.body); + delete pending[data.id]; + } + }; + worker.onerror = function(e) { + for (var id in pending) pending[id](e); + pending = {}; + }; + + this.addFile = function(name, text) { send({type: "add", name: name, text: text}); }; + this.delFile = function(name) { send({type: "del", name: name}); }; + this.request = function(body, c) { send({type: "req", body: body}, c); }; + } +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/tern/worker.js b/src/main/resources/templates/editor/lib/codemirror/addon/tern/worker.js new file mode 100644 index 0000000000000000000000000000000000000000..48277af8e79d82102c80fd1cd011f3cafa5cf2ec --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/tern/worker.js @@ -0,0 +1,44 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// declare global: tern, server + +var server; + +this.onmessage = function(e) { + var data = e.data; + switch (data.type) { + case "init": return startServer(data.defs, data.plugins, data.scripts); + case "add": return server.addFile(data.name, data.text); + case "del": return server.delFile(data.name); + case "req": return server.request(data.body, function(err, reqData) { + postMessage({id: data.id, body: reqData, err: err && String(err)}); + }); + case "getFile": + var c = pending[data.id]; + delete pending[data.id]; + return c(data.err, data.text); + default: throw new Error("Unknown message type: " + data.type); + } +}; + +var nextId = 0, pending = {}; +function getFile(file, c) { + postMessage({type: "getFile", name: file, id: ++nextId}); + pending[nextId] = c; +} + +function startServer(defs, plugins, scripts) { + if (scripts) importScripts.apply(null, scripts); + + server = new tern.Server({ + getFile: getFile, + async: true, + defs: defs, + plugins: plugins + }); +} + +var console = { + log: function(v) { postMessage({type: "debug", message: v}); } +}; diff --git a/src/main/resources/templates/editor/lib/codemirror/addon/wrap/hardwrap.js b/src/main/resources/templates/editor/lib/codemirror/addon/wrap/hardwrap.js new file mode 100644 index 0000000000000000000000000000000000000000..fe9b4dd66961e58dcc40e76feba73ddc002dfef6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addon/wrap/hardwrap.js @@ -0,0 +1,139 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var Pos = CodeMirror.Pos; + + function findParagraph(cm, pos, options) { + var startRE = options.paragraphStart || cm.getHelper(pos, "paragraphStart"); + for (var start = pos.line, first = cm.firstLine(); start > first; --start) { + var line = cm.getLine(start); + if (startRE && startRE.test(line)) break; + if (!/\S/.test(line)) { ++start; break; } + } + var endRE = options.paragraphEnd || cm.getHelper(pos, "paragraphEnd"); + for (var end = pos.line + 1, last = cm.lastLine(); end <= last; ++end) { + var line = cm.getLine(end); + if (endRE && endRE.test(line)) { ++end; break; } + if (!/\S/.test(line)) break; + } + return {from: start, to: end}; + } + + function findBreakPoint(text, column, wrapOn, killTrailingSpace) { + for (var at = column; at > 0; --at) + if (wrapOn.test(text.slice(at - 1, at + 1))) break; + if (at == 0) at = column; + var endOfText = at; + if (killTrailingSpace) + while (text.charAt(endOfText - 1) == " ") --endOfText; + return {from: endOfText, to: at}; + } + + function wrapRange(cm, from, to, options) { + from = cm.clipPos(from); to = cm.clipPos(to); + var column = options.column || 80; + var wrapOn = options.wrapOn || /\s\S|-[^\.\d]/; + var killTrailing = options.killTrailingSpace !== false; + var changes = [], curLine = "", curNo = from.line; + var lines = cm.getRange(from, to, false); + if (!lines.length) return null; + var leadingSpace = lines[0].match(/^[ \t]*/)[0]; + + for (var i = 0; i < lines.length; ++i) { + var text = lines[i], oldLen = curLine.length, spaceInserted = 0; + if (curLine && text && !wrapOn.test(curLine.charAt(curLine.length - 1) + text.charAt(0))) { + curLine += " "; + spaceInserted = 1; + } + var spaceTrimmed = ""; + if (i) { + spaceTrimmed = text.match(/^\s*/)[0]; + text = text.slice(spaceTrimmed.length); + } + curLine += text; + if (i) { + var firstBreak = curLine.length > column && leadingSpace == spaceTrimmed && + findBreakPoint(curLine, column, wrapOn, killTrailing); + // If this isn't broken, or is broken at a different point, remove old break + if (!firstBreak || firstBreak.from != oldLen || firstBreak.to != oldLen + spaceInserted) { + changes.push({text: [spaceInserted ? " " : ""], + from: Pos(curNo, oldLen), + to: Pos(curNo + 1, spaceTrimmed.length)}); + } else { + curLine = leadingSpace + text; + ++curNo; + } + } + while (curLine.length > column) { + var bp = findBreakPoint(curLine, column, wrapOn, killTrailing); + changes.push({text: ["", leadingSpace], + from: Pos(curNo, bp.from), + to: Pos(curNo, bp.to)}); + curLine = leadingSpace + curLine.slice(bp.to); + ++curNo; + } + } + if (changes.length) cm.operation(function() { + for (var i = 0; i < changes.length; ++i) { + var change = changes[i]; + cm.replaceRange(change.text, change.from, change.to); + } + }); + return changes.length ? {from: changes[0].from, to: CodeMirror.changeEnd(changes[changes.length - 1])} : null; + } + + CodeMirror.defineExtension("wrapParagraph", function(pos, options) { + options = options || {}; + if (!pos) pos = this.getCursor(); + var para = findParagraph(this, pos, options); + return wrapRange(this, Pos(para.from, 0), Pos(para.to - 1), options); + }); + + CodeMirror.commands.wrapLines = function(cm) { + cm.operation(function() { + var ranges = cm.listSelections(), at = cm.lastLine() + 1; + for (var i = ranges.length - 1; i >= 0; i--) { + var range = ranges[i], span; + if (range.empty()) { + var para = findParagraph(cm, range.head, {}); + span = {from: Pos(para.from, 0), to: Pos(para.to - 1)}; + } else { + span = {from: range.from(), to: range.to()}; + } + if (span.to.line >= at) continue; + at = span.from.line; + wrapRange(cm, span.from, span.to, {}); + } + }); + }; + + CodeMirror.defineExtension("wrapRange", function(from, to, options) { + return wrapRange(this, from, to, options || {}); + }); + + CodeMirror.defineExtension("wrapParagraphsInRange", function(from, to, options) { + options = options || {}; + var cm = this, paras = []; + for (var line = from.line; line <= to.line;) { + var para = findParagraph(cm, Pos(line, 0), options); + paras.push(para); + line = para.to; + } + var madeChange = false; + if (paras.length) cm.operation(function() { + for (var i = paras.length - 1; i >= 0; --i) + madeChange = madeChange || wrapRange(cm, Pos(paras[i].from, 0), Pos(paras[i].to - 1), options); + }); + return madeChange; + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/addons.min.js b/src/main/resources/templates/editor/lib/codemirror/addons.min.js new file mode 100644 index 0000000000000000000000000000000000000000..5d98e6c2e11752b1bbf544df56058d36776553fe --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/addons.min.js @@ -0,0 +1,4 @@ +/*! Editor.md v1.5.0 | addons.min.js | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-09 */ +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineOption("showTrailingSpace",!1,function(t, i, o){o==e.Init&&(o=!1),o&&!i?t.removeOverlay("trailingspace"):!o&&i&&t.addOverlay({token:function(e){for(var t=e.string.length,i=t; i&&/\s/.test(e.string.charAt(i-1)); --i);return i>e.pos?(e.pos=i,null):(e.pos=t,"trailingspace")},name:"trailingspace"})})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e, t, i){var o,r=e.getWrapperElement();return o=r.appendChild(document.createElement("div")),i?o.className="CodeMirror-dialog CodeMirror-dialog-bottom":o.className="CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?o.innerHTML=t:o.appendChild(t),o}function i(e, t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(o, r, n){function a(e){if("string"==typeof e)h.value=e;else{if(c)return;c=!0,l.parentNode.removeChild(l),d.focus(),n.onClose&&n.onClose(l)}}n||(n={}),i(this,null);var s,l=t(this,o,n.bottom),c=!1,d=this,h=l.getElementsByTagName("input")[0];return h?(n.value&&(h.value=n.value,h.select()),n.onInput&&e.on(h,"input",function(e){n.onInput(e,h.value,a)}),n.onKeyUp&&e.on(h,"keyup",function(e){n.onKeyUp(e,h.value,a)}),e.on(h,"keydown",function(t){n&&n.onKeyDown&&n.onKeyDown(t,h.value,a)||((27==t.keyCode||n.closeOnEnter!==!1&&13==t.keyCode)&&(h.blur(),e.e_stop(t),a()),13==t.keyCode&&r(h.value,t))}),n.closeOnBlur!==!1&&e.on(h,"blur",a),h.focus()):(s=l.getElementsByTagName("button")[0])&&(e.on(s,"click",function(){a(),d.focus()}),n.closeOnBlur!==!1&&e.on(s,"blur",a),s.focus()),a}),e.defineExtension("openConfirm",function(o,r,n){function a(){c||(c=!0,s.parentNode.removeChild(s),d.focus())}i(this,null);var s=t(this,o,n&&n.bottom),l=s.getElementsByTagName("button"),c=!1,d=this,h=1;l[0].focus();for(var u=0; u=h&&a()},200)}),e.on(f,"focus",function(){++h})}}),e.defineExtension("openNotification",function(o, r){function n(){l||(l=!0,clearTimeout(a),s.parentNode.removeChild(s))}i(this,n);var a,s=t(this,o,r&&r.bottom),l=!1,c=r&&"undefined"!=typeof r.duration?r.duration:5e3;return e.on(s,"click",function(t){e.e_preventDefault(t),n()}),c&&(a=setTimeout(n,c)),n})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e, t, r, n){if(this.atOccurrence=!1,this.doc=e,null==n&&"string"==typeof t&&(n=!1),r=r?e.clipPos(r):o(0,0),this.pos={from:r,to:r},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(i, r){if(i){t.lastIndex=0;for(var n,a,s=e.getLine(r.line).slice(0,r.ch),l=0;;){t.lastIndex=l;var c=t.exec(s);if(!c)break;if(n=c,a=n.index,l=n.index+(n[0].length||1),l==s.length)break}var d=n&&n[0].length||0;d||(0==a&&0==s.length?n=void 0:a!=e.getLine(r.line).length&&d++)}else{t.lastIndex=r.ch;var s=e.getLine(r.line),n=t.exec(s),d=n&&n[0].length||0,a=n&&n.index;a+d==s.length||d||(d=1)}return n&&d?{from:o(r.line,a),to:o(r.line,a+d),match:n}:void 0};else{var a=t;n&&(t=t.toLowerCase());var s=n?function(e){return e.toLowerCase()}:function(e){return e},l=t.split("\n");if(1==l.length)t.length?this.matches=function(r,n){if(r){var l=e.getLine(n.line).slice(0,n.ch),c=s(l),d=c.lastIndexOf(t);if(d>-1)return d=i(l,c,d),{from:o(n.line,d),to:o(n.line,d+a.length)}}else{var l=e.getLine(n.line).slice(n.ch),c=s(l),d=c.indexOf(t);if(d>-1)return d=i(l,c,d)+n.ch,{from:o(n.line,d),to:o(n.line,d+a.length)}}}:this.matches=function(){};else{var c=a.split("\n");this.matches=function(t,i){var r=l.length-1;if(t){if(i.line-(l.length-1)=1;--d,--a)if(l[d]!=s(e.getLine(a)))return;var h=e.getLine(a),u=h.length-c[0].length;if(s(h.slice(u))!=l[0])return;return{from:o(a,u),to:n}}if(!(i.line+(l.length-1)>e.lastLine())){var h=e.getLine(i.line),u=h.length-c[0].length;if(s(h.slice(u))==l[0]){for(var f=o(i.line,u),a=i.line+1,d=1;r>d;++d,++a)if(l[d]!=s(e.getLine(a)))return;if(s(e.getLine(a).slice(0,c[r].length))==l[r])return{from:f,to:o(a,c[r].length)}}}}}}}function i(e,t,i){if(e.length==t.length)return i;for(var o=Math.min(i,e.length);;){var r=e.slice(0,o).toLowerCase().length;if(i>r)++o;else{if(!(r>i))return o;--o}}}var o=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=o(e,0);return i.pos={from:t,to:t},i.atOccurrence=!1,!1}for(var i=this,r=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,r))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!r.line)return t(0);r=o(r.line-1,this.doc.getLine(r.line-1).length)}else{var n=this.doc.lineCount();if(r.line==n-1)return t(n);r=o(r.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to),this.pos.to=o(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e, i, o){return new t(this.doc,e,i,o)}),e.defineDocExtension("getSearchCursor",function(e, i, o){return new t(this,e,i,o)}),e.defineExtension("selectMatches",function(t, i){for(var o,r=[],n=this.getSearchCursor(t,this.getCursor("from"),i); (o=n.findNext())&&!(e.cmpPos(n.to(),this.getCursor("to"))>0);)r.push({anchor:n.from(),head:n.to()});r.length&&this.setSelections(r,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["./lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e, t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var i=e.exec(t.string);return i&&i.index==t.pos?(t.pos+=i[0].length,"searching"):void(i?t.pos=i.index:t.skipToEnd())}}}function i(){this.posFrom=this.posTo=this.query=null,this.overlay=null}function o(e){return e.state.search||(e.state.search=new i)}function r(e){return"string"==typeof e&&e==e.toLowerCase()}function n(e,t,i){return e.getSearchCursor(t,i,r(t))}function a(e,t,i,o,r){e.openDialog?e.openDialog(t,r,{value:o}):r(prompt(i,o))}function s(e,t,i,o){e.openConfirm?e.openConfirm(t,o):confirm(i)&&o[0]()}function l(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(i){}return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function c(e,i){var n=o(e);return n.query?d(e,i):void a(e,f,"Search for:",e.getSelection(),function(o){e.operation(function(){o&&!n.query&&(n.query=l(o),e.removeOverlay(n.overlay,r(n.query)),n.overlay=t(n.query,r(n.query)),e.addOverlay(n.overlay),e.showMatchesOnScrollbar&&(n.annotate&&(n.annotate.clear(),n.annotate=null),n.annotate=e.showMatchesOnScrollbar(n.query,r(n.query))),n.posFrom=n.posTo=e.getCursor(),d(e,i))})})}function d(t,i){t.operation(function(){var r=o(t),a=n(t,r.query,i?r.posFrom:r.posTo);(a.find(i)||(a=n(t,r.query,i?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),a.find(i)))&&(t.setSelection(a.from(),a.to()),t.scrollIntoView({from:a.from(),to:a.to()}),r.posFrom=a.from(),r.posTo=a.to())})}function h(e){e.operation(function(){var t=o(e);t.query&&(t.query=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function u(e,t){e.getOption("readOnly")||a(e,g,"Replace:",e.getSelection(),function(i){i&&(i=l(i),a(e,p,"Replace with:","",function(o){if(t)e.operation(function(){for(var t=n(e,i);t.findNext();)if("string"!=typeof i){var r=e.getRange(t.from(),t.to()).match(i);t.replace(o.replace(/\$(\d)/g,function(e,t){return r[t]}))}else t.replace(o)});else{h(e);var r=n(e,i,e.getCursor()),a=function(){var t,o=r.from();!(t=r.findNext())&&(r=n(e,i),!(t=r.findNext())||o&&r.from().line==o.line&&r.from().ch==o.ch)||(e.setSelection(r.from(),r.to()),e.scrollIntoView({from:r.from(),to:r.to()}),s(e,m,"Replace?",[function(){l(t)},a]))},l=function(e){r.replace("string"==typeof i?o:o.replace(/\$(\d)/g,function(t,i){return e[i]})),a()};a()}}))})}var f='Search: (Use /re/ syntax for regexp search)',g='Replace: (Use /re/ syntax for regexp search)',p='With: ',m="Replace? ";e.commands.find=function(e){h(e),c(e)},e.commands.findNext=c,e.commands.findPrev=function(e){c(e,!0)},e.commands.clearSearch=h,e.commands.replace=u,e.commands.replaceAll=function(e){u(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e, t){function i(e){clearTimeout(o.doRedraw),o.doRedraw=setTimeout(function(){o.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var o=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(o.doUpdate),o.doUpdate=setTimeout(function(){o.computeScale()&&i(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){i(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.heightAtLine(e.lastLine()+1,"local");return t!=this.hScale?(this.hScale=t,!0):void 0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){e!==!1&&this.computeScale();var t=this.cm,i=this.hScale,o=document.createDocumentFragment(),r=this.annotations;if(t.display.barWidth)for(var n,a=0; ac+.9));)s=r[++a],c=t.charCoords(s.to,"local").bottom*i;if(c!=l){var d=Math.max(c-l,3),h=o.appendChild(document.createElement("div"));h.style.cssText="position: absolute; right: 0px; width: "+Math.max(t.display.barWidth-1,2)+"px; top: "+(l+this.buttonHeight)+"px; height: "+d+"px",h.className=this.options.className}}this.div.textContent="",this.div.appendChild(o)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["./lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e, t, i, o){this.cm=e;var r={listenForChanges:!1};for(var n in o)r[n]=o[n];r.className||(r.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(r),this.query=t,this.caseFold=i,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e, t){a.onChange(t)})}function i(e,t,i){return t>=e?e:Math.max(t,e+i)}e.defineExtension("showMatchesOnScrollbar",function(e,i,o){return"string"==typeof o&&(o={className:o}),o||(o={}),new t(this,e,i,o)});var o=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t=this.gap.to)break;i.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var r=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold);r.findNext();){var i={from:r.from(),to:r.to()};if(i.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,i),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var o=t.from.line,r=e.changeEnd(t).line,n=r-t.to.line;if(this.gap?(this.gap.from=Math.min(i(this.gap.from,o,n),t.from.line),this.gap.to=Math.max(i(this.gap.to,o,n),t.from.line)):this.gap={from:t.from.line,to:r+1},n)for(var a=0; ac.ch&&(v=v.slice(0,v.length-d.end+c.ch));var w=v.toLowerCase();if(!v||"string"==d.type&&(d.end!=c.ch||!/[\"\']/.test(d.string.charAt(d.string.length-1))||1==d.string.length)||"tag"==d.type&&"closeTag"==u.type||d.string.indexOf("/")==d.string.length-1||p&&r(p,w)>-1||n(t,v,c,u,!0))return e.Pass;var b=m&&r(m,w)>-1;o[l]={indent:b,text:">"+(b?"\n\n":"")+"",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var l=i.length-1;l>=0;l--){var y=o[l];t.replaceRange(y.text,i[l].head,i[l].anchor,"+insert");var k=t.listSelections().slice(0);k[l]={head:y.newPos,anchor:y.newPos},t.setSelections(k),y.indent&&(t.indentLine(y.newPos.line,null,!0),t.indentLine(y.newPos.line+1,null,!0))}}function i(t,i){for(var o=t.listSelections(),r=[],a=i?"/":"";else{if("htmlmixed"!=t.getMode().name||"css"!=d.mode.name)return e.Pass;r[s]=a+"style>"}else{if(!h.context||!h.context.tagName||n(t,h.context.tagName,l,h))return e.Pass;r[s]=a+h.context.tagName+">"}}t.replaceSelections(r),o=t.listSelections();for(var s=0;si;++i)if(e[i]==t)return i;return-1}function n(t,i,o,r,n){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,o.line+500),s=e.scanForClosingTag(t,o,null,a);if(!s||s.tag!=i)return!1;for(var l=r.context,c=n?1:0;l&&l.tagName==i;l=l.prev)++c;o=s.to;for(var d=1;c>d;d++){var h=e.scanForClosingTag(t,o,null,a);if(!h||h.tag!=i)return!1;o=h.to}return!0}e.defineOption("autoCloseTags",!1,function(i,r,n){if(n!=e.Init&&n&&i.removeKeyMap("autoCloseTags"),r){var a={name:"autoCloseTags"};("object"!=typeof r||r.whenClosing)&&(a["'/'"]=function(e){return o(e)}),("object"!=typeof r||r.whenOpening)&&(a["'>'"]=function(e){return t(e)}),i.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],s=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return i(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t, r, n, a){function s(e){var i=l(t,r);if(!i||i.to.line-i.from.linet.firstLine();)r=e.Pos(r.line-1,0),d=s(!1);if(d&&!d.cleared&&"unfold"!==a){var h=i(t,n);e.on(h,"mousedown",function(t){u.clear(),e.e_preventDefault(t)});var u=t.markText(d.from,d.to,{replacedWith:h,clearOnEnter:!0,__isFold:!0});u.on("clear",function(i,o){e.signal(t,"unfold",t,i,o)}),e.signal(t,"fold",t,d.from,d.to)}}function i(e,t){var i=o(e,t,"widget");if("string"==typeof i){var r=document.createTextNode(i);i=document.createElement("span"),i.appendChild(r),i.className="CodeMirror-foldmarker"}return i}function o(e,t,i){if(t&&void 0!==t[i])return t[i];var o=e.options.foldOptions;return o&&void 0!==o[i]?o[i]:r[i]}e.newFoldFunction=function(e,i){return function(o,r){t(o,r,{rangeFinder:e,widget:i})}},e.defineExtension("foldCode",function(e,i,o){t(this,e,i,o)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),i=0;i=i;i++)t.foldCode(e.Pos(i,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var i=t.firstLine(),o=t.lastLine();o>=i;i++)t.foldCode(e.Pos(i,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t, i){for(var o=0; o=s&&(i=r(n.indicatorOpen))}e.setGutterMarker(t,n.gutter,i),++a})}function a(e){var t=e.getViewport(),i=e.state.foldGutter;i&&(e.operation(function(){n(e,t.from,t.to)}),i.from=t.from,i.to=t.to)}function s(e,t,i){var o=e.state.foldGutter;if(o){var r=o.options;i==r.gutter&&e.foldCode(h(t,0),r.rangeFinder)}}function l(e){var t=e.state.foldGutter;if(t){var i=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},i.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var i=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var i=e.getViewport();t.from==t.to||i.from-t.to>20||t.from-i.to>20?a(e):e.operation(function(){i.fromt.to&&(n(e,t.to,i.to),t.to=i.to)})},i.updateViewportTimeSpan||400)}}function d(e,t){var i=e.state.foldGutter;if(i){var o=t.line;o>=i.from&&o=l; ++l){var d=t.getLine(l),h=n(d);if(h>a)s=l;else if(/\S/.test(d))break}return s?{from:e.Pos(i.line,r.length),to:e.Pos(s,t.getLine(s).length)}:void 0}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","brace",function(t, i){function o(o){for(var r=i.ch,l=0;;){var c=0>=r?-1:s.lastIndexOf(o,r-1);if(-1!=c){if(1==l&&c=g; ++g)for(var p=t.getLine(g),m=g==a?r:0;;){var v=p.indexOf(l,m),w=p.indexOf(c,m);if(0>v&&(v=p.length),0>w&&(w=p.length),m=Math.min(v,w),m==p.length)break;if(t.getTokenTypeAt(e.Pos(g,m+1))==n)if(m==v)++u;else if(!--u){d=g,h=m;break e}++m}if(null!=d&&(a!=d||h!=r))return{from:e.Pos(a,r),to:e.Pos(d,h)}}}),e.registerHelper("fold","import",function(t,i){function o(i){if(it.lastLine())return null;var o=t.getTokenAt(e.Pos(i,1));if(/\S/.test(o.string)||(o=t.getTokenAt(e.Pos(i,o.end+1))),"keyword"!=o.type||"import"!=o.string)return null;for(var r=i,n=Math.min(t.lastLine(),i+10);n>=r;++r){var a=t.getLine(r),s=a.indexOf(";");if(-1!=s)return{startCh:o.end,end:e.Pos(r,s)}}}var r,i=i.line,n=o(i);if(!n||o(i-1)||(r=o(i-2))&&r.end.line==i-1)return null;for(var a=n.end;;){var s=o(a.line+1);if(null==s)break;a=s.end}return{from:t.clipPos(e.Pos(i,n.startCh+1)),to:a}}),e.registerHelper("fold","include",function(t, i){function o(i){if(it.lastLine())return null;var o=t.getTokenAt(e.Pos(i,1));return/\S/.test(o.string)||(o=t.getTokenAt(e.Pos(i,o.end+1))),"meta"==o.type&&"#include"==o.string.slice(0,8)?o.start+8:void 0}var i=i.line,r=o(i);if(null==r||null!=o(i-1))return null;for(var n=i;;){var a=o(n+1);if(null==a)break;++n}return{from:e.Pos(i,r+1),to:t.clipPos(e.Pos(n))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e, t){return e.line-t.line||e.ch-t.ch}function i(e, t, i, o){this.line=t,this.ch=i,this.cm=e,this.text=e.getLine(t),this.min=o?o.from:e.firstLine(),this.max=o?o.to-1:e.lastLine()}function o(e, t){var i=e.cm.getTokenTypeAt(u(e.line,t));return i&&/\btag\b/.test(i)}function r(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function n(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(r(e))continue;return}{if(o(e,t+1)){var i=e.text.lastIndexOf("/",t),n=i>-1&&!/\S/.test(e.text.slice(i+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t+1}}}function s(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(n(e))continue;return}if(o(e,t+1)){p.lastIndex=t,e.ch=t;var i=p.exec(e.text);if(i&&i.index==t)return i}else e.ch=t}}function l(e){for(;;){p.lastIndex=e.ch;var t=p.exec(e.text);if(!t){if(r(e))continue;return}{if(o(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(n(e))continue;return}{if(o(e,t+1)){var i=e.text.lastIndexOf("/",t),r=i>-1&&!/\S/.test(e.text.slice(i+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t}}}function d(e,t){for(var i=[];;){var o,r=l(e),n=e.line,s=e.ch-(r?r[0].length:0);if(!r||!(o=a(e)))return;if("selfClose"!=o)if(r[1]){for(var c=i.length-1;c>=0;--c)if(i[c]==r[2]){i.length=c;break}if(0>c&&(!t||t==r[2]))return{tag:r[2],from:u(n,s),to:u(e.line,e.ch)}}else i.push(r[2])}}function h(e,t){for(var i=[];;){var o=c(e);if(!o)return;if("selfClose"!=o){var r=e.line,n=e.ch,a=s(e);if(!a)return;if(a[1])i.push(a[2]);else{for(var l=i.length-1;l>=0;--l)if(i[l]==a[2]){i.length=l;break}if(0>l&&(!t||t==a[2]))return{tag:a[2],from:u(e.line,e.ch),to:u(r,n)}}}else s(e)}}var u=e.Pos,f="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",g=f+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",p=new RegExp("<(/?)(["+f+"]["+g+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var o=new i(e,t.line,0);;){var r,n=l(o);if(!n||o.line!=t.line||!(r=a(o)))return;if(!n[1]&&"selfClose"!=r){var t=u(o.line,o.ch),s=d(o,n[2]);return s&&{from:t,to:s.from}}}}),e.findMatchingTag=function(e,o,r){var n=new i(e,o.line,o.ch,r);if(-1!=n.text.indexOf(">")||-1!=n.text.indexOf("<")){var l=a(n),c=l&&u(n.line,n.ch),f=l&&s(n);if(l&&f&&!(t(n,o)>0)){var g={from:u(n.line,n.ch),to:c,tag:f[2]};return"selfClose"==l?{open:g,close:null,at:"open"}:f[1]?{open:h(n,f[2]),close:g,at:"close"}:(n=new i(e,c.line,c.ch,r),{open:g,close:d(n,f[2]),at:"open"})}}},e.findEnclosingTag=function(e, t, o){for(var r=new i(e,t.line,t.ch,o);;){var n=h(r);if(!n)break;var a=new i(e,t.line,t.ch,o),s=d(a,n.tag);if(s)return{open:n,close:s}}},e.scanForClosingTag=function(e, t, o, r){var n=new i(e,t.line,t.ch,r?{from:0,to:r}:null);return d(n,o)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","markdown",function(t, i){function o(i){var o=t.getTokenTypeAt(e.Pos(i,0));return o&&/\bheader\b/.test(o)}function r(e, t, i){var r=t&&t.match(/^#+/);return r&&o(e)?r[0].length:(r=i&&i.match(/^[=\-]+\s*$/),r&&o(e+1)?"="==i[0]?1:2:n)}var n=100,a=t.getLine(i.line),s=t.getLine(i.line+1),l=r(i.line,a,s);if(l===n)return void 0;for(var c=t.lastLine(),d=i.line,h=t.getLine(d+2); c>d&&!(r(d+1,s,h)<=l);)++d,s=h,h=t.getLine(d+2);return{from:e.Pos(i.line,a.length),to:e.Pos(d,t.getLine(d).length)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t, i){var o=t.getModeAt(i),r=o.blockCommentStart,n=o.blockCommentEnd;if(r&&n){for(var a,s=i.line,l=t.getLine(s),c=i.ch,d=0;;){var h=0>=c?-1:l.lastIndexOf(r,c-1);if(-1!=h){if(1==d&&h=m; ++m)for(var v=t.getLine(m),w=m==s?a:0;;){var b=v.indexOf(r,w),y=v.indexOf(n,w);if(0>b&&(b=v.length),0>y&&(y=v.length),w=Math.min(b,y),w==v.length)break;if(w==b)++g;else if(!--g){u=m,f=w;break e}++w}if(null!=u&&(s!=u||f!=a))return{from:e.Pos(s,a),to:e.Pos(u,f)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t, i, o){return{startState:function(){return{base:e.startState(t),overlay:e.startState(i),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(o){return{base:e.copyState(t,o.base),overlay:e.copyState(i,o.overlay),basePos:o.basePos,baseCur:null,overlayPos:o.overlayPos,overlayCur:null}},token:function(e, r){return(e!=r.streamSeen||Math.min(r.basePos,r.overlayPos)=i.ch+1)return/\bstring2?\b/.test(s);a.start=a.pos}}function o(o, r){for(var n={name:"autoCloseBrackets",Backspace:function(i){if(i.getOption("disableInput"))return e.Pass;for(var r=i.listSelections(),n=0;n=0;n--){var s=r[n].head;i.replaceRange("",c(s.line,s.ch-1),c(s.line,s.ch+1))}}},a="",s=0; s1&&r.indexOf(t)>=0&&n.getRange(c(p.line,p.ch-2),p)==t+t&&(p.ch<=2||n.getRange(c(p.line,p.ch-3),c(p.line,p.ch-2))!=t))f="addFour";else if('"'==t||"'"==t){if(e.isWordChar(d)||!i(n,p,t))return e.Pass;f="both"}else{if(!(n.getLine(p.line).length==p.ch||a.indexOf(d)>=0||l.test(d)))return e.Pass;f="both"}else f="surround";if(s){if(s!=f)return e.Pass}else s=f}n.operation(function(){if("skip"==s)n.execCommand("goCharRight");else if("skipThree"==s)for(var e=0;3>e;e++)n.execCommand("goCharRight");else if("surround"==s){for(var i=n.getSelections(),e=0;es&&e.addOverlay(t.overlay=a(n.slice(s,l),i,t.style)))}var c=e.getCursor("from"),d=e.getCursor("to");if(c.line==d.line&&(!t.wordsOnly||r(e,c,d))){var h=e.getRange(c,d).replace(/^\s+|\s+$/g,"");h.length>=t.minChars&&e.addOverlay(t.overlay=a(h,!1,t.style))}})}function r(e,t,i){var o=e.getRange(t,i);if(null!==o.match(/^\w+$/)){if(t.ch>0){var r={line:t.line,ch:t.ch-1},n=e.getRange(r,t);if(null===n.match(/\W/))return!1}if(i.ch=15){presto=false;webkit=true}var flipCtrlCmd=mac&&(qtwebkit||presto&&(presto_version==null||presto_version<12.11));var captureRightClick=gecko||(ie&&ie_version>=9);var sawReadOnlySpans=false,sawCollapsedSpans=false;function CodeMirror(place,options){if(!(this instanceof CodeMirror)){return new CodeMirror(place,options)}this.options=options=options?copyObj(options):{};copyObj(defaults,options,false);setGuttersForLineNumbers(options);var doc=options.value;if(typeof doc=="string"){doc=new Doc(doc,options.mode)}this.doc=doc;var input=new CodeMirror.inputStyles[options.inputStyle](this);var display=this.display=new Display(place,doc,input);display.wrapper.CodeMirror=this;updateGutters(this);themeChanged(this);if(options.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}if(options.autofocus&&!mobile){display.input.focus()}initScrollbars(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,focused:false,suppressEdits:false,pasteIncoming:false,cutIncoming:false,draggingText:false,highlight:new Delayed(),keySeq:null};var cm=this;if(ie&&ie_version<11){setTimeout(function(){cm.display.input.reset(true)},20)}registerEventHandlers(this);ensureGlobalHandlers();startOperation(this);this.curOp.forceUpdate=true;attachDoc(this,doc);if((options.autofocus&&!mobile)||cm.hasFocus()){setTimeout(bind(onFocus,this),20)}else{onBlur(this)}for(var opt in optionHandlers){if(optionHandlers.hasOwnProperty(opt)){optionHandlers[opt](this,options[opt],Init)}}maybeUpdateLineNumberWidth(this);if(options.finishInit){options.finishInit(this)}for(var i=0;id.maxLineLength){d.maxLineLength=len;d.maxLine=line}})}function setGuttersForLineNumbers(options){var found=indexOf(options.gutters,"CodeMirror-linenumbers");if(found==-1&&options.lineNumbers){options.gutters=options.gutters.concat(["CodeMirror-linenumbers"])}else{if(found>-1&&!options.lineNumbers){options.gutters=options.gutters.slice(0);options.gutters.splice(found,1)}}}function measureForScrollbars(cm){var d=cm.display,gutterW=d.gutters.offsetWidth;var docH=Math.round(cm.doc.height+paddingVert(cm.display));return{clientHeight:d.scroller.clientHeight,viewHeight:d.wrapper.clientHeight,scrollWidth:d.scroller.scrollWidth,clientWidth:d.scroller.clientWidth,viewWidth:d.wrapper.clientWidth,barLeft:cm.options.fixedGutter?gutterW:0,docHeight:docH,scrollHeight:docH+scrollGap(cm)+d.barHeight,nativeBarWidth:d.nativeBarWidth,gutterWidth:gutterW}}function NativeScrollbars(place,scroll,cm){this.cm=cm;var vert=this.vert=elt("div",[elt("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var horiz=this.horiz=elt("div",[elt("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");place(vert);place(horiz);on(vert,"scroll",function(){if(vert.clientHeight){scroll(vert.scrollTop,"vertical")}});on(horiz,"scroll",function(){if(horiz.clientWidth){scroll(horiz.scrollLeft,"horizontal")}});this.checkedOverlay=false;if(ie&&ie_version<8){this.horiz.style.minHeight=this.vert.style.minWidth="18px"}}NativeScrollbars.prototype=copyObj({update:function(measure){var needsH=measure.scrollWidth>measure.clientWidth+1;var needsV=measure.scrollHeight>measure.clientHeight+1;var sWidth=measure.nativeBarWidth;if(needsV){this.vert.style.display="block";this.vert.style.bottom=needsH?sWidth+"px":"0";var totalHeight=measure.viewHeight-(needsH?sWidth:0);this.vert.firstChild.style.height=Math.max(0,measure.scrollHeight-measure.clientHeight+totalHeight)+"px" +}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(needsH){this.horiz.style.display="block";this.horiz.style.right=needsV?sWidth+"px":"0";this.horiz.style.left=measure.barLeft+"px";var totalWidth=measure.viewWidth-measure.barLeft-(needsV?sWidth:0);this.horiz.firstChild.style.width=(measure.scrollWidth-measure.clientWidth+totalWidth)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedOverlay&&measure.clientHeight>0){if(sWidth==0){this.overlayHack()}this.checkedOverlay=true}return{right:needsV?sWidth:0,bottom:needsH?sWidth:0}},setScrollLeft:function(pos){if(this.horiz.scrollLeft!=pos){this.horiz.scrollLeft=pos}},setScrollTop:function(pos){if(this.vert.scrollTop!=pos){this.vert.scrollTop=pos}},overlayHack:function(){var w=mac&&!mac_geMountainLion?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=w;var self=this;var barMouseDown=function(e){if(e_target(e)!=self.vert&&e_target(e)!=self.horiz){operation(self.cm,onMouseDown)(e)}};on(this.vert,"mousedown",barMouseDown);on(this.horiz,"mousedown",barMouseDown)},clear:function(){var parent=this.horiz.parentNode;parent.removeChild(this.horiz);parent.removeChild(this.vert)}},NativeScrollbars.prototype);function NullScrollbars(){}NullScrollbars.prototype=copyObj({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},NullScrollbars.prototype);CodeMirror.scrollbarModel={"native":NativeScrollbars,"null":NullScrollbars};function initScrollbars(cm){if(cm.display.scrollbars){cm.display.scrollbars.clear();if(cm.display.scrollbars.addClass){rmClass(cm.display.wrapper,cm.display.scrollbars.addClass)}}cm.display.scrollbars=new CodeMirror.scrollbarModel[cm.options.scrollbarStyle](function(node){cm.display.wrapper.insertBefore(node,cm.display.scrollbarFiller);on(node,"mousedown",function(){if(cm.state.focused){setTimeout(function(){cm.display.input.focus()},0)}});node.setAttribute("cm-not-content","true")},function(pos,axis){if(axis=="horizontal"){setScrollLeft(cm,pos)}else{setScrollTop(cm,pos)}},cm);if(cm.display.scrollbars.addClass){addClass(cm.display.wrapper,cm.display.scrollbars.addClass)}}function updateScrollbars(cm,measure){if(!measure){measure=measureForScrollbars(cm)}var startWidth=cm.display.barWidth,startHeight=cm.display.barHeight;updateScrollbarsInner(cm,measure);for(var i=0;i<4&&startWidth!=cm.display.barWidth||startHeight!=cm.display.barHeight;i++){if(startWidth!=cm.display.barWidth&&cm.options.lineWrapping){updateHeightsInViewport(cm)}updateScrollbarsInner(cm,measureForScrollbars(cm));startWidth=cm.display.barWidth;startHeight=cm.display.barHeight}}function updateScrollbarsInner(cm,measure){var d=cm.display;var sizes=d.scrollbars.update(measure);d.sizer.style.paddingRight=(d.barWidth=sizes.right)+"px";d.sizer.style.paddingBottom=(d.barHeight=sizes.bottom)+"px";if(sizes.right&&sizes.bottom){d.scrollbarFiller.style.display="block";d.scrollbarFiller.style.height=sizes.bottom+"px";d.scrollbarFiller.style.width=sizes.right+"px"}else{d.scrollbarFiller.style.display=""}if(sizes.bottom&&cm.options.coverGutterNextToScrollbar&&cm.options.fixedGutter){d.gutterFiller.style.display="block";d.gutterFiller.style.height=sizes.bottom+"px";d.gutterFiller.style.width=measure.gutterWidth+"px"}else{d.gutterFiller.style.display=""}}function visibleLines(display,doc,viewport){var top=viewport&&viewport.top!=null?Math.max(0,viewport.top):display.scroller.scrollTop;top=Math.floor(top-paddingTop(display));var bottom=viewport&&viewport.bottom!=null?viewport.bottom:top+display.wrapper.clientHeight;var from=lineAtHeight(doc,top),to=lineAtHeight(doc,bottom);if(viewport&&viewport.ensure){var ensureFrom=viewport.ensure.from.line,ensureTo=viewport.ensure.to.line;if(ensureFrom=to){from=lineAtHeight(doc,heightAtLine(getLine(doc,ensureTo))-display.wrapper.clientHeight);to=ensureTo}}}return{from:from,to:Math.max(to,from+1)}}function alignHorizontally(cm){var display=cm.display,view=display.view;if(!display.alignWidgets&&(!display.gutters.firstChild||!cm.options.fixedGutter)){return}var comp=compensateForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft;var gutterW=display.gutters.offsetWidth,left=comp+"px";for(var i=0;i=display.viewFrom&&update.visible.to<=display.viewTo&&(display.updateLineNumbers==null||display.updateLineNumbers>=display.viewTo)&&display.renderedView==display.view&&countDirtyView(cm)==0){return false}if(maybeUpdateLineNumberWidth(cm)){resetView(cm);update.dims=getDimensions(cm)}var end=doc.first+doc.size;var from=Math.max(update.visible.from-cm.options.viewportMargin,doc.first);var to=Math.min(end,update.visible.to+cm.options.viewportMargin);if(display.viewFromto&&display.viewTo-to<20){to=Math.min(end,display.viewTo)}if(sawCollapsedSpans){from=visualLineNo(cm.doc,from);to=visualLineEndNo(cm.doc,to)}var different=from!=display.viewFrom||to!=display.viewTo||display.lastWrapHeight!=update.wrapperHeight||display.lastWrapWidth!=update.wrapperWidth;adjustView(cm,from,to);display.viewOffset=heightAtLine(getLine(cm.doc,display.viewFrom));cm.display.mover.style.top=display.viewOffset+"px";var toUpdate=countDirtyView(cm);if(!different&&toUpdate==0&&!update.force&&display.renderedView==display.view&&(display.updateLineNumbers==null||display.updateLineNumbers>=display.viewTo)){return false}var focused=activeElt();if(toUpdate>4){display.lineDiv.style.display="none"}patchDisplay(cm,display.updateLineNumbers,update.dims);if(toUpdate>4){display.lineDiv.style.display=""}display.renderedView=display.view;if(focused&&activeElt()!=focused&&focused.offsetHeight){focused.focus()}removeChildren(display.cursorDiv);removeChildren(display.selectionDiv);display.gutters.style.height=0;if(different){display.lastWrapHeight=update.wrapperHeight;display.lastWrapWidth=update.wrapperWidth;startWorker(cm,400)}display.updateLineNumbers=null;return true}function postUpdateDisplay(cm,update){var force=update.force,viewport=update.viewport;for(var first=true;;first=false){if(first&&cm.options.lineWrapping&&update.oldDisplayWidth!=displayWidth(cm)){force=true}else{force=false;if(viewport&&viewport.top!=null){viewport={top:Math.min(cm.doc.height+paddingVert(cm.display)-displayHeight(cm),viewport.top)}}update.visible=visibleLines(cm.display,cm.doc,viewport);if(update.visible.from>=cm.display.viewFrom&&update.visible.to<=cm.display.viewTo){break}}if(!updateDisplayIfNeeded(cm,update)){break}updateHeightsInViewport(cm);var barMeasure=measureForScrollbars(cm);updateSelection(cm);setDocumentHeight(cm,barMeasure);updateScrollbars(cm,barMeasure)}update.signal(cm,"update",cm);if(cm.display.viewFrom!=cm.display.reportedViewFrom||cm.display.viewTo!=cm.display.reportedViewTo){update.signal(cm,"viewportChange",cm,cm.display.viewFrom,cm.display.viewTo);cm.display.reportedViewFrom=cm.display.viewFrom;cm.display.reportedViewTo=cm.display.viewTo}}function updateDisplaySimple(cm,viewport){var update=new DisplayUpdate(cm,viewport);if(updateDisplayIfNeeded(cm,update)){updateHeightsInViewport(cm);postUpdateDisplay(cm,update);var barMeasure=measureForScrollbars(cm);updateSelection(cm);setDocumentHeight(cm,barMeasure);updateScrollbars(cm,barMeasure);update.finish()}}function setDocumentHeight(cm,measure){cm.display.sizer.style.minHeight=measure.docHeight+"px";var total=measure.docHeight+cm.display.barHeight; +cm.display.heightForcer.style.top=total+"px";cm.display.gutters.style.height=Math.max(total+scrollGap(cm),measure.clientHeight)+"px"}function updateHeightsInViewport(cm){var display=cm.display;var prevBottom=display.lineDiv.offsetTop;for(var i=0;i0.001||diff<-0.001){updateLineHeight(cur.line,height);updateWidgetHeight(cur.line);if(cur.rest){for(var j=0;j-1){updateNumber=false}updateLineForChanges(cm,lineView,lineN,dims)}if(updateNumber){removeChildren(lineView.lineNumber);lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options,lineN)))}cur=lineView.node.nextSibling}}lineN+=lineView.size}while(cur){cur=rm(cur)}}function updateLineForChanges(cm,lineView,lineN,dims){for(var j=0;j1){if(lastCopied&&lastCopied.join("\n")==inserted){multiPaste=sel.ranges.length%lastCopied.length==0&&map(lastCopied,splitLines)}else{if(textLines.length==sel.ranges.length){multiPaste=map(textLines,function(l){return[l]})}}}for(var i=sel.ranges.length-1;i>=0;i--){var range=sel.ranges[i];var from=range.from(),to=range.to();if(range.empty()){if(deleted&&deleted>0){from=Pos(from.line,from.ch-deleted)}else{if(cm.state.overwrite&&!cm.state.pasteIncoming){to=Pos(to.line,Math.min(getLine(doc,to.line).text.length,to.ch+lst(textLines).length))}}}var updateInput=cm.curOp.updateInput;var changeEvent={from:from,to:to,text:multiPaste?multiPaste[i%multiPaste.length]:textLines,origin:cm.state.pasteIncoming?"paste":cm.state.cutIncoming?"cut":"+input"};makeChange(cm.doc,changeEvent);signalLater(cm,"inputRead",cm,changeEvent);if(inserted&&!cm.state.pasteIncoming&&cm.options.electricChars&&cm.options.smartIndent&&range.head.ch<100&&(!i||sel.ranges[i-1].head.line!=range.head.line)){var mode=cm.getModeAt(range.head);var end=changeEnd(changeEvent);if(mode.electricChars){for(var j=0;j-1){indentLine(cm,end.line,"smart");break}}}else{if(mode.electricInput){if(mode.electricInput.test(getLine(doc,end.line).text.slice(0,end.ch))){indentLine(cm,end.line,"smart")}}}}}ensureCursorVisible(cm);cm.curOp.updateInput=updateInput;cm.curOp.typing=true;cm.state.pasteIncoming=cm.state.cutIncoming=false}function copyableRanges(cm){var text=[],ranges=[];for(var i=0;i=9&&input.hasSelection){input.hasSelection=null}input.poll()});on(te,"paste",function(){if(webkit&&!cm.state.fakedLastChar&&!(new Date-cm.state.lastMiddleDown<200)){var start=te.selectionStart,end=te.selectionEnd;te.value+="$";te.selectionEnd=end;te.selectionStart=start;cm.state.fakedLastChar=true}cm.state.pasteIncoming=true;input.fastPoll()});function prepareCopyCut(e){if(cm.somethingSelected()){lastCopied=cm.getSelections();if(input.inaccurateSelection){input.prevInput="";input.inaccurateSelection=false;te.value=lastCopied.join("\n");selectInput(te)}}else{var ranges=copyableRanges(cm);lastCopied=ranges.text;if(e.type=="cut"){cm.setSelections(ranges.ranges,null,sel_dontScroll)}else{input.prevInput="";te.value=ranges.text.join("\n");selectInput(te)}}if(e.type=="cut"){cm.state.cutIncoming=true}}on(te,"cut",prepareCopyCut);on(te,"copy",prepareCopyCut);on(display.scroller,"paste",function(e){if(eventInWidget(display,e)){return}cm.state.pasteIncoming=true;input.focus()});on(display.lineSpace,"selectstart",function(e){if(!eventInWidget(display,e)){e_preventDefault(e)}})},prepareSelection:function(){var cm=this.cm,display=cm.display,doc=cm.doc;var result=prepareSelection(cm);if(cm.options.moveInputWithCursor){var headPos=cursorCoords(cm,doc.sel.primary().head,"div");var wrapOff=display.wrapper.getBoundingClientRect(),lineOff=display.lineDiv.getBoundingClientRect();result.teTop=Math.max(0,Math.min(display.wrapper.clientHeight-10,headPos.top+lineOff.top-wrapOff.top));result.teLeft=Math.max(0,Math.min(display.wrapper.clientWidth-10,headPos.left+lineOff.left-wrapOff.left))}return result},showSelection:function(drawn){var cm=this.cm,display=cm.display;removeChildrenAndAdd(display.cursorDiv,drawn.cursors);removeChildrenAndAdd(display.selectionDiv,drawn.selection);if(drawn.teTop!=null){this.wrapper.style.top=drawn.teTop+"px";this.wrapper.style.left=drawn.teLeft+"px"}},reset:function(typing){if(this.contextMenuPending){return}var minimal,selected,cm=this.cm,doc=cm.doc;if(cm.somethingSelected()){this.prevInput="";var range=doc.sel.primary();minimal=hasCopyEvent&&(range.to().line-range.from().line>100||(selected=cm.getSelection()).length>1000);var content=minimal?"-":selected||cm.getSelection();this.textarea.value=content;if(cm.state.focused){selectInput(this.textarea)}if(ie&&ie_version>=9){this.hasSelection=content}}else{if(!typing){this.prevInput=this.textarea.value="";if(ie&&ie_version>=9){this.hasSelection=null}}}this.inaccurateSelection=minimal},getField:function(){return this.textarea},supportsTouch:function(){return false},focus:function(){if(this.cm.options.readOnly!="nocursor"&&(!mobile||activeElt()!=this.textarea)){try{this.textarea.focus()}catch(e){}}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var input=this;if(input.pollingFast){return}input.polling.set(this.cm.options.pollInterval,function(){input.poll();if(input.cm.state.focused){input.slowPoll()}})},fastPoll:function(){var missed=false,input=this;input.pollingFast=true;function p(){var changed=input.poll();if(!changed&&!missed){missed=true;input.polling.set(60,p)}else{input.pollingFast=false;input.slowPoll()}}input.polling.set(20,p)},poll:function(){var cm=this.cm,input=this.textarea,prevInput=this.prevInput;if(!cm.state.focused||(hasSelection(input)&&!prevInput)||isReadOnly(cm)||cm.options.disableInput||cm.state.keySeq){return false}if(cm.state.pasteIncoming&&cm.state.fakedLastChar){input.value=input.value.substring(0,input.value.length-1);cm.state.fakedLastChar=false}var text=input.value;if(text==prevInput&&!cm.somethingSelected()){return false}if(ie&&ie_version>=9&&this.hasSelection===text||mac&&/[\uf700-\uf7ff]/.test(text)){cm.display.input.reset();return false}if(text.charCodeAt(0)==8203&&cm.doc.sel==cm.display.selForContextMenu&&!prevInput){prevInput="\u200b" +}var same=0,l=Math.min(prevInput.length,text.length);while(same1000||text.indexOf("\n")>-1){input.value=self.prevInput=""}else{self.prevInput=text}});return true},ensurePolled:function(){if(this.pollingFast&&this.poll()){this.pollingFast=false}},onKeyPress:function(){if(ie&&ie_version>=9){this.hasSelection=null}this.fastPoll()},onContextMenu:function(e){var input=this,cm=input.cm,display=cm.display,te=input.textarea;var pos=posFromMouse(cm,e),scrollPos=display.scroller.scrollTop;if(!pos||presto){return}var reset=cm.options.resetSelectionOnContextMenu;if(reset&&cm.doc.sel.contains(pos)==-1){operation(cm,setSelection)(cm.doc,simpleSelection(pos),sel_dontScroll)}var oldCSS=te.style.cssText;input.wrapper.style.position="absolute";te.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(ie?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(webkit){var oldScrollY=window.scrollY}display.input.focus();if(webkit){window.scrollTo(null,oldScrollY)}display.input.reset();if(!cm.somethingSelected()){te.value=input.prevInput=" "}input.contextMenuPending=true;display.selForContextMenu=cm.doc.sel;clearTimeout(display.detectingSelectAll);function prepareSelectAllHack(){if(te.selectionStart!=null){var selected=cm.somethingSelected();var extval=te.value="\u200b"+(selected?te.value:"");input.prevInput=selected?"":"\u200b";te.selectionStart=1;te.selectionEnd=extval.length;display.selForContextMenu=cm.doc.sel}}function rehide(){input.contextMenuPending=false;input.wrapper.style.position="relative";te.style.cssText=oldCSS;if(ie&&ie_version<9){display.scrollbars.setScrollTop(display.scroller.scrollTop=scrollPos)}if(te.selectionStart!=null){if(!ie||(ie&&ie_version<9)){prepareSelectAllHack()}var i=0,poll=function(){if(display.selForContextMenu==cm.doc.sel&&te.selectionStart==0){operation(cm,commands.selectAll)(cm)}else{if(i++<10){display.detectingSelectAll=setTimeout(poll,500)}else{display.input.reset()}}};display.detectingSelectAll=setTimeout(poll,200)}}if(ie&&ie_version>=9){prepareSelectAllHack()}if(captureRightClick){e_stop(e);var mouseup=function(){off(window,"mouseup",mouseup);setTimeout(rehide,20)};on(window,"mouseup",mouseup)}else{setTimeout(rehide,50)}},setUneditable:nothing,needsContentAttribute:false},TextareaInput.prototype);function ContentEditableInput(cm){this.cm=cm;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Delayed()}ContentEditableInput.prototype=copyObj({init:function(display){var input=this,cm=input.cm;var div=input.div=display.lineDiv;div.contentEditable="true";disableBrowserMagic(div);on(div,"paste",function(e){var pasted=e.clipboardData&&e.clipboardData.getData("text/plain");if(pasted){e.preventDefault();cm.replaceSelection(pasted,null,"paste")}});on(div,"compositionstart",function(e){var data=e.data;input.composing={sel:cm.doc.sel,data:data,startData:data};if(!data){return}var prim=cm.doc.sel.primary();var line=cm.getLine(prim.head.line);var found=line.indexOf(data,Math.max(0,prim.head.ch-data.length));if(found>-1&&found<=prim.head.ch){input.composing.sel=simpleSelection(Pos(prim.head.line,found),Pos(prim.head.line,found+data.length))}});on(div,"compositionupdate",function(e){input.composing.data=e.data});on(div,"compositionend",function(e){var ours=input.composing;if(!ours){return}if(e.data!=ours.startData&&!/\u200b/.test(e.data)){ours.data=e.data}setTimeout(function(){if(!ours.handled){input.applyComposition(ours)}if(input.composing==ours){input.composing=null}},50)});on(div,"touchstart",function(){input.forceCompositionEnd()});on(div,"input",function(){if(input.composing){return}if(!input.pollContent()){runInOp(input.cm,function(){regChange(cm)})}});function onCopyCut(e){if(cm.somethingSelected()){lastCopied=cm.getSelections();if(e.type=="cut"){cm.replaceSelection("",null,"cut")}}else{var ranges=copyableRanges(cm);lastCopied=ranges.text;if(e.type=="cut"){cm.operation(function(){cm.setSelections(ranges.ranges,0,sel_dontScroll);cm.replaceSelection("",null,"cut")})}}if(e.clipboardData&&!ios){e.preventDefault();e.clipboardData.clearData();e.clipboardData.setData("text/plain",lastCopied.join("\n"))}else{var kludge=hiddenTextarea(),te=kludge.firstChild;cm.display.lineSpace.insertBefore(kludge,cm.display.lineSpace.firstChild);te.value=lastCopied.join("\n");var hadFocus=document.activeElement;selectInput(te);setTimeout(function(){cm.display.lineSpace.removeChild(kludge);hadFocus.focus()},50)}}on(div,"copy",onCopyCut);on(div,"cut",onCopyCut)},prepareSelection:function(){var result=prepareSelection(this.cm,false);result.focus=this.cm.state.focused;return result},showSelection:function(info){if(!info||!this.cm.display.view.length){return +}if(info.focus){this.showPrimarySelection()}this.showMultipleSelections(info)},showPrimarySelection:function(){var sel=window.getSelection(),prim=this.cm.doc.sel.primary();var curAnchor=domToPos(this.cm,sel.anchorNode,sel.anchorOffset);var curFocus=domToPos(this.cm,sel.focusNode,sel.focusOffset);if(curAnchor&&!curAnchor.bad&&curFocus&&!curFocus.bad&&cmp(minPos(curAnchor,curFocus),prim.from())==0&&cmp(maxPos(curAnchor,curFocus),prim.to())==0){return}var start=posToDOM(this.cm,prim.from());var end=posToDOM(this.cm,prim.to());if(!start&&!end){return}var view=this.cm.display.view;var old=sel.rangeCount&&sel.getRangeAt(0);if(!start){start={node:view[0].measure.map[2],offset:0}}else{if(!end){var measure=view[view.length-1].measure;var map=measure.maps?measure.maps[measure.maps.length-1]:measure.map;end={node:map[map.length-1],offset:map[map.length-2]-map[map.length-3]}}}try{var rng=range(start.node,start.offset,end.offset,end.node)}catch(e){}if(rng){sel.removeAllRanges();sel.addRange(rng);if(old&&sel.anchorNode==null){sel.addRange(old)}}this.rememberSelection()},showMultipleSelections:function(info){removeChildrenAndAdd(this.cm.display.cursorDiv,info.cursors);removeChildrenAndAdd(this.cm.display.selectionDiv,info.selection)},rememberSelection:function(){var sel=window.getSelection();this.lastAnchorNode=sel.anchorNode;this.lastAnchorOffset=sel.anchorOffset;this.lastFocusNode=sel.focusNode;this.lastFocusOffset=sel.focusOffset},selectionInEditor:function(){var sel=window.getSelection();if(!sel.rangeCount){return false}var node=sel.getRangeAt(0).commonAncestorContainer;return contains(this.div,node)},focus:function(){if(this.cm.options.readOnly!="nocursor"){this.div.focus()}},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return true},receivedFocus:function(){var input=this;if(this.selectionInEditor()){this.pollSelection()}else{runInOp(this.cm,function(){input.cm.curOp.selectionChanged=true})}function poll(){if(input.cm.state.focused){input.pollSelection();input.polling.set(input.cm.options.pollInterval,poll)}}this.polling.set(this.cm.options.pollInterval,poll)},pollSelection:function(){if(this.composing){return}var sel=window.getSelection(),cm=this.cm;if(sel.anchorNode!=this.lastAnchorNode||sel.anchorOffset!=this.lastAnchorOffset||sel.focusNode!=this.lastFocusNode||sel.focusOffset!=this.lastFocusOffset){this.rememberSelection();var anchor=domToPos(cm,sel.anchorNode,sel.anchorOffset);var head=domToPos(cm,sel.focusNode,sel.focusOffset);if(anchor&&head){runInOp(cm,function(){setSelection(cm.doc,simpleSelection(anchor,head),sel_dontScroll);if(anchor.bad||head.bad){cm.curOp.selectionChanged=true}})}}},pollContent:function(){var cm=this.cm,display=cm.display,sel=cm.doc.sel.primary();var from=sel.from(),to=sel.to();if(from.linedisplay.viewTo-1){return false}var fromIndex;if(from.line==display.viewFrom||(fromIndex=findViewIndex(cm,from.line))==0){var fromLine=lineNo(display.view[0].line);var fromNode=display.view[0].node}else{var fromLine=lineNo(display.view[fromIndex].line);var fromNode=display.view[fromIndex-1].node.nextSibling}var toIndex=findViewIndex(cm,to.line);if(toIndex==display.view.length-1){var toLine=display.viewTo-1;var toNode=display.view[toIndex].node}else{var toLine=lineNo(display.view[toIndex+1].line)-1;var toNode=display.view[toIndex+1].node.previousSibling}var newText=splitLines(domTextBetween(cm,fromNode,toNode,fromLine,toLine));var oldText=getBetween(cm.doc,Pos(fromLine,0),Pos(toLine,getLine(cm.doc,toLine).text.length));while(newText.length>1&&oldText.length>1){if(lst(newText)==lst(oldText)){newText.pop();oldText.pop();toLine--}else{if(newText[0]==oldText[0]){newText.shift();oldText.shift();fromLine++}else{break}}}var cutFront=0,cutEnd=0;var newTop=newText[0],oldTop=oldText[0],maxCutFront=Math.min(newTop.length,oldTop.length);while(cutFront1||newText[0]||cmp(chFrom,chTo)){replaceRange(cm.doc,newText,chFrom,chTo,"+input");return true}},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){if(!this.composing||this.composing.handled){return}this.applyComposition(this.composing);this.composing.handled=true;this.div.blur();this.div.focus()},applyComposition:function(composing){if(composing.data&&composing.data!=composing.startData){operation(this.cm,applyTextInput)(this.cm,composing.data,0,composing.sel) +}},setUneditable:function(node){node.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault();operation(this.cm,applyTextInput)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},onContextMenu:nothing,resetPosition:nothing,needsContentAttribute:true},ContentEditableInput.prototype);function posToDOM(cm,pos){var view=findViewForLine(cm,pos.line);if(!view||view.hidden){return null}var line=getLine(cm.doc,pos.line);var info=mapFromLineView(view,line,pos.line);var order=getOrder(line),side="left";if(order){var partPos=getBidiPartAt(order,pos.ch);side=partPos%2?"right":"left"}var result=nodeAndOffsetInLineMap(info.map,pos.ch,"left");result.offset=result.collapse=="right"?result.end:result.start;return result}function badPos(pos,bad){if(bad){pos.bad=true}return pos}function domToPos(cm,node,offset){var lineNode;if(node==cm.display.lineDiv){lineNode=cm.display.lineDiv.childNodes[offset];if(!lineNode){return badPos(cm.clipPos(Pos(cm.display.viewTo-1)),true)}node=null;offset=0}else{for(lineNode=node;;lineNode=lineNode.parentNode){if(!lineNode||lineNode==cm.display.lineDiv){return null}if(lineNode.parentNode&&lineNode.parentNode==cm.display.lineDiv){break}}}for(var i=0;i=0&&cmp(pos,range.to())<=0){return i}}return -1}};function Range(anchor,head){this.anchor=anchor;this.head=head +}Range.prototype={from:function(){return minPos(this.anchor,this.head)},to:function(){return maxPos(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};function normalizeSelection(ranges,primIndex){var prim=ranges[primIndex];ranges.sort(function(a,b){return cmp(a.from(),b.from())});primIndex=indexOf(ranges,prim);for(var i=1;i=0){var from=minPos(prev.from(),cur.from()),to=maxPos(prev.to(),cur.to());var inv=prev.empty()?cur.from()==cur.head:prev.from()==prev.head;if(i<=primIndex){--primIndex}ranges.splice(--i,2,new Range(inv?to:from,inv?from:to))}}return new Selection(ranges,primIndex)}function simpleSelection(anchor,head){return new Selection([new Range(anchor,head||anchor)],0)}function clipLine(doc,n){return Math.max(doc.first,Math.min(n,doc.first+doc.size-1))}function clipPos(doc,pos){if(pos.linelast){return Pos(last,getLine(doc,last).text.length)}return clipToLen(pos,getLine(doc,pos.line).text.length)}function clipToLen(pos,linelen){var ch=pos.ch;if(ch==null||ch>linelen){return Pos(pos.line,linelen)}else{if(ch<0){return Pos(pos.line,0)}else{return pos}}}function isLine(doc,l){return l>=doc.first&&l=curPos.ch:sp.to>curPos.ch))){if(mayClear){signal(m,"beforeCursorEnter");if(m.explicitlyCleared){if(!line.markedSpans){break}else{--i;continue}}}if(!m.atomic){continue}var newPos=m.find(dir<0?-1:1);if(cmp(newPos,curPos)==0){newPos.ch+=dir; +if(newPos.ch<0){if(newPos.line>doc.first){newPos=clipPos(doc,Pos(newPos.line-1))}else{newPos=null}}else{if(newPos.ch>line.text.length){if(newPos.line3){add(left,leftPos.top,null,leftPos.bottom);left=leftSide;if(leftPos.bottomend.bottom||rightPos.bottom==end.bottom&&rightPos.right>end.right){end=rightPos}if(left0){display.blinker=setInterval(function(){display.cursorDiv.style.visibility=(on=!on)?"":"hidden"},cm.options.cursorBlinkRate)}else{if(cm.options.cursorBlinkRate<0){display.cursorDiv.style.visibility="hidden"}}}function startWorker(cm,time){if(cm.doc.mode.startState&&cm.doc.frontier=cm.display.viewTo){return}var end=+new Date+cm.options.workTime;var state=copyState(doc.mode,getStateBefore(cm,doc.frontier));var changedLines=[];doc.iter(doc.frontier,Math.min(doc.first+doc.size,cm.display.viewTo+500),function(line){if(doc.frontier>=cm.display.viewFrom){var oldStyles=line.styles; +var highlighted=highlightLine(cm,line,state,true);line.styles=highlighted.styles;var oldCls=line.styleClasses,newCls=highlighted.classes;if(newCls){line.styleClasses=newCls}else{if(oldCls){line.styleClasses=null}}var ischange=!oldStyles||oldStyles.length!=line.styles.length||oldCls!=newCls&&(!oldCls||!newCls||oldCls.bgClass!=newCls.bgClass||oldCls.textClass!=newCls.textClass);for(var i=0;!ischange&&iend){startWorker(cm,cm.options.workDelay);return true}});if(changedLines.length){runInOp(cm,function(){for(var i=0;ilim;--search){if(search<=doc.first){return doc.first}var line=getLine(doc,search-1);if(line.stateAfter&&(!precise||search<=doc.frontier)){return search}var indented=countColumn(line.text,null,cm.options.tabSize);if(minline==null||minindent>indented){minline=search-1;minindent=indented}}return minline}function getStateBefore(cm,n,precise){var doc=cm.doc,display=cm.display;if(!doc.mode.startState){return true}var pos=findStartLine(cm,n,precise),state=pos>doc.first&&getLine(doc,pos-1).stateAfter;if(!state){state=startState(doc.mode)}else{state=copyState(doc.mode,state)}doc.iter(pos,n,function(line){processLine(cm,line.text,state);var save=pos==n-1||pos%5==0||pos>=display.viewFrom&&pos2){heights.push((cur.bottom+next.top)/2-rect.top)}}}heights.push(rect.bottom-rect.top)}}function mapFromLineView(lineView,line,lineN){if(lineView.line==line){return{map:lineView.measure.map,cache:lineView.measure.cache}}for(var i=0;ilineN){return{map:lineView.measure.maps[i],cache:lineView.measure.caches[i],before:true}}}}function updateExternalMeasurement(cm,line){line=visualLine(line);var lineN=lineNo(line);var view=cm.display.externalMeasured=new LineView(cm.doc,line,lineN);view.lineN=lineN;var built=view.built=buildLineContent(cm,view);view.text=built.pre;removeChildrenAndAdd(cm.display.lineMeasure,built.pre);return view}function measureChar(cm,line,ch,bias){return measureCharPrepared(cm,prepareMeasureForLine(cm,line),ch,bias)}function findViewForLine(cm,lineN){if(lineN>=cm.display.viewFrom&&lineN=ext.lineN&&lineNch){end=mEnd-mStart;start=end-1;if(ch>=mEnd){collapse="right"}}}}if(start!=null){node=map[i+2];if(mStart==mEnd&&bias==(node.insertLeft?"left":"right")){collapse=bias}if(bias=="left"&&start==0){while(i&&map[i-2]==map[i-3]&&map[i-1].insertLeft){node=map[(i-=3)+2];collapse="left"}}if(bias=="right"&&start==mEnd-mStart){while(i0){collapse=bias="right"}var rects;if(cm.options.lineWrapping&&(rects=node.getClientRects()).length>1){rect=rects[bias=="right"?rects.length-1:0]}else{rect=node.getBoundingClientRect()}}if(ie&&ie_version<9&&!start&&(!rect||!rect.left&&!rect.right)){var rSpan=node.parentNode.getClientRects()[0];if(rSpan){rect={left:rSpan.left,right:rSpan.left+charWidth(cm.display),top:rSpan.top,bottom:rSpan.bottom}}else{rect=nullRect}}var rtop=rect.top-prepared.rect.top,rbot=rect.bottom-prepared.rect.top;var mid=(rtop+rbot)/2;var heights=prepared.view.measure.heights;for(var i=0;ipart.from){return get(ch-1)}return get(ch,right)}var order=getOrder(lineObj),ch=pos.ch;if(!order){return get(ch)}var partPos=getBidiPartAt(order,ch);var val=getBidi(ch,partPos);if(bidiOther!=null){val.other=getBidi(ch,bidiOther)}return val}function estimateCoords(cm,pos){var left=0,pos=clipPos(cm.doc,pos);if(!cm.options.lineWrapping){left=charWidth(cm.display)*pos.ch}var lineObj=getLine(cm.doc,pos.line);var top=heightAtLine(lineObj)+paddingTop(cm.display);return{left:left,right:left,top:top,bottom:top+lineObj.height}}function PosWithInfo(line,ch,outside,xRel){var pos=Pos(line,ch);pos.xRel=xRel;if(outside){pos.outside=true}return pos}function coordsChar(cm,x,y){var doc=cm.doc;y+=cm.display.viewOffset;if(y<0){return PosWithInfo(doc.first,0,true,-1)}var lineN=lineAtHeight(doc,y),last=doc.first+doc.size-1;if(lineN>last){return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,true,1)}if(x<0){x=0}var lineObj=getLine(doc,lineN);for(;;){var found=coordsCharInner(cm,lineObj,lineN,x,y);var merged=collapsedSpanAtEnd(lineObj);var mergedPos=merged&&merged.find(0,true);if(merged&&(found.ch>mergedPos.from.ch||found.ch==mergedPos.from.ch&&found.xRel>0)){lineN=lineNo(lineObj=mergedPos.to.line)}else{return found}}}function coordsCharInner(cm,lineObj,lineNo,x,y){var innerOff=y-heightAtLine(lineObj);var wrongLine=false,adjust=2*cm.display.wrapper.clientWidth;var preparedMeasure=prepareMeasureForLine(cm,lineObj);function getX(ch){var sp=cursorCoords(cm,Pos(lineNo,ch),"line",lineObj,preparedMeasure);wrongLine=true;if(innerOff>sp.bottom){return sp.left-adjust}else{if(innerOfftoX){return PosWithInfo(lineNo,to,toOutside,1)}for(;;){if(bidi?to==from||to==moveVisually(lineObj,from,1):to-from<=1){var ch=x1?1:0);return pos}var step=Math.ceil(dist/2),middle=from+step;if(bidi){middle=from;for(var i=0;ix){to=middle;toX=middleX;if(toOutside=wrongLine){toX+=1000}dist=step}else{from=middle;fromX=middleX;fromOutside=wrongLine;dist-=step}}}var measureText;function textHeight(display){if(display.cachedTextHeight!=null){return display.cachedTextHeight}if(measureText==null){measureText=elt("pre");for(var i=0;i<49;++i){measureText.appendChild(document.createTextNode("x"));measureText.appendChild(elt("br"))}measureText.appendChild(document.createTextNode("x"))}removeChildrenAndAdd(display.measure,measureText);var height=measureText.offsetHeight/50;if(height>3){display.cachedTextHeight=height}removeChildren(display.measure);return height||1}function charWidth(display){if(display.cachedCharWidth!=null){return display.cachedCharWidth}var anchor=elt("span","xxxxxxxxxx");var pre=elt("pre",[anchor]);removeChildrenAndAdd(display.measure,pre);var rect=anchor.getBoundingClientRect(),width=(rect.right-rect.left)/10;if(width>2){display.cachedCharWidth=width}return width||10}var operationGroup=null;var nextOpId=0;function startOperation(cm){cm.curOp={cm:cm,viewChanged:false,startHeight:cm.doc.height,forceUpdate:false,updateInput:null,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++nextOpId};if(operationGroup){operationGroup.ops.push(cm.curOp)}else{cm.curOp.ownsGroup=operationGroup={ops:[cm.curOp],delayedCallbacks:[]}}}function fireCallbacksForOps(group){var callbacks=group.delayedCallbacks,i=0; +do{for(;i=display.viewTo)||display.maxLineChanged&&cm.options.lineWrapping;op.update=op.mustUpdate&&new DisplayUpdate(cm,op.mustUpdate&&{top:op.scrollTop,ensure:op.scrollToPos},op.forceUpdate)}function endOperation_W1(op){op.updatedDisplay=op.mustUpdate&&updateDisplayIfNeeded(op.cm,op.update)}function endOperation_R2(op){var cm=op.cm,display=cm.display;if(op.updatedDisplay){updateHeightsInViewport(cm)}op.barMeasure=measureForScrollbars(cm);if(display.maxLineChanged&&!cm.options.lineWrapping){op.adjustWidthTo=measureChar(cm,display.maxLine,display.maxLine.text.length).left+3;cm.display.sizerWidth=op.adjustWidthTo;op.barMeasure.scrollWidth=Math.max(display.scroller.clientWidth,display.sizer.offsetLeft+op.adjustWidthTo+scrollGap(cm)+cm.display.barWidth);op.maxScrollLeft=Math.max(0,display.sizer.offsetLeft+op.adjustWidthTo-displayWidth(cm))}if(op.updatedDisplay||op.selectionChanged){op.preparedSelection=display.input.prepareSelection()}}function endOperation_W2(op){var cm=op.cm;if(op.adjustWidthTo!=null){cm.display.sizer.style.minWidth=op.adjustWidthTo+"px";if(op.maxScrollLeft
        ]", + "[link ]", + "[tag&bracket <][tag div][tag&bracket >]", + "[tag&bracket ]"); + +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/meta.js b/src/main/resources/templates/editor/lib/codemirror/mode/meta.js new file mode 100644 index 0000000000000000000000000000000000000000..e110288afc512b98aafaaea457bb1bbf0d76fb02 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/meta.js @@ -0,0 +1,177 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.modeInfo = [ + {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]}, + {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i}, + {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]}, + {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, + {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, + {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp"]}, + {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj"]}, + {name: "CoffeeScript", mime: "text/x-coffeescript", mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]}, + {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]}, + {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]}, + {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]}, + {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]}, + {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]}, + {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]}, + {name: "Dart", mimes: ["application/dart", "text/x-dart"], mode: "dart", ext: ["dart"]}, + {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]}, + {name: "Django", mime: "text/x-django", mode: "django"}, + {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/}, + {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]}, + {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]}, + {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"}, + {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]}, + {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]}, + {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, + {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]}, + {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, + {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]}, + {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90"]}, + {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]}, + {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]}, + {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]}, + {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history).md$/i}, + {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]}, + {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy"]}, + {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]}, + {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]}, + {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]}, + {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]}, + {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]}, + {name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm"], alias: ["xhtml"]}, + {name: "HTTP", mime: "message/http", mode: "http"}, + {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]}, + {name: "Jade", mime: "text/x-jade", mode: "jade", ext: ["jade"]}, + {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, + {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]}, + {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"], + mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]}, + {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]}, + {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, + {name: "Jinja2", mime: "null", mode: "jinja2"}, + {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]}, + {name: "Kotlin", mime: "text/x-kotlin", mode: "kotlin", ext: ["kt"]}, + {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]}, + {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]}, + {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]}, + {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]}, + {name: "mIRC", mime: "text/mirc", mode: "mirc"}, + {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"}, + {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]}, + {name: "MS SQL", mime: "text/x-mssql", mode: "sql"}, + {name: "MySQL", mime: "text/x-mysql", mode: "sql"}, + {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i}, + {name: "NTriples", mime: "text/n-triples", mode: "ntriples", ext: ["nt"]}, + {name: "Objective C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"]}, + {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]}, + {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]}, + {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]}, + {name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]}, + {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]}, + {name: "PHP", mime: "application/x-httpd-php", mode: "php", ext: ["php", "php3", "php4", "php5", "phtml"]}, + {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]}, + {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]}, + {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]}, + {name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]}, + {name: "Python", mime: "text/x-python", mode: "python", ext: ["py", "pyw"]}, + {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]}, + {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]}, + {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r"], alias: ["rscript"]}, + {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]}, + {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"}, + {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]}, + {name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"], alias: ["jruby", "macruby", "rake", "rb", "rbx"]}, + {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]}, + {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]}, + {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]}, + {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]}, + {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]}, + {name: "Shell", mime: "text/x-sh", mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"]}, + {name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]}, + {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]}, + {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]}, + {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]}, + {name: "SmartyMixed", mime: "text/x-smarty", mode: "smartymixed"}, + {name: "Solr", mime: "text/x-solr", mode: "solr"}, + {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]}, + {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]}, + {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]}, + {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]}, + {name: "MariaDB", mime: "text/x-mariadb", mode: "sql"}, + {name: "sTeX", mime: "text/x-stex", mode: "stex"}, + {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]}, + {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v"]}, + {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]}, + {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]}, + {name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"}, + {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, + {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]}, + {name: "Tornado", mime: "text/x-tornado", mode: "tornado"}, + {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]}, + {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]}, + {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]}, + {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]}, + {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]}, + {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]}, + {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd"], alias: ["rss", "wsdl", "xsd"]}, + {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]}, + {name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml"], alias: ["yml"]}, + {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]} + ]; + // Ensure all modes have a mime property for backwards compatibility + for (var i = 0; i < CodeMirror.modeInfo.length; i++) { + var info = CodeMirror.modeInfo[i]; + if (info.mimes) info.mime = info.mimes[0]; + } + + CodeMirror.findModeByMIME = function(mime) { + mime = mime.toLowerCase(); + for (var i = 0; i < CodeMirror.modeInfo.length; i++) { + var info = CodeMirror.modeInfo[i]; + if (info.mime == mime) return info; + if (info.mimes) for (var j = 0; j < info.mimes.length; j++) + if (info.mimes[j] == mime) return info; + } + }; + + CodeMirror.findModeByExtension = function(ext) { + for (var i = 0; i < CodeMirror.modeInfo.length; i++) { + var info = CodeMirror.modeInfo[i]; + if (info.ext) for (var j = 0; j < info.ext.length; j++) + if (info.ext[j] == ext) return info; + } + }; + + CodeMirror.findModeByFileName = function(filename) { + for (var i = 0; i < CodeMirror.modeInfo.length; i++) { + var info = CodeMirror.modeInfo[i]; + if (info.file && info.file.test(filename)) return info; + } + var dot = filename.lastIndexOf("."); + var ext = dot > -1 && filename.substring(dot + 1, filename.length); + if (ext) return CodeMirror.findModeByExtension(ext); + }; + + CodeMirror.findModeByName = function(name) { + name = name.toLowerCase(); + for (var i = 0; i < CodeMirror.modeInfo.length; i++) { + var info = CodeMirror.modeInfo[i]; + if (info.name.toLowerCase() == name) return info; + if (info.alias) for (var j = 0; j < info.alias.length; j++) + if (info.alias[j].toLowerCase() == name) return info; + } + }; +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/mirc/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/mirc/index.html new file mode 100644 index 0000000000000000000000000000000000000000..fd2f34e4baf4ad2ff79d7f8ed8577aee874be372 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/mirc/index.html @@ -0,0 +1,160 @@ + + +CodeMirror: mIRC mode + + + + + + + + + + +
        +

        mIRC mode

        +
        + + +

        MIME types defined: text/mirc.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/mirc/mirc.js b/src/main/resources/templates/editor/lib/codemirror/mode/mirc/mirc.js new file mode 100644 index 0000000000000000000000000000000000000000..f0d5c6ad50e08c3e92562ef77f470ac9330d72d2 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/mirc/mirc.js @@ -0,0 +1,193 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +//mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMIME("text/mirc", "mirc"); +CodeMirror.defineMode("mirc", function() { + function parseWords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + var specials = parseWords("$! $$ $& $? $+ $abook $abs $active $activecid " + + "$activewid $address $addtok $agent $agentname $agentstat $agentver " + + "$alias $and $anick $ansi2mirc $aop $appactive $appstate $asc $asctime " + + "$asin $atan $avoice $away $awaymsg $awaytime $banmask $base $bfind " + + "$binoff $biton $bnick $bvar $bytes $calc $cb $cd $ceil $chan $chanmodes " + + "$chantypes $chat $chr $cid $clevel $click $cmdbox $cmdline $cnick $color " + + "$com $comcall $comchan $comerr $compact $compress $comval $cos $count " + + "$cr $crc $creq $crlf $ctime $ctimer $ctrlenter $date $day $daylight " + + "$dbuh $dbuw $dccignore $dccport $dde $ddename $debug $decode $decompress " + + "$deltok $devent $dialog $did $didreg $didtok $didwm $disk $dlevel $dll " + + "$dllcall $dname $dns $duration $ebeeps $editbox $emailaddr $encode $error " + + "$eval $event $exist $feof $ferr $fgetc $file $filename $filtered $finddir " + + "$finddirn $findfile $findfilen $findtok $fline $floor $fopen $fread $fserve " + + "$fulladdress $fulldate $fullname $fullscreen $get $getdir $getdot $gettok $gmt " + + "$group $halted $hash $height $hfind $hget $highlight $hnick $hotline " + + "$hotlinepos $ial $ialchan $ibl $idle $iel $ifmatch $ignore $iif $iil " + + "$inelipse $ini $inmidi $inpaste $inpoly $input $inrect $inroundrect " + + "$insong $instok $int $inwave $ip $isalias $isbit $isdde $isdir $isfile " + + "$isid $islower $istok $isupper $keychar $keyrpt $keyval $knick $lactive " + + "$lactivecid $lactivewid $left $len $level $lf $line $lines $link $lock " + + "$lock $locked $log $logstamp $logstampfmt $longfn $longip $lower $ltimer " + + "$maddress $mask $matchkey $matchtok $md5 $me $menu $menubar $menucontext " + + "$menutype $mid $middir $mircdir $mircexe $mircini $mklogfn $mnick $mode " + + "$modefirst $modelast $modespl $mouse $msfile $network $newnick $nick $nofile " + + "$nopath $noqt $not $notags $notify $null $numeric $numok $oline $onpoly " + + "$opnick $or $ord $os $passivedcc $pic $play $pnick $port $portable $portfree " + + "$pos $prefix $prop $protect $puttok $qt $query $rand $r $rawmsg $read $readomo " + + "$readn $regex $regml $regsub $regsubex $remove $remtok $replace $replacex " + + "$reptok $result $rgb $right $round $scid $scon $script $scriptdir $scriptline " + + "$sdir $send $server $serverip $sfile $sha1 $shortfn $show $signal $sin " + + "$site $sline $snick $snicks $snotify $sock $sockbr $sockerr $sockname " + + "$sorttok $sound $sqrt $ssl $sreq $sslready $status $strip $str $stripped " + + "$syle $submenu $switchbar $tan $target $ticks $time $timer $timestamp " + + "$timestampfmt $timezone $tip $titlebar $toolbar $treebar $trust $ulevel " + + "$ulist $upper $uptime $url $usermode $v1 $v2 $var $vcmd $vcmdstat $vcmdver " + + "$version $vnick $vol $wid $width $wildsite $wildtok $window $wrap $xor"); + var keywords = parseWords("abook ajinvite alias aline ame amsg anick aop auser autojoin avoice " + + "away background ban bcopy beep bread break breplace bset btrunc bunset bwrite " + + "channel clear clearall cline clipboard close cnick color comclose comopen " + + "comreg continue copy creq ctcpreply ctcps dcc dccserver dde ddeserver " + + "debug dec describe dialog did didtok disable disconnect dlevel dline dll " + + "dns dqwindow drawcopy drawdot drawfill drawline drawpic drawrect drawreplace " + + "drawrot drawsave drawscroll drawtext ebeeps echo editbox emailaddr enable " + + "events exit fclose filter findtext finger firewall flash flist flood flush " + + "flushini font fopen fseek fsend fserve fullname fwrite ghide gload gmove " + + "gopts goto gplay gpoint gqreq groups gshow gsize gstop gtalk gunload hadd " + + "halt haltdef hdec hdel help hfree hinc hload hmake hop hsave ial ialclear " + + "ialmark identd if ignore iline inc invite iuser join kick linesep links list " + + "load loadbuf localinfo log mdi me menubar mkdir mnick mode msg nick noop notice " + + "notify omsg onotice part partall pdcc perform play playctrl pop protect pvoice " + + "qme qmsg query queryn quit raw reload remini remote remove rename renwin " + + "reseterror resetidle return rlevel rline rmdir run ruser save savebuf saveini " + + "say scid scon server set showmirc signam sline sockaccept sockclose socklist " + + "socklisten sockmark sockopen sockpause sockread sockrename sockudp sockwrite " + + "sound speak splay sreq strip switchbar timer timestamp titlebar tnick tokenize " + + "toolbar topic tray treebar ulist unload unset unsetall updatenl url uwho " + + "var vcadd vcmd vcrem vol while whois window winhelp write writeint if isalnum " + + "isalpha isaop isavoice isban ischan ishop isignore isin isincs isletter islower " + + "isnotify isnum ison isop isprotect isreg isupper isvoice iswm iswmcs " + + "elseif else goto menu nicklist status title icon size option text edit " + + "button check radio box scroll list combo link tab item"); + var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch"); + var isOperatorChar = /[+\-*&%=<>!?^\/\|]/; + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + function tokenBase(stream, state) { + var beforeParams = state.beforeParams; + state.beforeParams = false; + var ch = stream.next(); + if (/[\[\]{}\(\),\.]/.test(ch)) { + if (ch == "(" && beforeParams) state.inParams = true; + else if (ch == ")") state.inParams = false; + return null; + } + else if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + else if (ch == "\\") { + stream.eat("\\"); + stream.eat(/./); + return "number"; + } + else if (ch == "/" && stream.eat("*")) { + return chain(stream, state, tokenComment); + } + else if (ch == ";" && stream.match(/ *\( *\(/)) { + return chain(stream, state, tokenUnparsed); + } + else if (ch == ";" && !state.inParams) { + stream.skipToEnd(); + return "comment"; + } + else if (ch == '"') { + stream.eat(/"/); + return "keyword"; + } + else if (ch == "$") { + stream.eatWhile(/[$_a-z0-9A-Z\.:]/); + if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) { + return "keyword"; + } + else { + state.beforeParams = true; + return "builtin"; + } + } + else if (ch == "%") { + stream.eatWhile(/[^,^\s^\(^\)]/); + state.beforeParams = true; + return "string"; + } + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + else { + stream.eatWhile(/[\w\$_{}]/); + var word = stream.current().toLowerCase(); + if (keywords && keywords.propertyIsEnumerable(word)) + return "keyword"; + if (functions && functions.propertyIsEnumerable(word)) { + state.beforeParams = true; + return "keyword"; + } + return null; + } + } + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + function tokenUnparsed(stream, state) { + var maybeEnd = 0, ch; + while (ch = stream.next()) { + if (ch == ";" && maybeEnd == 2) { + state.tokenize = tokenBase; + break; + } + if (ch == ")") + maybeEnd++; + else if (ch != " ") + maybeEnd = 0; + } + return "meta"; + } + return { + startState: function() { + return { + tokenize: tokenBase, + beforeParams: false, + inParams: false + }; + }, + token: function(stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + } + }; +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/mllike/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/mllike/index.html new file mode 100644 index 0000000000000000000000000000000000000000..5923af8f873a6ede18015df21684debf7c6ad746 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/mllike/index.html @@ -0,0 +1,179 @@ + + +CodeMirror: ML-like mode + + + + + + + + + + +
        +

        OCaml mode

        + + + + +

        F# mode

        + + + + + +

        MIME types defined: text/x-ocaml (OCaml) and text/x-fsharp (F#).

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/mllike/mllike.js b/src/main/resources/templates/editor/lib/codemirror/mode/mllike/mllike.js new file mode 100644 index 0000000000000000000000000000000000000000..04ab1c98ecd7008310864806613a3f8f16e79db2 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/mllike/mllike.js @@ -0,0 +1,205 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode('mllike', function(_config, parserConfig) { + var words = { + 'let': 'keyword', + 'rec': 'keyword', + 'in': 'keyword', + 'of': 'keyword', + 'and': 'keyword', + 'if': 'keyword', + 'then': 'keyword', + 'else': 'keyword', + 'for': 'keyword', + 'to': 'keyword', + 'while': 'keyword', + 'do': 'keyword', + 'done': 'keyword', + 'fun': 'keyword', + 'function': 'keyword', + 'val': 'keyword', + 'type': 'keyword', + 'mutable': 'keyword', + 'match': 'keyword', + 'with': 'keyword', + 'try': 'keyword', + 'open': 'builtin', + 'ignore': 'builtin', + 'begin': 'keyword', + 'end': 'keyword' + }; + + var extraWords = parserConfig.extraWords || {}; + for (var prop in extraWords) { + if (extraWords.hasOwnProperty(prop)) { + words[prop] = parserConfig.extraWords[prop]; + } + } + + function tokenBase(stream, state) { + var ch = stream.next(); + + if (ch === '"') { + state.tokenize = tokenString; + return state.tokenize(stream, state); + } + if (ch === '(') { + if (stream.eat('*')) { + state.commentLevel++; + state.tokenize = tokenComment; + return state.tokenize(stream, state); + } + } + if (ch === '~') { + stream.eatWhile(/\w/); + return 'variable-2'; + } + if (ch === '`') { + stream.eatWhile(/\w/); + return 'quote'; + } + if (ch === '/' && parserConfig.slashComments && stream.eat('/')) { + stream.skipToEnd(); + return 'comment'; + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\d]/); + if (stream.eat('.')) { + stream.eatWhile(/[\d]/); + } + return 'number'; + } + if ( /[+\-*&%=<>!?|]/.test(ch)) { + return 'operator'; + } + stream.eatWhile(/\w/); + var cur = stream.current(); + return words[cur] || 'variable'; + } + + function tokenString(stream, state) { + var next, end = false, escaped = false; + while ((next = stream.next()) != null) { + if (next === '"' && !escaped) { + end = true; + break; + } + escaped = !escaped && next === '\\'; + } + if (end && !escaped) { + state.tokenize = tokenBase; + } + return 'string'; + }; + + function tokenComment(stream, state) { + var prev, next; + while(state.commentLevel > 0 && (next = stream.next()) != null) { + if (prev === '(' && next === '*') state.commentLevel++; + if (prev === '*' && next === ')') state.commentLevel--; + prev = next; + } + if (state.commentLevel <= 0) { + state.tokenize = tokenBase; + } + return 'comment'; + } + + return { + startState: function() {return {tokenize: tokenBase, commentLevel: 0};}, + token: function(stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + }, + + blockCommentStart: "(*", + blockCommentEnd: "*)", + lineComment: parserConfig.slashComments ? "//" : null + }; +}); + +CodeMirror.defineMIME('text/x-ocaml', { + name: 'mllike', + extraWords: { + 'succ': 'keyword', + 'trace': 'builtin', + 'exit': 'builtin', + 'print_string': 'builtin', + 'print_endline': 'builtin', + 'true': 'atom', + 'false': 'atom', + 'raise': 'keyword' + } +}); + +CodeMirror.defineMIME('text/x-fsharp', { + name: 'mllike', + extraWords: { + 'abstract': 'keyword', + 'as': 'keyword', + 'assert': 'keyword', + 'base': 'keyword', + 'class': 'keyword', + 'default': 'keyword', + 'delegate': 'keyword', + 'downcast': 'keyword', + 'downto': 'keyword', + 'elif': 'keyword', + 'exception': 'keyword', + 'extern': 'keyword', + 'finally': 'keyword', + 'global': 'keyword', + 'inherit': 'keyword', + 'inline': 'keyword', + 'interface': 'keyword', + 'internal': 'keyword', + 'lazy': 'keyword', + 'let!': 'keyword', + 'member' : 'keyword', + 'module': 'keyword', + 'namespace': 'keyword', + 'new': 'keyword', + 'null': 'keyword', + 'override': 'keyword', + 'private': 'keyword', + 'public': 'keyword', + 'return': 'keyword', + 'return!': 'keyword', + 'select': 'keyword', + 'static': 'keyword', + 'struct': 'keyword', + 'upcast': 'keyword', + 'use': 'keyword', + 'use!': 'keyword', + 'val': 'keyword', + 'when': 'keyword', + 'yield': 'keyword', + 'yield!': 'keyword', + + 'List': 'builtin', + 'Seq': 'builtin', + 'Map': 'builtin', + 'Set': 'builtin', + 'int': 'builtin', + 'string': 'builtin', + 'raise': 'builtin', + 'failwith': 'builtin', + 'not': 'builtin', + 'true': 'builtin', + 'false': 'builtin' + }, + slashComments: true +}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/modelica/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/modelica/index.html new file mode 100644 index 0000000000000000000000000000000000000000..408c3b17e3b4f05acd8f2c51acda37bcba884c39 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/modelica/index.html @@ -0,0 +1,67 @@ + + +CodeMirror: Modelica mode + + + + + + + + + + + + +
        +

        Modelica mode

        + +
        + + + +

        Simple mode that tries to handle Modelica as well as it can.

        + +

        MIME types defined: text/x-modelica + (Modlica code).

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/modelica/modelica.js b/src/main/resources/templates/editor/lib/codemirror/mode/modelica/modelica.js new file mode 100644 index 0000000000000000000000000000000000000000..77ec7a3c1872d4f891a68bc22981ff2bd14f584a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/modelica/modelica.js @@ -0,0 +1,245 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Modelica support for CodeMirror, copyright (c) by Lennart Ochel + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +}) + +(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("modelica", function(config, parserConfig) { + + var indentUnit = config.indentUnit; + var keywords = parserConfig.keywords || {}; + var builtin = parserConfig.builtin || {}; + var atoms = parserConfig.atoms || {}; + + var isSingleOperatorChar = /[;=\(:\),{}.*<>+\-\/^\[\]]/; + var isDoubleOperatorChar = /(:=|<=|>=|==|<>|\.\+|\.\-|\.\*|\.\/|\.\^)/; + var isDigit = /[0-9]/; + var isNonDigit = /[_a-zA-Z]/; + + function tokenLineComment(stream, state) { + stream.skipToEnd(); + state.tokenize = null; + return "comment"; + } + + function tokenBlockComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (maybeEnd && ch == "/") { + state.tokenize = null; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function tokenString(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == '"' && !escaped) { + state.tokenize = null; + state.sol = false; + break; + } + escaped = !escaped && ch == "\\"; + } + + return "string"; + } + + function tokenIdent(stream, state) { + stream.eatWhile(isDigit); + while (stream.eat(isDigit) || stream.eat(isNonDigit)) { } + + + var cur = stream.current(); + + if(state.sol && (cur == "package" || cur == "model" || cur == "when" || cur == "connector")) state.level++; + else if(state.sol && cur == "end" && state.level > 0) state.level--; + + state.tokenize = null; + state.sol = false; + + if (keywords.propertyIsEnumerable(cur)) return "keyword"; + else if (builtin.propertyIsEnumerable(cur)) return "builtin"; + else if (atoms.propertyIsEnumerable(cur)) return "atom"; + else return "variable"; + } + + function tokenQIdent(stream, state) { + while (stream.eat(/[^']/)) { } + + state.tokenize = null; + state.sol = false; + + if(stream.eat("'")) + return "variable"; + else + return "error"; + } + + function tokenUnsignedNuber(stream, state) { + stream.eatWhile(isDigit); + if (stream.eat('.')) { + stream.eatWhile(isDigit); + } + if (stream.eat('e') || stream.eat('E')) { + if (!stream.eat('-')) + stream.eat('+'); + stream.eatWhile(isDigit); + } + + state.tokenize = null; + state.sol = false; + return "number"; + } + + // Interface + return { + startState: function() { + return { + tokenize: null, + level: 0, + sol: true + }; + }, + + token: function(stream, state) { + if(state.tokenize != null) { + return state.tokenize(stream, state); + } + + if(stream.sol()) { + state.sol = true; + } + + // WHITESPACE + if(stream.eatSpace()) { + state.tokenize = null; + return null; + } + + var ch = stream.next(); + + // LINECOMMENT + if(ch == '/' && stream.eat('/')) { + state.tokenize = tokenLineComment; + } + // BLOCKCOMMENT + else if(ch == '/' && stream.eat('*')) { + state.tokenize = tokenBlockComment; + } + // TWO SYMBOL TOKENS + else if(isDoubleOperatorChar.test(ch+stream.peek())) { + stream.next(); + state.tokenize = null; + return "operator"; + } + // SINGLE SYMBOL TOKENS + else if(isSingleOperatorChar.test(ch)) { + state.tokenize = null; + return "operator"; + } + // IDENT + else if(isNonDigit.test(ch)) { + state.tokenize = tokenIdent; + } + // Q-IDENT + else if(ch == "'" && stream.peek() && stream.peek() != "'") { + state.tokenize = tokenQIdent; + } + // STRING + else if(ch == '"') { + state.tokenize = tokenString; + } + // UNSIGNED_NUBER + else if(isDigit.test(ch)) { + state.tokenize = tokenUnsignedNuber; + } + // ERROR + else { + state.tokenize = null; + return "error"; + } + + return state.tokenize(stream, state); + }, + + indent: function(state, textAfter) { + if (state.tokenize != null) return CodeMirror.Pass; + + var level = state.level; + if(/(algorithm)/.test(textAfter)) level--; + if(/(equation)/.test(textAfter)) level--; + if(/(initial algorithm)/.test(textAfter)) level--; + if(/(initial equation)/.test(textAfter)) level--; + if(/(end)/.test(textAfter)) level--; + + if(level > 0) + return indentUnit*level; + else + return 0; + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//" + }; + }); + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i=0; i + +CodeMirror: NGINX mode + + + + + + + + + + + + + +
        +

        NGINX mode

        +
        + + +

        MIME types defined: text/nginx.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/nginx/nginx.js b/src/main/resources/templates/editor/lib/codemirror/mode/nginx/nginx.js new file mode 100644 index 0000000000000000000000000000000000000000..135b9cc7f81223e0161c48e1cf939e730583bbe2 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/nginx/nginx.js @@ -0,0 +1,178 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("nginx", function(config) { + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var keywords = words( + /* ngxDirectiveControl */ "break return rewrite set" + + /* ngxDirective */ " accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23" + ); + + var keywords_block = words( + /* ngxDirectiveBlock */ "http mail events server types location upstream charset_map limit_except if geo map" + ); + + var keywords_important = words( + /* ngxDirectiveImportant */ "include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files" + ); + + var indentUnit = config.indentUnit, type; + function ret(style, tp) {type = tp; return style;} + + function tokenBase(stream, state) { + + + stream.eatWhile(/[\w\$_]/); + + var cur = stream.current(); + + + if (keywords.propertyIsEnumerable(cur)) { + return "keyword"; + } + else if (keywords_block.propertyIsEnumerable(cur)) { + return "variable-2"; + } + else if (keywords_important.propertyIsEnumerable(cur)) { + return "string-2"; + } + /**/ + + var ch = stream.next(); + if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());} + else if (ch == "/" && stream.eat("*")) { + state.tokenize = tokenCComment; + return tokenCComment(stream, state); + } + else if (ch == "<" && stream.eat("!")) { + state.tokenize = tokenSGMLComment; + return tokenSGMLComment(stream, state); + } + else if (ch == "=") ret(null, "compare"); + else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare"); + else if (ch == "\"" || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + else if (ch == "#") { + stream.skipToEnd(); + return ret("comment", "comment"); + } + else if (ch == "!") { + stream.match(/^\s*\w*/); + return ret("keyword", "important"); + } + else if (/\d/.test(ch)) { + stream.eatWhile(/[\w.%]/); + return ret("number", "unit"); + } + else if (/[,.+>*\/]/.test(ch)) { + return ret(null, "select-op"); + } + else if (/[;{}:\[\]]/.test(ch)) { + return ret(null, ch); + } + else { + stream.eatWhile(/[\w\\\-]/); + return ret("variable", "variable"); + } + } + + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenSGMLComment(stream, state) { + var dashes = 0, ch; + while ((ch = stream.next()) != null) { + if (dashes >= 2 && ch == ">") { + state.tokenize = tokenBase; + break; + } + dashes = (ch == "-") ? dashes + 1 : 0; + } + return ret("comment", "comment"); + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) + break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return ret("string", "string"); + }; + } + + return { + startState: function(base) { + return {tokenize: tokenBase, + baseIndent: base || 0, + stack: []}; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + type = null; + var style = state.tokenize(stream, state); + + var context = state.stack[state.stack.length-1]; + if (type == "hash" && context == "rule") style = "atom"; + else if (style == "variable") { + if (context == "rule") style = "number"; + else if (!context || context == "@media{") style = "tag"; + } + + if (context == "rule" && /^[\{\};]$/.test(type)) + state.stack.pop(); + if (type == "{") { + if (context == "@media") state.stack[state.stack.length-1] = "@media{"; + else state.stack.push("{"); + } + else if (type == "}") state.stack.pop(); + else if (type == "@media") state.stack.push("@media"); + else if (context == "{" && type != "comment") state.stack.push("rule"); + return style; + }, + + indent: function(state, textAfter) { + var n = state.stack.length; + if (/^\}/.test(textAfter)) + n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1; + return state.baseIndent + n * indentUnit; + }, + + electricChars: "}" + }; +}); + +CodeMirror.defineMIME("text/nginx", "text/x-nginx-conf"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/ntriples/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/ntriples/index.html new file mode 100644 index 0000000000000000000000000000000000000000..1355e7189e53ac1a67e173db0a859612a3c2ea17 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/ntriples/index.html @@ -0,0 +1,45 @@ + + +CodeMirror: NTriples mode + + + + + + + + + +
        +

        NTriples mode

        +
        + +
        + + +

        MIME types defined: text/n-triples.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/ntriples/ntriples.js b/src/main/resources/templates/editor/lib/codemirror/mode/ntriples/ntriples.js new file mode 100644 index 0000000000000000000000000000000000000000..0524b1e8ab653bcec45190ab66d5228aecfbd24a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/ntriples/ntriples.js @@ -0,0 +1,186 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/********************************************************** +* This script provides syntax highlighting support for +* the Ntriples format. +* Ntriples format specification: +* http://www.w3.org/TR/rdf-testcases/#ntriples +***********************************************************/ + +/* + The following expression defines the defined ASF grammar transitions. + + pre_subject -> + { + ( writing_subject_uri | writing_bnode_uri ) + -> pre_predicate + -> writing_predicate_uri + -> pre_object + -> writing_object_uri | writing_object_bnode | + ( + writing_object_literal + -> writing_literal_lang | writing_literal_type + ) + -> post_object + -> BEGIN + } otherwise { + -> ERROR + } +*/ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("ntriples", function() { + + var Location = { + PRE_SUBJECT : 0, + WRITING_SUB_URI : 1, + WRITING_BNODE_URI : 2, + PRE_PRED : 3, + WRITING_PRED_URI : 4, + PRE_OBJ : 5, + WRITING_OBJ_URI : 6, + WRITING_OBJ_BNODE : 7, + WRITING_OBJ_LITERAL : 8, + WRITING_LIT_LANG : 9, + WRITING_LIT_TYPE : 10, + POST_OBJ : 11, + ERROR : 12 + }; + function transitState(currState, c) { + var currLocation = currState.location; + var ret; + + // Opening. + if (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI; + else if(currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI; + else if(currLocation == Location.PRE_PRED && c == '<') ret = Location.WRITING_PRED_URI; + else if(currLocation == Location.PRE_OBJ && c == '<') ret = Location.WRITING_OBJ_URI; + else if(currLocation == Location.PRE_OBJ && c == '_') ret = Location.WRITING_OBJ_BNODE; + else if(currLocation == Location.PRE_OBJ && c == '"') ret = Location.WRITING_OBJ_LITERAL; + + // Closing. + else if(currLocation == Location.WRITING_SUB_URI && c == '>') ret = Location.PRE_PRED; + else if(currLocation == Location.WRITING_BNODE_URI && c == ' ') ret = Location.PRE_PRED; + else if(currLocation == Location.WRITING_PRED_URI && c == '>') ret = Location.PRE_OBJ; + else if(currLocation == Location.WRITING_OBJ_URI && c == '>') ret = Location.POST_OBJ; + else if(currLocation == Location.WRITING_OBJ_BNODE && c == ' ') ret = Location.POST_OBJ; + else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '"') ret = Location.POST_OBJ; + else if(currLocation == Location.WRITING_LIT_LANG && c == ' ') ret = Location.POST_OBJ; + else if(currLocation == Location.WRITING_LIT_TYPE && c == '>') ret = Location.POST_OBJ; + + // Closing typed and language literal. + else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '@') ret = Location.WRITING_LIT_LANG; + else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '^') ret = Location.WRITING_LIT_TYPE; + + // Spaces. + else if( c == ' ' && + ( + currLocation == Location.PRE_SUBJECT || + currLocation == Location.PRE_PRED || + currLocation == Location.PRE_OBJ || + currLocation == Location.POST_OBJ + ) + ) ret = currLocation; + + // Reset. + else if(currLocation == Location.POST_OBJ && c == '.') ret = Location.PRE_SUBJECT; + + // Error + else ret = Location.ERROR; + + currState.location=ret; + } + + return { + startState: function() { + return { + location : Location.PRE_SUBJECT, + uris : [], + anchors : [], + bnodes : [], + langs : [], + types : [] + }; + }, + token: function(stream, state) { + var ch = stream.next(); + if(ch == '<') { + transitState(state, ch); + var parsedURI = ''; + stream.eatWhile( function(c) { if( c != '#' && c != '>' ) { parsedURI += c; return true; } return false;} ); + state.uris.push(parsedURI); + if( stream.match('#', false) ) return 'variable'; + stream.next(); + transitState(state, '>'); + return 'variable'; + } + if(ch == '#') { + var parsedAnchor = ''; + stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false;}); + state.anchors.push(parsedAnchor); + return 'variable-2'; + } + if(ch == '>') { + transitState(state, '>'); + return 'variable'; + } + if(ch == '_') { + transitState(state, ch); + var parsedBNode = ''; + stream.eatWhile(function(c) { if( c != ' ' ) { parsedBNode += c; return true; } return false;}); + state.bnodes.push(parsedBNode); + stream.next(); + transitState(state, ' '); + return 'builtin'; + } + if(ch == '"') { + transitState(state, ch); + stream.eatWhile( function(c) { return c != '"'; } ); + stream.next(); + if( stream.peek() != '@' && stream.peek() != '^' ) { + transitState(state, '"'); + } + return 'string'; + } + if( ch == '@' ) { + transitState(state, '@'); + var parsedLang = ''; + stream.eatWhile(function(c) { if( c != ' ' ) { parsedLang += c; return true; } return false;}); + state.langs.push(parsedLang); + stream.next(); + transitState(state, ' '); + return 'string-2'; + } + if( ch == '^' ) { + stream.next(); + transitState(state, '^'); + var parsedType = ''; + stream.eatWhile(function(c) { if( c != '>' ) { parsedType += c; return true; } return false;} ); + state.types.push(parsedType); + stream.next(); + transitState(state, '>'); + return 'variable'; + } + if( ch == ' ' ) { + transitState(state, ch); + } + if( ch == '.' ) { + transitState(state, ch); + } + } + }; +}); + +CodeMirror.defineMIME("text/n-triples", "ntriples"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/octave/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/octave/index.html new file mode 100644 index 0000000000000000000000000000000000000000..79df5811998b1ed6389ef1e681dc47393701fd6b --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/octave/index.html @@ -0,0 +1,83 @@ + + +CodeMirror: Octave mode + + + + + + + + + +
        +

        Octave mode

        + +
        + + +

        MIME types defined: text/x-octave.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/octave/octave.js b/src/main/resources/templates/editor/lib/codemirror/mode/octave/octave.js new file mode 100644 index 0000000000000000000000000000000000000000..a7bec030c274bad5d6fdd91cee3c3bc5b18fc32b --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/octave/octave.js @@ -0,0 +1,135 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("octave", function() { + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); + } + + var singleOperators = new RegExp("^[\\+\\-\\*/&|\\^~<>!@'\\\\]"); + var singleDelimiters = new RegExp('^[\\(\\[\\{\\},:=;]'); + var doubleOperators = new RegExp("^((==)|(~=)|(<=)|(>=)|(<<)|(>>)|(\\.[\\+\\-\\*/\\^\\\\]))"); + var doubleDelimiters = new RegExp("^((!=)|(\\+=)|(\\-=)|(\\*=)|(/=)|(&=)|(\\|=)|(\\^=))"); + var tripleDelimiters = new RegExp("^((>>=)|(<<=))"); + var expressionEnd = new RegExp("^[\\]\\)]"); + var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*"); + + var builtins = wordRegexp([ + 'error', 'eval', 'function', 'abs', 'acos', 'atan', 'asin', 'cos', + 'cosh', 'exp', 'log', 'prod', 'sum', 'log10', 'max', 'min', 'sign', 'sin', 'sinh', + 'sqrt', 'tan', 'reshape', 'break', 'zeros', 'default', 'margin', 'round', 'ones', + 'rand', 'syn', 'ceil', 'floor', 'size', 'clear', 'zeros', 'eye', 'mean', 'std', 'cov', + 'det', 'eig', 'inv', 'norm', 'rank', 'trace', 'expm', 'logm', 'sqrtm', 'linspace', 'plot', + 'title', 'xlabel', 'ylabel', 'legend', 'text', 'grid', 'meshgrid', 'mesh', 'num2str', + 'fft', 'ifft', 'arrayfun', 'cellfun', 'input', 'fliplr', 'flipud', 'ismember' + ]); + + var keywords = wordRegexp([ + 'return', 'case', 'switch', 'else', 'elseif', 'end', 'endif', 'endfunction', + 'if', 'otherwise', 'do', 'for', 'while', 'try', 'catch', 'classdef', 'properties', 'events', + 'methods', 'global', 'persistent', 'endfor', 'endwhile', 'printf', 'sprintf', 'disp', 'until', + 'continue', 'pkg' + ]); + + + // tokenizers + function tokenTranspose(stream, state) { + if (!stream.sol() && stream.peek() === '\'') { + stream.next(); + state.tokenize = tokenBase; + return 'operator'; + } + state.tokenize = tokenBase; + return tokenBase(stream, state); + } + + + function tokenComment(stream, state) { + if (stream.match(/^.*%}/)) { + state.tokenize = tokenBase; + return 'comment'; + }; + stream.skipToEnd(); + return 'comment'; + } + + function tokenBase(stream, state) { + // whitespaces + if (stream.eatSpace()) return null; + + // Handle one line Comments + if (stream.match('%{')){ + state.tokenize = tokenComment; + stream.skipToEnd(); + return 'comment'; + } + + if (stream.match(/^[%#]/)){ + stream.skipToEnd(); + return 'comment'; + } + + // Handle Number Literals + if (stream.match(/^[0-9\.+-]/, false)) { + if (stream.match(/^[+-]?0x[0-9a-fA-F]+[ij]?/)) { + stream.tokenize = tokenBase; + return 'number'; }; + if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; }; + if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; }; + } + if (stream.match(wordRegexp(['nan','NaN','inf','Inf']))) { return 'number'; }; + + // Handle Strings + if (stream.match(/^"([^"]|(""))*"/)) { return 'string'; } ; + if (stream.match(/^'([^']|(''))*'/)) { return 'string'; } ; + + // Handle words + if (stream.match(keywords)) { return 'keyword'; } ; + if (stream.match(builtins)) { return 'builtin'; } ; + if (stream.match(identifiers)) { return 'variable'; } ; + + if (stream.match(singleOperators) || stream.match(doubleOperators)) { return 'operator'; }; + if (stream.match(singleDelimiters) || stream.match(doubleDelimiters) || stream.match(tripleDelimiters)) { return null; }; + + if (stream.match(expressionEnd)) { + state.tokenize = tokenTranspose; + return null; + }; + + + // Handle non-detected items + stream.next(); + return 'error'; + }; + + + return { + startState: function() { + return { + tokenize: tokenBase + }; + }, + + token: function(stream, state) { + var style = state.tokenize(stream, state); + if (style === 'number' || style === 'variable'){ + state.tokenize = tokenTranspose; + } + return style; + } + }; +}); + +CodeMirror.defineMIME("text/x-octave", "octave"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/pascal/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/pascal/index.html new file mode 100644 index 0000000000000000000000000000000000000000..f8a99ad01ecd2b12c49d0c7de93247aefccd0906 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/pascal/index.html @@ -0,0 +1,61 @@ + + +CodeMirror: Pascal mode + + + + + + + + + +
        +

        Pascal mode

        + + +
        + + + +

        MIME types defined: text/x-pascal.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/pascal/pascal.js b/src/main/resources/templates/editor/lib/codemirror/mode/pascal/pascal.js new file mode 100644 index 0000000000000000000000000000000000000000..2d0c3d4240dfab15e4ff4cc359769e61320d2d4f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/pascal/pascal.js @@ -0,0 +1,109 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("pascal", function() { + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + var keywords = words("and array begin case const div do downto else end file for forward integer " + + "boolean char function goto if in label mod nil not of or packed procedure " + + "program record repeat set string then to type until var while with"); + var atoms = {"null": true}; + + var isOperatorChar = /[+\-*&%=<>!?|\/]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == "#" && state.startOfLine) { + stream.skipToEnd(); + return "meta"; + } + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (ch == "(" && stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + return null; + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (ch == "/") { + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current(); + if (keywords.propertyIsEnumerable(cur)) return "keyword"; + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "variable"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !escaped) state.tokenize = null; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == ")" && maybeEnd) { + state.tokenize = null; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + // Interface + + return { + startState: function() { + return {tokenize: null}; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment" || style == "meta") return style; + return style; + }, + + electricChars: "{}" + }; +}); + +CodeMirror.defineMIME("text/x-pascal", "pascal"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/pegjs/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/pegjs/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0c746048815127713ae9d7ad0da02e84c626f3d0 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/pegjs/index.html @@ -0,0 +1,66 @@ + + + + CodeMirror: PEG.js Mode + + + + + + + + + + + + +
        +

        PEG.js Mode

        +
        + +

        The PEG.js Mode

        +

        Created by Forbes Lindesay.

        +
        + + diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/pegjs/pegjs.js b/src/main/resources/templates/editor/lib/codemirror/mode/pegjs/pegjs.js new file mode 100644 index 0000000000000000000000000000000000000000..306e3768c91b45f8a08349111482e9b17847f647 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/pegjs/pegjs.js @@ -0,0 +1,114 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../javascript/javascript")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../javascript/javascript"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("pegjs", function (config) { + var jsMode = CodeMirror.getMode(config, "javascript"); + + function identifier(stream) { + return stream.match(/^[a-zA-Z_][a-zA-Z0-9_]*/); + } + + return { + startState: function () { + return { + inString: false, + stringType: null, + inComment: false, + inChracterClass: false, + braced: 0, + lhs: true, + localState: null + }; + }, + token: function (stream, state) { + if (stream) + + //check for state changes + if (!state.inString && !state.inComment && ((stream.peek() == '"') || (stream.peek() == "'"))) { + state.stringType = stream.peek(); + stream.next(); // Skip quote + state.inString = true; // Update state + } + if (!state.inString && !state.inComment && stream.match(/^\/\*/)) { + state.inComment = true; + } + + //return state + if (state.inString) { + while (state.inString && !stream.eol()) { + if (stream.peek() === state.stringType) { + stream.next(); // Skip quote + state.inString = false; // Clear flag + } else if (stream.peek() === '\\') { + stream.next(); + stream.next(); + } else { + stream.match(/^.[^\\\"\']*/); + } + } + return state.lhs ? "property string" : "string"; // Token style + } else if (state.inComment) { + while (state.inComment && !stream.eol()) { + if (stream.match(/\*\//)) { + state.inComment = false; // Clear flag + } else { + stream.match(/^.[^\*]*/); + } + } + return "comment"; + } else if (state.inChracterClass) { + while (state.inChracterClass && !stream.eol()) { + if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) { + state.inChracterClass = false; + } + } + } else if (stream.peek() === '[') { + stream.next(); + state.inChracterClass = true; + return 'bracket'; + } else if (stream.match(/^\/\//)) { + stream.skipToEnd(); + return "comment"; + } else if (state.braced || stream.peek() === '{') { + if (state.localState === null) { + state.localState = jsMode.startState(); + } + var token = jsMode.token(stream, state.localState); + var text = stream.current(); + if (!token) { + for (var i = 0; i < text.length; i++) { + if (text[i] === '{') { + state.braced++; + } else if (text[i] === '}') { + state.braced--; + } + }; + } + return token; + } else if (identifier(stream)) { + if (stream.peek() === ':') { + return 'variable'; + } + return 'variable-2'; + } else if (['[', ']', '(', ')'].indexOf(stream.peek()) != -1) { + stream.next(); + return 'bracket'; + } else if (!stream.eatSpace()) { + stream.next(); + } + return null; + } + }; +}, "javascript"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/perl/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/perl/index.html new file mode 100644 index 0000000000000000000000000000000000000000..8c1021c42bff4296c86a6c75c743878941811673 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/perl/index.html @@ -0,0 +1,75 @@ + + +CodeMirror: Perl mode + + + + + + + + + +
        +

        Perl mode

        + + +
        + + + +

        MIME types defined: text/x-perl.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/perl/perl.js b/src/main/resources/templates/editor/lib/codemirror/mode/perl/perl.js new file mode 100644 index 0000000000000000000000000000000000000000..bef62bc7d949d044b003253689f8cd9d00038440 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/perl/perl.js @@ -0,0 +1,837 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08) +// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com) + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("perl",function(){ + // http://perldoc.perl.org + var PERL={ // null - magic touch + // 1 - keyword + // 2 - def + // 3 - atom + // 4 - operator + // 5 - variable-2 (predefined) + // [x,y] - x=1,2,3; y=must be defined if x{...} + // PERL operators + '->' : 4, + '++' : 4, + '--' : 4, + '**' : 4, + // ! ~ \ and unary + and - + '=~' : 4, + '!~' : 4, + '*' : 4, + '/' : 4, + '%' : 4, + 'x' : 4, + '+' : 4, + '-' : 4, + '.' : 4, + '<<' : 4, + '>>' : 4, + // named unary operators + '<' : 4, + '>' : 4, + '<=' : 4, + '>=' : 4, + 'lt' : 4, + 'gt' : 4, + 'le' : 4, + 'ge' : 4, + '==' : 4, + '!=' : 4, + '<=>' : 4, + 'eq' : 4, + 'ne' : 4, + 'cmp' : 4, + '~~' : 4, + '&' : 4, + '|' : 4, + '^' : 4, + '&&' : 4, + '||' : 4, + '//' : 4, + '..' : 4, + '...' : 4, + '?' : 4, + ':' : 4, + '=' : 4, + '+=' : 4, + '-=' : 4, + '*=' : 4, // etc. ??? + ',' : 4, + '=>' : 4, + '::' : 4, + // list operators (rightward) + 'not' : 4, + 'and' : 4, + 'or' : 4, + 'xor' : 4, + // PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;) + 'BEGIN' : [5,1], + 'END' : [5,1], + 'PRINT' : [5,1], + 'PRINTF' : [5,1], + 'GETC' : [5,1], + 'READ' : [5,1], + 'READLINE' : [5,1], + 'DESTROY' : [5,1], + 'TIE' : [5,1], + 'TIEHANDLE' : [5,1], + 'UNTIE' : [5,1], + 'STDIN' : 5, + 'STDIN_TOP' : 5, + 'STDOUT' : 5, + 'STDOUT_TOP' : 5, + 'STDERR' : 5, + 'STDERR_TOP' : 5, + '$ARG' : 5, + '$_' : 5, + '@ARG' : 5, + '@_' : 5, + '$LIST_SEPARATOR' : 5, + '$"' : 5, + '$PROCESS_ID' : 5, + '$PID' : 5, + '$$' : 5, + '$REAL_GROUP_ID' : 5, + '$GID' : 5, + '$(' : 5, + '$EFFECTIVE_GROUP_ID' : 5, + '$EGID' : 5, + '$)' : 5, + '$PROGRAM_NAME' : 5, + '$0' : 5, + '$SUBSCRIPT_SEPARATOR' : 5, + '$SUBSEP' : 5, + '$;' : 5, + '$REAL_USER_ID' : 5, + '$UID' : 5, + '$<' : 5, + '$EFFECTIVE_USER_ID' : 5, + '$EUID' : 5, + '$>' : 5, + '$a' : 5, + '$b' : 5, + '$COMPILING' : 5, + '$^C' : 5, + '$DEBUGGING' : 5, + '$^D' : 5, + '${^ENCODING}' : 5, + '$ENV' : 5, + '%ENV' : 5, + '$SYSTEM_FD_MAX' : 5, + '$^F' : 5, + '@F' : 5, + '${^GLOBAL_PHASE}' : 5, + '$^H' : 5, + '%^H' : 5, + '@INC' : 5, + '%INC' : 5, + '$INPLACE_EDIT' : 5, + '$^I' : 5, + '$^M' : 5, + '$OSNAME' : 5, + '$^O' : 5, + '${^OPEN}' : 5, + '$PERLDB' : 5, + '$^P' : 5, + '$SIG' : 5, + '%SIG' : 5, + '$BASETIME' : 5, + '$^T' : 5, + '${^TAINT}' : 5, + '${^UNICODE}' : 5, + '${^UTF8CACHE}' : 5, + '${^UTF8LOCALE}' : 5, + '$PERL_VERSION' : 5, + '$^V' : 5, + '${^WIN32_SLOPPY_STAT}' : 5, + '$EXECUTABLE_NAME' : 5, + '$^X' : 5, + '$1' : 5, // - regexp $1, $2... + '$MATCH' : 5, + '$&' : 5, + '${^MATCH}' : 5, + '$PREMATCH' : 5, + '$`' : 5, + '${^PREMATCH}' : 5, + '$POSTMATCH' : 5, + "$'" : 5, + '${^POSTMATCH}' : 5, + '$LAST_PAREN_MATCH' : 5, + '$+' : 5, + '$LAST_SUBMATCH_RESULT' : 5, + '$^N' : 5, + '@LAST_MATCH_END' : 5, + '@+' : 5, + '%LAST_PAREN_MATCH' : 5, + '%+' : 5, + '@LAST_MATCH_START' : 5, + '@-' : 5, + '%LAST_MATCH_START' : 5, + '%-' : 5, + '$LAST_REGEXP_CODE_RESULT' : 5, + '$^R' : 5, + '${^RE_DEBUG_FLAGS}' : 5, + '${^RE_TRIE_MAXBUF}' : 5, + '$ARGV' : 5, + '@ARGV' : 5, + 'ARGV' : 5, + 'ARGVOUT' : 5, + '$OUTPUT_FIELD_SEPARATOR' : 5, + '$OFS' : 5, + '$,' : 5, + '$INPUT_LINE_NUMBER' : 5, + '$NR' : 5, + '$.' : 5, + '$INPUT_RECORD_SEPARATOR' : 5, + '$RS' : 5, + '$/' : 5, + '$OUTPUT_RECORD_SEPARATOR' : 5, + '$ORS' : 5, + '$\\' : 5, + '$OUTPUT_AUTOFLUSH' : 5, + '$|' : 5, + '$ACCUMULATOR' : 5, + '$^A' : 5, + '$FORMAT_FORMFEED' : 5, + '$^L' : 5, + '$FORMAT_PAGE_NUMBER' : 5, + '$%' : 5, + '$FORMAT_LINES_LEFT' : 5, + '$-' : 5, + '$FORMAT_LINE_BREAK_CHARACTERS' : 5, + '$:' : 5, + '$FORMAT_LINES_PER_PAGE' : 5, + '$=' : 5, + '$FORMAT_TOP_NAME' : 5, + '$^' : 5, + '$FORMAT_NAME' : 5, + '$~' : 5, + '${^CHILD_ERROR_NATIVE}' : 5, + '$EXTENDED_OS_ERROR' : 5, + '$^E' : 5, + '$EXCEPTIONS_BEING_CAUGHT' : 5, + '$^S' : 5, + '$WARNING' : 5, + '$^W' : 5, + '${^WARNING_BITS}' : 5, + '$OS_ERROR' : 5, + '$ERRNO' : 5, + '$!' : 5, + '%OS_ERROR' : 5, + '%ERRNO' : 5, + '%!' : 5, + '$CHILD_ERROR' : 5, + '$?' : 5, + '$EVAL_ERROR' : 5, + '$@' : 5, + '$OFMT' : 5, + '$#' : 5, + '$*' : 5, + '$ARRAY_BASE' : 5, + '$[' : 5, + '$OLD_PERL_VERSION' : 5, + '$]' : 5, + // PERL blocks + 'if' :[1,1], + elsif :[1,1], + 'else' :[1,1], + 'while' :[1,1], + unless :[1,1], + 'for' :[1,1], + foreach :[1,1], + // PERL functions + 'abs' :1, // - absolute value function + accept :1, // - accept an incoming socket connect + alarm :1, // - schedule a SIGALRM + 'atan2' :1, // - arctangent of Y/X in the range -PI to PI + bind :1, // - binds an address to a socket + binmode :1, // - prepare binary files for I/O + bless :1, // - create an object + bootstrap :1, // + 'break' :1, // - break out of a "given" block + caller :1, // - get context of the current subroutine call + chdir :1, // - change your current working directory + chmod :1, // - changes the permissions on a list of files + chomp :1, // - remove a trailing record separator from a string + chop :1, // - remove the last character from a string + chown :1, // - change the owership on a list of files + chr :1, // - get character this number represents + chroot :1, // - make directory new root for path lookups + close :1, // - close file (or pipe or socket) handle + closedir :1, // - close directory handle + connect :1, // - connect to a remote socket + 'continue' :[1,1], // - optional trailing block in a while or foreach + 'cos' :1, // - cosine function + crypt :1, // - one-way passwd-style encryption + dbmclose :1, // - breaks binding on a tied dbm file + dbmopen :1, // - create binding on a tied dbm file + 'default' :1, // + defined :1, // - test whether a value, variable, or function is defined + 'delete' :1, // - deletes a value from a hash + die :1, // - raise an exception or bail out + 'do' :1, // - turn a BLOCK into a TERM + dump :1, // - create an immediate core dump + each :1, // - retrieve the next key/value pair from a hash + endgrent :1, // - be done using group file + endhostent :1, // - be done using hosts file + endnetent :1, // - be done using networks file + endprotoent :1, // - be done using protocols file + endpwent :1, // - be done using passwd file + endservent :1, // - be done using services file + eof :1, // - test a filehandle for its end + 'eval' :1, // - catch exceptions or compile and run code + 'exec' :1, // - abandon this program to run another + exists :1, // - test whether a hash key is present + exit :1, // - terminate this program + 'exp' :1, // - raise I to a power + fcntl :1, // - file control system call + fileno :1, // - return file descriptor from filehandle + flock :1, // - lock an entire file with an advisory lock + fork :1, // - create a new process just like this one + format :1, // - declare a picture format with use by the write() function + formline :1, // - internal function used for formats + getc :1, // - get the next character from the filehandle + getgrent :1, // - get next group record + getgrgid :1, // - get group record given group user ID + getgrnam :1, // - get group record given group name + gethostbyaddr :1, // - get host record given its address + gethostbyname :1, // - get host record given name + gethostent :1, // - get next hosts record + getlogin :1, // - return who logged in at this tty + getnetbyaddr :1, // - get network record given its address + getnetbyname :1, // - get networks record given name + getnetent :1, // - get next networks record + getpeername :1, // - find the other end of a socket connection + getpgrp :1, // - get process group + getppid :1, // - get parent process ID + getpriority :1, // - get current nice value + getprotobyname :1, // - get protocol record given name + getprotobynumber :1, // - get protocol record numeric protocol + getprotoent :1, // - get next protocols record + getpwent :1, // - get next passwd record + getpwnam :1, // - get passwd record given user login name + getpwuid :1, // - get passwd record given user ID + getservbyname :1, // - get services record given its name + getservbyport :1, // - get services record given numeric port + getservent :1, // - get next services record + getsockname :1, // - retrieve the sockaddr for a given socket + getsockopt :1, // - get socket options on a given socket + given :1, // + glob :1, // - expand filenames using wildcards + gmtime :1, // - convert UNIX time into record or string using Greenwich time + 'goto' :1, // - create spaghetti code + grep :1, // - locate elements in a list test true against a given criterion + hex :1, // - convert a string to a hexadecimal number + 'import' :1, // - patch a module's namespace into your own + index :1, // - find a substring within a string + 'int' :1, // - get the integer portion of a number + ioctl :1, // - system-dependent device control system call + 'join' :1, // - join a list into a string using a separator + keys :1, // - retrieve list of indices from a hash + kill :1, // - send a signal to a process or process group + last :1, // - exit a block prematurely + lc :1, // - return lower-case version of a string + lcfirst :1, // - return a string with just the next letter in lower case + length :1, // - return the number of bytes in a string + 'link' :1, // - create a hard link in the filesytem + listen :1, // - register your socket as a server + local : 2, // - create a temporary value for a global variable (dynamic scoping) + localtime :1, // - convert UNIX time into record or string using local time + lock :1, // - get a thread lock on a variable, subroutine, or method + 'log' :1, // - retrieve the natural logarithm for a number + lstat :1, // - stat a symbolic link + m :null, // - match a string with a regular expression pattern + map :1, // - apply a change to a list to get back a new list with the changes + mkdir :1, // - create a directory + msgctl :1, // - SysV IPC message control operations + msgget :1, // - get SysV IPC message queue + msgrcv :1, // - receive a SysV IPC message from a message queue + msgsnd :1, // - send a SysV IPC message to a message queue + my : 2, // - declare and assign a local variable (lexical scoping) + 'new' :1, // + next :1, // - iterate a block prematurely + no :1, // - unimport some module symbols or semantics at compile time + oct :1, // - convert a string to an octal number + open :1, // - open a file, pipe, or descriptor + opendir :1, // - open a directory + ord :1, // - find a character's numeric representation + our : 2, // - declare and assign a package variable (lexical scoping) + pack :1, // - convert a list into a binary representation + 'package' :1, // - declare a separate global namespace + pipe :1, // - open a pair of connected filehandles + pop :1, // - remove the last element from an array and return it + pos :1, // - find or set the offset for the last/next m//g search + print :1, // - output a list to a filehandle + printf :1, // - output a formatted list to a filehandle + prototype :1, // - get the prototype (if any) of a subroutine + push :1, // - append one or more elements to an array + q :null, // - singly quote a string + qq :null, // - doubly quote a string + qr :null, // - Compile pattern + quotemeta :null, // - quote regular expression magic characters + qw :null, // - quote a list of words + qx :null, // - backquote quote a string + rand :1, // - retrieve the next pseudorandom number + read :1, // - fixed-length buffered input from a filehandle + readdir :1, // - get a directory from a directory handle + readline :1, // - fetch a record from a file + readlink :1, // - determine where a symbolic link is pointing + readpipe :1, // - execute a system command and collect standard output + recv :1, // - receive a message over a Socket + redo :1, // - start this loop iteration over again + ref :1, // - find out the type of thing being referenced + rename :1, // - change a filename + require :1, // - load in external functions from a library at runtime + reset :1, // - clear all variables of a given name + 'return' :1, // - get out of a function early + reverse :1, // - flip a string or a list + rewinddir :1, // - reset directory handle + rindex :1, // - right-to-left substring search + rmdir :1, // - remove a directory + s :null, // - replace a pattern with a string + say :1, // - print with newline + scalar :1, // - force a scalar context + seek :1, // - reposition file pointer for random-access I/O + seekdir :1, // - reposition directory pointer + select :1, // - reset default output or do I/O multiplexing + semctl :1, // - SysV semaphore control operations + semget :1, // - get set of SysV semaphores + semop :1, // - SysV semaphore operations + send :1, // - send a message over a socket + setgrent :1, // - prepare group file for use + sethostent :1, // - prepare hosts file for use + setnetent :1, // - prepare networks file for use + setpgrp :1, // - set the process group of a process + setpriority :1, // - set a process's nice value + setprotoent :1, // - prepare protocols file for use + setpwent :1, // - prepare passwd file for use + setservent :1, // - prepare services file for use + setsockopt :1, // - set some socket options + shift :1, // - remove the first element of an array, and return it + shmctl :1, // - SysV shared memory operations + shmget :1, // - get SysV shared memory segment identifier + shmread :1, // - read SysV shared memory + shmwrite :1, // - write SysV shared memory + shutdown :1, // - close down just half of a socket connection + 'sin' :1, // - return the sine of a number + sleep :1, // - block for some number of seconds + socket :1, // - create a socket + socketpair :1, // - create a pair of sockets + 'sort' :1, // - sort a list of values + splice :1, // - add or remove elements anywhere in an array + 'split' :1, // - split up a string using a regexp delimiter + sprintf :1, // - formatted print into a string + 'sqrt' :1, // - square root function + srand :1, // - seed the random number generator + stat :1, // - get a file's status information + state :1, // - declare and assign a state variable (persistent lexical scoping) + study :1, // - optimize input data for repeated searches + 'sub' :1, // - declare a subroutine, possibly anonymously + 'substr' :1, // - get or alter a portion of a stirng + symlink :1, // - create a symbolic link to a file + syscall :1, // - execute an arbitrary system call + sysopen :1, // - open a file, pipe, or descriptor + sysread :1, // - fixed-length unbuffered input from a filehandle + sysseek :1, // - position I/O pointer on handle used with sysread and syswrite + system :1, // - run a separate program + syswrite :1, // - fixed-length unbuffered output to a filehandle + tell :1, // - get current seekpointer on a filehandle + telldir :1, // - get current seekpointer on a directory handle + tie :1, // - bind a variable to an object class + tied :1, // - get a reference to the object underlying a tied variable + time :1, // - return number of seconds since 1970 + times :1, // - return elapsed time for self and child processes + tr :null, // - transliterate a string + truncate :1, // - shorten a file + uc :1, // - return upper-case version of a string + ucfirst :1, // - return a string with just the next letter in upper case + umask :1, // - set file creation mode mask + undef :1, // - remove a variable or function definition + unlink :1, // - remove one link to a file + unpack :1, // - convert binary structure into normal perl variables + unshift :1, // - prepend more elements to the beginning of a list + untie :1, // - break a tie binding to a variable + use :1, // - load in a module at compile time + utime :1, // - set a file's last access and modify times + values :1, // - return a list of the values in a hash + vec :1, // - test or set particular bits in a string + wait :1, // - wait for any child process to die + waitpid :1, // - wait for a particular child process to die + wantarray :1, // - get void vs scalar vs list context of current subroutine call + warn :1, // - print debugging info + when :1, // + write :1, // - print a picture record + y :null}; // - transliterate a string + + var RXstyle="string-2"; + var RXmodifiers=/[goseximacplud]/; // NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type + + function tokenChain(stream,state,chain,style,tail){ // NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;) + state.chain=null; // 12 3tail + state.style=null; + state.tail=null; + state.tokenize=function(stream,state){ + var e=false,c,i=0; + while(c=stream.next()){ + if(c===chain[i]&&!e){ + if(chain[++i]!==undefined){ + state.chain=chain[i]; + state.style=style; + state.tail=tail;} + else if(tail) + stream.eatWhile(tail); + state.tokenize=tokenPerl; + return style;} + e=!e&&c=="\\";} + return style;}; + return state.tokenize(stream,state);} + + function tokenSOMETHING(stream,state,string){ + state.tokenize=function(stream,state){ + if(stream.string==string) + state.tokenize=tokenPerl; + stream.skipToEnd(); + return "string";}; + return state.tokenize(stream,state);} + + function tokenPerl(stream,state){ + if(stream.eatSpace()) + return null; + if(state.chain) + return tokenChain(stream,state,state.chain,state.style,state.tail); + if(stream.match(/^\-?[\d\.]/,false)) + if(stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/)) + return 'number'; + if(stream.match(/^<<(?=\w)/)){ // NOTE: <"],RXstyle,RXmodifiers);} + if(/[\^'"!~\/]/.test(c)){ + eatSuffix(stream, 1); + return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}} + else if(c=="q"){ + c=look(stream, 1); + if(c=="("){ + eatSuffix(stream, 2); + return tokenChain(stream,state,[")"],"string");} + if(c=="["){ + eatSuffix(stream, 2); + return tokenChain(stream,state,["]"],"string");} + if(c=="{"){ + eatSuffix(stream, 2); + return tokenChain(stream,state,["}"],"string");} + if(c=="<"){ + eatSuffix(stream, 2); + return tokenChain(stream,state,[">"],"string");} + if(/[\^'"!~\/]/.test(c)){ + eatSuffix(stream, 1); + return tokenChain(stream,state,[stream.eat(c)],"string");}} + else if(c=="w"){ + c=look(stream, 1); + if(c=="("){ + eatSuffix(stream, 2); + return tokenChain(stream,state,[")"],"bracket");} + if(c=="["){ + eatSuffix(stream, 2); + return tokenChain(stream,state,["]"],"bracket");} + if(c=="{"){ + eatSuffix(stream, 2); + return tokenChain(stream,state,["}"],"bracket");} + if(c=="<"){ + eatSuffix(stream, 2); + return tokenChain(stream,state,[">"],"bracket");} + if(/[\^'"!~\/]/.test(c)){ + eatSuffix(stream, 1); + return tokenChain(stream,state,[stream.eat(c)],"bracket");}} + else if(c=="r"){ + c=look(stream, 1); + if(c=="("){ + eatSuffix(stream, 2); + return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);} + if(c=="["){ + eatSuffix(stream, 2); + return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);} + if(c=="{"){ + eatSuffix(stream, 2); + return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);} + if(c=="<"){ + eatSuffix(stream, 2); + return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);} + if(/[\^'"!~\/]/.test(c)){ + eatSuffix(stream, 1); + return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}} + else if(/[\^'"!~\/(\[{<]/.test(c)){ + if(c=="("){ + eatSuffix(stream, 1); + return tokenChain(stream,state,[")"],"string");} + if(c=="["){ + eatSuffix(stream, 1); + return tokenChain(stream,state,["]"],"string");} + if(c=="{"){ + eatSuffix(stream, 1); + return tokenChain(stream,state,["}"],"string");} + if(c=="<"){ + eatSuffix(stream, 1); + return tokenChain(stream,state,[">"],"string");} + if(/[\^'"!~\/]/.test(c)){ + return tokenChain(stream,state,[stream.eat(c)],"string");}}}} + if(ch=="m"){ + var c=look(stream, -2); + if(!(c&&/\w/.test(c))){ + c=stream.eat(/[(\[{<\^'"!~\/]/); + if(c){ + if(/[\^'"!~\/]/.test(c)){ + return tokenChain(stream,state,[c],RXstyle,RXmodifiers);} + if(c=="("){ + return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);} + if(c=="["){ + return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);} + if(c=="{"){ + return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);} + if(c=="<"){ + return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}}}} + if(ch=="s"){ + var c=/[\/>\]})\w]/.test(look(stream, -2)); + if(!c){ + c=stream.eat(/[(\[{<\^'"!~\/]/); + if(c){ + if(c=="[") + return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers); + if(c=="{") + return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers); + if(c=="<") + return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); + if(c=="(") + return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); + return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}} + if(ch=="y"){ + var c=/[\/>\]})\w]/.test(look(stream, -2)); + if(!c){ + c=stream.eat(/[(\[{<\^'"!~\/]/); + if(c){ + if(c=="[") + return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers); + if(c=="{") + return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers); + if(c=="<") + return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); + if(c=="(") + return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); + return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}} + if(ch=="t"){ + var c=/[\/>\]})\w]/.test(look(stream, -2)); + if(!c){ + c=stream.eat("r");if(c){ + c=stream.eat(/[(\[{<\^'"!~\/]/); + if(c){ + if(c=="[") + return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers); + if(c=="{") + return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers); + if(c=="<") + return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); + if(c=="(") + return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); + return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}} + if(ch=="`"){ + return tokenChain(stream,state,[ch],"variable-2");} + if(ch=="/"){ + if(!/~\s*$/.test(prefix(stream))) + return "operator"; + else + return tokenChain(stream,state,[ch],RXstyle,RXmodifiers);} + if(ch=="$"){ + var p=stream.pos; + if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}")) + return "variable-2"; + else + stream.pos=p;} + if(/[$@%]/.test(ch)){ + var p=stream.pos; + if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(look(stream, -2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){ + var c=stream.current(); + if(PERL[c]) + return "variable-2";} + stream.pos=p;} + if(/[$@%&]/.test(ch)){ + if(stream.eatWhile(/[\w$\[\]]/)||stream.eat("{")&&stream.eatWhile(/[\w$\[\]]/)&&stream.eat("}")){ + var c=stream.current(); + if(PERL[c]) + return "variable-2"; + else + return "variable";}} + if(ch=="#"){ + if(look(stream, -2)!="$"){ + stream.skipToEnd(); + return "comment";}} + if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){ + var p=stream.pos; + stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/); + if(PERL[stream.current()]) + return "operator"; + else + stream.pos=p;} + if(ch=="_"){ + if(stream.pos==1){ + if(suffix(stream, 6)=="_END__"){ + return tokenChain(stream,state,['\0'],"comment");} + else if(suffix(stream, 7)=="_DATA__"){ + return tokenChain(stream,state,['\0'],"variable-2");} + else if(suffix(stream, 7)=="_C__"){ + return tokenChain(stream,state,['\0'],"string");}}} + if(/\w/.test(ch)){ + var p=stream.pos; + if(look(stream, -2)=="{"&&(look(stream, 0)=="}"||stream.eatWhile(/\w/)&&look(stream, 0)=="}")) + return "string"; + else + stream.pos=p;} + if(/[A-Z]/.test(ch)){ + var l=look(stream, -2); + var p=stream.pos; + stream.eatWhile(/[A-Z_]/); + if(/[\da-z]/.test(look(stream, 0))){ + stream.pos=p;} + else{ + var c=PERL[stream.current()]; + if(!c) + return "meta"; + if(c[1]) + c=c[0]; + if(l!=":"){ + if(c==1) + return "keyword"; + else if(c==2) + return "def"; + else if(c==3) + return "atom"; + else if(c==4) + return "operator"; + else if(c==5) + return "variable-2"; + else + return "meta";} + else + return "meta";}} + if(/[a-zA-Z_]/.test(ch)){ + var l=look(stream, -2); + stream.eatWhile(/\w/); + var c=PERL[stream.current()]; + if(!c) + return "meta"; + if(c[1]) + c=c[0]; + if(l!=":"){ + if(c==1) + return "keyword"; + else if(c==2) + return "def"; + else if(c==3) + return "atom"; + else if(c==4) + return "operator"; + else if(c==5) + return "variable-2"; + else + return "meta";} + else + return "meta";} + return null;} + + return { + startState: function() { + return { + tokenize: tokenPerl, + chain: null, + style: null, + tail: null + }; + }, + token: function(stream, state) { + return (state.tokenize || tokenPerl)(stream, state); + }, + lineComment: '#' + }; +}); + +CodeMirror.registerHelper("wordChars", "perl", /[\w$]/); + +CodeMirror.defineMIME("text/x-perl", "perl"); + +// it's like "peek", but need for look-ahead or look-behind if index < 0 +function look(stream, c){ + return stream.string.charAt(stream.pos+(c||0)); +} + +// return a part of prefix of current stream from current position +function prefix(stream, c){ + if(c){ + var x=stream.pos-c; + return stream.string.substr((x>=0?x:0),c);} + else{ + return stream.string.substr(0,stream.pos-1); + } +} + +// return a part of suffix of current stream from current position +function suffix(stream, c){ + var y=stream.string.length; + var x=y-stream.pos+1; + return stream.string.substr(stream.pos,(c&&c=(y=stream.string.length-1)) + stream.pos=y; + else + stream.pos=x; +} + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/php/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/php/index.html new file mode 100644 index 0000000000000000000000000000000000000000..80bf6496613d74512cd60194541dfb4870a1619a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/php/index.html @@ -0,0 +1,64 @@ + + +CodeMirror: PHP mode + + + + + + + + + + + + + + + +
        +

        PHP mode

        +
        + + + +

        Simple HTML/PHP mode based on + the C-like mode. Depends on XML, + JavaScript, CSS, HTMLMixed, and C-like modes.

        + +

        MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/php/php.js b/src/main/resources/templates/editor/lib/codemirror/mode/php/php.js new file mode 100644 index 0000000000000000000000000000000000000000..e112d91121c3e80ca7337f239281a2c87e81b53f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/php/php.js @@ -0,0 +1,226 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../clike/clike")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../clike/clike"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function keywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + // Helper for stringWithEscapes + function matchSequence(list, end) { + if (list.length == 0) return stringWithEscapes(end); + return function (stream, state) { + var patterns = list[0]; + for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) { + state.tokenize = matchSequence(list.slice(1), end); + return patterns[i][1]; + } + state.tokenize = stringWithEscapes(end); + return "string"; + }; + } + function stringWithEscapes(closing) { + return function(stream, state) { return stringWithEscapes_(stream, state, closing); }; + } + function stringWithEscapes_(stream, state, closing) { + // "Complex" syntax + if (stream.match("${", false) || stream.match("{$", false)) { + state.tokenize = null; + return "string"; + } + + // Simple syntax + if (stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) { + // After the variable name there may appear array or object operator. + if (stream.match("[", false)) { + // Match array operator + state.tokenize = matchSequence([ + [["[", null]], + [[/\d[\w\.]*/, "number"], + [/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"], + [/[\w\$]+/, "variable"]], + [["]", null]] + ], closing); + } + if (stream.match(/\-\>\w/, false)) { + // Match object operator + state.tokenize = matchSequence([ + [["->", null]], + [[/[\w]+/, "variable"]] + ], closing); + } + return "variable-2"; + } + + var escaped = false; + // Normal string + while (!stream.eol() && + (escaped || (!stream.match("{$", false) && + !stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) { + if (!escaped && stream.match(closing)) { + state.tokenize = null; + state.tokStack.pop(); state.tokStack.pop(); + break; + } + escaped = stream.next() == "\\" && !escaped; + } + return "string"; + } + + var phpKeywords = "abstract and array as break case catch class clone const continue declare default " + + "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " + + "for foreach function global goto if implements interface instanceof namespace " + + "new or private protected public static switch throw trait try use var while xor " + + "die echo empty exit eval include include_once isset list require require_once return " + + "print unset __halt_compiler self static parent yield insteadof finally"; + var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__"; + var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count"; + CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" ")); + CodeMirror.registerHelper("wordChars", "php", /[\w$]/); + + var phpConfig = { + name: "clike", + helperType: "php", + keywords: keywords(phpKeywords), + blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"), + atoms: keywords(phpAtoms), + builtin: keywords(phpBuiltin), + multiLineStrings: true, + hooks: { + "$": function(stream) { + stream.eatWhile(/[\w\$_]/); + return "variable-2"; + }, + "<": function(stream, state) { + if (stream.match(/<", false)) stream.next(); + return "comment"; + }, + "/": function(stream) { + if (stream.eat("/")) { + while (!stream.eol() && !stream.match("?>", false)) stream.next(); + return "comment"; + } + return false; + }, + '"': function(_stream, state) { + (state.tokStack || (state.tokStack = [])).push('"', 0); + state.tokenize = stringWithEscapes('"'); + return "string"; + }, + "{": function(_stream, state) { + if (state.tokStack && state.tokStack.length) + state.tokStack[state.tokStack.length - 1]++; + return false; + }, + "}": function(_stream, state) { + if (state.tokStack && state.tokStack.length > 0 && + !--state.tokStack[state.tokStack.length - 1]) { + state.tokenize = stringWithEscapes(state.tokStack[state.tokStack.length - 2]); + } + return false; + } + } + }; + + CodeMirror.defineMode("php", function(config, parserConfig) { + var htmlMode = CodeMirror.getMode(config, "text/html"); + var phpMode = CodeMirror.getMode(config, phpConfig); + + function dispatch(stream, state) { + var isPHP = state.curMode == phpMode; + if (stream.sol() && state.pending && state.pending != '"' && state.pending != "'") state.pending = null; + if (!isPHP) { + if (stream.match(/^<\?\w*/)) { + state.curMode = phpMode; + state.curState = state.php; + return "meta"; + } + if (state.pending == '"' || state.pending == "'") { + while (!stream.eol() && stream.next() != state.pending) {} + var style = "string"; + } else if (state.pending && stream.pos < state.pending.end) { + stream.pos = state.pending.end; + var style = state.pending.style; + } else { + var style = htmlMode.token(stream, state.curState); + } + if (state.pending) state.pending = null; + var cur = stream.current(), openPHP = cur.search(/<\?/), m; + if (openPHP != -1) { + if (style == "string" && (m = cur.match(/[\'\"]$/)) && !/\?>/.test(cur)) state.pending = m[0]; + else state.pending = {end: stream.pos, style: style}; + stream.backUp(cur.length - openPHP); + } + return style; + } else if (isPHP && state.php.tokenize == null && stream.match("?>")) { + state.curMode = htmlMode; + state.curState = state.html; + return "meta"; + } else { + return phpMode.token(stream, state.curState); + } + } + + return { + startState: function() { + var html = CodeMirror.startState(htmlMode), php = CodeMirror.startState(phpMode); + return {html: html, + php: php, + curMode: parserConfig.startOpen ? phpMode : htmlMode, + curState: parserConfig.startOpen ? php : html, + pending: null}; + }, + + copyState: function(state) { + var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html), + php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur; + if (state.curMode == htmlMode) cur = htmlNew; + else cur = phpNew; + return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur, + pending: state.pending}; + }, + + token: dispatch, + + indent: function(state, textAfter) { + if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) || + (state.curMode == phpMode && /^\?>/.test(textAfter))) + return htmlMode.indent(state.html, textAfter); + return state.curMode.indent(state.curState, textAfter); + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//", + + innerMode: function(state) { return {state: state.curState, mode: state.curMode}; } + }; + }, "htmlmixed", "clike"); + + CodeMirror.defineMIME("application/x-httpd-php", "php"); + CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true}); + CodeMirror.defineMIME("text/x-php", phpConfig); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/php/test.js b/src/main/resources/templates/editor/lib/codemirror/mode/php/test.js new file mode 100644 index 0000000000000000000000000000000000000000..e2ecefc1875017dd5985799b47b375d631bbf766 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/php/test.js @@ -0,0 +1,154 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + var mode = CodeMirror.getMode({indentUnit: 2}, "php"); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + MT('simple_test', + '[meta ]'); + + MT('variable_interpolation_non_alphanumeric', + '[meta $/$\\$}$\\\"$:$;$?$|$[[$]]$+$=aaa"]', + '[meta ?>]'); + + MT('variable_interpolation_digits', + '[meta ]'); + + MT('variable_interpolation_simple_syntax_1', + '[meta ]'); + + MT('variable_interpolation_simple_syntax_2', + '[meta ]'); + + MT('variable_interpolation_simple_syntax_3', + '[meta [variable aaaaa][string .aaaaaa"];', + '[keyword echo] [string "aaa][variable-2 $aaaa][string ->][variable-2 $aaaaa][string .aaaaaa"];', + '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string [[2]].aaaaaa"];', + '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string ->aaaa2.aaaaaa"];', + '[meta ?>]'); + + MT('variable_interpolation_escaping', + '[meta aaa.aaa"];', + '[keyword echo] [string "aaa\\$aaaa[[2]]aaa.aaa"];', + '[keyword echo] [string "aaa\\$aaaa[[asd]]aaa.aaa"];', + '[keyword echo] [string "aaa{\\$aaaa->aaa.aaa"];', + '[keyword echo] [string "aaa{\\$aaaa[[2]]aaa.aaa"];', + '[keyword echo] [string "aaa{\\aaaaa[[asd]]aaa.aaa"];', + '[keyword echo] [string "aaa\\${aaaa->aaa.aaa"];', + '[keyword echo] [string "aaa\\${aaaa[[2]]aaa.aaa"];', + '[keyword echo] [string "aaa\\${aaaa[[asd]]aaa.aaa"];', + '[meta ?>]'); + + MT('variable_interpolation_complex_syntax_1', + '[meta aaa.aaa"];', + '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa]}[string ->aaa.aaa"];', + '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa][[',' [number 42]',']]}[string ->aaa.aaa"];', + '[keyword echo] [string "aaa][variable-2 $]{[variable aaaa][meta ?>]aaaaaa'); + + MT('variable_interpolation_complex_syntax_2', + '[meta } $aaaaaa.aaa"];', + '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*}?>*/][[',' [string "aaa][variable-2 $aaa][string {}][variable-2 $]{[variable aaa]}[string "]',']]}[string ->aaa.aaa"];', + '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*} } $aaa } */]}[string ->aaa.aaa"];'); + + + function build_recursive_monsters(nt, t, n){ + var monsters = [t]; + for (var i = 1; i <= n; ++i) + monsters[i] = nt.join(monsters[i - 1]); + return monsters; + } + + var m1 = build_recursive_monsters( + ['[string "][variable-2 $]{[variable aaa] [operator +] ', '}[string "]'], + '[comment /* }?>} */] [string "aaa][variable-2 $aaa][string .aaa"]', + 10 + ); + + MT('variable_interpolation_complex_syntax_3_1', + '[meta ]'); + + var m2 = build_recursive_monsters( + ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', '}[string .a"]'], + '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]', + 5 + ); + + MT('variable_interpolation_complex_syntax_3_2', + '[meta ]'); + + function build_recursive_monsters_2(mf1, mf2, nt, t, n){ + var monsters = [t]; + for (var i = 1; i <= n; ++i) + monsters[i] = nt[0] + mf1[i - 1] + nt[1] + mf2[i - 1] + nt[2] + monsters[i - 1] + nt[3]; + return monsters; + } + + var m3 = build_recursive_monsters_2( + m1, + m2, + ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', ' [operator +] ', '}[string .a"]'], + '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]', + 4 + ); + + MT('variable_interpolation_complex_syntax_3_3', + '[meta ]'); + + MT("variable_interpolation_heredoc", + "[meta + +CodeMirror: Pig Latin mode + + + + + + + + + +
        +

        Pig Latin mode

        +
        + + + +

        + Simple mode that handles Pig Latin language. +

        + +

        MIME type defined: text/x-pig + (PIG code) + +

        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/pig/pig.js b/src/main/resources/templates/editor/lib/codemirror/mode/pig/pig.js new file mode 100644 index 0000000000000000000000000000000000000000..c74b2cc866554138b511996a60888cff3668c7e5 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/pig/pig.js @@ -0,0 +1,188 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/* + * Pig Latin Mode for CodeMirror 2 + * @author Prasanth Jayachandran + * @link https://github.com/prasanthj/pig-codemirror-2 + * This implementation is adapted from PL/SQL mode in CodeMirror 2. + */ +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("pig", function(_config, parserConfig) { + var keywords = parserConfig.keywords, + builtins = parserConfig.builtins, + types = parserConfig.types, + multiLineStrings = parserConfig.multiLineStrings; + + var isOperatorChar = /[*+\-%<>=&?:\/!|]/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + var type; + function ret(tp, style) { + type = tp; + return style; + } + + function tokenComment(stream, state) { + var isEnd = false; + var ch; + while(ch = stream.next()) { + if(ch == "/" && isEnd) { + state.tokenize = tokenBase; + break; + } + isEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while((next = stream.next()) != null) { + if (next == quote && !escaped) { + end = true; break; + } + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return ret("string", "error"); + }; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + + // is a start of string? + if (ch == '"' || ch == "'") + return chain(stream, state, tokenString(ch)); + // is it one of the special chars + else if(/[\[\]{}\(\),;\.]/.test(ch)) + return ret(ch); + // is it a number? + else if(/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return ret("number", "number"); + } + // multi line comment or operator + else if (ch == "/") { + if (stream.eat("*")) { + return chain(stream, state, tokenComment); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // single line comment or operator + else if (ch=="-") { + if(stream.eat("-")){ + stream.skipToEnd(); + return ret("comment", "comment"); + } + else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // is it an operator + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + else { + // get the while word + stream.eatWhile(/[\w\$_]/); + // is it one of the listed keywords? + if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) { + if (stream.eat(")") || stream.eat(".")) { + //keywords can be used as variables like flatten(group), group.$0 etc.. + } + else { + return ("keyword", "keyword"); + } + } + // is it one of the builtin functions? + if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) + { + return ("keyword", "variable-2"); + } + // is it one of the listed types? + if (types && types.propertyIsEnumerable(stream.current().toUpperCase())) + return ("keyword", "variable-3"); + // default is a 'variable' + return ret("variable", "pig-word"); + } + } + + // Interface + return { + startState: function() { + return { + tokenize: tokenBase, + startOfLine: true + }; + }, + + token: function(stream, state) { + if(stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + } + }; +}); + +(function() { + function keywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + // builtin funcs taken from trunk revision 1303237 + var pBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL " + + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS " + + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG " + + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN " + + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER " + + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS " + + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA " + + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE " + + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG " + + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER "; + + // taken from QueryLexer.g + var pKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP " + + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL " + + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE " + + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE " + + "NEQ MATCHES TRUE FALSE DUMP"; + + // data types + var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP "; + + CodeMirror.defineMIME("text/x-pig", { + name: "pig", + builtins: keywords(pBuiltins), + keywords: keywords(pKeywords), + types: keywords(pTypes) + }); + + CodeMirror.registerHelper("hintWords", "pig", (pBuiltins + pTypes + pKeywords).split(" ")); +}()); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/properties/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/properties/index.html new file mode 100644 index 0000000000000000000000000000000000000000..f885302de21ce059911880e0c71e84a2ec6e1cc4 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/properties/index.html @@ -0,0 +1,53 @@ + + +CodeMirror: Properties files mode + + + + + + + + + +
        +

        Properties files mode

        +
        + + +

        MIME types defined: text/x-properties, + text/x-ini.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/properties/properties.js b/src/main/resources/templates/editor/lib/codemirror/mode/properties/properties.js new file mode 100644 index 0000000000000000000000000000000000000000..0740084209c10cec55b6b62c81ec32fc0bd3cabd --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/properties/properties.js @@ -0,0 +1,78 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("properties", function() { + return { + token: function(stream, state) { + var sol = stream.sol() || state.afterSection; + var eol = stream.eol(); + + state.afterSection = false; + + if (sol) { + if (state.nextMultiline) { + state.inMultiline = true; + state.nextMultiline = false; + } else { + state.position = "def"; + } + } + + if (eol && ! state.nextMultiline) { + state.inMultiline = false; + state.position = "def"; + } + + if (sol) { + while(stream.eatSpace()); + } + + var ch = stream.next(); + + if (sol && (ch === "#" || ch === "!" || ch === ";")) { + state.position = "comment"; + stream.skipToEnd(); + return "comment"; + } else if (sol && ch === "[") { + state.afterSection = true; + stream.skipTo("]"); stream.eat("]"); + return "header"; + } else if (ch === "=" || ch === ":") { + state.position = "quote"; + return null; + } else if (ch === "\\" && state.position === "quote") { + if (stream.next() !== "u") { // u = Unicode sequence \u1234 + // Multiline value + state.nextMultiline = true; + } + } + + return state.position; + }, + + startState: function() { + return { + position : "def", // Current position, "def", "quote" or "comment" + nextMultiline : false, // Is the next line multiline value + inMultiline : false, // Is the current line a multiline value + afterSection : false // Did we just open a section + }; + } + + }; +}); + +CodeMirror.defineMIME("text/x-properties", "properties"); +CodeMirror.defineMIME("text/x-ini", "properties"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/puppet/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/puppet/index.html new file mode 100644 index 0000000000000000000000000000000000000000..5614c3695ae6ea2e019319e7871ad7b5c53605cd --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/puppet/index.html @@ -0,0 +1,121 @@ + + +CodeMirror: Puppet mode + + + + + + + + + + +
        +

        Puppet mode

        +
        + + +

        MIME types defined: text/x-puppet.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/puppet/puppet.js b/src/main/resources/templates/editor/lib/codemirror/mode/puppet/puppet.js new file mode 100644 index 0000000000000000000000000000000000000000..e7f799f78a3de993190c6a8809efa0e3b3d04303 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/puppet/puppet.js @@ -0,0 +1,220 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("puppet", function () { + // Stores the words from the define method + var words = {}; + // Taken, mostly, from the Puppet official variable standards regex + var variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/; + + // Takes a string of words separated by spaces and adds them as + // keys with the value of the first argument 'style' + function define(style, string) { + var split = string.split(' '); + for (var i = 0; i < split.length; i++) { + words[split[i]] = style; + } + } + + // Takes commonly known puppet types/words and classifies them to a style + define('keyword', 'class define site node include import inherits'); + define('keyword', 'case if else in and elsif default or'); + define('atom', 'false true running present absent file directory undef'); + define('builtin', 'action augeas burst chain computer cron destination dport exec ' + + 'file filebucket group host icmp iniface interface jump k5login limit log_level ' + + 'log_prefix macauthorization mailalias maillist mcx mount nagios_command ' + + 'nagios_contact nagios_contactgroup nagios_host nagios_hostdependency ' + + 'nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service ' + + 'nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo ' + + 'nagios_servicegroup nagios_timeperiod name notify outiface package proto reject ' + + 'resources router schedule scheduled_task selboolean selmodule service source ' + + 'sport ssh_authorized_key sshkey stage state table tidy todest toports tosource ' + + 'user vlan yumrepo zfs zone zpool'); + + // After finding a start of a string ('|") this function attempts to find the end; + // If a variable is encountered along the way, we display it differently when it + // is encapsulated in a double-quoted string. + function tokenString(stream, state) { + var current, prev, found_var = false; + while (!stream.eol() && (current = stream.next()) != state.pending) { + if (current === '$' && prev != '\\' && state.pending == '"') { + found_var = true; + break; + } + prev = current; + } + if (found_var) { + stream.backUp(1); + } + if (current == state.pending) { + state.continueString = false; + } else { + state.continueString = true; + } + return "string"; + } + + // Main function + function tokenize(stream, state) { + // Matches one whole word + var word = stream.match(/[\w]+/, false); + // Matches attributes (i.e. ensure => present ; 'ensure' would be matched) + var attribute = stream.match(/(\s+)?\w+\s+=>.*/, false); + // Matches non-builtin resource declarations + // (i.e. "apache::vhost {" or "mycustomclasss {" would be matched) + var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false); + // Matches virtual and exported resources (i.e. @@user { ; and the like) + var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false); + + // Finally advance the stream + var ch = stream.next(); + + // Have we found a variable? + if (ch === '$') { + if (stream.match(variable_regex)) { + // If so, and its in a string, assign it a different color + return state.continueString ? 'variable-2' : 'variable'; + } + // Otherwise return an invalid variable + return "error"; + } + // Should we still be looking for the end of a string? + if (state.continueString) { + // If so, go through the loop again + stream.backUp(1); + return tokenString(stream, state); + } + // Are we in a definition (class, node, define)? + if (state.inDefinition) { + // If so, return def (i.e. for 'class myclass {' ; 'myclass' would be matched) + if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) { + return 'def'; + } + // Match the rest it the next time around + stream.match(/\s+{/); + state.inDefinition = false; + } + // Are we in an 'include' statement? + if (state.inInclude) { + // Match and return the included class + stream.match(/(\s+)?\S+(\s+)?/); + state.inInclude = false; + return 'def'; + } + // Do we just have a function on our hands? + // In 'ensure_resource("myclass")', 'ensure_resource' is matched + if (stream.match(/(\s+)?\w+\(/)) { + stream.backUp(1); + return 'def'; + } + // Have we matched the prior attribute regex? + if (attribute) { + stream.match(/(\s+)?\w+/); + return 'tag'; + } + // Do we have Puppet specific words? + if (word && words.hasOwnProperty(word)) { + // Negates the initial next() + stream.backUp(1); + // Acutally move the stream + stream.match(/[\w]+/); + // We want to process these words differently + // do to the importance they have in Puppet + if (stream.match(/\s+\S+\s+{/, false)) { + state.inDefinition = true; + } + if (word == 'include') { + state.inInclude = true; + } + // Returns their value as state in the prior define methods + return words[word]; + } + // Is there a match on a reference? + if (/(^|\s+)[A-Z][\w:_]+/.test(word)) { + // Negate the next() + stream.backUp(1); + // Match the full reference + stream.match(/(^|\s+)[A-Z][\w:_]+/); + return 'def'; + } + // Have we matched the prior resource regex? + if (resource) { + stream.match(/(\s+)?[\w:_]+/); + return 'def'; + } + // Have we matched the prior special_resource regex? + if (special_resource) { + stream.match(/(\s+)?[@]{1,2}/); + return 'special'; + } + // Match all the comments. All of them. + if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } + // Have we found a string? + if (ch == "'" || ch == '"') { + // Store the type (single or double) + state.pending = ch; + // Perform the looping function to find the end + return tokenString(stream, state); + } + // Match all the brackets + if (ch == '{' || ch == '}') { + return 'bracket'; + } + // Match characters that we are going to assume + // are trying to be regex + if (ch == '/') { + stream.match(/.*?\//); + return 'variable-3'; + } + // Match all the numbers + if (ch.match(/[0-9]/)) { + stream.eatWhile(/[0-9]+/); + return 'number'; + } + // Match the '=' and '=>' operators + if (ch == '=') { + if (stream.peek() == '>') { + stream.next(); + } + return "operator"; + } + // Keep advancing through all the rest + stream.eatWhile(/[\w-]/); + // Return a blank line for everything else + return null; + } + // Start it all + return { + startState: function () { + var state = {}; + state.inDefinition = false; + state.inInclude = false; + state.continueString = false; + state.pending = false; + return state; + }, + token: function (stream, state) { + // Strip the spaces, but regex will account for them eitherway + if (stream.eatSpace()) return null; + // Go through the main process + return tokenize(stream, state); + } + }; +}); + +CodeMirror.defineMIME("text/x-puppet", "puppet"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/python/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/python/index.html new file mode 100644 index 0000000000000000000000000000000000000000..86eb3d52f78802703a52972182dd28120c22cb2b --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/python/index.html @@ -0,0 +1,198 @@ + + +CodeMirror: Python mode + + + + + + + + + + +
        +

        Python mode

        + +
        + + +

        Cython mode

        + +
        + + +

        Configuration Options for Python mode:

        +
          +
        • version - 2/3 - The version of Python to recognize. Default is 2.
        • +
        • singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.
        • +
        • hangingIndent - int - If you want to write long arguments to a function starting on a new line, how much that line should be indented. Defaults to one normal indentation unit.
        • +
        +

        Advanced Configuration Options:

        +

        Usefull for superset of python syntax like Enthought enaml, IPython magics and questionmark help

        +
          +
        • singleOperators - RegEx - Regular Expression for single operator matching, default :
          ^[\\+\\-\\*/%&|\\^~<>!]
          including
          @
          on Python 3
        • +
        • singleDelimiters - RegEx - Regular Expression for single delimiter matching, default :
          ^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]
        • +
        • doubleOperators - RegEx - Regular Expression for double operators matching, default :
          ^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))
        • +
        • doubleDelimiters - RegEx - Regular Expressoin for double delimiters matching, default :
          ^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))
        • +
        • tripleDelimiters - RegEx - Regular Expression for triple delimiters matching, default :
          ^((//=)|(>>=)|(<<=)|(\\*\\*=))
        • +
        • identifiers - RegEx - Regular Expression for identifier, default :
          ^[_A-Za-z][_A-Za-z0-9]*
          on Python 2 and
          ^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*
          on Python 3.
        • +
        • extra_keywords - list of string - List of extra words ton consider as keywords
        • +
        • extra_builtins - list of string - List of extra words ton consider as builtins
        • +
        + + +

        MIME types defined: text/x-python and text/x-cython.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/python/python.js b/src/main/resources/templates/editor/lib/codemirror/mode/python/python.js new file mode 100644 index 0000000000000000000000000000000000000000..98c0409ae2e014b8df8c4c928fd31b8e27f0235e --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/python/python.js @@ -0,0 +1,359 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); + } + + var wordOperators = wordRegexp(["and", "or", "not", "is"]); + var commonKeywords = ["as", "assert", "break", "class", "continue", + "def", "del", "elif", "else", "except", "finally", + "for", "from", "global", "if", "import", + "lambda", "pass", "raise", "return", + "try", "while", "with", "yield", "in"]; + var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr", + "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod", + "enumerate", "eval", "filter", "float", "format", "frozenset", + "getattr", "globals", "hasattr", "hash", "help", "hex", "id", + "input", "int", "isinstance", "issubclass", "iter", "len", + "list", "locals", "map", "max", "memoryview", "min", "next", + "object", "oct", "open", "ord", "pow", "property", "range", + "repr", "reversed", "round", "set", "setattr", "slice", + "sorted", "staticmethod", "str", "sum", "super", "tuple", + "type", "vars", "zip", "__import__", "NotImplemented", + "Ellipsis", "__debug__"]; + var py2 = {builtins: ["apply", "basestring", "buffer", "cmp", "coerce", "execfile", + "file", "intern", "long", "raw_input", "reduce", "reload", + "unichr", "unicode", "xrange", "False", "True", "None"], + keywords: ["exec", "print"]}; + var py3 = {builtins: ["ascii", "bytes", "exec", "print"], + keywords: ["nonlocal", "False", "True", "None"]}; + + CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins)); + + function top(state) { + return state.scopes[state.scopes.length - 1]; + } + + CodeMirror.defineMode("python", function(conf, parserConf) { + var ERRORCLASS = "error"; + + var singleDelimiters = parserConf.singleDelimiters || new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"); + var doubleOperators = parserConf.doubleOperators || new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); + var doubleDelimiters = parserConf.doubleDelimiters || new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); + var tripleDelimiters = parserConf.tripleDelimiters || new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); + + if (parserConf.version && parseInt(parserConf.version, 10) == 3){ + // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator + var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]"); + var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"); + } else { + var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"); + var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); + } + + var hangingIndent = parserConf.hangingIndent || conf.indentUnit; + + var myKeywords = commonKeywords, myBuiltins = commonBuiltins; + if(parserConf.extra_keywords != undefined){ + myKeywords = myKeywords.concat(parserConf.extra_keywords); + } + if(parserConf.extra_builtins != undefined){ + myBuiltins = myBuiltins.concat(parserConf.extra_builtins); + } + if (parserConf.version && parseInt(parserConf.version, 10) == 3) { + myKeywords = myKeywords.concat(py3.keywords); + myBuiltins = myBuiltins.concat(py3.builtins); + var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i"); + } else { + myKeywords = myKeywords.concat(py2.keywords); + myBuiltins = myBuiltins.concat(py2.builtins); + var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i"); + } + var keywords = wordRegexp(myKeywords); + var builtins = wordRegexp(myBuiltins); + + // tokenizers + function tokenBase(stream, state) { + // Handle scope changes + if (stream.sol() && top(state).type == "py") { + var scopeOffset = top(state).offset; + if (stream.eatSpace()) { + var lineOffset = stream.indentation(); + if (lineOffset > scopeOffset) + pushScope(stream, state, "py"); + else if (lineOffset < scopeOffset && dedent(stream, state)) + state.errorToken = true; + return null; + } else { + var style = tokenBaseInner(stream, state); + if (scopeOffset > 0 && dedent(stream, state)) + style += " " + ERRORCLASS; + return style; + } + } + return tokenBaseInner(stream, state); + } + + function tokenBaseInner(stream, state) { + if (stream.eatSpace()) return null; + + var ch = stream.peek(); + + // Handle Comments + if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } + + // Handle Number Literals + if (stream.match(/^[0-9\.]/, false)) { + var floatLiteral = false; + // Floats + if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; } + if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; } + if (stream.match(/^\.\d+/)) { floatLiteral = true; } + if (floatLiteral) { + // Float literals may be "imaginary" + stream.eat(/J/i); + return "number"; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^0x[0-9a-f]+/i)) intLiteral = true; + // Binary + if (stream.match(/^0b[01]+/i)) intLiteral = true; + // Octal + if (stream.match(/^0o[0-7]+/i)) intLiteral = true; + // Decimal + if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { + // Decimal literals may be "imaginary" + stream.eat(/J/i); + // TODO - Can you have imaginary longs? + intLiteral = true; + } + // Zero by itself with no other piece of number. + if (stream.match(/^0(?![\dx])/i)) intLiteral = true; + if (intLiteral) { + // Integer literals may be "long" + stream.eat(/L/i); + return "number"; + } + } + + // Handle Strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenStringFactory(stream.current()); + return state.tokenize(stream, state); + } + + // Handle operators and Delimiters + if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) + return null; + + if (stream.match(doubleOperators) + || stream.match(singleOperators) + || stream.match(wordOperators)) + return "operator"; + + if (stream.match(singleDelimiters)) + return null; + + if (stream.match(keywords)) + return "keyword"; + + if (stream.match(builtins)) + return "builtin"; + + if (stream.match(/^(self|cls)\b/)) + return "variable-2"; + + if (stream.match(identifiers)) { + if (state.lastToken == "def" || state.lastToken == "class") + return "def"; + return "variable"; + } + + // Handle non-detected items + stream.next(); + return ERRORCLASS; + } + + function tokenStringFactory(delimiter) { + while ("rub".indexOf(delimiter.charAt(0).toLowerCase()) >= 0) + delimiter = delimiter.substr(1); + + var singleline = delimiter.length == 1; + var OUTCLASS = "string"; + + function tokenString(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"\\]/); + if (stream.eat("\\")) { + stream.next(); + if (singleline && stream.eol()) + return OUTCLASS; + } else if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) + return ERRORCLASS; + else + state.tokenize = tokenBase; + } + return OUTCLASS; + } + tokenString.isString = true; + return tokenString; + } + + function pushScope(stream, state, type) { + var offset = 0, align = null; + if (type == "py") { + while (top(state).type != "py") + state.scopes.pop(); + } + offset = top(state).offset + (type == "py" ? conf.indentUnit : hangingIndent); + if (type != "py" && !stream.match(/^(\s|#.*)*$/, false)) + align = stream.column() + 1; + state.scopes.push({offset: offset, type: type, align: align}); + } + + function dedent(stream, state) { + var indented = stream.indentation(); + while (top(state).offset > indented) { + if (top(state).type != "py") return true; + state.scopes.pop(); + } + return top(state).offset != indented; + } + + function tokenLexer(stream, state) { + var style = state.tokenize(stream, state); + var current = stream.current(); + + // Handle '.' connected identifiers + if (current == ".") { + style = stream.match(identifiers, false) ? null : ERRORCLASS; + if (style == null && state.lastStyle == "meta") { + // Apply 'meta' style to '.' connected identifiers when + // appropriate. + style = "meta"; + } + return style; + } + + // Handle decorators + if (current == "@"){ + if(parserConf.version && parseInt(parserConf.version, 10) == 3){ + return stream.match(identifiers, false) ? "meta" : "operator"; + } else { + return stream.match(identifiers, false) ? "meta" : ERRORCLASS; + } + } + + if ((style == "variable" || style == "builtin") + && state.lastStyle == "meta") + style = "meta"; + + // Handle scope changes. + if (current == "pass" || current == "return") + state.dedent += 1; + + if (current == "lambda") state.lambda = true; + if (current == ":" && !state.lambda && top(state).type == "py") + pushScope(stream, state, "py"); + + var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1; + if (delimiter_index != -1) + pushScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1)); + + delimiter_index = "])}".indexOf(current); + if (delimiter_index != -1) { + if (top(state).type == current) state.scopes.pop(); + else return ERRORCLASS; + } + if (state.dedent > 0 && stream.eol() && top(state).type == "py") { + if (state.scopes.length > 1) state.scopes.pop(); + state.dedent -= 1; + } + + return style; + } + + var external = { + startState: function(basecolumn) { + return { + tokenize: tokenBase, + scopes: [{offset: basecolumn || 0, type: "py", align: null}], + lastStyle: null, + lastToken: null, + lambda: false, + dedent: 0 + }; + }, + + token: function(stream, state) { + var addErr = state.errorToken; + if (addErr) state.errorToken = false; + var style = tokenLexer(stream, state); + + state.lastStyle = style; + + var current = stream.current(); + if (current && style) + state.lastToken = current; + + if (stream.eol() && state.lambda) + state.lambda = false; + return addErr ? style + " " + ERRORCLASS : style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase) + return state.tokenize.isString ? CodeMirror.Pass : 0; + + var scope = top(state); + var closing = textAfter && textAfter.charAt(0) == scope.type; + if (scope.align != null) + return scope.align - (closing ? 1 : 0); + else if (closing && state.scopes.length > 1) + return state.scopes[state.scopes.length - 2].offset; + else + return scope.offset; + }, + + lineComment: "#", + fold: "indent" + }; + return external; + }); + + CodeMirror.defineMIME("text/x-python", "python"); + + var words = function(str) { return str.split(" "); }; + + CodeMirror.defineMIME("text/x-cython", { + name: "python", + extra_keywords: words("by cdef cimport cpdef ctypedef enum except"+ + "extern gil include nogil property public"+ + "readonly struct union DEF IF ELIF ELSE") + }); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/q/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/q/index.html new file mode 100644 index 0000000000000000000000000000000000000000..72785ba3bf54d5f94d9400b29e65b453d56fd334 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/q/index.html @@ -0,0 +1,144 @@ + + +CodeMirror: Q mode + + + + + + + + + + +
        +

        Q mode

        + + +
        + + + +

        MIME type defined: text/x-q.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/q/q.js b/src/main/resources/templates/editor/lib/codemirror/mode/q/q.js new file mode 100644 index 0000000000000000000000000000000000000000..a4af9383e7b3b4a759417e3bd1b0fe713dc28a8c --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/q/q.js @@ -0,0 +1,139 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("q",function(config){ + var indentUnit=config.indentUnit, + curPunc, + keywords=buildRE(["abs","acos","aj","aj0","all","and","any","asc","asin","asof","atan","attr","avg","avgs","bin","by","ceiling","cols","cor","cos","count","cov","cross","csv","cut","delete","deltas","desc","dev","differ","distinct","div","do","each","ej","enlist","eval","except","exec","exit","exp","fby","fills","first","fkeys","flip","floor","from","get","getenv","group","gtime","hclose","hcount","hdel","hopen","hsym","iasc","idesc","if","ij","in","insert","inter","inv","key","keys","last","like","list","lj","load","log","lower","lsq","ltime","ltrim","mavg","max","maxs","mcount","md5","mdev","med","meta","min","mins","mmax","mmin","mmu","mod","msum","neg","next","not","null","or","over","parse","peach","pj","plist","prd","prds","prev","prior","rand","rank","ratios","raze","read0","read1","reciprocal","reverse","rload","rotate","rsave","rtrim","save","scan","select","set","setenv","show","signum","sin","sqrt","ss","ssr","string","sublist","sum","sums","sv","system","tables","tan","til","trim","txf","type","uj","ungroup","union","update","upper","upsert","value","var","view","views","vs","wavg","where","where","while","within","wj","wj1","wsum","xasc","xbar","xcol","xcols","xdesc","xexp","xgroup","xkey","xlog","xprev","xrank"]), + E=/[|/&^!+:\\\-*%$=~#;@><,?_\'\"\[\(\]\)\s{}]/; + function buildRE(w){return new RegExp("^("+w.join("|")+")$");} + function tokenBase(stream,state){ + var sol=stream.sol(),c=stream.next(); + curPunc=null; + if(sol) + if(c=="/") + return(state.tokenize=tokenLineComment)(stream,state); + else if(c=="\\"){ + if(stream.eol()||/\s/.test(stream.peek())) + return stream.skipToEnd(),/^\\\s*$/.test(stream.current())?(state.tokenize=tokenCommentToEOF)(stream, state):state.tokenize=tokenBase,"comment"; + else + return state.tokenize=tokenBase,"builtin"; + } + if(/\s/.test(c)) + return stream.peek()=="/"?(stream.skipToEnd(),"comment"):"whitespace"; + if(c=='"') + return(state.tokenize=tokenString)(stream,state); + if(c=='`') + return stream.eatWhile(/[A-Z|a-z|\d|_|:|\/|\.]/),"symbol"; + if(("."==c&&/\d/.test(stream.peek()))||/\d/.test(c)){ + var t=null; + stream.backUp(1); + if(stream.match(/^\d{4}\.\d{2}(m|\.\d{2}([D|T](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/) + || stream.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/) + || stream.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/) + || stream.match(/^\d+[ptuv]{1}/)) + t="temporal"; + else if(stream.match(/^0[NwW]{1}/) + || stream.match(/^0x[\d|a-f|A-F]*/) + || stream.match(/^[0|1]+[b]{1}/) + || stream.match(/^\d+[chijn]{1}/) + || stream.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/)) + t="number"; + return(t&&(!(c=stream.peek())||E.test(c)))?t:(stream.next(),"error"); + } + if(/[A-Z|a-z]|\./.test(c)) + return stream.eatWhile(/[A-Z|a-z|\.|_|\d]/),keywords.test(stream.current())?"keyword":"variable"; + if(/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(c)) + return null; + if(/[{}\(\[\]\)]/.test(c)) + return null; + return"error"; + } + function tokenLineComment(stream,state){ + return stream.skipToEnd(),/\/\s*$/.test(stream.current())?(state.tokenize=tokenBlockComment)(stream,state):(state.tokenize=tokenBase),"comment"; + } + function tokenBlockComment(stream,state){ + var f=stream.sol()&&stream.peek()=="\\"; + stream.skipToEnd(); + if(f&&/^\\\s*$/.test(stream.current())) + state.tokenize=tokenBase; + return"comment"; + } + function tokenCommentToEOF(stream){return stream.skipToEnd(),"comment";} + function tokenString(stream,state){ + var escaped=false,next,end=false; + while((next=stream.next())){ + if(next=="\""&&!escaped){end=true;break;} + escaped=!escaped&&next=="\\"; + } + if(end)state.tokenize=tokenBase; + return"string"; + } + function pushContext(state,type,col){state.context={prev:state.context,indent:state.indent,col:col,type:type};} + function popContext(state){state.indent=state.context.indent;state.context=state.context.prev;} + return{ + startState:function(){ + return{tokenize:tokenBase, + context:null, + indent:0, + col:0}; + }, + token:function(stream,state){ + if(stream.sol()){ + if(state.context&&state.context.align==null) + state.context.align=false; + state.indent=stream.indentation(); + } + //if (stream.eatSpace()) return null; + var style=state.tokenize(stream,state); + if(style!="comment"&&state.context&&state.context.align==null&&state.context.type!="pattern"){ + state.context.align=true; + } + if(curPunc=="(")pushContext(state,")",stream.column()); + else if(curPunc=="[")pushContext(state,"]",stream.column()); + else if(curPunc=="{")pushContext(state,"}",stream.column()); + else if(/[\]\}\)]/.test(curPunc)){ + while(state.context&&state.context.type=="pattern")popContext(state); + if(state.context&&curPunc==state.context.type)popContext(state); + } + else if(curPunc=="."&&state.context&&state.context.type=="pattern")popContext(state); + else if(/atom|string|variable/.test(style)&&state.context){ + if(/[\}\]]/.test(state.context.type)) + pushContext(state,"pattern",stream.column()); + else if(state.context.type=="pattern"&&!state.context.align){ + state.context.align=true; + state.context.col=stream.column(); + } + } + return style; + }, + indent:function(state,textAfter){ + var firstChar=textAfter&&textAfter.charAt(0); + var context=state.context; + if(/[\]\}]/.test(firstChar)) + while (context&&context.type=="pattern")context=context.prev; + var closing=context&&firstChar==context.type; + if(!context) + return 0; + else if(context.type=="pattern") + return context.col; + else if(context.align) + return context.col+(closing?0:1); + else + return context.indent+(closing?0:indentUnit); + } + }; +}); +CodeMirror.defineMIME("text/x-q","q"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/r/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/r/index.html new file mode 100644 index 0000000000000000000000000000000000000000..6dd9634659dc1b69feb517bbe447ef4d73a05cef --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/r/index.html @@ -0,0 +1,85 @@ + + +CodeMirror: R mode + + + + + + + + + +
        +

        R mode

        +
        + + +

        MIME types defined: text/x-rsrc.

        + +

        Development of the CodeMirror R mode was kindly sponsored + by Ubalo.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/r/r.js b/src/main/resources/templates/editor/lib/codemirror/mode/r/r.js new file mode 100644 index 0000000000000000000000000000000000000000..1ab4a9565ac632f626ca2e285995be064d9e8080 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/r/r.js @@ -0,0 +1,162 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("r", function(config) { + function wordObj(str) { + var words = str.split(" "), res = {}; + for (var i = 0; i < words.length; ++i) res[words[i]] = true; + return res; + } + var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"); + var builtins = wordObj("list quote bquote eval return call parse deparse"); + var keywords = wordObj("if else repeat while function for in next break"); + var blockkeywords = wordObj("if else repeat while function for"); + var opChars = /[+\-*\/^<>=!&|~$:]/; + var curPunc; + + function tokenBase(stream, state) { + curPunc = null; + var ch = stream.next(); + if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } else if (ch == "0" && stream.eat("x")) { + stream.eatWhile(/[\da-f]/i); + return "number"; + } else if (ch == "." && stream.eat(/\d/)) { + stream.match(/\d*(?:e[+\-]?\d+)?/); + return "number"; + } else if (/\d/.test(ch)) { + stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/); + return "number"; + } else if (ch == "'" || ch == '"') { + state.tokenize = tokenString(ch); + return "string"; + } else if (ch == "." && stream.match(/.[.\d]+/)) { + return "keyword"; + } else if (/[\w\.]/.test(ch) && ch != "_") { + stream.eatWhile(/[\w\.]/); + var word = stream.current(); + if (atoms.propertyIsEnumerable(word)) return "atom"; + if (keywords.propertyIsEnumerable(word)) { + // Block keywords start new blocks, except 'else if', which only starts + // one new block for the 'if', no block for the 'else'. + if (blockkeywords.propertyIsEnumerable(word) && + !stream.match(/\s*if(\s+|$)/, false)) + curPunc = "block"; + return "keyword"; + } + if (builtins.propertyIsEnumerable(word)) return "builtin"; + return "variable"; + } else if (ch == "%") { + if (stream.skipTo("%")) stream.next(); + return "variable-2"; + } else if (ch == "<" && stream.eat("-")) { + return "arrow"; + } else if (ch == "=" && state.ctx.argList) { + return "arg-is"; + } else if (opChars.test(ch)) { + if (ch == "$") return "dollar"; + stream.eatWhile(opChars); + return "operator"; + } else if (/[\(\){}\[\];]/.test(ch)) { + curPunc = ch; + if (ch == ";") return "semi"; + return null; + } else { + return null; + } + } + + function tokenString(quote) { + return function(stream, state) { + if (stream.eat("\\")) { + var ch = stream.next(); + if (ch == "x") stream.match(/^[a-f0-9]{2}/i); + else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next(); + else if (ch == "u") stream.match(/^[a-f0-9]{4}/i); + else if (ch == "U") stream.match(/^[a-f0-9]{8}/i); + else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/); + return "string-2"; + } else { + var next; + while ((next = stream.next()) != null) { + if (next == quote) { state.tokenize = tokenBase; break; } + if (next == "\\") { stream.backUp(1); break; } + } + return "string"; + } + }; + } + + function push(state, type, stream) { + state.ctx = {type: type, + indent: state.indent, + align: null, + column: stream.column(), + prev: state.ctx}; + } + function pop(state) { + state.indent = state.ctx.indent; + state.ctx = state.ctx.prev; + } + + return { + startState: function() { + return {tokenize: tokenBase, + ctx: {type: "top", + indent: -config.indentUnit, + align: false}, + indent: 0, + afterIdent: false}; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (state.ctx.align == null) state.ctx.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + if (style != "comment" && state.ctx.align == null) state.ctx.align = true; + + var ctype = state.ctx.type; + if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state); + if (curPunc == "{") push(state, "}", stream); + else if (curPunc == "(") { + push(state, ")", stream); + if (state.afterIdent) state.ctx.argList = true; + } + else if (curPunc == "[") push(state, "]", stream); + else if (curPunc == "block") push(state, "block", stream); + else if (curPunc == ctype) pop(state); + state.afterIdent = style == "variable" || style == "keyword"; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx, + closing = firstChar == ctx.type; + if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit); + else if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indent + (closing ? 0 : config.indentUnit); + }, + + lineComment: "#" + }; +}); + +CodeMirror.defineMIME("text/x-rsrc", "r"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/rpm/changes/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/rpm/changes/index.html new file mode 100644 index 0000000000000000000000000000000000000000..6e5031bd1f55f5131753103eeaa39db765503450 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/rpm/changes/index.html @@ -0,0 +1,66 @@ + + +CodeMirror: RPM changes mode + + + + + + + + + + + +
        +

        RPM changes mode

        + +
        + + +

        MIME types defined: text/x-rpm-changes.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/rpm/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/rpm/index.html new file mode 100644 index 0000000000000000000000000000000000000000..9a34e6dfb8958f4820138571cd5c54a8acb9c3a3 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/rpm/index.html @@ -0,0 +1,149 @@ + + +CodeMirror: RPM changes mode + + + + + + + + + + + +
        +

        RPM changes mode

        + +
        + + +

        RPM spec mode

        + +
        + + +

        MIME types defined: text/x-rpm-spec, text/x-rpm-changes.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/rpm/rpm.js b/src/main/resources/templates/editor/lib/codemirror/mode/rpm/rpm.js new file mode 100644 index 0000000000000000000000000000000000000000..3bb7cd2f62abc19690a75ed1cfd56ff23c4c01cf --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/rpm/rpm.js @@ -0,0 +1,101 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("rpm-changes", function() { + var headerSeperator = /^-+$/; + var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; + var simpleEmail = /^[\w+.-]+@[\w.-]+/; + + return { + token: function(stream) { + if (stream.sol()) { + if (stream.match(headerSeperator)) { return 'tag'; } + if (stream.match(headerLine)) { return 'tag'; } + } + if (stream.match(simpleEmail)) { return 'string'; } + stream.next(); + return null; + } + }; +}); + +CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes"); + +// Quick and dirty spec file highlighting + +CodeMirror.defineMode("rpm-spec", function() { + var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/; + + var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/; + var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/; + var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros + var control_flow_simple = /^%(else|endif)/; // rpm control flow macros + var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros + + return { + startState: function () { + return { + controlFlow: false, + macroParameters: false, + section: false + }; + }, + token: function (stream, state) { + var ch = stream.peek(); + if (ch == "#") { stream.skipToEnd(); return "comment"; } + + if (stream.sol()) { + if (stream.match(preamble)) { return "preamble"; } + if (stream.match(section)) { return "section"; } + } + + if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT' + if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}' + + if (stream.match(control_flow_simple)) { return "keyword"; } + if (stream.match(control_flow_complex)) { + state.controlFlow = true; + return "keyword"; + } + if (state.controlFlow) { + if (stream.match(operators)) { return "operator"; } + if (stream.match(/^(\d+)/)) { return "number"; } + if (stream.eol()) { state.controlFlow = false; } + } + + if (stream.match(arch)) { return "number"; } + + // Macros like '%make_install' or '%attr(0775,root,root)' + if (stream.match(/^%[\w]+/)) { + if (stream.match(/^\(/)) { state.macroParameters = true; } + return "macro"; + } + if (state.macroParameters) { + if (stream.match(/^\d+/)) { return "number";} + if (stream.match(/^\)/)) { + state.macroParameters = false; + return "macro"; + } + } + if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}' + + //TODO: Include bash script sub-parser (CodeMirror supports that) + stream.next(); + return null; + } + }; +}); + +CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/rst/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/rst/index.html new file mode 100644 index 0000000000000000000000000000000000000000..2902dea2312d7bf2b6de68d62df400e20198cd23 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/rst/index.html @@ -0,0 +1,535 @@ + + +CodeMirror: reStructuredText mode + + + + + + + + + + +
        +

        reStructuredText mode

        +
        + + +

        + The python mode will be used for highlighting blocks + containing Python/IPython terminal sessions: blocks starting with + >>> (for Python) or In [num]: (for + IPython). + + Further, the stex mode will be used for highlighting + blocks containing LaTex code. +

        + +

        MIME types defined: text/x-rst.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/rst/rst.js b/src/main/resources/templates/editor/lib/codemirror/mode/rst/rst.js new file mode 100644 index 0000000000000000000000000000000000000000..bcf110c1a5331f06105a24b06621ce5aeb935ec0 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/rst/rst.js @@ -0,0 +1,557 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../python/python"), require("../stex/stex"), require("../../addon/mode/overlay")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../python/python", "../stex/stex", "../../addon/mode/overlay"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode('rst', function (config, options) { + + var rx_strong = /^\*\*[^\*\s](?:[^\*]*[^\*\s])?\*\*/; + var rx_emphasis = /^\*[^\*\s](?:[^\*]*[^\*\s])?\*/; + var rx_literal = /^``[^`\s](?:[^`]*[^`\s])``/; + + var rx_number = /^(?:[\d]+(?:[\.,]\d+)*)/; + var rx_positive = /^(?:\s\+[\d]+(?:[\.,]\d+)*)/; + var rx_negative = /^(?:\s\-[\d]+(?:[\.,]\d+)*)/; + + var rx_uri_protocol = "[Hh][Tt][Tt][Pp][Ss]?://"; + var rx_uri_domain = "(?:[\\d\\w.-]+)\\.(?:\\w{2,6})"; + var rx_uri_path = "(?:/[\\d\\w\\#\\%\\&\\-\\.\\,\\/\\:\\=\\?\\~]+)*"; + var rx_uri = new RegExp("^" + rx_uri_protocol + rx_uri_domain + rx_uri_path); + + var overlay = { + token: function (stream) { + + if (stream.match(rx_strong) && stream.match (/\W+|$/, false)) + return 'strong'; + if (stream.match(rx_emphasis) && stream.match (/\W+|$/, false)) + return 'em'; + if (stream.match(rx_literal) && stream.match (/\W+|$/, false)) + return 'string-2'; + if (stream.match(rx_number)) + return 'number'; + if (stream.match(rx_positive)) + return 'positive'; + if (stream.match(rx_negative)) + return 'negative'; + if (stream.match(rx_uri)) + return 'link'; + + while (stream.next() != null) { + if (stream.match(rx_strong, false)) break; + if (stream.match(rx_emphasis, false)) break; + if (stream.match(rx_literal, false)) break; + if (stream.match(rx_number, false)) break; + if (stream.match(rx_positive, false)) break; + if (stream.match(rx_negative, false)) break; + if (stream.match(rx_uri, false)) break; + } + + return null; + } + }; + + var mode = CodeMirror.getMode( + config, options.backdrop || 'rst-base' + ); + + return CodeMirror.overlayMode(mode, overlay, true); // combine +}, 'python', 'stex'); + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +CodeMirror.defineMode('rst-base', function (config) { + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function format(string) { + var args = Array.prototype.slice.call(arguments, 1); + return string.replace(/{(\d+)}/g, function (match, n) { + return typeof args[n] != 'undefined' ? args[n] : match; + }); + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + var mode_python = CodeMirror.getMode(config, 'python'); + var mode_stex = CodeMirror.getMode(config, 'stex'); + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + var SEPA = "\\s+"; + var TAIL = "(?:\\s*|\\W|$)", + rx_TAIL = new RegExp(format('^{0}', TAIL)); + + var NAME = + "(?:[^\\W\\d_](?:[\\w!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)", + rx_NAME = new RegExp(format('^{0}', NAME)); + var NAME_WWS = + "(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)"; + var REF_NAME = format('(?:{0}|`{1}`)', NAME, NAME_WWS); + + var TEXT1 = "(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)"; + var TEXT2 = "(?:[^\\`]+)", + rx_TEXT2 = new RegExp(format('^{0}', TEXT2)); + + var rx_section = new RegExp( + "^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$"); + var rx_explicit = new RegExp( + format('^\\.\\.{0}', SEPA)); + var rx_link = new RegExp( + format('^_{0}:{1}|^__:{1}', REF_NAME, TAIL)); + var rx_directive = new RegExp( + format('^{0}::{1}', REF_NAME, TAIL)); + var rx_substitution = new RegExp( + format('^\\|{0}\\|{1}{2}::{3}', TEXT1, SEPA, REF_NAME, TAIL)); + var rx_footnote = new RegExp( + format('^\\[(?:\\d+|#{0}?|\\*)]{1}', REF_NAME, TAIL)); + var rx_citation = new RegExp( + format('^\\[{0}\\]{1}', REF_NAME, TAIL)); + + var rx_substitution_ref = new RegExp( + format('^\\|{0}\\|', TEXT1)); + var rx_footnote_ref = new RegExp( + format('^\\[(?:\\d+|#{0}?|\\*)]_', REF_NAME)); + var rx_citation_ref = new RegExp( + format('^\\[{0}\\]_', REF_NAME)); + var rx_link_ref1 = new RegExp( + format('^{0}__?', REF_NAME)); + var rx_link_ref2 = new RegExp( + format('^`{0}`_', TEXT2)); + + var rx_role_pre = new RegExp( + format('^:{0}:`{1}`{2}', NAME, TEXT2, TAIL)); + var rx_role_suf = new RegExp( + format('^`{1}`:{0}:{2}', NAME, TEXT2, TAIL)); + var rx_role = new RegExp( + format('^:{0}:{1}', NAME, TAIL)); + + var rx_directive_name = new RegExp(format('^{0}', REF_NAME)); + var rx_directive_tail = new RegExp(format('^::{0}', TAIL)); + var rx_substitution_text = new RegExp(format('^\\|{0}\\|', TEXT1)); + var rx_substitution_sepa = new RegExp(format('^{0}', SEPA)); + var rx_substitution_name = new RegExp(format('^{0}', REF_NAME)); + var rx_substitution_tail = new RegExp(format('^::{0}', TAIL)); + var rx_link_head = new RegExp("^_"); + var rx_link_name = new RegExp(format('^{0}|_', REF_NAME)); + var rx_link_tail = new RegExp(format('^:{0}', TAIL)); + + var rx_verbatim = new RegExp('^::\\s*$'); + var rx_examples = new RegExp('^\\s+(?:>>>|In \\[\\d+\\]:)\\s'); + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function to_normal(stream, state) { + var token = null; + + if (stream.sol() && stream.match(rx_examples, false)) { + change(state, to_mode, { + mode: mode_python, local: CodeMirror.startState(mode_python) + }); + } else if (stream.sol() && stream.match(rx_explicit)) { + change(state, to_explicit); + token = 'meta'; + } else if (stream.sol() && stream.match(rx_section)) { + change(state, to_normal); + token = 'header'; + } else if (phase(state) == rx_role_pre || + stream.match(rx_role_pre, false)) { + + switch (stage(state)) { + case 0: + change(state, to_normal, context(rx_role_pre, 1)); + stream.match(/^:/); + token = 'meta'; + break; + case 1: + change(state, to_normal, context(rx_role_pre, 2)); + stream.match(rx_NAME); + token = 'keyword'; + + if (stream.current().match(/^(?:math|latex)/)) { + state.tmp_stex = true; + } + break; + case 2: + change(state, to_normal, context(rx_role_pre, 3)); + stream.match(/^:`/); + token = 'meta'; + break; + case 3: + if (state.tmp_stex) { + state.tmp_stex = undefined; state.tmp = { + mode: mode_stex, local: CodeMirror.startState(mode_stex) + }; + } + + if (state.tmp) { + if (stream.peek() == '`') { + change(state, to_normal, context(rx_role_pre, 4)); + state.tmp = undefined; + break; + } + + token = state.tmp.mode.token(stream, state.tmp.local); + break; + } + + change(state, to_normal, context(rx_role_pre, 4)); + stream.match(rx_TEXT2); + token = 'string'; + break; + case 4: + change(state, to_normal, context(rx_role_pre, 5)); + stream.match(/^`/); + token = 'meta'; + break; + case 5: + change(state, to_normal, context(rx_role_pre, 6)); + stream.match(rx_TAIL); + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_role_suf || + stream.match(rx_role_suf, false)) { + + switch (stage(state)) { + case 0: + change(state, to_normal, context(rx_role_suf, 1)); + stream.match(/^`/); + token = 'meta'; + break; + case 1: + change(state, to_normal, context(rx_role_suf, 2)); + stream.match(rx_TEXT2); + token = 'string'; + break; + case 2: + change(state, to_normal, context(rx_role_suf, 3)); + stream.match(/^`:/); + token = 'meta'; + break; + case 3: + change(state, to_normal, context(rx_role_suf, 4)); + stream.match(rx_NAME); + token = 'keyword'; + break; + case 4: + change(state, to_normal, context(rx_role_suf, 5)); + stream.match(/^:/); + token = 'meta'; + break; + case 5: + change(state, to_normal, context(rx_role_suf, 6)); + stream.match(rx_TAIL); + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_role || stream.match(rx_role, false)) { + + switch (stage(state)) { + case 0: + change(state, to_normal, context(rx_role, 1)); + stream.match(/^:/); + token = 'meta'; + break; + case 1: + change(state, to_normal, context(rx_role, 2)); + stream.match(rx_NAME); + token = 'keyword'; + break; + case 2: + change(state, to_normal, context(rx_role, 3)); + stream.match(/^:/); + token = 'meta'; + break; + case 3: + change(state, to_normal, context(rx_role, 4)); + stream.match(rx_TAIL); + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_substitution_ref || + stream.match(rx_substitution_ref, false)) { + + switch (stage(state)) { + case 0: + change(state, to_normal, context(rx_substitution_ref, 1)); + stream.match(rx_substitution_text); + token = 'variable-2'; + break; + case 1: + change(state, to_normal, context(rx_substitution_ref, 2)); + if (stream.match(/^_?_?/)) token = 'link'; + break; + default: + change(state, to_normal); + } + } else if (stream.match(rx_footnote_ref)) { + change(state, to_normal); + token = 'quote'; + } else if (stream.match(rx_citation_ref)) { + change(state, to_normal); + token = 'quote'; + } else if (stream.match(rx_link_ref1)) { + change(state, to_normal); + if (!stream.peek() || stream.peek().match(/^\W$/)) { + token = 'link'; + } + } else if (phase(state) == rx_link_ref2 || + stream.match(rx_link_ref2, false)) { + + switch (stage(state)) { + case 0: + if (!stream.peek() || stream.peek().match(/^\W$/)) { + change(state, to_normal, context(rx_link_ref2, 1)); + } else { + stream.match(rx_link_ref2); + } + break; + case 1: + change(state, to_normal, context(rx_link_ref2, 2)); + stream.match(/^`/); + token = 'link'; + break; + case 2: + change(state, to_normal, context(rx_link_ref2, 3)); + stream.match(rx_TEXT2); + break; + case 3: + change(state, to_normal, context(rx_link_ref2, 4)); + stream.match(/^`_/); + token = 'link'; + break; + default: + change(state, to_normal); + } + } else if (stream.match(rx_verbatim)) { + change(state, to_verbatim); + } + + else { + if (stream.next()) change(state, to_normal); + } + + return token; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function to_explicit(stream, state) { + var token = null; + + if (phase(state) == rx_substitution || + stream.match(rx_substitution, false)) { + + switch (stage(state)) { + case 0: + change(state, to_explicit, context(rx_substitution, 1)); + stream.match(rx_substitution_text); + token = 'variable-2'; + break; + case 1: + change(state, to_explicit, context(rx_substitution, 2)); + stream.match(rx_substitution_sepa); + break; + case 2: + change(state, to_explicit, context(rx_substitution, 3)); + stream.match(rx_substitution_name); + token = 'keyword'; + break; + case 3: + change(state, to_explicit, context(rx_substitution, 4)); + stream.match(rx_substitution_tail); + token = 'meta'; + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_directive || + stream.match(rx_directive, false)) { + + switch (stage(state)) { + case 0: + change(state, to_explicit, context(rx_directive, 1)); + stream.match(rx_directive_name); + token = 'keyword'; + + if (stream.current().match(/^(?:math|latex)/)) + state.tmp_stex = true; + else if (stream.current().match(/^python/)) + state.tmp_py = true; + break; + case 1: + change(state, to_explicit, context(rx_directive, 2)); + stream.match(rx_directive_tail); + token = 'meta'; + + if (stream.match(/^latex\s*$/) || state.tmp_stex) { + state.tmp_stex = undefined; change(state, to_mode, { + mode: mode_stex, local: CodeMirror.startState(mode_stex) + }); + } + break; + case 2: + change(state, to_explicit, context(rx_directive, 3)); + if (stream.match(/^python\s*$/) || state.tmp_py) { + state.tmp_py = undefined; change(state, to_mode, { + mode: mode_python, local: CodeMirror.startState(mode_python) + }); + } + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_link || stream.match(rx_link, false)) { + + switch (stage(state)) { + case 0: + change(state, to_explicit, context(rx_link, 1)); + stream.match(rx_link_head); + stream.match(rx_link_name); + token = 'link'; + break; + case 1: + change(state, to_explicit, context(rx_link, 2)); + stream.match(rx_link_tail); + token = 'meta'; + break; + default: + change(state, to_normal); + } + } else if (stream.match(rx_footnote)) { + change(state, to_normal); + token = 'quote'; + } else if (stream.match(rx_citation)) { + change(state, to_normal); + token = 'quote'; + } + + else { + stream.eatSpace(); + if (stream.eol()) { + change(state, to_normal); + } else { + stream.skipToEnd(); + change(state, to_comment); + token = 'comment'; + } + } + + return token; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function to_comment(stream, state) { + return as_block(stream, state, 'comment'); + } + + function to_verbatim(stream, state) { + return as_block(stream, state, 'meta'); + } + + function as_block(stream, state, token) { + if (stream.eol() || stream.eatSpace()) { + stream.skipToEnd(); + return token; + } else { + change(state, to_normal); + return null; + } + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function to_mode(stream, state) { + + if (state.ctx.mode && state.ctx.local) { + + if (stream.sol()) { + if (!stream.eatSpace()) change(state, to_normal); + return null; + } + + return state.ctx.mode.token(stream, state.ctx.local); + } + + change(state, to_normal); + return null; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function context(phase, stage, mode, local) { + return {phase: phase, stage: stage, mode: mode, local: local}; + } + + function change(state, tok, ctx) { + state.tok = tok; + state.ctx = ctx || {}; + } + + function stage(state) { + return state.ctx.stage || 0; + } + + function phase(state) { + return state.ctx.phase; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + return { + startState: function () { + return {tok: to_normal, ctx: context(undefined, 0)}; + }, + + copyState: function (state) { + var ctx = state.ctx, tmp = state.tmp; + if (ctx.local) + ctx = {mode: ctx.mode, local: CodeMirror.copyState(ctx.mode, ctx.local)}; + if (tmp) + tmp = {mode: tmp.mode, local: CodeMirror.copyState(tmp.mode, tmp.local)}; + return {tok: state.tok, ctx: ctx, tmp: tmp}; + }, + + innerMode: function (state) { + return state.tmp ? {state: state.tmp.local, mode: state.tmp.mode} + : state.ctx.mode ? {state: state.ctx.local, mode: state.ctx.mode} + : null; + }, + + token: function (stream, state) { + return state.tok(stream, state); + } + }; +}, 'python', 'stex'); + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +CodeMirror.defineMIME('text/x-rst', 'rst'); + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/ruby/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/ruby/index.html new file mode 100644 index 0000000000000000000000000000000000000000..97544babc3abd69a4ff360c3b6a40a3700dec696 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/ruby/index.html @@ -0,0 +1,183 @@ + + +CodeMirror: Ruby mode + + + + + + + + + + +
        +

        Ruby mode

        +
        + + +

        MIME types defined: text/x-ruby.

        + +

        Development of the CodeMirror Ruby mode was kindly sponsored + by Ubalo.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/ruby/ruby.js b/src/main/resources/templates/editor/lib/codemirror/mode/ruby/ruby.js new file mode 100644 index 0000000000000000000000000000000000000000..eab9d9da7fa73e1388cb577ad8c4f48cce8a0f1b --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/ruby/ruby.js @@ -0,0 +1,285 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("ruby", function(config) { + function wordObj(words) { + var o = {}; + for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; + return o; + } + var keywords = wordObj([ + "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else", + "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or", + "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless", + "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc", + "caller", "lambda", "proc", "public", "protected", "private", "require", "load", + "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__" + ]); + var indentWords = wordObj(["def", "class", "case", "for", "while", "module", "then", + "catch", "loop", "proc", "begin"]); + var dedentWords = wordObj(["end", "until"]); + var matching = {"[": "]", "{": "}", "(": ")"}; + var curPunc; + + function chain(newtok, stream, state) { + state.tokenize.push(newtok); + return newtok(stream, state); + } + + function tokenBase(stream, state) { + curPunc = null; + if (stream.sol() && stream.match("=begin") && stream.eol()) { + state.tokenize.push(readBlockComment); + return "comment"; + } + if (stream.eatSpace()) return null; + var ch = stream.next(), m; + if (ch == "`" || ch == "'" || ch == '"') { + return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state); + } else if (ch == "/") { + var currentIndex = stream.current().length; + if (stream.skipTo("/")) { + var search_till = stream.current().length; + stream.backUp(stream.current().length - currentIndex); + var balance = 0; // balance brackets + while (stream.current().length < search_till) { + var chchr = stream.next(); + if (chchr == "(") balance += 1; + else if (chchr == ")") balance -= 1; + if (balance < 0) break; + } + stream.backUp(stream.current().length - currentIndex); + if (balance == 0) + return chain(readQuoted(ch, "string-2", true), stream, state); + } + return "operator"; + } else if (ch == "%") { + var style = "string", embed = true; + if (stream.eat("s")) style = "atom"; + else if (stream.eat(/[WQ]/)) style = "string"; + else if (stream.eat(/[r]/)) style = "string-2"; + else if (stream.eat(/[wxq]/)) { style = "string"; embed = false; } + var delim = stream.eat(/[^\w\s=]/); + if (!delim) return "operator"; + if (matching.propertyIsEnumerable(delim)) delim = matching[delim]; + return chain(readQuoted(delim, style, embed, true), stream, state); + } else if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } else if (ch == "<" && (m = stream.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) { + return chain(readHereDoc(m[1]), stream, state); + } else if (ch == "0") { + if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/); + else if (stream.eat("b")) stream.eatWhile(/[01]/); + else stream.eatWhile(/[0-7]/); + return "number"; + } else if (/\d/.test(ch)) { + stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/); + return "number"; + } else if (ch == "?") { + while (stream.match(/^\\[CM]-/)) {} + if (stream.eat("\\")) stream.eatWhile(/\w/); + else stream.next(); + return "string"; + } else if (ch == ":") { + if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state); + if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state); + + // :> :>> :< :<< are valid symbols + if (stream.eat(/[\<\>]/)) { + stream.eat(/[\<\>]/); + return "atom"; + } + + // :+ :- :/ :* :| :& :! are valid symbols + if (stream.eat(/[\+\-\*\/\&\|\:\!]/)) { + return "atom"; + } + + // Symbols can't start by a digit + if (stream.eat(/[a-zA-Z$@_\xa1-\uffff]/)) { + stream.eatWhile(/[\w$\xa1-\uffff]/); + // Only one ? ! = is allowed and only as the last character + stream.eat(/[\?\!\=]/); + return "atom"; + } + return "operator"; + } else if (ch == "@" && stream.match(/^@?[a-zA-Z_\xa1-\uffff]/)) { + stream.eat("@"); + stream.eatWhile(/[\w\xa1-\uffff]/); + return "variable-2"; + } else if (ch == "$") { + if (stream.eat(/[a-zA-Z_]/)) { + stream.eatWhile(/[\w]/); + } else if (stream.eat(/\d/)) { + stream.eat(/\d/); + } else { + stream.next(); // Must be a special global like $: or $! + } + return "variable-3"; + } else if (/[a-zA-Z_\xa1-\uffff]/.test(ch)) { + stream.eatWhile(/[\w\xa1-\uffff]/); + stream.eat(/[\?\!]/); + if (stream.eat(":")) return "atom"; + return "ident"; + } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) { + curPunc = "|"; + return null; + } else if (/[\(\)\[\]{}\\;]/.test(ch)) { + curPunc = ch; + return null; + } else if (ch == "-" && stream.eat(">")) { + return "arrow"; + } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) { + var more = stream.eatWhile(/[=+\-\/*:\.^%<>~|]/); + if (ch == "." && !more) curPunc = "."; + return "operator"; + } else { + return null; + } + } + + function tokenBaseUntilBrace(depth) { + if (!depth) depth = 1; + return function(stream, state) { + if (stream.peek() == "}") { + if (depth == 1) { + state.tokenize.pop(); + return state.tokenize[state.tokenize.length-1](stream, state); + } else { + state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth - 1); + } + } else if (stream.peek() == "{") { + state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth + 1); + } + return tokenBase(stream, state); + }; + } + function tokenBaseOnce() { + var alreadyCalled = false; + return function(stream, state) { + if (alreadyCalled) { + state.tokenize.pop(); + return state.tokenize[state.tokenize.length-1](stream, state); + } + alreadyCalled = true; + return tokenBase(stream, state); + }; + } + function readQuoted(quote, style, embed, unescaped) { + return function(stream, state) { + var escaped = false, ch; + + if (state.context.type === 'read-quoted-paused') { + state.context = state.context.prev; + stream.eat("}"); + } + + while ((ch = stream.next()) != null) { + if (ch == quote && (unescaped || !escaped)) { + state.tokenize.pop(); + break; + } + if (embed && ch == "#" && !escaped) { + if (stream.eat("{")) { + if (quote == "}") { + state.context = {prev: state.context, type: 'read-quoted-paused'}; + } + state.tokenize.push(tokenBaseUntilBrace()); + break; + } else if (/[@\$]/.test(stream.peek())) { + state.tokenize.push(tokenBaseOnce()); + break; + } + } + escaped = !escaped && ch == "\\"; + } + return style; + }; + } + function readHereDoc(phrase) { + return function(stream, state) { + if (stream.match(phrase)) state.tokenize.pop(); + else stream.skipToEnd(); + return "string"; + }; + } + function readBlockComment(stream, state) { + if (stream.sol() && stream.match("=end") && stream.eol()) + state.tokenize.pop(); + stream.skipToEnd(); + return "comment"; + } + + return { + startState: function() { + return {tokenize: [tokenBase], + indented: 0, + context: {type: "top", indented: -config.indentUnit}, + continuedLine: false, + lastTok: null, + varList: false}; + }, + + token: function(stream, state) { + if (stream.sol()) state.indented = stream.indentation(); + var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype; + var thisTok = curPunc; + if (style == "ident") { + var word = stream.current(); + style = state.lastTok == "." ? "property" + : keywords.propertyIsEnumerable(stream.current()) ? "keyword" + : /^[A-Z]/.test(word) ? "tag" + : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def" + : "variable"; + if (style == "keyword") { + thisTok = word; + if (indentWords.propertyIsEnumerable(word)) kwtype = "indent"; + else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent"; + else if ((word == "if" || word == "unless") && stream.column() == stream.indentation()) + kwtype = "indent"; + else if (word == "do" && state.context.indented < state.indented) + kwtype = "indent"; + } + } + if (curPunc || (style && style != "comment")) state.lastTok = thisTok; + if (curPunc == "|") state.varList = !state.varList; + + if (kwtype == "indent" || /[\(\[\{]/.test(curPunc)) + state.context = {prev: state.context, type: curPunc || style, indented: state.indented}; + else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev) + state.context = state.context.prev; + + if (stream.eol()) + state.continuedLine = (curPunc == "\\" || style == "operator"); + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0); + var ct = state.context; + var closing = ct.type == matching[firstChar] || + ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter); + return ct.indented + (closing ? 0 : config.indentUnit) + + (state.continuedLine ? config.indentUnit : 0); + }, + + electricChars: "}de", // enD and rescuE + lineComment: "#" + }; +}); + +CodeMirror.defineMIME("text/x-ruby", "ruby"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/ruby/test.js b/src/main/resources/templates/editor/lib/codemirror/mode/ruby/test.js new file mode 100644 index 0000000000000000000000000000000000000000..cade864ff9668b733c61a92d6f45b0a0ae4c966d --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/ruby/test.js @@ -0,0 +1,14 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + var mode = CodeMirror.getMode({indentUnit: 2}, "ruby"); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + MT("divide_equal_operator", + "[variable bar] [operator /=] [variable foo]"); + + MT("divide_equal_operator_no_spacing", + "[variable foo][operator /=][number 42]"); + +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/rust/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/rust/index.html new file mode 100644 index 0000000000000000000000000000000000000000..407e84f2cf161dd473bcdcc12b2b7b55e8e5fe2d --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/rust/index.html @@ -0,0 +1,60 @@ + + +CodeMirror: Rust mode + + + + + + + + + +
        +

        Rust mode

        + + +
        + + + +

        MIME types defined: text/x-rustsrc.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/rust/rust.js b/src/main/resources/templates/editor/lib/codemirror/mode/rust/rust.js new file mode 100644 index 0000000000000000000000000000000000000000..2bffa9a6aab657015cd864678640093de851bafc --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/rust/rust.js @@ -0,0 +1,451 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("rust", function() { + var indentUnit = 4, altIndentUnit = 2; + var valKeywords = { + "if": "if-style", "while": "if-style", "loop": "else-style", "else": "else-style", + "do": "else-style", "ret": "else-style", "fail": "else-style", + "break": "atom", "cont": "atom", "const": "let", "resource": "fn", + "let": "let", "fn": "fn", "for": "for", "alt": "alt", "iface": "iface", + "impl": "impl", "type": "type", "enum": "enum", "mod": "mod", + "as": "op", "true": "atom", "false": "atom", "assert": "op", "check": "op", + "claim": "op", "native": "ignore", "unsafe": "ignore", "import": "else-style", + "export": "else-style", "copy": "op", "log": "op", "log_err": "op", + "use": "op", "bind": "op", "self": "atom", "struct": "enum" + }; + var typeKeywords = function() { + var keywords = {"fn": "fn", "block": "fn", "obj": "obj"}; + var atoms = "bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" "); + for (var i = 0, e = atoms.length; i < e; ++i) keywords[atoms[i]] = "atom"; + return keywords; + }(); + var operatorChar = /[+\-*&%=<>!?|\.@]/; + + // Tokenizer + + // Used as scratch variable to communicate multiple values without + // consing up tons of objects. + var tcat, content; + function r(tc, style) { + tcat = tc; + return style; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"') { + state.tokenize = tokenString; + return state.tokenize(stream, state); + } + if (ch == "'") { + tcat = "atom"; + if (stream.eat("\\")) { + if (stream.skipTo("'")) { stream.next(); return "string"; } + else { return "error"; } + } else { + stream.next(); + return stream.eat("'") ? "string" : "error"; + } + } + if (ch == "/") { + if (stream.eat("/")) { stream.skipToEnd(); return "comment"; } + if (stream.eat("*")) { + state.tokenize = tokenComment(1); + return state.tokenize(stream, state); + } + } + if (ch == "#") { + if (stream.eat("[")) { tcat = "open-attr"; return null; } + stream.eatWhile(/\w/); + return r("macro", "meta"); + } + if (ch == ":" && stream.match(":<")) { + return r("op", null); + } + if (ch.match(/\d/) || (ch == "." && stream.eat(/\d/))) { + var flp = false; + if (!stream.match(/^x[\da-f]+/i) && !stream.match(/^b[01]+/)) { + stream.eatWhile(/\d/); + if (stream.eat(".")) { flp = true; stream.eatWhile(/\d/); } + if (stream.match(/^e[+\-]?\d+/i)) { flp = true; } + } + if (flp) stream.match(/^f(?:32|64)/); + else stream.match(/^[ui](?:8|16|32|64)/); + return r("atom", "number"); + } + if (ch.match(/[()\[\]{}:;,]/)) return r(ch, null); + if (ch == "-" && stream.eat(">")) return r("->", null); + if (ch.match(operatorChar)) { + stream.eatWhile(operatorChar); + return r("op", null); + } + stream.eatWhile(/\w/); + content = stream.current(); + if (stream.match(/^::\w/)) { + stream.backUp(1); + return r("prefix", "variable-2"); + } + if (state.keywords.propertyIsEnumerable(content)) + return r(state.keywords[content], content.match(/true|false/) ? "atom" : "keyword"); + return r("name", "variable"); + } + + function tokenString(stream, state) { + var ch, escaped = false; + while (ch = stream.next()) { + if (ch == '"' && !escaped) { + state.tokenize = tokenBase; + return r("atom", "string"); + } + escaped = !escaped && ch == "\\"; + } + // Hack to not confuse the parser when a string is split in + // pieces. + return r("op", "string"); + } + + function tokenComment(depth) { + return function(stream, state) { + var lastCh = null, ch; + while (ch = stream.next()) { + if (ch == "/" && lastCh == "*") { + if (depth == 1) { + state.tokenize = tokenBase; + break; + } else { + state.tokenize = tokenComment(depth - 1); + return state.tokenize(stream, state); + } + } + if (ch == "*" && lastCh == "/") { + state.tokenize = tokenComment(depth + 1); + return state.tokenize(stream, state); + } + lastCh = ch; + } + return "comment"; + }; + } + + // Parser + + var cx = {state: null, stream: null, marked: null, cc: null}; + function pass() { + for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); + } + function cont() { + pass.apply(null, arguments); + return true; + } + + function pushlex(type, info) { + var result = function() { + var state = cx.state; + state.lexical = {indented: state.indented, column: cx.stream.column(), + type: type, prev: state.lexical, info: info}; + }; + result.lex = true; + return result; + } + function poplex() { + var state = cx.state; + if (state.lexical.prev) { + if (state.lexical.type == ")") + state.indented = state.lexical.indented; + state.lexical = state.lexical.prev; + } + } + function typecx() { cx.state.keywords = typeKeywords; } + function valcx() { cx.state.keywords = valKeywords; } + poplex.lex = typecx.lex = valcx.lex = true; + + function commasep(comb, end) { + function more(type) { + if (type == ",") return cont(comb, more); + if (type == end) return cont(); + return cont(more); + } + return function(type) { + if (type == end) return cont(); + return pass(comb, more); + }; + } + + function stat_of(comb, tag) { + return cont(pushlex("stat", tag), comb, poplex, block); + } + function block(type) { + if (type == "}") return cont(); + if (type == "let") return stat_of(letdef1, "let"); + if (type == "fn") return stat_of(fndef); + if (type == "type") return cont(pushlex("stat"), tydef, endstatement, poplex, block); + if (type == "enum") return stat_of(enumdef); + if (type == "mod") return stat_of(mod); + if (type == "iface") return stat_of(iface); + if (type == "impl") return stat_of(impl); + if (type == "open-attr") return cont(pushlex("]"), commasep(expression, "]"), poplex); + if (type == "ignore" || type.match(/[\]\);,]/)) return cont(block); + return pass(pushlex("stat"), expression, poplex, endstatement, block); + } + function endstatement(type) { + if (type == ";") return cont(); + return pass(); + } + function expression(type) { + if (type == "atom" || type == "name") return cont(maybeop); + if (type == "{") return cont(pushlex("}"), exprbrace, poplex); + if (type.match(/[\[\(]/)) return matchBrackets(type, expression); + if (type.match(/[\]\)\};,]/)) return pass(); + if (type == "if-style") return cont(expression, expression); + if (type == "else-style" || type == "op") return cont(expression); + if (type == "for") return cont(pattern, maybetype, inop, expression, expression); + if (type == "alt") return cont(expression, altbody); + if (type == "fn") return cont(fndef); + if (type == "macro") return cont(macro); + return cont(); + } + function maybeop(type) { + if (content == ".") return cont(maybeprop); + if (content == "::<"){return cont(typarams, maybeop);} + if (type == "op" || content == ":") return cont(expression); + if (type == "(" || type == "[") return matchBrackets(type, expression); + return pass(); + } + function maybeprop() { + if (content.match(/^\w+$/)) {cx.marked = "variable"; return cont(maybeop);} + return pass(expression); + } + function exprbrace(type) { + if (type == "op") { + if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block); + if (content == "||") return cont(poplex, pushlex("}", "block"), block); + } + if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":" + && !cx.stream.match("::", false))) + return pass(record_of(expression)); + return pass(block); + } + function record_of(comb) { + function ro(type) { + if (content == "mutable" || content == "with") {cx.marked = "keyword"; return cont(ro);} + if (content.match(/^\w*$/)) {cx.marked = "variable"; return cont(ro);} + if (type == ":") return cont(comb, ro); + if (type == "}") return cont(); + return cont(ro); + } + return ro; + } + function blockvars(type) { + if (type == "name") {cx.marked = "def"; return cont(blockvars);} + if (type == "op" && content == "|") return cont(); + return cont(blockvars); + } + + function letdef1(type) { + if (type.match(/[\]\)\};]/)) return cont(); + if (content == "=") return cont(expression, letdef2); + if (type == ",") return cont(letdef1); + return pass(pattern, maybetype, letdef1); + } + function letdef2(type) { + if (type.match(/[\]\)\};,]/)) return pass(letdef1); + else return pass(expression, letdef2); + } + function maybetype(type) { + if (type == ":") return cont(typecx, rtype, valcx); + return pass(); + } + function inop(type) { + if (type == "name" && content == "in") {cx.marked = "keyword"; return cont();} + return pass(); + } + function fndef(type) { + if (content == "@" || content == "~") {cx.marked = "keyword"; return cont(fndef);} + if (type == "name") {cx.marked = "def"; return cont(fndef);} + if (content == "<") return cont(typarams, fndef); + if (type == "{") return pass(expression); + if (type == "(") return cont(pushlex(")"), commasep(argdef, ")"), poplex, fndef); + if (type == "->") return cont(typecx, rtype, valcx, fndef); + if (type == ";") return cont(); + return cont(fndef); + } + function tydef(type) { + if (type == "name") {cx.marked = "def"; return cont(tydef);} + if (content == "<") return cont(typarams, tydef); + if (content == "=") return cont(typecx, rtype, valcx); + return cont(tydef); + } + function enumdef(type) { + if (type == "name") {cx.marked = "def"; return cont(enumdef);} + if (content == "<") return cont(typarams, enumdef); + if (content == "=") return cont(typecx, rtype, valcx, endstatement); + if (type == "{") return cont(pushlex("}"), typecx, enumblock, valcx, poplex); + return cont(enumdef); + } + function enumblock(type) { + if (type == "}") return cont(); + if (type == "(") return cont(pushlex(")"), commasep(rtype, ")"), poplex, enumblock); + if (content.match(/^\w+$/)) cx.marked = "def"; + return cont(enumblock); + } + function mod(type) { + if (type == "name") {cx.marked = "def"; return cont(mod);} + if (type == "{") return cont(pushlex("}"), block, poplex); + return pass(); + } + function iface(type) { + if (type == "name") {cx.marked = "def"; return cont(iface);} + if (content == "<") return cont(typarams, iface); + if (type == "{") return cont(pushlex("}"), block, poplex); + return pass(); + } + function impl(type) { + if (content == "<") return cont(typarams, impl); + if (content == "of" || content == "for") {cx.marked = "keyword"; return cont(rtype, impl);} + if (type == "name") {cx.marked = "def"; return cont(impl);} + if (type == "{") return cont(pushlex("}"), block, poplex); + return pass(); + } + function typarams() { + if (content == ">") return cont(); + if (content == ",") return cont(typarams); + if (content == ":") return cont(rtype, typarams); + return pass(rtype, typarams); + } + function argdef(type) { + if (type == "name") {cx.marked = "def"; return cont(argdef);} + if (type == ":") return cont(typecx, rtype, valcx); + return pass(); + } + function rtype(type) { + if (type == "name") {cx.marked = "variable-3"; return cont(rtypemaybeparam); } + if (content == "mutable") {cx.marked = "keyword"; return cont(rtype);} + if (type == "atom") return cont(rtypemaybeparam); + if (type == "op" || type == "obj") return cont(rtype); + if (type == "fn") return cont(fntype); + if (type == "{") return cont(pushlex("{"), record_of(rtype), poplex); + return matchBrackets(type, rtype); + } + function rtypemaybeparam() { + if (content == "<") return cont(typarams); + return pass(); + } + function fntype(type) { + if (type == "(") return cont(pushlex("("), commasep(rtype, ")"), poplex, fntype); + if (type == "->") return cont(rtype); + return pass(); + } + function pattern(type) { + if (type == "name") {cx.marked = "def"; return cont(patternmaybeop);} + if (type == "atom") return cont(patternmaybeop); + if (type == "op") return cont(pattern); + if (type.match(/[\]\)\};,]/)) return pass(); + return matchBrackets(type, pattern); + } + function patternmaybeop(type) { + if (type == "op" && content == ".") return cont(); + if (content == "to") {cx.marked = "keyword"; return cont(pattern);} + else return pass(); + } + function altbody(type) { + if (type == "{") return cont(pushlex("}", "alt"), altblock1, poplex); + return pass(); + } + function altblock1(type) { + if (type == "}") return cont(); + if (type == "|") return cont(altblock1); + if (content == "when") {cx.marked = "keyword"; return cont(expression, altblock2);} + if (type.match(/[\]\);,]/)) return cont(altblock1); + return pass(pattern, altblock2); + } + function altblock2(type) { + if (type == "{") return cont(pushlex("}", "alt"), block, poplex, altblock1); + else return pass(altblock1); + } + + function macro(type) { + if (type.match(/[\[\(\{]/)) return matchBrackets(type, expression); + return pass(); + } + function matchBrackets(type, comb) { + if (type == "[") return cont(pushlex("]"), commasep(comb, "]"), poplex); + if (type == "(") return cont(pushlex(")"), commasep(comb, ")"), poplex); + if (type == "{") return cont(pushlex("}"), commasep(comb, "}"), poplex); + return cont(); + } + + function parse(state, stream, style) { + var cc = state.cc; + // Communicate our context to the combinators. + // (Less wasteful than consing up a hundred closures on every call.) + cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; + + while (true) { + var combinator = cc.length ? cc.pop() : block; + if (combinator(tcat)) { + while(cc.length && cc[cc.length - 1].lex) + cc.pop()(); + return cx.marked || style; + } + } + } + + return { + startState: function() { + return { + tokenize: tokenBase, + cc: [], + lexical: {indented: -indentUnit, column: 0, type: "top", align: false}, + keywords: valKeywords, + indented: 0 + }; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = false; + state.indented = stream.indentation(); + } + if (stream.eatSpace()) return null; + tcat = content = null; + var style = state.tokenize(stream, state); + if (style == "comment") return style; + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = true; + if (tcat == "prefix") return style; + if (!content) content = stream.current(); + return parse(state, stream, style); + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, + type = lexical.type, closing = firstChar == type; + if (type == "stat") return lexical.indented + indentUnit; + if (lexical.align) return lexical.column + (closing ? 0 : 1); + return lexical.indented + (closing ? 0 : (lexical.info == "alt" ? altIndentUnit : indentUnit)); + }, + + electricChars: "{}", + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//", + fold: "brace" + }; +}); + +CodeMirror.defineMIME("text/x-rustsrc", "rust"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/sass/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/sass/index.html new file mode 100644 index 0000000000000000000000000000000000000000..9f4a79022101d18a660bb6d4d391786726205837 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/sass/index.html @@ -0,0 +1,66 @@ + + +CodeMirror: Sass mode + + + + + + + + + + +
        +

        Sass mode

        +
        + + +

        MIME types defined: text/x-sass.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/sass/sass.js b/src/main/resources/templates/editor/lib/codemirror/mode/sass/sass.js new file mode 100644 index 0000000000000000000000000000000000000000..52a668291591092820cd11931a1011bfcb8ca7d8 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/sass/sass.js @@ -0,0 +1,414 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("sass", function(config) { + function tokenRegexp(words) { + return new RegExp("^" + words.join("|")); + } + + var keywords = ["true", "false", "null", "auto"]; + var keywordsRegexp = new RegExp("^" + keywords.join("|")); + + var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-", + "\\!=", "/", "\\*", "%", "and", "or", "not", ";","\\{","\\}",":"]; + var opRegexp = tokenRegexp(operators); + + var pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/; + + function urlTokens(stream, state) { + var ch = stream.peek(); + + if (ch === ")") { + stream.next(); + state.tokenizer = tokenBase; + return "operator"; + } else if (ch === "(") { + stream.next(); + stream.eatSpace(); + + return "operator"; + } else if (ch === "'" || ch === '"') { + state.tokenizer = buildStringTokenizer(stream.next()); + return "string"; + } else { + state.tokenizer = buildStringTokenizer(")", false); + return "string"; + } + } + function comment(indentation, multiLine) { + return function(stream, state) { + if (stream.sol() && stream.indentation() <= indentation) { + state.tokenizer = tokenBase; + return tokenBase(stream, state); + } + + if (multiLine && stream.skipTo("*/")) { + stream.next(); + stream.next(); + state.tokenizer = tokenBase; + } else { + stream.skipToEnd(); + } + + return "comment"; + }; + } + + function buildStringTokenizer(quote, greedy) { + if (greedy == null) { greedy = true; } + + function stringTokenizer(stream, state) { + var nextChar = stream.next(); + var peekChar = stream.peek(); + var previousChar = stream.string.charAt(stream.pos-2); + + var endingString = ((nextChar !== "\\" && peekChar === quote) || (nextChar === quote && previousChar !== "\\")); + + if (endingString) { + if (nextChar !== quote && greedy) { stream.next(); } + state.tokenizer = tokenBase; + return "string"; + } else if (nextChar === "#" && peekChar === "{") { + state.tokenizer = buildInterpolationTokenizer(stringTokenizer); + stream.next(); + return "operator"; + } else { + return "string"; + } + } + + return stringTokenizer; + } + + function buildInterpolationTokenizer(currentTokenizer) { + return function(stream, state) { + if (stream.peek() === "}") { + stream.next(); + state.tokenizer = currentTokenizer; + return "operator"; + } else { + return tokenBase(stream, state); + } + }; + } + + function indent(state) { + if (state.indentCount == 0) { + state.indentCount++; + var lastScopeOffset = state.scopes[0].offset; + var currentOffset = lastScopeOffset + config.indentUnit; + state.scopes.unshift({ offset:currentOffset }); + } + } + + function dedent(state) { + if (state.scopes.length == 1) return; + + state.scopes.shift(); + } + + function tokenBase(stream, state) { + var ch = stream.peek(); + + // Comment + if (stream.match("/*")) { + state.tokenizer = comment(stream.indentation(), true); + return state.tokenizer(stream, state); + } + if (stream.match("//")) { + state.tokenizer = comment(stream.indentation(), false); + return state.tokenizer(stream, state); + } + + // Interpolation + if (stream.match("#{")) { + state.tokenizer = buildInterpolationTokenizer(tokenBase); + return "operator"; + } + + // Strings + if (ch === '"' || ch === "'") { + stream.next(); + state.tokenizer = buildStringTokenizer(ch); + return "string"; + } + + if(!state.cursorHalf){// state.cursorHalf === 0 + // first half i.e. before : for key-value pairs + // including selectors + + if (ch === ".") { + stream.next(); + if (stream.match(/^[\w-]+/)) { + indent(state); + return "atom"; + } else if (stream.peek() === "#") { + indent(state); + return "atom"; + } + } + + if (ch === "#") { + stream.next(); + // ID selectors + if (stream.match(/^[\w-]+/)) { + indent(state); + return "atom"; + } + if (stream.peek() === "#") { + indent(state); + return "atom"; + } + } + + // Variables + if (ch === "$") { + stream.next(); + stream.eatWhile(/[\w-]/); + return "variable-2"; + } + + // Numbers + if (stream.match(/^-?[0-9\.]+/)) + return "number"; + + // Units + if (stream.match(/^(px|em|in)\b/)) + return "unit"; + + if (stream.match(keywordsRegexp)) + return "keyword"; + + if (stream.match(/^url/) && stream.peek() === "(") { + state.tokenizer = urlTokens; + return "atom"; + } + + if (ch === "=") { + // Match shortcut mixin definition + if (stream.match(/^=[\w-]+/)) { + indent(state); + return "meta"; + } + } + + if (ch === "+") { + // Match shortcut mixin definition + if (stream.match(/^\+[\w-]+/)){ + return "variable-3"; + } + } + + if(ch === "@"){ + if(stream.match(/@extend/)){ + if(!stream.match(/\s*[\w]/)) + dedent(state); + } + } + + + // Indent Directives + if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) { + indent(state); + return "meta"; + } + + // Other Directives + if (ch === "@") { + stream.next(); + stream.eatWhile(/[\w-]/); + return "meta"; + } + + if (stream.eatWhile(/[\w-]/)){ + if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){ + return "propery"; + } + else if(stream.match(/ *:/,false)){ + indent(state); + state.cursorHalf = 1; + return "atom"; + } + else if(stream.match(/ *,/,false)){ + return "atom"; + } + else{ + indent(state); + return "atom"; + } + } + + if(ch === ":"){ + if (stream.match(pseudoElementsRegexp)){ // could be a pseudo-element + return "keyword"; + } + stream.next(); + state.cursorHalf=1; + return "operator"; + } + + } // cursorHalf===0 ends here + else{ + + if (ch === "#") { + stream.next(); + // Hex numbers + if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){ + if(!stream.peek()){ + state.cursorHalf = 0; + } + return "number"; + } + } + + // Numbers + if (stream.match(/^-?[0-9\.]+/)){ + if(!stream.peek()){ + state.cursorHalf = 0; + } + return "number"; + } + + // Units + if (stream.match(/^(px|em|in)\b/)){ + if(!stream.peek()){ + state.cursorHalf = 0; + } + return "unit"; + } + + if (stream.match(keywordsRegexp)){ + if(!stream.peek()){ + state.cursorHalf = 0; + } + return "keyword"; + } + + if (stream.match(/^url/) && stream.peek() === "(") { + state.tokenizer = urlTokens; + if(!stream.peek()){ + state.cursorHalf = 0; + } + return "atom"; + } + + // Variables + if (ch === "$") { + stream.next(); + stream.eatWhile(/[\w-]/); + if(!stream.peek()){ + state.cursorHalf = 0; + } + return "variable-3"; + } + + // bang character for !important, !default, etc. + if (ch === "!") { + stream.next(); + if(!stream.peek()){ + state.cursorHalf = 0; + } + return stream.match(/^[\w]+/) ? "keyword": "operator"; + } + + if (stream.match(opRegexp)){ + if(!stream.peek()){ + state.cursorHalf = 0; + } + return "operator"; + } + + // attributes + if (stream.eatWhile(/[\w-]/)) { + if(!stream.peek()){ + state.cursorHalf = 0; + } + return "attribute"; + } + + //stream.eatSpace(); + if(!stream.peek()){ + state.cursorHalf = 0; + return null; + } + + } // else ends here + + if (stream.match(opRegexp)) + return "operator"; + + // If we haven't returned by now, we move 1 character + // and return an error + stream.next(); + return null; + } + + function tokenLexer(stream, state) { + if (stream.sol()) state.indentCount = 0; + var style = state.tokenizer(stream, state); + var current = stream.current(); + + if (current === "@return" || current === "}"){ + dedent(state); + } + + if (style !== null) { + var startOfToken = stream.pos - current.length; + + var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount); + + var newScopes = []; + + for (var i = 0; i < state.scopes.length; i++) { + var scope = state.scopes[i]; + + if (scope.offset <= withCurrentIndent) + newScopes.push(scope); + } + + state.scopes = newScopes; + } + + + return style; + } + + return { + startState: function() { + return { + tokenizer: tokenBase, + scopes: [{offset: 0, type: "sass"}], + indentCount: 0, + cursorHalf: 0, // cursor half tells us if cursor lies after (1) + // or before (0) colon (well... more or less) + definedVars: [], + definedMixins: [] + }; + }, + token: function(stream, state) { + var style = tokenLexer(stream, state); + + state.lastToken = { style: style, content: stream.current() }; + + return style; + }, + + indent: function(state) { + return state.scopes[0].offset; + } + }; +}); + +CodeMirror.defineMIME("text/x-sass", "sass"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/scheme/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/scheme/index.html new file mode 100644 index 0000000000000000000000000000000000000000..04d5c6a2a3435e502cf01c5de133b46be27e2195 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/scheme/index.html @@ -0,0 +1,77 @@ + + +CodeMirror: Scheme mode + + + + + + + + + +
        +

        Scheme mode

        +
        + + +

        MIME types defined: text/x-scheme.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/scheme/scheme.js b/src/main/resources/templates/editor/lib/codemirror/mode/scheme/scheme.js new file mode 100644 index 0000000000000000000000000000000000000000..979edc0963c430f6107d6eb29c30977d0adc66eb --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/scheme/scheme.js @@ -0,0 +1,248 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/** + * Author: Koh Zi Han, based on implementation by Koh Zi Chun + */ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("scheme", function () { + var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", + ATOM = "atom", NUMBER = "number", BRACKET = "bracket"; + var INDENT_WORD_SKIP = 2; + + function makeKeywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"); + var indentKeys = makeKeywords("define let letrec let* lambda"); + + function stateStack(indent, type, prev) { // represents a state stack object + this.indent = indent; + this.type = type; + this.prev = prev; + } + + function pushStack(state, indent, type) { + state.indentStack = new stateStack(indent, type, state.indentStack); + } + + function popStack(state) { + state.indentStack = state.indentStack.prev; + } + + var binaryMatcher = new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i); + var octalMatcher = new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i); + var hexMatcher = new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i); + var decimalMatcher = new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i); + + function isBinaryNumber (stream) { + return stream.match(binaryMatcher); + } + + function isOctalNumber (stream) { + return stream.match(octalMatcher); + } + + function isDecimalNumber (stream, backup) { + if (backup === true) { + stream.backUp(1); + } + return stream.match(decimalMatcher); + } + + function isHexNumber (stream) { + return stream.match(hexMatcher); + } + + return { + startState: function () { + return { + indentStack: null, + indentation: 0, + mode: false, + sExprComment: false + }; + }, + + token: function (stream, state) { + if (state.indentStack == null && stream.sol()) { + // update indentation, but only if indentStack is empty + state.indentation = stream.indentation(); + } + + // skip spaces + if (stream.eatSpace()) { + return null; + } + var returnType = null; + + switch(state.mode){ + case "string": // multi-line string parsing mode + var next, escaped = false; + while ((next = stream.next()) != null) { + if (next == "\"" && !escaped) { + + state.mode = false; + break; + } + escaped = !escaped && next == "\\"; + } + returnType = STRING; // continue on in scheme-string mode + break; + case "comment": // comment parsing mode + var next, maybeEnd = false; + while ((next = stream.next()) != null) { + if (next == "#" && maybeEnd) { + + state.mode = false; + break; + } + maybeEnd = (next == "|"); + } + returnType = COMMENT; + break; + case "s-expr-comment": // s-expr commenting mode + state.mode = false; + if(stream.peek() == "(" || stream.peek() == "["){ + // actually start scheme s-expr commenting mode + state.sExprComment = 0; + }else{ + // if not we just comment the entire of the next token + stream.eatWhile(/[^/s]/); // eat non spaces + returnType = COMMENT; + break; + } + default: // default parsing mode + var ch = stream.next(); + + if (ch == "\"") { + state.mode = "string"; + returnType = STRING; + + } else if (ch == "'") { + returnType = ATOM; + } else if (ch == '#') { + if (stream.eat("|")) { // Multi-line comment + state.mode = "comment"; // toggle to comment mode + returnType = COMMENT; + } else if (stream.eat(/[tf]/i)) { // #t/#f (atom) + returnType = ATOM; + } else if (stream.eat(';')) { // S-Expr comment + state.mode = "s-expr-comment"; + returnType = COMMENT; + } else { + var numTest = null, hasExactness = false, hasRadix = true; + if (stream.eat(/[ei]/i)) { + hasExactness = true; + } else { + stream.backUp(1); // must be radix specifier + } + if (stream.match(/^#b/i)) { + numTest = isBinaryNumber; + } else if (stream.match(/^#o/i)) { + numTest = isOctalNumber; + } else if (stream.match(/^#x/i)) { + numTest = isHexNumber; + } else if (stream.match(/^#d/i)) { + numTest = isDecimalNumber; + } else if (stream.match(/^[-+0-9.]/, false)) { + hasRadix = false; + numTest = isDecimalNumber; + // re-consume the intial # if all matches failed + } else if (!hasExactness) { + stream.eat('#'); + } + if (numTest != null) { + if (hasRadix && !hasExactness) { + // consume optional exactness after radix + stream.match(/^#[ei]/i); + } + if (numTest(stream)) + returnType = NUMBER; + } + } + } else if (/^[-+0-9.]/.test(ch) && isDecimalNumber(stream, true)) { // match non-prefixed number, must be decimal + returnType = NUMBER; + } else if (ch == ";") { // comment + stream.skipToEnd(); // rest of the line is a comment + returnType = COMMENT; + } else if (ch == "(" || ch == "[") { + var keyWord = ''; var indentTemp = stream.column(), letter; + /** + Either + (indent-word .. + (non-indent-word .. + (;something else, bracket, etc. + */ + + while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) { + keyWord += letter; + } + + if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word + + pushStack(state, indentTemp + INDENT_WORD_SKIP, ch); + } else { // non-indent word + // we continue eating the spaces + stream.eatSpace(); + if (stream.eol() || stream.peek() == ";") { + // nothing significant after + // we restart indentation 1 space after + pushStack(state, indentTemp + 1, ch); + } else { + pushStack(state, indentTemp + stream.current().length, ch); // else we match + } + } + stream.backUp(stream.current().length - 1); // undo all the eating + + if(typeof state.sExprComment == "number") state.sExprComment++; + + returnType = BRACKET; + } else if (ch == ")" || ch == "]") { + returnType = BRACKET; + if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) { + popStack(state); + + if(typeof state.sExprComment == "number"){ + if(--state.sExprComment == 0){ + returnType = COMMENT; // final closing bracket + state.sExprComment = false; // turn off s-expr commenting mode + } + } + } + } else { + stream.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/); + + if (keywords && keywords.propertyIsEnumerable(stream.current())) { + returnType = BUILTIN; + } else returnType = "variable"; + } + } + return (typeof state.sExprComment == "number") ? COMMENT : returnType; + }, + + indent: function (state) { + if (state.indentStack == null) return state.indentation; + return state.indentStack.indent; + }, + + lineComment: ";;" + }; +}); + +CodeMirror.defineMIME("text/x-scheme", "scheme"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/shell/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/shell/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0b56300b12be2dcd3fad2d9c8b3cc7379db95b0c --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/shell/index.html @@ -0,0 +1,66 @@ + + +CodeMirror: Shell mode + + + + + + + + + + +
        +

        Shell mode

        + + + + + + +

        MIME types defined: text/x-sh.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/shell/shell.js b/src/main/resources/templates/editor/lib/codemirror/mode/shell/shell.js new file mode 100644 index 0000000000000000000000000000000000000000..a684e8c233ad293ee677cb53d13bd53c9acba7ca --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/shell/shell.js @@ -0,0 +1,139 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode('shell', function() { + + var words = {}; + function define(style, string) { + var split = string.split(' '); + for(var i = 0; i < split.length; i++) { + words[split[i]] = style; + } + }; + + // Atoms + define('atom', 'true false'); + + // Keywords + define('keyword', 'if then do else elif while until for in esac fi fin ' + + 'fil done exit set unset export function'); + + // Commands + define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' + + 'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' + + 'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' + + 'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' + + 'touch vi vim wall wc wget who write yes zsh'); + + function tokenBase(stream, state) { + if (stream.eatSpace()) return null; + + var sol = stream.sol(); + var ch = stream.next(); + + if (ch === '\\') { + stream.next(); + return null; + } + if (ch === '\'' || ch === '"' || ch === '`') { + state.tokens.unshift(tokenString(ch)); + return tokenize(stream, state); + } + if (ch === '#') { + if (sol && stream.eat('!')) { + stream.skipToEnd(); + return 'meta'; // 'comment'? + } + stream.skipToEnd(); + return 'comment'; + } + if (ch === '$') { + state.tokens.unshift(tokenDollar); + return tokenize(stream, state); + } + if (ch === '+' || ch === '=') { + return 'operator'; + } + if (ch === '-') { + stream.eat('-'); + stream.eatWhile(/\w/); + return 'attribute'; + } + if (/\d/.test(ch)) { + stream.eatWhile(/\d/); + if(stream.eol() || !/\w/.test(stream.peek())) { + return 'number'; + } + } + stream.eatWhile(/[\w-]/); + var cur = stream.current(); + if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; + return words.hasOwnProperty(cur) ? words[cur] : null; + } + + function tokenString(quote) { + return function(stream, state) { + var next, end = false, escaped = false; + while ((next = stream.next()) != null) { + if (next === quote && !escaped) { + end = true; + break; + } + if (next === '$' && !escaped && quote !== '\'') { + escaped = true; + stream.backUp(1); + state.tokens.unshift(tokenDollar); + break; + } + escaped = !escaped && next === '\\'; + } + if (end || !escaped) { + state.tokens.shift(); + } + return (quote === '`' || quote === ')' ? 'quote' : 'string'); + }; + }; + + var tokenDollar = function(stream, state) { + if (state.tokens.length > 1) stream.eat('$'); + var ch = stream.next(), hungry = /\w/; + if (ch === '{') hungry = /[^}]/; + if (ch === '(') { + state.tokens[0] = tokenString(')'); + return tokenize(stream, state); + } + if (!/\d/.test(ch)) { + stream.eatWhile(hungry); + stream.eat('}'); + } + state.tokens.shift(); + return 'def'; + }; + + function tokenize(stream, state) { + return (state.tokens[0] || tokenBase) (stream, state); + }; + + return { + startState: function() {return {tokens:[]};}, + token: function(stream, state) { + return tokenize(stream, state); + }, + lineComment: '#', + fold: "brace" + }; +}); + +CodeMirror.defineMIME('text/x-sh', 'shell'); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/shell/test.js b/src/main/resources/templates/editor/lib/codemirror/mode/shell/test.js new file mode 100644 index 0000000000000000000000000000000000000000..a413b5a406b981172b0ae83d675dac369531ad49 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/shell/test.js @@ -0,0 +1,58 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + var mode = CodeMirror.getMode({}, "shell"); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + MT("var", + "text [def $var] text"); + MT("varBraces", + "text[def ${var}]text"); + MT("varVar", + "text [def $a$b] text"); + MT("varBracesVarBraces", + "text[def ${a}${b}]text"); + + MT("singleQuotedVar", + "[string 'text $var text']"); + MT("singleQuotedVarBraces", + "[string 'text ${var} text']"); + + MT("doubleQuotedVar", + '[string "text ][def $var][string text"]'); + MT("doubleQuotedVarBraces", + '[string "text][def ${var}][string text"]'); + MT("doubleQuotedVarPunct", + '[string "text ][def $@][string text"]'); + MT("doubleQuotedVarVar", + '[string "][def $a$b][string "]'); + MT("doubleQuotedVarBracesVarBraces", + '[string "][def ${a}${b}][string "]'); + + MT("notAString", + "text\\'text"); + MT("escapes", + "outside\\'\\\"\\`\\\\[string \"inside\\`\\'\\\"\\\\`\\$notAVar\"]outside\\$\\(notASubShell\\)"); + + MT("subshell", + "[builtin echo] [quote $(whoami)] s log, stardate [quote `date`]."); + MT("doubleQuotedSubshell", + "[builtin echo] [string \"][quote $(whoami)][string 's log, stardate `date`.\"]"); + + MT("hashbang", + "[meta #!/bin/bash]"); + MT("comment", + "text [comment # Blurb]"); + + MT("numbers", + "[number 0] [number 1] [number 2]"); + MT("keywords", + "[keyword while] [atom true]; [keyword do]", + " [builtin sleep] [number 3]", + "[keyword done]"); + MT("options", + "[builtin ls] [attribute -l] [attribute --human-readable]"); + MT("operator", + "[def var][operator =]value"); +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/sieve/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/sieve/index.html new file mode 100644 index 0000000000000000000000000000000000000000..6f029b623e81813f57e0cf9a98c5603d68f79a99 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/sieve/index.html @@ -0,0 +1,93 @@ + + +CodeMirror: Sieve (RFC5228) mode + + + + + + + + + +
        +

        Sieve (RFC5228) mode

        +
        + + +

        MIME types defined: application/sieve.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/sieve/sieve.js b/src/main/resources/templates/editor/lib/codemirror/mode/sieve/sieve.js new file mode 100644 index 0000000000000000000000000000000000000000..f67db2f5531b0c524fea1ab8e09ed8b86bcd6548 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/sieve/sieve.js @@ -0,0 +1,193 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("sieve", function(config) { + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var keywords = words("if elsif else stop require"); + var atoms = words("true false not"); + var indentUnit = config.indentUnit; + + function tokenBase(stream, state) { + + var ch = stream.next(); + if (ch == "/" && stream.eat("*")) { + state.tokenize = tokenCComment; + return tokenCComment(stream, state); + } + + if (ch === '#') { + stream.skipToEnd(); + return "comment"; + } + + if (ch == "\"") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + + if (ch == "(") { + state._indent.push("("); + // add virtual angel wings so that editor behaves... + // ...more sane incase of broken brackets + state._indent.push("{"); + return null; + } + + if (ch === "{") { + state._indent.push("{"); + return null; + } + + if (ch == ")") { + state._indent.pop(); + state._indent.pop(); + } + + if (ch === "}") { + state._indent.pop(); + return null; + } + + if (ch == ",") + return null; + + if (ch == ";") + return null; + + + if (/[{}\(\),;]/.test(ch)) + return null; + + // 1*DIGIT "K" / "M" / "G" + if (/\d/.test(ch)) { + stream.eatWhile(/[\d]/); + stream.eat(/[KkMmGg]/); + return "number"; + } + + // ":" (ALPHA / "_") *(ALPHA / DIGIT / "_") + if (ch == ":") { + stream.eatWhile(/[a-zA-Z_]/); + stream.eatWhile(/[a-zA-Z0-9_]/); + + return "operator"; + } + + stream.eatWhile(/\w/); + var cur = stream.current(); + + // "text:" *(SP / HTAB) (hash-comment / CRLF) + // *(multiline-literal / multiline-dotstart) + // "." CRLF + if ((cur == "text") && stream.eat(":")) + { + state.tokenize = tokenMultiLineString; + return "string"; + } + + if (keywords.propertyIsEnumerable(cur)) + return "keyword"; + + if (atoms.propertyIsEnumerable(cur)) + return "atom"; + + return null; + } + + function tokenMultiLineString(stream, state) + { + state._multiLineString = true; + // the first line is special it may contain a comment + if (!stream.sol()) { + stream.eatSpace(); + + if (stream.peek() == "#") { + stream.skipToEnd(); + return "comment"; + } + + stream.skipToEnd(); + return "string"; + } + + if ((stream.next() == ".") && (stream.eol())) + { + state._multiLineString = false; + state.tokenize = tokenBase; + } + + return "string"; + } + + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) + break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return "string"; + }; + } + + return { + startState: function(base) { + return {tokenize: tokenBase, + baseIndent: base || 0, + _indent: []}; + }, + + token: function(stream, state) { + if (stream.eatSpace()) + return null; + + return (state.tokenize || tokenBase)(stream, state);; + }, + + indent: function(state, _textAfter) { + var length = state._indent.length; + if (_textAfter && (_textAfter[0] == "}")) + length--; + + if (length <0) + length = 0; + + return length * indentUnit; + }, + + electricChars: "}" + }; +}); + +CodeMirror.defineMIME("application/sieve", "sieve"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/slim/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/slim/index.html new file mode 100644 index 0000000000000000000000000000000000000000..7fa4e50df3c51bea62529cc18a705438d6443d85 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/slim/index.html @@ -0,0 +1,96 @@ + + +CodeMirror: SLIM mode + + + + + + + + + + + + + + + + + + + + +
        +

        SLIM mode

        +
        + + +

        MIME types defined: application/x-slim.

        + +

        + Parsing/Highlighting Tests: + normal, + verbose. +

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/slim/slim.js b/src/main/resources/templates/editor/lib/codemirror/mode/slim/slim.js new file mode 100644 index 0000000000000000000000000000000000000000..164464d06678874a1ed3fa120324bb8d862fd4e6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/slim/slim.js @@ -0,0 +1,575 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../ruby/ruby")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../ruby/ruby"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + + CodeMirror.defineMode("slim", function(config) { + var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"}); + var rubyMode = CodeMirror.getMode(config, "ruby"); + var modes = { html: htmlMode, ruby: rubyMode }; + var embedded = { + ruby: "ruby", + javascript: "javascript", + css: "text/css", + sass: "text/x-sass", + scss: "text/x-scss", + less: "text/x-less", + styl: "text/x-styl", // no highlighting so far + coffee: "coffeescript", + asciidoc: "text/x-asciidoc", + markdown: "text/x-markdown", + textile: "text/x-textile", // no highlighting so far + creole: "text/x-creole", // no highlighting so far + wiki: "text/x-wiki", // no highlighting so far + mediawiki: "text/x-mediawiki", // no highlighting so far + rdoc: "text/x-rdoc", // no highlighting so far + builder: "text/x-builder", // no highlighting so far + nokogiri: "text/x-nokogiri", // no highlighting so far + erb: "application/x-erb" + }; + var embeddedRegexp = function(map){ + var arr = []; + for(var key in map) arr.push(key); + return new RegExp("^("+arr.join('|')+"):"); + }(embedded); + + var styleMap = { + "commentLine": "comment", + "slimSwitch": "operator special", + "slimTag": "tag", + "slimId": "attribute def", + "slimClass": "attribute qualifier", + "slimAttribute": "attribute", + "slimSubmode": "keyword special", + "closeAttributeTag": null, + "slimDoctype": null, + "lineContinuation": null + }; + var closing = { + "{": "}", + "[": "]", + "(": ")" + }; + + var nameStartChar = "_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD"; + var nameChar = nameStartChar + "\\-0-9\xB7\u0300-\u036F\u203F-\u2040"; + var nameRegexp = new RegExp("^[:"+nameStartChar+"](?::["+nameChar+"]|["+nameChar+"]*)"); + var attributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*(?=\\s*=)"); + var wrappedAttributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*"); + var classNameRegexp = /^\.-?[_a-zA-Z]+[\w\-]*/; + var classIdRegexp = /^#[_a-zA-Z]+[\w\-]*/; + + function backup(pos, tokenize, style) { + var restore = function(stream, state) { + state.tokenize = tokenize; + if (stream.pos < pos) { + stream.pos = pos; + return style; + } + return state.tokenize(stream, state); + }; + return function(stream, state) { + state.tokenize = restore; + return tokenize(stream, state); + }; + } + + function maybeBackup(stream, state, pat, offset, style) { + var cur = stream.current(); + var idx = cur.search(pat); + if (idx > -1) { + state.tokenize = backup(stream.pos, state.tokenize, style); + stream.backUp(cur.length - idx - offset); + } + return style; + } + + function continueLine(state, column) { + state.stack = { + parent: state.stack, + style: "continuation", + indented: column, + tokenize: state.line + }; + state.line = state.tokenize; + } + function finishContinue(state) { + if (state.line == state.tokenize) { + state.line = state.stack.tokenize; + state.stack = state.stack.parent; + } + } + + function lineContinuable(column, tokenize) { + return function(stream, state) { + finishContinue(state); + if (stream.match(/^\\$/)) { + continueLine(state, column); + return "lineContinuation"; + } + var style = tokenize(stream, state); + if (stream.eol() && stream.current().match(/(?:^|[^\\])(?:\\\\)*\\$/)) { + stream.backUp(1); + } + return style; + }; + } + function commaContinuable(column, tokenize) { + return function(stream, state) { + finishContinue(state); + var style = tokenize(stream, state); + if (stream.eol() && stream.current().match(/,$/)) { + continueLine(state, column); + } + return style; + }; + } + + function rubyInQuote(endQuote, tokenize) { + // TODO: add multi line support + return function(stream, state) { + var ch = stream.peek(); + if (ch == endQuote && state.rubyState.tokenize.length == 1) { + // step out of ruby context as it seems to complete processing all the braces + stream.next(); + state.tokenize = tokenize; + return "closeAttributeTag"; + } else { + return ruby(stream, state); + } + }; + } + function startRubySplat(tokenize) { + var rubyState; + var runSplat = function(stream, state) { + if (state.rubyState.tokenize.length == 1 && !state.rubyState.context.prev) { + stream.backUp(1); + if (stream.eatSpace()) { + state.rubyState = rubyState; + state.tokenize = tokenize; + return tokenize(stream, state); + } + stream.next(); + } + return ruby(stream, state); + }; + return function(stream, state) { + rubyState = state.rubyState; + state.rubyState = rubyMode.startState(); + state.tokenize = runSplat; + return ruby(stream, state); + }; + } + + function ruby(stream, state) { + return rubyMode.token(stream, state.rubyState); + } + + function htmlLine(stream, state) { + if (stream.match(/^\\$/)) { + return "lineContinuation"; + } + return html(stream, state); + } + function html(stream, state) { + if (stream.match(/^#\{/)) { + state.tokenize = rubyInQuote("}", state.tokenize); + return null; + } + return maybeBackup(stream, state, /[^\\]#\{/, 1, htmlMode.token(stream, state.htmlState)); + } + + function startHtmlLine(lastTokenize) { + return function(stream, state) { + var style = htmlLine(stream, state); + if (stream.eol()) state.tokenize = lastTokenize; + return style; + }; + } + + function startHtmlMode(stream, state, offset) { + state.stack = { + parent: state.stack, + style: "html", + indented: stream.column() + offset, // pipe + space + tokenize: state.line + }; + state.line = state.tokenize = html; + return null; + } + + function comment(stream, state) { + stream.skipToEnd(); + return state.stack.style; + } + + function commentMode(stream, state) { + state.stack = { + parent: state.stack, + style: "comment", + indented: state.indented + 1, + tokenize: state.line + }; + state.line = comment; + return comment(stream, state); + } + + function attributeWrapper(stream, state) { + if (stream.eat(state.stack.endQuote)) { + state.line = state.stack.line; + state.tokenize = state.stack.tokenize; + state.stack = state.stack.parent; + return null; + } + if (stream.match(wrappedAttributeNameRegexp)) { + state.tokenize = attributeWrapperAssign; + return "slimAttribute"; + } + stream.next(); + return null; + } + function attributeWrapperAssign(stream, state) { + if (stream.match(/^==?/)) { + state.tokenize = attributeWrapperValue; + return null; + } + return attributeWrapper(stream, state); + } + function attributeWrapperValue(stream, state) { + var ch = stream.peek(); + if (ch == '"' || ch == "\'") { + state.tokenize = readQuoted(ch, "string", true, false, attributeWrapper); + stream.next(); + return state.tokenize(stream, state); + } + if (ch == '[') { + return startRubySplat(attributeWrapper)(stream, state); + } + if (stream.match(/^(true|false|nil)\b/)) { + state.tokenize = attributeWrapper; + return "keyword"; + } + return startRubySplat(attributeWrapper)(stream, state); + } + + function startAttributeWrapperMode(state, endQuote, tokenize) { + state.stack = { + parent: state.stack, + style: "wrapper", + indented: state.indented + 1, + tokenize: tokenize, + line: state.line, + endQuote: endQuote + }; + state.line = state.tokenize = attributeWrapper; + return null; + } + + function sub(stream, state) { + if (stream.match(/^#\{/)) { + state.tokenize = rubyInQuote("}", state.tokenize); + return null; + } + var subStream = new CodeMirror.StringStream(stream.string.slice(state.stack.indented), stream.tabSize); + subStream.pos = stream.pos - state.stack.indented; + subStream.start = stream.start - state.stack.indented; + subStream.lastColumnPos = stream.lastColumnPos - state.stack.indented; + subStream.lastColumnValue = stream.lastColumnValue - state.stack.indented; + var style = state.subMode.token(subStream, state.subState); + stream.pos = subStream.pos + state.stack.indented; + return style; + } + function firstSub(stream, state) { + state.stack.indented = stream.column(); + state.line = state.tokenize = sub; + return state.tokenize(stream, state); + } + + function createMode(mode) { + var query = embedded[mode]; + var spec = CodeMirror.mimeModes[query]; + if (spec) { + return CodeMirror.getMode(config, spec); + } + var factory = CodeMirror.modes[query]; + if (factory) { + return factory(config, {name: query}); + } + return CodeMirror.getMode(config, "null"); + } + + function getMode(mode) { + if (!modes.hasOwnProperty(mode)) { + return modes[mode] = createMode(mode); + } + return modes[mode]; + } + + function startSubMode(mode, state) { + var subMode = getMode(mode); + var subState = subMode.startState && subMode.startState(); + + state.subMode = subMode; + state.subState = subState; + + state.stack = { + parent: state.stack, + style: "sub", + indented: state.indented + 1, + tokenize: state.line + }; + state.line = state.tokenize = firstSub; + return "slimSubmode"; + } + + function doctypeLine(stream, _state) { + stream.skipToEnd(); + return "slimDoctype"; + } + + function startLine(stream, state) { + var ch = stream.peek(); + if (ch == '<') { + return (state.tokenize = startHtmlLine(state.tokenize))(stream, state); + } + if (stream.match(/^[|']/)) { + return startHtmlMode(stream, state, 1); + } + if (stream.match(/^\/(!|\[\w+])?/)) { + return commentMode(stream, state); + } + if (stream.match(/^(-|==?[<>]?)/)) { + state.tokenize = lineContinuable(stream.column(), commaContinuable(stream.column(), ruby)); + return "slimSwitch"; + } + if (stream.match(/^doctype\b/)) { + state.tokenize = doctypeLine; + return "keyword"; + } + + var m = stream.match(embeddedRegexp); + if (m) { + return startSubMode(m[1], state); + } + + return slimTag(stream, state); + } + + function slim(stream, state) { + if (state.startOfLine) { + return startLine(stream, state); + } + return slimTag(stream, state); + } + + function slimTag(stream, state) { + if (stream.eat('*')) { + state.tokenize = startRubySplat(slimTagExtras); + return null; + } + if (stream.match(nameRegexp)) { + state.tokenize = slimTagExtras; + return "slimTag"; + } + return slimClass(stream, state); + } + function slimTagExtras(stream, state) { + if (stream.match(/^(<>?|> state.indented && state.last != "slimSubmode") { + state.line = state.tokenize = state.stack.tokenize; + state.stack = state.stack.parent; + state.subMode = null; + state.subState = null; + } + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + state.startOfLine = false; + if (style) state.last = style; + return styleMap.hasOwnProperty(style) ? styleMap[style] : style; + }, + + blankLine: function(state) { + if (state.subMode && state.subMode.blankLine) { + return state.subMode.blankLine(state.subState); + } + }, + + innerMode: function(state) { + if (state.subMode) return {state: state.subState, mode: state.subMode}; + return {state: state, mode: mode}; + } + + //indent: function(state) { + // return state.indented; + //} + }; + return mode; + }, "htmlmixed", "ruby"); + + CodeMirror.defineMIME("text/x-slim", "slim"); + CodeMirror.defineMIME("application/x-slim", "slim"); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/slim/test.js b/src/main/resources/templates/editor/lib/codemirror/mode/slim/test.js new file mode 100644 index 0000000000000000000000000000000000000000..be4ddacb620299573a8838e1a2774ad9d7f7bfca --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/slim/test.js @@ -0,0 +1,96 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh + +(function() { + var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "slim"); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + // Requires at least one media query + MT("elementName", + "[tag h1] Hey There"); + + MT("oneElementPerLine", + "[tag h1] Hey There .h2"); + + MT("idShortcut", + "[attribute&def #test] Hey There"); + + MT("tagWithIdShortcuts", + "[tag h1][attribute&def #test] Hey There"); + + MT("classShortcut", + "[attribute&qualifier .hello] Hey There"); + + MT("tagWithIdAndClassShortcuts", + "[tag h1][attribute&def #test][attribute&qualifier .hello] Hey There"); + + MT("docType", + "[keyword doctype] xml"); + + MT("comment", + "[comment / Hello WORLD]"); + + MT("notComment", + "[tag h1] This is not a / comment "); + + MT("attributes", + "[tag a]([attribute title]=[string \"test\"]) [attribute href]=[string \"link\"]}"); + + MT("multiLineAttributes", + "[tag a]([attribute title]=[string \"test\"]", + " ) [attribute href]=[string \"link\"]}"); + + MT("htmlCode", + "[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket ]"); + + MT("rubyBlock", + "[operator&special =][variable-2 @item]"); + + MT("selectorRubyBlock", + "[tag a][attribute&qualifier .test][operator&special =] [variable-2 @item]"); + + MT("nestedRubyBlock", + "[tag a]", + " [operator&special =][variable puts] [string \"test\"]"); + + MT("multilinePlaintext", + "[tag p]", + " | Hello,", + " World"); + + MT("multilineRuby", + "[tag p]", + " [comment /# this is a comment]", + " [comment and this is a comment too]", + " | Date/Time", + " [operator&special -] [variable now] [operator =] [tag DateTime][operator .][property now]", + " [tag strong][operator&special =] [variable now]", + " [operator&special -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][property parse]([string \"December 31, 2006\"])", + " [operator&special =][string \"Happy\"]", + " [operator&special =][string \"Belated\"]", + " [operator&special =][string \"Birthday\"]"); + + MT("multilineComment", + "[comment /]", + " [comment Multiline]", + " [comment Comment]"); + + MT("hamlAfterRubyTag", + "[attribute&qualifier .block]", + " [tag strong][operator&special =] [variable now]", + " [attribute&qualifier .test]", + " [operator&special =][variable now]", + " [attribute&qualifier .right]"); + + MT("stretchedRuby", + "[operator&special =] [variable puts] [string \"Hello\"],", + " [string \"World\"]"); + + MT("interpolationInHashAttribute", + "[tag div]{[attribute id] = [string \"]#{[variable test]}[string _]#{[variable ting]}[string \"]} test"); + + MT("interpolationInHTMLAttribute", + "[tag div]([attribute title]=[string \"]#{[variable test]}[string _]#{[variable ting]()}[string \"]) Test"); +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/smalltalk/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/smalltalk/index.html new file mode 100644 index 0000000000000000000000000000000000000000..2155ebc2a039b49da23607549e8eaf8f114f1481 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/smalltalk/index.html @@ -0,0 +1,68 @@ + + +CodeMirror: Smalltalk mode + + + + + + + + + + +
        +

        Smalltalk mode

        +
        + + + +

        Simple Smalltalk mode.

        + +

        MIME types defined: text/x-stsrc.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/smalltalk/smalltalk.js b/src/main/resources/templates/editor/lib/codemirror/mode/smalltalk/smalltalk.js new file mode 100644 index 0000000000000000000000000000000000000000..bb510ba2e15ff0f008b522a53791d2e729b9bbc3 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/smalltalk/smalltalk.js @@ -0,0 +1,168 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode('smalltalk', function(config) { + + var specialChars = /[+\-\/\\*~<>=@%|&?!.,:;^]/; + var keywords = /true|false|nil|self|super|thisContext/; + + var Context = function(tokenizer, parent) { + this.next = tokenizer; + this.parent = parent; + }; + + var Token = function(name, context, eos) { + this.name = name; + this.context = context; + this.eos = eos; + }; + + var State = function() { + this.context = new Context(next, null); + this.expectVariable = true; + this.indentation = 0; + this.userIndentationDelta = 0; + }; + + State.prototype.userIndent = function(indentation) { + this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0; + }; + + var next = function(stream, context, state) { + var token = new Token(null, context, false); + var aChar = stream.next(); + + if (aChar === '"') { + token = nextComment(stream, new Context(nextComment, context)); + + } else if (aChar === '\'') { + token = nextString(stream, new Context(nextString, context)); + + } else if (aChar === '#') { + if (stream.peek() === '\'') { + stream.next(); + token = nextSymbol(stream, new Context(nextSymbol, context)); + } else { + if (stream.eatWhile(/[^\s.{}\[\]()]/)) + token.name = 'string-2'; + else + token.name = 'meta'; + } + + } else if (aChar === '$') { + if (stream.next() === '<') { + stream.eatWhile(/[^\s>]/); + stream.next(); + } + token.name = 'string-2'; + + } else if (aChar === '|' && state.expectVariable) { + token.context = new Context(nextTemporaries, context); + + } else if (/[\[\]{}()]/.test(aChar)) { + token.name = 'bracket'; + token.eos = /[\[{(]/.test(aChar); + + if (aChar === '[') { + state.indentation++; + } else if (aChar === ']') { + state.indentation = Math.max(0, state.indentation - 1); + } + + } else if (specialChars.test(aChar)) { + stream.eatWhile(specialChars); + token.name = 'operator'; + token.eos = aChar !== ';'; // ; cascaded message expression + + } else if (/\d/.test(aChar)) { + stream.eatWhile(/[\w\d]/); + token.name = 'number'; + + } else if (/[\w_]/.test(aChar)) { + stream.eatWhile(/[\w\d_]/); + token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null; + + } else { + token.eos = state.expectVariable; + } + + return token; + }; + + var nextComment = function(stream, context) { + stream.eatWhile(/[^"]/); + return new Token('comment', stream.eat('"') ? context.parent : context, true); + }; + + var nextString = function(stream, context) { + stream.eatWhile(/[^']/); + return new Token('string', stream.eat('\'') ? context.parent : context, false); + }; + + var nextSymbol = function(stream, context) { + stream.eatWhile(/[^']/); + return new Token('string-2', stream.eat('\'') ? context.parent : context, false); + }; + + var nextTemporaries = function(stream, context) { + var token = new Token(null, context, false); + var aChar = stream.next(); + + if (aChar === '|') { + token.context = context.parent; + token.eos = true; + + } else { + stream.eatWhile(/[^|]/); + token.name = 'variable'; + } + + return token; + }; + + return { + startState: function() { + return new State; + }, + + token: function(stream, state) { + state.userIndent(stream.indentation()); + + if (stream.eatSpace()) { + return null; + } + + var token = state.context.next(stream, state.context, state); + state.context = token.context; + state.expectVariable = token.eos; + + return token.name; + }, + + blankLine: function(state) { + state.userIndent(0); + }, + + indent: function(state, textAfter) { + var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta; + return (state.indentation + i) * config.indentUnit; + }, + + electricChars: ']' + }; + +}); + +CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/smarty/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/smarty/index.html new file mode 100644 index 0000000000000000000000000000000000000000..8d88c9a302cb94726871f24b406c36edcab1b74f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/smarty/index.html @@ -0,0 +1,136 @@ + + +CodeMirror: Smarty mode + + + + + + + + + +
        +

        Smarty mode

        +
        + + + +
        + +

        Smarty 2, custom delimiters

        +
        + + + +
        + +

        Smarty 3

        + + + + + + +

        A plain text/Smarty version 2 or 3 mode, which allows for custom delimiter tags.

        + +

        MIME types defined: text/x-smarty

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/smarty/smarty.js b/src/main/resources/templates/editor/lib/codemirror/mode/smarty/smarty.js new file mode 100644 index 0000000000000000000000000000000000000000..bb053245d3581f9bbf6e2ff37dcac1d20ba64ac6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/smarty/smarty.js @@ -0,0 +1,221 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/** + * Smarty 2 and 3 mode. + */ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("smarty", function(config) { + "use strict"; + + // our default settings; check to see if they're overridden + var settings = { + rightDelimiter: '}', + leftDelimiter: '{', + smartyVersion: 2 // for backward compatibility + }; + if (config.hasOwnProperty("leftDelimiter")) { + settings.leftDelimiter = config.leftDelimiter; + } + if (config.hasOwnProperty("rightDelimiter")) { + settings.rightDelimiter = config.rightDelimiter; + } + if (config.hasOwnProperty("smartyVersion") && config.smartyVersion === 3) { + settings.smartyVersion = 3; + } + + var keyFunctions = ["debug", "extends", "function", "include", "literal"]; + var last; + var regs = { + operatorChars: /[+\-*&%=<>!?]/, + validIdentifier: /[a-zA-Z0-9_]/, + stringChar: /['"]/ + }; + + var helpers = { + cont: function(style, lastType) { + last = lastType; + return style; + }, + chain: function(stream, state, parser) { + state.tokenize = parser; + return parser(stream, state); + } + }; + + + // our various parsers + var parsers = { + + // the main tokenizer + tokenizer: function(stream, state) { + if (stream.match(settings.leftDelimiter, true)) { + if (stream.eat("*")) { + return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter)); + } else { + // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode + state.depth++; + var isEol = stream.eol(); + var isFollowedByWhitespace = /\s/.test(stream.peek()); + if (settings.smartyVersion === 3 && settings.leftDelimiter === "{" && (isEol || isFollowedByWhitespace)) { + state.depth--; + return null; + } else { + state.tokenize = parsers.smarty; + last = "startTag"; + return "tag"; + } + } + } else { + stream.next(); + return null; + } + }, + + // parsing Smarty content + smarty: function(stream, state) { + if (stream.match(settings.rightDelimiter, true)) { + if (settings.smartyVersion === 3) { + state.depth--; + if (state.depth <= 0) { + state.tokenize = parsers.tokenizer; + } + } else { + state.tokenize = parsers.tokenizer; + } + return helpers.cont("tag", null); + } + + if (stream.match(settings.leftDelimiter, true)) { + state.depth++; + return helpers.cont("tag", "startTag"); + } + + var ch = stream.next(); + if (ch == "$") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("variable-2", "variable"); + } else if (ch == "|") { + return helpers.cont("operator", "pipe"); + } else if (ch == ".") { + return helpers.cont("operator", "property"); + } else if (regs.stringChar.test(ch)) { + state.tokenize = parsers.inAttribute(ch); + return helpers.cont("string", "string"); + } else if (regs.operatorChars.test(ch)) { + stream.eatWhile(regs.operatorChars); + return helpers.cont("operator", "operator"); + } else if (ch == "[" || ch == "]") { + return helpers.cont("bracket", "bracket"); + } else if (ch == "(" || ch == ")") { + return helpers.cont("bracket", "operator"); + } else if (/\d/.test(ch)) { + stream.eatWhile(/\d/); + return helpers.cont("number", "number"); + } else { + + if (state.last == "variable") { + if (ch == "@") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("property", "property"); + } else if (ch == "|") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("qualifier", "modifier"); + } + } else if (state.last == "pipe") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("qualifier", "modifier"); + } else if (state.last == "whitespace") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("attribute", "modifier"); + } if (state.last == "property") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("property", null); + } else if (/\s/.test(ch)) { + last = "whitespace"; + return null; + } + + var str = ""; + if (ch != "/") { + str += ch; + } + var c = null; + while (c = stream.eat(regs.validIdentifier)) { + str += c; + } + for (var i=0, j=keyFunctions.length; i + +CodeMirror: Smarty mixed mode + + + + + + + + + + + + + +
        +

        Smarty mixed mode

        +
        + + + +

        The Smarty mixed mode depends on the Smarty and HTML mixed modes. HTML + mixed mode itself depends on XML, JavaScript, and CSS modes.

        + +

        It takes the same options, as Smarty and HTML mixed modes.

        + +

        MIME types defined: text/x-smarty.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/smartymixed/smartymixed.js b/src/main/resources/templates/editor/lib/codemirror/mode/smartymixed/smartymixed.js new file mode 100644 index 0000000000000000000000000000000000000000..4fc7ca4b606ec2ef60e7a9e5e4a95bc356258dbc --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/smartymixed/smartymixed.js @@ -0,0 +1,197 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/** +* @file smartymixed.js +* @brief Smarty Mixed Codemirror mode (Smarty + Mixed HTML) +* @author Ruslan Osmanov +* @version 3.0 +* @date 05.07.2013 +*/ + +// Warning: Don't base other modes on this one. This here is a +// terrible way to write a mixed mode. + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../smarty/smarty")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../smarty/smarty"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("smartymixed", function(config) { + var htmlMixedMode = CodeMirror.getMode(config, "htmlmixed"); + var smartyMode = CodeMirror.getMode(config, "smarty"); + + var settings = { + rightDelimiter: '}', + leftDelimiter: '{' + }; + + if (config.hasOwnProperty("leftDelimiter")) { + settings.leftDelimiter = config.leftDelimiter; + } + if (config.hasOwnProperty("rightDelimiter")) { + settings.rightDelimiter = config.rightDelimiter; + } + + function reEsc(str) { return str.replace(/[^\s\w]/g, "\\$&"); } + + var reLeft = reEsc(settings.leftDelimiter), reRight = reEsc(settings.rightDelimiter); + var regs = { + smartyComment: new RegExp("^" + reRight + "\\*"), + literalOpen: new RegExp(reLeft + "literal" + reRight), + literalClose: new RegExp(reLeft + "\/literal" + reRight), + hasLeftDelimeter: new RegExp(".*" + reLeft), + htmlHasLeftDelimeter: new RegExp("[^<>]*" + reLeft) + }; + + var helpers = { + chain: function(stream, state, parser) { + state.tokenize = parser; + return parser(stream, state); + }, + + cleanChain: function(stream, state, parser) { + state.tokenize = null; + state.localState = null; + state.localMode = null; + return (typeof parser == "string") ? (parser ? parser : null) : parser(stream, state); + }, + + maybeBackup: function(stream, pat, style) { + var cur = stream.current(); + var close = cur.search(pat), + m; + if (close > - 1) stream.backUp(cur.length - close); + else if (m = cur.match(/<\/?$/)) { + stream.backUp(cur.length); + if (!stream.match(pat, false)) stream.match(cur[0]); + } + return style; + } + }; + + var parsers = { + html: function(stream, state) { + var htmlTagName = state.htmlMixedState.htmlState.context && state.htmlMixedState.htmlState.context.tagName + ? state.htmlMixedState.htmlState.context.tagName + : null; + + if (!state.inLiteral && stream.match(regs.htmlHasLeftDelimeter, false) && htmlTagName === null) { + state.tokenize = parsers.smarty; + state.localMode = smartyMode; + state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, "")); + return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState)); + } else if (!state.inLiteral && stream.match(settings.leftDelimiter, false)) { + state.tokenize = parsers.smarty; + state.localMode = smartyMode; + state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, "")); + return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState)); + } + return htmlMixedMode.token(stream, state.htmlMixedState); + }, + + smarty: function(stream, state) { + if (stream.match(settings.leftDelimiter, false)) { + if (stream.match(regs.smartyComment, false)) { + return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter)); + } + } else if (stream.match(settings.rightDelimiter, false)) { + stream.eat(settings.rightDelimiter); + state.tokenize = parsers.html; + state.localMode = htmlMixedMode; + state.localState = state.htmlMixedState; + return "tag"; + } + + return helpers.maybeBackup(stream, settings.rightDelimiter, smartyMode.token(stream, state.localState)); + }, + + inBlock: function(style, terminator) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + helpers.cleanChain(stream, state, ""); + break; + } + stream.next(); + } + return style; + }; + } + }; + + return { + startState: function() { + var state = htmlMixedMode.startState(); + return { + token: parsers.html, + localMode: null, + localState: null, + htmlMixedState: state, + tokenize: null, + inLiteral: false + }; + }, + + copyState: function(state) { + var local = null, tok = (state.tokenize || state.token); + if (state.localState) { + local = CodeMirror.copyState((tok != parsers.html ? smartyMode : htmlMixedMode), state.localState); + } + return { + token: state.token, + tokenize: state.tokenize, + localMode: state.localMode, + localState: local, + htmlMixedState: CodeMirror.copyState(htmlMixedMode, state.htmlMixedState), + inLiteral: state.inLiteral + }; + }, + + token: function(stream, state) { + if (stream.match(settings.leftDelimiter, false)) { + if (!state.inLiteral && stream.match(regs.literalOpen, true)) { + state.inLiteral = true; + return "keyword"; + } else if (state.inLiteral && stream.match(regs.literalClose, true)) { + state.inLiteral = false; + return "keyword"; + } + } + if (state.inLiteral && state.localState != state.htmlMixedState) { + state.tokenize = parsers.html; + state.localMode = htmlMixedMode; + state.localState = state.htmlMixedState; + } + + var style = (state.tokenize || state.token)(stream, state); + return style; + }, + + indent: function(state, textAfter) { + if (state.localMode == smartyMode + || (state.inLiteral && !state.localMode) + || regs.hasLeftDelimeter.test(textAfter)) { + return CodeMirror.Pass; + } + return htmlMixedMode.indent(state.htmlMixedState, textAfter); + }, + + innerMode: function(state) { + return { + state: state.localState || state.htmlMixedState, + mode: state.localMode || htmlMixedMode + }; + } + }; +}, "htmlmixed", "smarty"); + +CodeMirror.defineMIME("text/x-smarty", "smartymixed"); +// vim: et ts=2 sts=2 sw=2 + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/solr/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/solr/index.html new file mode 100644 index 0000000000000000000000000000000000000000..4b18c25b786843bc6522d553d712898d3eb432af --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/solr/index.html @@ -0,0 +1,57 @@ + + +CodeMirror: Solr mode + + + + + + + + + +
        +

        Solr mode

        + +
        + +
        + + + +

        MIME types defined: text/x-solr.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/solr/solr.js b/src/main/resources/templates/editor/lib/codemirror/mode/solr/solr.js new file mode 100644 index 0000000000000000000000000000000000000000..f7f7087891694b345dfaaed3392fd83c5d460702 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/solr/solr.js @@ -0,0 +1,104 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("solr", function() { + "use strict"; + + var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\^\"\\]/; + var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/; + var isOperatorString = /^(OR|AND|NOT|TO)$/i; + + function isNumber(word) { + return parseFloat(word, 10).toString() === word; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) break; + escaped = !escaped && next == "\\"; + } + + if (!escaped) state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenOperator(operator) { + return function(stream, state) { + var style = "operator"; + if (operator == "+") + style += " positive"; + else if (operator == "-") + style += " negative"; + else if (operator == "|") + stream.eat(/\|/); + else if (operator == "&") + stream.eat(/\&/); + else if (operator == "^") + style += " boost"; + + state.tokenize = tokenBase; + return style; + }; + } + + function tokenWord(ch) { + return function(stream, state) { + var word = ch; + while ((ch = stream.peek()) && ch.match(isStringChar) != null) { + word += stream.next(); + } + + state.tokenize = tokenBase; + if (isOperatorString.test(word)) + return "operator"; + else if (isNumber(word)) + return "number"; + else if (stream.peek() == ":") + return "field"; + else + return "string"; + }; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"') + state.tokenize = tokenString(ch); + else if (isOperatorChar.test(ch)) + state.tokenize = tokenOperator(ch); + else if (isStringChar.test(ch)) + state.tokenize = tokenWord(ch); + + return (state.tokenize != tokenBase) ? state.tokenize(stream, state) : null; + } + + return { + startState: function() { + return { + tokenize: tokenBase + }; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + } + }; +}); + +CodeMirror.defineMIME("text/x-solr", "solr"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/soy/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/soy/index.html new file mode 100644 index 0000000000000000000000000000000000000000..f0216f097dd1c7eb8506ba685dd6be8a7857fa9c --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/soy/index.html @@ -0,0 +1,68 @@ + + +CodeMirror: Soy (Closure Template) mode + + + + + + + + + + + + + + +
        +

        Soy (Closure Template) mode

        +
        + + + +

        A mode for Closure Templates (Soy).

        +

        MIME type defined: text/x-soy.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/soy/soy.js b/src/main/resources/templates/editor/lib/codemirror/mode/soy/soy.js new file mode 100644 index 0000000000000000000000000000000000000000..7e81e8dd56b7b93f37a8ebc2fdd442b9e4c6e85b --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/soy/soy.js @@ -0,0 +1,198 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + var indentingTags = ["template", "literal", "msg", "fallbackmsg", "let", "if", "elseif", + "else", "switch", "case", "default", "foreach", "ifempty", "for", + "call", "param", "deltemplate", "delcall", "log"]; + + CodeMirror.defineMode("soy", function(config) { + var textMode = CodeMirror.getMode(config, "text/plain"); + var modes = { + html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false}), + attributes: textMode, + text: textMode, + uri: textMode, + css: CodeMirror.getMode(config, "text/css"), + js: CodeMirror.getMode(config, {name: "text/javascript", statementIndent: 2 * config.indentUnit}) + }; + + function last(array) { + return array[array.length - 1]; + } + + function tokenUntil(stream, state, untilRegExp) { + var oldString = stream.string; + var match = untilRegExp.exec(oldString.substr(stream.pos)); + if (match) { + // We don't use backUp because it backs up just the position, not the state. + // This uses an undocumented API. + stream.string = oldString.substr(0, stream.pos + match.index); + } + var result = stream.hideFirstChars(state.indent, function() { + return state.localMode.token(stream, state.localState); + }); + stream.string = oldString; + return result; + } + + return { + startState: function() { + return { + kind: [], + kindTag: [], + soyState: [], + indent: 0, + localMode: modes.html, + localState: CodeMirror.startState(modes.html) + }; + }, + + copyState: function(state) { + return { + tag: state.tag, // Last seen Soy tag. + kind: state.kind.concat([]), // Values of kind="" attributes. + kindTag: state.kindTag.concat([]), // Opened tags with kind="" attributes. + soyState: state.soyState.concat([]), + indent: state.indent, // Indentation of the following line. + localMode: state.localMode, + localState: CodeMirror.copyState(state.localMode, state.localState) + }; + }, + + token: function(stream, state) { + var match; + + switch (last(state.soyState)) { + case "comment": + if (stream.match(/^.*?\*\//)) { + state.soyState.pop(); + } else { + stream.skipToEnd(); + } + return "comment"; + + case "variable": + if (stream.match(/^}/)) { + state.indent -= 2 * config.indentUnit; + state.soyState.pop(); + return "variable-2"; + } + stream.next(); + return null; + + case "tag": + if (stream.match(/^\/?}/)) { + if (state.tag == "/template" || state.tag == "/deltemplate") state.indent = 0; + else state.indent -= (stream.current() == "/}" || indentingTags.indexOf(state.tag) == -1 ? 2 : 1) * config.indentUnit; + state.soyState.pop(); + return "keyword"; + } else if (stream.match(/^(\w+)(?==)/)) { + if (stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) { + var kind = match[1]; + state.kind.push(kind); + state.kindTag.push(state.tag); + state.localMode = modes[kind] || modes.html; + state.localState = CodeMirror.startState(state.localMode); + } + return "attribute"; + } else if (stream.match(/^"/)) { + state.soyState.push("string"); + return "string"; + } + stream.next(); + return null; + + case "literal": + if (stream.match(/^(?=\{\/literal})/)) { + state.indent -= config.indentUnit; + state.soyState.pop(); + return this.token(stream, state); + } + return tokenUntil(stream, state, /\{\/literal}/); + + case "string": + if (stream.match(/^.*?"/)) { + state.soyState.pop(); + } else { + stream.skipToEnd(); + } + return "string"; + } + + if (stream.match(/^\/\*/)) { + state.soyState.push("comment"); + return "comment"; + } else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) { + return "comment"; + } else if (stream.match(/^\{\$\w*/)) { + state.indent += 2 * config.indentUnit; + state.soyState.push("variable"); + return "variable-2"; + } else if (stream.match(/^\{literal}/)) { + state.indent += config.indentUnit; + state.soyState.push("literal"); + return "keyword"; + } else if (match = stream.match(/^\{([\/@\\]?\w*)/)) { + if (match[1] != "/switch") + state.indent += (/^(\/|(else|elseif|case|default)$)/.test(match[1]) && state.tag != "switch" ? 1 : 2) * config.indentUnit; + state.tag = match[1]; + if (state.tag == "/" + last(state.kindTag)) { + // We found the tag that opened the current kind="". + state.kind.pop(); + state.kindTag.pop(); + state.localMode = modes[last(state.kind)] || modes.html; + state.localState = CodeMirror.startState(state.localMode); + } + state.soyState.push("tag"); + return "keyword"; + } + + return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/); + }, + + indent: function(state, textAfter) { + var indent = state.indent, top = last(state.soyState); + if (top == "comment") return CodeMirror.Pass; + + if (top == "literal") { + if (/^\{\/literal}/.test(textAfter)) indent -= config.indentUnit; + } else { + if (/^\s*\{\/(template|deltemplate)\b/.test(textAfter)) return 0; + if (/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(textAfter)) indent -= config.indentUnit; + if (state.tag != "switch" && /^\{(case|default)\b/.test(textAfter)) indent -= config.indentUnit; + if (/^\{\/switch\b/.test(textAfter)) indent -= config.indentUnit; + } + if (indent && state.localMode.indent) + indent += state.localMode.indent(state.localState, textAfter); + return indent; + }, + + innerMode: function(state) { + if (state.soyState.length && last(state.soyState) != "literal") return null; + else return {state: state.localState, mode: state.localMode}; + }, + + electricInput: /^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/, + lineComment: "//", + blockCommentStart: "/*", + blockCommentEnd: "*/", + blockCommentContinue: " * ", + fold: "indent" + }; + }, "htmlmixed"); + + CodeMirror.registerHelper("hintWords", "soy", indentingTags.concat( + ["delpackage", "namespace", "alias", "print", "css", "debugger"])); + + CodeMirror.defineMIME("text/x-soy", "soy"); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/sparql/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/sparql/index.html new file mode 100644 index 0000000000000000000000000000000000000000..84ef4d36392c8eb937104b206e61e34768df6aef --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/sparql/index.html @@ -0,0 +1,61 @@ + + +CodeMirror: SPARQL mode + + + + + + + + + + +
        +

        SPARQL mode

        +
        + + +

        MIME types defined: application/sparql-query.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/sparql/sparql.js b/src/main/resources/templates/editor/lib/codemirror/mode/sparql/sparql.js new file mode 100644 index 0000000000000000000000000000000000000000..bbf8a76a0dbba12b52ba274ecf1d58280fd5144f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/sparql/sparql.js @@ -0,0 +1,174 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("sparql", function(config) { + var indentUnit = config.indentUnit; + var curPunc; + + function wordRegexp(words) { + return new RegExp("^(?:" + words.join("|") + ")$", "i"); + } + var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", + "iri", "uri", "bnode", "count", "sum", "min", "max", "avg", "sample", + "group_concat", "rand", "abs", "ceil", "floor", "round", "concat", "substr", "strlen", + "replace", "ucase", "lcase", "encode_for_uri", "contains", "strstarts", "strends", + "strbefore", "strafter", "year", "month", "day", "hours", "minutes", "seconds", + "timezone", "tz", "now", "uuid", "struuid", "md5", "sha1", "sha256", "sha384", + "sha512", "coalesce", "if", "strlang", "strdt", "isnumeric", "regex", "exists", + "isblank", "isliteral", "a"]); + var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe", + "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional", + "graph", "by", "asc", "desc", "as", "having", "undef", "values", "group", + "minus", "in", "not", "service", "silent", "using", "insert", "delete", "union", + "true", "false", "with", + "data", "copy", "to", "move", "add", "create", "drop", "clear", "load"]); + var operatorChars = /[*+\-<>=&|\^\/!\?]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + curPunc = null; + if (ch == "$" || ch == "?") { + if(ch == "?" && stream.match(/\s/, false)){ + return "operator"; + } + stream.match(/^[\w\d]*/); + return "variable-2"; + } + else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) { + stream.match(/^[^\s\u00a0>]*>?/); + return "atom"; + } + else if (ch == "\"" || ch == "'") { + state.tokenize = tokenLiteral(ch); + return state.tokenize(stream, state); + } + else if (/[{}\(\),\.;\[\]]/.test(ch)) { + curPunc = ch; + return "bracket"; + } + else if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } + else if (operatorChars.test(ch)) { + stream.eatWhile(operatorChars); + return "operator"; + } + else if (ch == ":") { + stream.eatWhile(/[\w\d\._\-]/); + return "atom"; + } + else if (ch == "@") { + stream.eatWhile(/[a-z\d\-]/i); + return "meta"; + } + else { + stream.eatWhile(/[_\w\d]/); + if (stream.eat(":")) { + stream.eatWhile(/[\w\d_\-]/); + return "atom"; + } + var word = stream.current(); + if (ops.test(word)) + return "builtin"; + else if (keywords.test(word)) + return "keyword"; + else + return "variable"; + } + } + + function tokenLiteral(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "string"; + }; + } + + function pushContext(state, type, col) { + state.context = {prev: state.context, indent: state.indent, col: col, type: type}; + } + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; + } + + return { + startState: function() { + return {tokenize: tokenBase, + context: null, + indent: 0, + col: 0}; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) state.context.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + + if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { + state.context.align = true; + } + + if (curPunc == "(") pushContext(state, ")", stream.column()); + else if (curPunc == "[") pushContext(state, "]", stream.column()); + else if (curPunc == "{") pushContext(state, "}", stream.column()); + else if (/[\]\}\)]/.test(curPunc)) { + while (state.context && state.context.type == "pattern") popContext(state); + if (state.context && curPunc == state.context.type) popContext(state); + } + else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); + else if (/atom|string|variable/.test(style) && state.context) { + if (/[\}\]]/.test(state.context.type)) + pushContext(state, "pattern", stream.column()); + else if (state.context.type == "pattern" && !state.context.align) { + state.context.align = true; + state.context.col = stream.column(); + } + } + + return style; + }, + + indent: function(state, textAfter) { + var firstChar = textAfter && textAfter.charAt(0); + var context = state.context; + if (/[\]\}]/.test(firstChar)) + while (context && context.type == "pattern") context = context.prev; + + var closing = context && firstChar == context.type; + if (!context) + return 0; + else if (context.type == "pattern") + return context.col; + else if (context.align) + return context.col + (closing ? 0 : 1); + else + return context.indent + (closing ? 0 : indentUnit); + } + }; +}); + +CodeMirror.defineMIME("application/sparql-query", "sparql"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/spreadsheet/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/spreadsheet/index.html new file mode 100644 index 0000000000000000000000000000000000000000..a52f76f050c1a825f3df461be8d54a56cc4f04cd --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/spreadsheet/index.html @@ -0,0 +1,42 @@ + + +CodeMirror: Spreadsheet mode + + + + + + + + + + +
        +

        Spreadsheet mode

        +
        + + + +

        MIME types defined: text/x-spreadsheet.

        + +

        The Spreadsheet Mode

        +

        Created by Robert Plummer

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/spreadsheet/spreadsheet.js b/src/main/resources/templates/editor/lib/codemirror/mode/spreadsheet/spreadsheet.js new file mode 100644 index 0000000000000000000000000000000000000000..6fab00fddaf23fcf69a1ce0b735996be0f37a774 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/spreadsheet/spreadsheet.js @@ -0,0 +1,109 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("spreadsheet", function () { + return { + startState: function () { + return { + stringType: null, + stack: [] + }; + }, + token: function (stream, state) { + if (!stream) return; + + //check for state changes + if (state.stack.length === 0) { + //strings + if ((stream.peek() == '"') || (stream.peek() == "'")) { + state.stringType = stream.peek(); + stream.next(); // Skip quote + state.stack.unshift("string"); + } + } + + //return state + //stack has + switch (state.stack[0]) { + case "string": + while (state.stack[0] === "string" && !stream.eol()) { + if (stream.peek() === state.stringType) { + stream.next(); // Skip quote + state.stack.shift(); // Clear flag + } else if (stream.peek() === "\\") { + stream.next(); + stream.next(); + } else { + stream.match(/^.[^\\\"\']*/); + } + } + return "string"; + + case "characterClass": + while (state.stack[0] === "characterClass" && !stream.eol()) { + if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) + state.stack.shift(); + } + return "operator"; + } + + var peek = stream.peek(); + + //no stack + switch (peek) { + case "[": + stream.next(); + state.stack.unshift("characterClass"); + return "bracket"; + case ":": + stream.next(); + return "operator"; + case "\\": + if (stream.match(/\\[a-z]+/)) return "string-2"; + else return null; + case ".": + case ",": + case ";": + case "*": + case "-": + case "+": + case "^": + case "<": + case "/": + case "=": + stream.next(); + return "atom"; + case "$": + stream.next(); + return "builtin"; + } + + if (stream.match(/\d+/)) { + if (stream.match(/^\w+/)) return "error"; + return "number"; + } else if (stream.match(/^[a-zA-Z_]\w*/)) { + if (stream.match(/(?=[\(.])/, false)) return "keyword"; + return "variable-2"; + } else if (["[", "]", "(", ")", "{", "}"].indexOf(peek) != -1) { + stream.next(); + return "bracket"; + } else if (!stream.eatSpace()) { + stream.next(); + } + return null; + } + }; + }); + + CodeMirror.defineMIME("text/x-spreadsheet", "spreadsheet"); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/sql/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/sql/index.html new file mode 100644 index 0000000000000000000000000000000000000000..a0d8d9e1b937977175eb59f8d6003d204aea5e57 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/sql/index.html @@ -0,0 +1,84 @@ + + +CodeMirror: SQL Mode for CodeMirror + + + + + + + + + + + + +
        +

        SQL Mode for CodeMirror

        +
        + +
        +

        MIME types defined: + text/x-sql, + text/x-mysql, + text/x-mariadb, + text/x-cassandra, + text/x-plsql, + text/x-mssql, + text/x-hive. +

        + + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/sql/sql.js b/src/main/resources/templates/editor/lib/codemirror/mode/sql/sql.js new file mode 100644 index 0000000000000000000000000000000000000000..ee6c194b0e8c914507133e0bf1f278c2cd049097 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/sql/sql.js @@ -0,0 +1,391 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("sql", function(config, parserConfig) { + "use strict"; + + var client = parserConfig.client || {}, + atoms = parserConfig.atoms || {"false": true, "true": true, "null": true}, + builtin = parserConfig.builtin || {}, + keywords = parserConfig.keywords || {}, + operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/, + support = parserConfig.support || {}, + hooks = parserConfig.hooks || {}, + dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true}; + + function tokenBase(stream, state) { + var ch = stream.next(); + + // call hooks from the mime type + if (hooks[ch]) { + var result = hooks[ch](stream, state); + if (result !== false) return result; + } + + if (support.hexNumber == true && + ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) + || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/))) { + // hex + // ref: http://dev.mysql.com/doc/refman/5.5/en/hexadecimal-literals.html + return "number"; + } else if (support.binaryNumber == true && + (((ch == "b" || ch == "B") && stream.match(/^'[01]+'/)) + || (ch == "0" && stream.match(/^b[01]+/)))) { + // bitstring + // ref: http://dev.mysql.com/doc/refman/5.5/en/bit-field-literals.html + return "number"; + } else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) { + // numbers + // ref: http://dev.mysql.com/doc/refman/5.5/en/number-literals.html + stream.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/); + support.decimallessFloat == true && stream.eat('.'); + return "number"; + } else if (ch == "?" && (stream.eatSpace() || stream.eol() || stream.eat(";"))) { + // placeholders + return "variable-3"; + } else if (ch == "'" || (ch == '"' && support.doubleQuote)) { + // strings + // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html + state.tokenize = tokenLiteral(ch); + return state.tokenize(stream, state); + } else if ((((support.nCharCast == true && (ch == "n" || ch == "N")) + || (support.charsetCast == true && ch == "_" && stream.match(/[a-z][a-z0-9]*/i))) + && (stream.peek() == "'" || stream.peek() == '"'))) { + // charset casting: _utf8'str', N'str', n'str' + // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html + return "keyword"; + } else if (/^[\(\),\;\[\]]/.test(ch)) { + // no highlightning + return null; + } else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) { + // 1-line comment + stream.skipToEnd(); + return "comment"; + } else if ((support.commentHash && ch == "#") + || (ch == "-" && stream.eat("-") && (!support.commentSpaceRequired || stream.eat(" ")))) { + // 1-line comments + // ref: https://kb.askmonty.org/en/comment-syntax/ + stream.skipToEnd(); + return "comment"; + } else if (ch == "/" && stream.eat("*")) { + // multi-line comments + // ref: https://kb.askmonty.org/en/comment-syntax/ + state.tokenize = tokenComment; + return state.tokenize(stream, state); + } else if (ch == ".") { + // .1 for 0.1 + if (support.zerolessFloat == true && stream.match(/^(?:\d+(?:e[+-]?\d+)?)/i)) { + return "number"; + } + // .table_name (ODBC) + // // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html + if (support.ODBCdotTable == true && stream.match(/^[a-zA-Z_]+/)) { + return "variable-2"; + } + } else if (operatorChars.test(ch)) { + // operators + stream.eatWhile(operatorChars); + return null; + } else if (ch == '{' && + (stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) { + // dates (weird ODBC syntax) + // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html + return "number"; + } else { + stream.eatWhile(/^[_\w\d]/); + var word = stream.current().toLowerCase(); + // dates (standard SQL syntax) + // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html + if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/))) + return "number"; + if (atoms.hasOwnProperty(word)) return "atom"; + if (builtin.hasOwnProperty(word)) return "builtin"; + if (keywords.hasOwnProperty(word)) return "keyword"; + if (client.hasOwnProperty(word)) return "string-2"; + return null; + } + } + + // 'string', with char specified in quote escaped by '\' + function tokenLiteral(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "string"; + }; + } + function tokenComment(stream, state) { + while (true) { + if (stream.skipTo("*")) { + stream.next(); + if (stream.eat("/")) { + state.tokenize = tokenBase; + break; + } + } else { + stream.skipToEnd(); + break; + } + } + return "comment"; + } + + function pushContext(stream, state, type) { + state.context = { + prev: state.context, + indent: stream.indentation(), + col: stream.column(), + type: type + }; + } + + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; + } + + return { + startState: function() { + return {tokenize: tokenBase, context: null}; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) + state.context.align = false; + } + if (stream.eatSpace()) return null; + + var style = state.tokenize(stream, state); + if (style == "comment") return style; + + if (state.context && state.context.align == null) + state.context.align = true; + + var tok = stream.current(); + if (tok == "(") + pushContext(stream, state, ")"); + else if (tok == "[") + pushContext(stream, state, "]"); + else if (state.context && state.context.type == tok) + popContext(state); + return style; + }, + + indent: function(state, textAfter) { + var cx = state.context; + if (!cx) return CodeMirror.Pass; + var closing = textAfter.charAt(0) == cx.type; + if (cx.align) return cx.col + (closing ? 0 : 1); + else return cx.indent + (closing ? 0 : config.indentUnit); + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : null + }; +}); + +(function() { + "use strict"; + + // `identifier` + function hookIdentifier(stream) { + // MySQL/MariaDB identifiers + // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html + var ch; + while ((ch = stream.next()) != null) { + if (ch == "`" && !stream.eat("`")) return "variable-2"; + } + stream.backUp(stream.current().length - 1); + return stream.eatWhile(/\w/) ? "variable-2" : null; + } + + // variable token + function hookVar(stream) { + // variables + // @@prefix.varName @varName + // varName can be quoted with ` or ' or " + // ref: http://dev.mysql.com/doc/refman/5.5/en/user-variables.html + if (stream.eat("@")) { + stream.match(/^session\./); + stream.match(/^local\./); + stream.match(/^global\./); + } + + if (stream.eat("'")) { + stream.match(/^.*'/); + return "variable-2"; + } else if (stream.eat('"')) { + stream.match(/^.*"/); + return "variable-2"; + } else if (stream.eat("`")) { + stream.match(/^.*`/); + return "variable-2"; + } else if (stream.match(/^[0-9a-zA-Z$\.\_]+/)) { + return "variable-2"; + } + return null; + }; + + // short client keyword token + function hookClient(stream) { + // \N means NULL + // ref: http://dev.mysql.com/doc/refman/5.5/en/null-values.html + if (stream.eat("N")) { + return "atom"; + } + // \g, etc + // ref: http://dev.mysql.com/doc/refman/5.5/en/mysql-commands.html + return stream.match(/^[a-zA-Z.#!?]/) ? "variable-2" : null; + } + + // these keywords are used by all SQL dialects (however, a mode can still overwrite it) + var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where "; + + // turn a space-separated list into an array + function set(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + // A generic SQL Mode. It's not a standard, it just try to support what is generally supported + CodeMirror.defineMIME("text/x-sql", { + name: "sql", + keywords: set(sqlKeywords + "begin"), + builtin: set("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=]/, + dateSQL: set("date time timestamp"), + support: set("ODBCdotTable doubleQuote binaryNumber hexNumber") + }); + + CodeMirror.defineMIME("text/x-mssql", { + name: "sql", + client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), + keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered"), + builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=]/, + dateSQL: set("date datetimeoffset datetime2 smalldatetime datetime time"), + hooks: { + "@": hookVar + } + }); + + CodeMirror.defineMIME("text/x-mysql", { + name: "sql", + client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), + keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), + builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=&|^]/, + dateSQL: set("date time timestamp"), + support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"), + hooks: { + "@": hookVar, + "`": hookIdentifier, + "\\": hookClient + } + }); + + CodeMirror.defineMIME("text/x-mariadb", { + name: "sql", + client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), + keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), + builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=&|^]/, + dateSQL: set("date time timestamp"), + support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"), + hooks: { + "@": hookVar, + "`": hookIdentifier, + "\\": hookClient + } + }); + + // the query language used by Apache Cassandra is called CQL, but this mime type + // is called Cassandra to avoid confusion with Contextual Query Language + CodeMirror.defineMIME("text/x-cassandra", { + name: "sql", + client: { }, + keywords: set("use select from using consistency where limit first reversed first and in insert into values using consistency ttl update set delete truncate begin batch apply create keyspace with columnfamily primary key index on drop alter type add any one quorum all local_quorum each_quorum"), + builtin: set("ascii bigint blob boolean counter decimal double float int text timestamp uuid varchar varint"), + atoms: set("false true"), + operatorChars: /^[<>=]/, + dateSQL: { }, + support: set("commentSlashSlash decimallessFloat"), + hooks: { } + }); + + // this is based on Peter Raganitsch's 'plsql' mode + CodeMirror.defineMIME("text/x-plsql", { + name: "sql", + client: set("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"), + keywords: set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"), + builtin: set("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"), + operatorChars: /^[*+\-%<>!=~]/, + dateSQL: set("date time timestamp"), + support: set("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber") + }); + + // Created to support specific hive keywords + CodeMirror.defineMIME("text/x-hive", { + name: "sql", + keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"), + builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=]/, + dateSQL: set("date timestamp"), + support: set("ODBCdotTable doubleQuote binaryNumber hexNumber") + }); +}()); + +}); + +/* + How Properties of Mime Types are used by SQL Mode + ================================================= + + keywords: + A list of keywords you want to be highlighted. + builtin: + A list of builtin types you want to be highlighted (if you want types to be of class "builtin" instead of "keyword"). + operatorChars: + All characters that must be handled as operators. + client: + Commands parsed and executed by the client (not the server). + support: + A list of supported syntaxes which are not common, but are supported by more than 1 DBMS. + * ODBCdotTable: .tableName + * zerolessFloat: .1 + * doubleQuote + * nCharCast: N'string' + * charsetCast: _utf8'string' + * commentHash: use # char for comments + * commentSlashSlash: use // for comments + * commentSpaceRequired: require a space after -- for comments + atoms: + Keywords that must be highlighted as atoms,. Some DBMS's support more atoms than others: + UNKNOWN, INFINITY, UNDERFLOW, NaN... + dateSQL: + Used for date/time SQL standard syntax, because not all DBMS's support same temporal types. +*/ diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/stex/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/stex/index.html new file mode 100644 index 0000000000000000000000000000000000000000..14679da4f337f72c6839bdb1b940fd2d16413f72 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/stex/index.html @@ -0,0 +1,110 @@ + + +CodeMirror: sTeX mode + + + + + + + + + +
        +

        sTeX mode

        +
        + + +

        MIME types defined: text/x-stex.

        + +

        Parsing/Highlighting Tests: normal, verbose.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/stex/stex.js b/src/main/resources/templates/editor/lib/codemirror/mode/stex/stex.js new file mode 100644 index 0000000000000000000000000000000000000000..835ed46d1ec4c46f6a5d301327ef5c5a0b678c37 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/stex/stex.js @@ -0,0 +1,251 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/* + * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de) + * Licence: MIT + */ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("stex", function() { + "use strict"; + + function pushCommand(state, command) { + state.cmdState.push(command); + } + + function peekCommand(state) { + if (state.cmdState.length > 0) { + return state.cmdState[state.cmdState.length - 1]; + } else { + return null; + } + } + + function popCommand(state) { + var plug = state.cmdState.pop(); + if (plug) { + plug.closeBracket(); + } + } + + // returns the non-default plugin closest to the end of the list + function getMostPowerful(state) { + var context = state.cmdState; + for (var i = context.length - 1; i >= 0; i--) { + var plug = context[i]; + if (plug.name == "DEFAULT") { + continue; + } + return plug; + } + return { styleIdentifier: function() { return null; } }; + } + + function addPluginPattern(pluginName, cmdStyle, styles) { + return function () { + this.name = pluginName; + this.bracketNo = 0; + this.style = cmdStyle; + this.styles = styles; + this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin + + this.styleIdentifier = function() { + return this.styles[this.bracketNo - 1] || null; + }; + this.openBracket = function() { + this.bracketNo++; + return "bracket"; + }; + this.closeBracket = function() {}; + }; + } + + var plugins = {}; + + plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]); + plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]); + plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]); + plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]); + plugins["end"] = addPluginPattern("end", "tag", ["atom"]); + + plugins["DEFAULT"] = function () { + this.name = "DEFAULT"; + this.style = "tag"; + + this.styleIdentifier = this.openBracket = this.closeBracket = function() {}; + }; + + function setState(state, f) { + state.f = f; + } + + // called when in a normal (no environment) context + function normal(source, state) { + var plug; + // Do we look like '\command' ? If so, attempt to apply the plugin 'command' + if (source.match(/^\\[a-zA-Z@]+/)) { + var cmdName = source.current().slice(1); + plug = plugins[cmdName] || plugins["DEFAULT"]; + plug = new plug(); + pushCommand(state, plug); + setState(state, beginParams); + return plug.style; + } + + // escape characters + if (source.match(/^\\[$&%#{}_]/)) { + return "tag"; + } + + // white space control characters + if (source.match(/^\\[,;!\/\\]/)) { + return "tag"; + } + + // find if we're starting various math modes + if (source.match("\\[")) { + setState(state, function(source, state){ return inMathMode(source, state, "\\]"); }); + return "keyword"; + } + if (source.match("$$")) { + setState(state, function(source, state){ return inMathMode(source, state, "$$"); }); + return "keyword"; + } + if (source.match("$")) { + setState(state, function(source, state){ return inMathMode(source, state, "$"); }); + return "keyword"; + } + + var ch = source.next(); + if (ch == "%") { + source.skipToEnd(); + return "comment"; + } else if (ch == '}' || ch == ']') { + plug = peekCommand(state); + if (plug) { + plug.closeBracket(ch); + setState(state, beginParams); + } else { + return "error"; + } + return "bracket"; + } else if (ch == '{' || ch == '[') { + plug = plugins["DEFAULT"]; + plug = new plug(); + pushCommand(state, plug); + return "bracket"; + } else if (/\d/.test(ch)) { + source.eatWhile(/[\w.%]/); + return "atom"; + } else { + source.eatWhile(/[\w\-_]/); + plug = getMostPowerful(state); + if (plug.name == 'begin') { + plug.argument = source.current(); + } + return plug.styleIdentifier(); + } + } + + function inMathMode(source, state, endModeSeq) { + if (source.eatSpace()) { + return null; + } + if (source.match(endModeSeq)) { + setState(state, normal); + return "keyword"; + } + if (source.match(/^\\[a-zA-Z@]+/)) { + return "tag"; + } + if (source.match(/^[a-zA-Z]+/)) { + return "variable-2"; + } + // escape characters + if (source.match(/^\\[$&%#{}_]/)) { + return "tag"; + } + // white space control characters + if (source.match(/^\\[,;!\/]/)) { + return "tag"; + } + // special math-mode characters + if (source.match(/^[\^_&]/)) { + return "tag"; + } + // non-special characters + if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) { + return null; + } + if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) { + return "number"; + } + var ch = source.next(); + if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") { + return "bracket"; + } + + if (ch == "%") { + source.skipToEnd(); + return "comment"; + } + return "error"; + } + + function beginParams(source, state) { + var ch = source.peek(), lastPlug; + if (ch == '{' || ch == '[') { + lastPlug = peekCommand(state); + lastPlug.openBracket(ch); + source.eat(ch); + setState(state, normal); + return "bracket"; + } + if (/[ \t\r]/.test(ch)) { + source.eat(ch); + return null; + } + setState(state, normal); + popCommand(state); + + return normal(source, state); + } + + return { + startState: function() { + return { + cmdState: [], + f: normal + }; + }, + copyState: function(s) { + return { + cmdState: s.cmdState.slice(), + f: s.f + }; + }, + token: function(stream, state) { + return state.f(stream, state); + }, + blankLine: function(state) { + state.f = normal; + state.cmdState.length = 0; + }, + lineComment: "%" + }; + }); + + CodeMirror.defineMIME("text/x-stex", "stex"); + CodeMirror.defineMIME("text/x-latex", "stex"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/stex/test.js b/src/main/resources/templates/editor/lib/codemirror/mode/stex/test.js new file mode 100644 index 0000000000000000000000000000000000000000..22f027ec7b6b7259c9a6aa1866b41b17b8cdaffd --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/stex/test.js @@ -0,0 +1,123 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + var mode = CodeMirror.getMode({tabSize: 4}, "stex"); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + MT("word", + "foo"); + + MT("twoWords", + "foo bar"); + + MT("beginEndDocument", + "[tag \\begin][bracket {][atom document][bracket }]", + "[tag \\end][bracket {][atom document][bracket }]"); + + MT("beginEndEquation", + "[tag \\begin][bracket {][atom equation][bracket }]", + " E=mc^2", + "[tag \\end][bracket {][atom equation][bracket }]"); + + MT("beginModule", + "[tag \\begin][bracket {][atom module][bracket }[[]]]"); + + MT("beginModuleId", + "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]"); + + MT("importModule", + "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]"); + + MT("importModulePath", + "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]"); + + MT("psForPDF", + "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]"); + + MT("comment", + "[comment % foo]"); + + MT("tagComment", + "[tag \\item][comment % bar]"); + + MT("commentTag", + " [comment % \\item]"); + + MT("commentLineBreak", + "[comment %]", + "foo"); + + MT("tagErrorCurly", + "[tag \\begin][error }][bracket {]"); + + MT("tagErrorSquare", + "[tag \\item][error ]]][bracket {]"); + + MT("commentCurly", + "[comment % }]"); + + MT("tagHash", + "the [tag \\#] key"); + + MT("tagNumber", + "a [tag \\$][atom 5] stetson"); + + MT("tagPercent", + "[atom 100][tag \\%] beef"); + + MT("tagAmpersand", + "L [tag \\&] N"); + + MT("tagUnderscore", + "foo[tag \\_]bar"); + + MT("tagBracketOpen", + "[tag \\emph][bracket {][tag \\{][bracket }]"); + + MT("tagBracketClose", + "[tag \\emph][bracket {][tag \\}][bracket }]"); + + MT("tagLetterNumber", + "section [tag \\S][atom 1]"); + + MT("textTagNumber", + "para [tag \\P][atom 2]"); + + MT("thinspace", + "x[tag \\,]y"); + + MT("thickspace", + "x[tag \\;]y"); + + MT("negativeThinspace", + "x[tag \\!]y"); + + MT("periodNotSentence", + "J.\\ L.\\ is"); + + MT("periodSentence", + "X[tag \\@]. The"); + + MT("italicCorrection", + "[bracket {][tag \\em] If[tag \\/][bracket }] I"); + + MT("tagBracket", + "[tag \\newcommand][bracket {][tag \\pop][bracket }]"); + + MT("inlineMathTagFollowedByNumber", + "[keyword $][tag \\pi][number 2][keyword $]"); + + MT("inlineMath", + "[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text"); + + MT("displayMath", + "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text"); + + MT("mathWithComment", + "[keyword $][variable-2 x] [comment % $]", + "[variable-2 y][keyword $] other text"); + + MT("lineBreakArgument", + "[tag \\\\][bracket [[][atom 1cm][bracket ]]]"); +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/stylus/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/stylus/index.html new file mode 100644 index 0000000000000000000000000000000000000000..354bf303280f59d6eceeeada7b2364c9455a07ad --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/stylus/index.html @@ -0,0 +1,104 @@ + + +CodeMirror: Stylus mode + + + + + + + + + + + +
        +

        Stylus mode

        +
        +
        + + +

        MIME types defined: text/x-styl.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/stylus/stylus.js b/src/main/resources/templates/editor/lib/codemirror/mode/stylus/stylus.js new file mode 100644 index 0000000000000000000000000000000000000000..6f7c75442531e3f7b6f0173d452ebb43eedb2c11 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/stylus/stylus.js @@ -0,0 +1,444 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("stylus", function(config) { + + var operatorsRegexp = /^(\?:?|\+[+=]?|-[\-=]?|\*[\*=]?|\/=?|[=!:\?]?=|<=?|>=?|%=?|&&|\|=?|\~|!|\^|\\)/, + delimitersRegexp = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/, + wordOperatorsRegexp = wordRegexp(wordOperators), + commonKeywordsRegexp = wordRegexp(commonKeywords), + commonAtomsRegexp = wordRegexp(commonAtoms), + commonDefRegexp = wordRegexp(commonDef), + vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/), + cssValuesWithBracketsRegexp = new RegExp("^(" + cssValuesWithBrackets_.join("|") + ")\\([\\w\-\\#\\,\\.\\%\\s\\(\\)]*\\)"); + + var tokenBase = function(stream, state) { + + if (stream.eatSpace()) return null; + + var ch = stream.peek(); + + // Single line Comment + if (stream.match('//')) { + stream.skipToEnd(); + return "comment"; + } + + // Multiline Comment + if (stream.match('/*')) { + state.tokenizer = multilineComment; + return state.tokenizer(stream, state); + } + + // Strings + if (ch === '"' || ch === "'") { + stream.next(); + state.tokenizer = buildStringTokenizer(ch); + return "string"; + } + + // Def + if (ch === "@") { + stream.next(); + if (stream.match(/extend/)) { + dedent(state); // remove indentation after selectors + } else if (stream.match(/media[\w-\s]*[\w-]/)) { + indent(state); + } else if(stream.eatWhile(/[\w-]/)) { + if(stream.current().match(commonDefRegexp)) { + indent(state); + } + } + return "def"; + } + + // Number + if (stream.match(/^-?[0-9\.]/, false)) { + + // Floats + if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i) || stream.match(/^-?\d+\.\d*/)) { + + // Prevent from getting extra . on 1.. + if (stream.peek() == ".") { + stream.backUp(1); + } + // Units + stream.eatWhile(/[a-z%]/i); + return "number"; + } + // Integers + if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/) || stream.match(/^-?0(?![\dx])/i)) { + // Units + stream.eatWhile(/[a-z%]/i); + return "number"; + } + } + + // Hex color and id selector + if (ch === "#") { + stream.next(); + + // Hex color + if (stream.match(/^[0-9a-f]{6}|[0-9a-f]{3}/i)) { + return "atom"; + } + + // ID selector + if (stream.match(/^[\w-]+/i)) { + indent(state); + return "builtin"; + } + } + + // Vendor prefixes + if (stream.match(vendorPrefixesRegexp)) { + return "meta"; + } + + // Gradients and animation as CSS value + if (stream.match(cssValuesWithBracketsRegexp)) { + return "atom"; + } + + // Mixins / Functions with indentation + if (stream.sol() && stream.match(/^\.?[a-z][\w-]*\(/i)) { + stream.backUp(1); + indent(state); + return "keyword"; + } + + // Mixins / Functions + if (stream.match(/^\.?[a-z][\w-]*\(/i)) { + stream.backUp(1); + return "keyword"; + } + + // +Block mixins + if (stream.match(/^(\+|\-)[a-z][\w-]+\(/i)) { + stream.backUp(1); + indent(state); + return "keyword"; + } + + // url tokens + if (stream.match(/^url/) && stream.peek() === "(") { + state.tokenizer = urlTokens; + if(!stream.peek()) { + state.cursorHalf = 0; + } + return "atom"; + } + + // Class + if (stream.match(/^\.[a-z][\w-]*/i)) { + indent(state); + return "qualifier"; + } + + // & Parent Reference with BEM naming + if (stream.match(/^(_|__|-|--)[a-z0-9-]+/)) { + return "qualifier"; + } + + // Pseudo elements/classes + if (ch == ':' && stream.match(/^::?[\w-]+/)) { + indent(state); + return "variable-3"; + } + + // Conditionals + if (stream.match(wordRegexp(["for", "if", "else", "unless"]))) { + indent(state); + return "keyword"; + } + + // Keywords + if (stream.match(commonKeywordsRegexp)) { + return "keyword"; + } + + // Atoms + if (stream.match(commonAtomsRegexp)) { + return "atom"; + } + + // Variables + if (stream.match(/^\$?[a-z][\w-]+\s?=(\s|[\w-'"\$])/i)) { + stream.backUp(2); + var cssPropertie = stream.current().toLowerCase().match(/[\w-]+/)[0]; + return cssProperties[cssPropertie] === undefined ? "variable-2" : "property"; + } else if (stream.match(/\$[\w-\.]+/i)) { + return "variable-2"; + } else if (stream.match(/\$?[\w-]+\.[\w-]+/i)) { + var cssTypeSelector = stream.current().toLowerCase().match(/[\w]+/)[0]; + if(cssTypeSelectors[cssTypeSelector] === undefined) { + return "variable-2"; + } else stream.backUp(stream.current().length); + } + + // !important + if (ch === "!") { + stream.next(); + return stream.match(/^[\w]+/) ? "keyword": "operator"; + } + + // / Root Reference + if (stream.match(/^\/(:|\.|#|[a-z])/)) { + stream.backUp(1); + return "variable-3"; + } + + // Operators and delimiters + if (stream.match(operatorsRegexp) || stream.match(wordOperatorsRegexp)) { + return "operator"; + } + if (stream.match(delimitersRegexp)) { + return null; + } + + // & Parent Reference + if (ch === "&") { + stream.next(); + return "variable-3"; + } + + // Font family + if (stream.match(/^[A-Z][a-z0-9-]+/)) { + return "string"; + } + + // CSS rule + // NOTE: Some css selectors and property values have the same name + // (embed, menu, pre, progress, sub, table), + // so they will have the same color (.cm-atom). + if (stream.match(/[\w-]*/i)) { + + var word = stream.current().toLowerCase(); + + if(cssProperties[word] !== undefined) { + // CSS property + if(!stream.eol()) + return "property"; + else + return "variable-2"; + + } else if(cssValues[word] !== undefined) { + // CSS value + return "atom"; + + } else if(cssTypeSelectors[word] !== undefined) { + // CSS type selectors + indent(state); + return "tag"; + + } else if(word) { + // By default variable-2 + return "variable-2"; + } + } + + // Handle non-detected items + stream.next(); + return null; + + }; + + var tokenLexer = function(stream, state) { + + if (stream.sol()) { + state.indentCount = 0; + } + + var style = state.tokenizer(stream, state); + var current = stream.current(); + + if (stream.eol() && (current === "}" || current === ",")) { + dedent(state); + } + + if (style !== null) { + var startOfToken = stream.pos - current.length; + var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount); + + var newScopes = []; + + for (var i = 0; i < state.scopes.length; i++) { + var scope = state.scopes[i]; + + if (scope.offset <= withCurrentIndent) { + newScopes.push(scope); + } + } + + state.scopes = newScopes; + } + + return style; + }; + + return { + startState: function() { + return { + tokenizer: tokenBase, + scopes: [{offset: 0, type: 'styl'}] + }; + }, + + token: function(stream, state) { + var style = tokenLexer(stream, state); + state.lastToken = { style: style, content: stream.current() }; + return style; + }, + + indent: function(state) { + return state.scopes[0].offset; + }, + + lineComment: "//", + fold: "indent" + + }; + + function urlTokens(stream, state) { + var ch = stream.peek(); + + if (ch === ")") { + stream.next(); + state.tokenizer = tokenBase; + return "operator"; + } else if (ch === "(") { + stream.next(); + stream.eatSpace(); + + return "operator"; + } else if (ch === "'" || ch === '"') { + state.tokenizer = buildStringTokenizer(stream.next()); + return "string"; + } else { + state.tokenizer = buildStringTokenizer(")", false); + return "string"; + } + } + + function multilineComment(stream, state) { + if (stream.skipTo("*/")) { + stream.next(); + stream.next(); + state.tokenizer = tokenBase; + } else { + stream.next(); + } + return "comment"; + } + + function buildStringTokenizer(quote, greedy) { + + if(greedy == null) { + greedy = true; + } + + function stringTokenizer(stream, state) { + var nextChar = stream.next(); + var peekChar = stream.peek(); + var previousChar = stream.string.charAt(stream.pos-2); + + var endingString = ((nextChar !== "\\" && peekChar === quote) || + (nextChar === quote && previousChar !== "\\")); + + if (endingString) { + if (nextChar !== quote && greedy) { + stream.next(); + } + state.tokenizer = tokenBase; + return "string"; + } else if (nextChar === "#" && peekChar === "{") { + state.tokenizer = buildInterpolationTokenizer(stringTokenizer); + stream.next(); + return "operator"; + } else { + return "string"; + } + } + + return stringTokenizer; + } + + function buildInterpolationTokenizer(currentTokenizer) { + return function(stream, state) { + if (stream.peek() === "}") { + stream.next(); + state.tokenizer = currentTokenizer; + return "operator"; + } else { + return tokenBase(stream, state); + } + }; + } + + function indent(state) { + if (state.indentCount == 0) { + state.indentCount++; + var lastScopeOffset = state.scopes[0].offset; + var currentOffset = lastScopeOffset + config.indentUnit; + state.scopes.unshift({ offset:currentOffset }); + } + } + + function dedent(state) { + if (state.scopes.length == 1) { return true; } + state.scopes.shift(); + } + + }); + + // https://developer.mozilla.org/en-US/docs/Web/HTML/Element + var cssTypeSelectors_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi","bdo","bgsound","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]; + // https://github.com/csscomb/csscomb.js/blob/master/config/zen.json + var cssProperties_ = ["position","top","right","bottom","left","z-index","display","visibility","flex-direction","flex-order","flex-pack","float","clear","flex-align","overflow","overflow-x","overflow-y","overflow-scrolling","clip","box-sizing","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","min-width","min-height","max-width","max-height","width","height","outline","outline-width","outline-style","outline-color","outline-offset","border","border-spacing","border-collapse","border-width","border-style","border-color","border-top","border-top-width","border-top-style","border-top-color","border-right","border-right-width","border-right-style","border-right-color","border-bottom","border-bottom-width","border-bottom-style","border-bottom-color","border-left","border-left-width","border-left-style","border-left-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","border-image","border-image-source","border-image-slice","border-image-width","border-image-outset","border-image-repeat","border-top-image","border-right-image","border-bottom-image","border-left-image","border-corner-image","border-top-left-image","border-top-right-image","border-bottom-right-image","border-bottom-left-image","background","filter:progid:DXImageTransform\\.Microsoft\\.AlphaImageLoader","background-color","background-image","background-attachment","background-position","background-position-x","background-position-y","background-clip","background-origin","background-size","background-repeat","box-decoration-break","box-shadow","color","table-layout","caption-side","empty-cells","list-style","list-style-position","list-style-type","list-style-image","quotes","content","counter-increment","counter-reset","writing-mode","vertical-align","text-align","text-align-last","text-decoration","text-emphasis","text-emphasis-position","text-emphasis-style","text-emphasis-color","text-indent","-ms-text-justify","text-justify","text-outline","text-transform","text-wrap","text-overflow","text-overflow-ellipsis","text-overflow-mode","text-size-adjust","text-shadow","white-space","word-spacing","word-wrap","word-break","tab-size","hyphens","letter-spacing","font","font-weight","font-style","font-variant","font-size-adjust","font-stretch","font-size","font-family","src","line-height","opacity","filter:\\\\\\\\'progid:DXImageTransform.Microsoft.Alpha","filter:progid:DXImageTransform.Microsoft.Alpha\\(Opacity","interpolation-mode","filter","resize","cursor","nav-index","nav-up","nav-right","nav-down","nav-left","transition","transition-delay","transition-timing-function","transition-duration","transition-property","transform","transform-origin","animation","animation-name","animation-duration","animation-play-state","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","pointer-events","unicode-bidi","direction","columns","column-span","column-width","column-count","column-fill","column-gap","column-rule","column-rule-width","column-rule-style","column-rule-color","break-before","break-inside","break-after","page-break-before","page-break-inside","page-break-after","orphans","widows","zoom","max-zoom","min-zoom","user-zoom","orientation","text-rendering","speak","animation-fill-mode","backface-visibility","user-drag","user-select","appearance"]; + // https://github.com/codemirror/CodeMirror/blob/master/mode/css/css.js#L501 + var cssValues_ = ["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale"]; + var cssColorValues_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]; + var cssValuesWithBrackets_ = ["gradient","linear-gradient","radial-gradient","repeating-linear-gradient","repeating-radial-gradient","cubic-bezier","translateX","translateY","translate3d","rotate3d","scale","scale3d","perspective","skewX"]; + + var wordOperators = ["in", "and", "or", "not", "is a", "is", "isnt", "defined", "if unless"], + commonKeywords = ["for", "if", "else", "unless", "return"], + commonAtoms = ["null", "true", "false", "href", "title", "type", "not-allowed", "readonly", "disabled"], + commonDef = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"], + cssTypeSelectors = keySet(cssTypeSelectors_), + cssProperties = keySet(cssProperties_), + cssValues = keySet(cssValues_.concat(cssColorValues_)), + hintWords = wordOperators.concat(commonKeywords, + commonAtoms, + commonDef, + cssTypeSelectors_, + cssProperties_, + cssValues_, + cssValuesWithBrackets_, + cssColorValues_); + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); + }; + + function keySet(array) { + var keys = {}; + for (var i = 0; i < array.length; ++i) { + keys[array[i]] = true; + } + return keys; + }; + + CodeMirror.registerHelper("hintWords", "stylus", hintWords); + CodeMirror.defineMIME("text/x-styl", "stylus"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tcl/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/tcl/index.html new file mode 100644 index 0000000000000000000000000000000000000000..ce4ad3423edf8e083c5f5a182c114c55696e2652 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tcl/index.html @@ -0,0 +1,142 @@ + + +CodeMirror: Tcl mode + + + + + + + + + + +
        +

        Tcl mode

        +
        + + +

        MIME types defined: text/x-tcl.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tcl/tcl.js b/src/main/resources/templates/editor/lib/codemirror/mode/tcl/tcl.js new file mode 100644 index 0000000000000000000000000000000000000000..056accb2df3e7d3b9c771e8c620727be82723c44 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tcl/tcl.js @@ -0,0 +1,147 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +//tcl mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("tcl", function() { + function parseWords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + var keywords = parseWords("Tcl safe after append array auto_execok auto_import auto_load " + + "auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror " + + "binary break catch cd close concat continue dde eof encoding error " + + "eval exec exit expr fblocked fconfigure fcopy file fileevent filename " + + "filename flush for foreach format gets glob global history http if " + + "incr info interp join lappend lindex linsert list llength load lrange " + + "lreplace lsearch lset lsort memory msgcat namespace open package parray " + + "pid pkg::create pkg_mkIndex proc puts pwd re_syntax read regex regexp " + + "registry regsub rename resource return scan seek set socket source split " + + "string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord " + + "tcl_wordBreakAfter tcl_startOfPreviousWord tcl_wordBreakBefore tcltest " + + "tclvars tell time trace unknown unset update uplevel upvar variable " + + "vwait"); + var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch"); + var isOperatorChar = /[+\-*&%=<>!?^\/\|]/; + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + function tokenBase(stream, state) { + var beforeParams = state.beforeParams; + state.beforeParams = false; + var ch = stream.next(); + if ((ch == '"' || ch == "'") && state.inParams) + return chain(stream, state, tokenString(ch)); + else if (/[\[\]{}\(\),;\.]/.test(ch)) { + if (ch == "(" && beforeParams) state.inParams = true; + else if (ch == ")") state.inParams = false; + return null; + } + else if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + else if (ch == "#" && stream.eat("*")) { + return chain(stream, state, tokenComment); + } + else if (ch == "#" && stream.match(/ *\[ *\[/)) { + return chain(stream, state, tokenUnparsed); + } + else if (ch == "#" && stream.eat("#")) { + stream.skipToEnd(); + return "comment"; + } + else if (ch == '"') { + stream.skipTo(/"/); + return "comment"; + } + else if (ch == "$") { + stream.eatWhile(/[$_a-z0-9A-Z\.{:]/); + stream.eatWhile(/}/); + state.beforeParams = true; + return "builtin"; + } + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "comment"; + } + else { + stream.eatWhile(/[\w\$_{}\xa1-\uffff]/); + var word = stream.current().toLowerCase(); + if (keywords && keywords.propertyIsEnumerable(word)) + return "keyword"; + if (functions && functions.propertyIsEnumerable(word)) { + state.beforeParams = true; + return "keyword"; + } + return null; + } + } + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) { + end = true; + break; + } + escaped = !escaped && next == "\\"; + } + if (end) state.tokenize = tokenBase; + return "string"; + }; + } + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + function tokenUnparsed(stream, state) { + var maybeEnd = 0, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd == 2) { + state.tokenize = tokenBase; + break; + } + if (ch == "]") + maybeEnd++; + else if (ch != " ") + maybeEnd = 0; + } + return "meta"; + } + return { + startState: function() { + return { + tokenize: tokenBase, + beforeParams: false, + inParams: false + }; + }, + token: function(stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + } + }; +}); +CodeMirror.defineMIME("text/x-tcl", "tcl"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/textile/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/textile/index.html new file mode 100644 index 0000000000000000000000000000000000000000..42b156b1e205fb323e8d17eebe31014a96c41fe7 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/textile/index.html @@ -0,0 +1,191 @@ + + +CodeMirror: Textile mode + + + + + + + + + +
        +

        Textile mode

        +
        + + +

        MIME types defined: text/x-textile.

        + +

        Parsing/Highlighting Tests: normal, verbose.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/textile/test.js b/src/main/resources/templates/editor/lib/codemirror/mode/textile/test.js new file mode 100644 index 0000000000000000000000000000000000000000..49cdaf9c91e1be56799546904eefacda404957f8 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/textile/test.js @@ -0,0 +1,417 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + var mode = CodeMirror.getMode({tabSize: 4}, 'textile'); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + MT('simpleParagraphs', + 'Some text.', + '', + 'Some more text.'); + + /* + * Phrase Modifiers + */ + + MT('em', + 'foo [em _bar_]'); + + MT('emBoogus', + 'code_mirror'); + + MT('strong', + 'foo [strong *bar*]'); + + MT('strongBogus', + '3 * 3 = 9'); + + MT('italic', + 'foo [em __bar__]'); + + MT('italicBogus', + 'code__mirror'); + + MT('bold', + 'foo [strong **bar**]'); + + MT('boldBogus', + '3 ** 3 = 27'); + + MT('simpleLink', + '[link "CodeMirror":http://codemirror.net]'); + + MT('referenceLink', + '[link "CodeMirror":code_mirror]', + 'Normal Text.', + '[link [[code_mirror]]http://codemirror.net]'); + + MT('footCite', + 'foo bar[qualifier [[1]]]'); + + MT('footCiteBogus', + 'foo bar[[1a2]]'); + + MT('special-characters', + 'Registered [tag (r)], ' + + 'Trademark [tag (tm)], and ' + + 'Copyright [tag (c)] 2008'); + + MT('cite', + "A book is [keyword ??The Count of Monte Cristo??] by Dumas."); + + MT('additionAndDeletion', + 'The news networks declared [negative -Al Gore-] ' + + '[positive +George W. Bush+] the winner in Florida.'); + + MT('subAndSup', + 'f(x, n) = log [builtin ~4~] x [builtin ^n^]'); + + MT('spanAndCode', + 'A [quote %span element%] and [atom @code element@]'); + + MT('spanBogus', + 'Percentage 25% is not a span.'); + + MT('citeBogus', + 'Question? is not a citation.'); + + MT('codeBogus', + 'user@example.com'); + + MT('subBogus', + '~username'); + + MT('supBogus', + 'foo ^ bar'); + + MT('deletionBogus', + '3 - 3 = 0'); + + MT('additionBogus', + '3 + 3 = 6'); + + MT('image', + 'An image: [string !http://www.example.com/image.png!]'); + + MT('imageWithAltText', + 'An image: [string !http://www.example.com/image.png (Alt Text)!]'); + + MT('imageWithUrl', + 'An image: [string !http://www.example.com/image.png!:http://www.example.com/]'); + + /* + * Headers + */ + + MT('h1', + '[header&header-1 h1. foo]'); + + MT('h2', + '[header&header-2 h2. foo]'); + + MT('h3', + '[header&header-3 h3. foo]'); + + MT('h4', + '[header&header-4 h4. foo]'); + + MT('h5', + '[header&header-5 h5. foo]'); + + MT('h6', + '[header&header-6 h6. foo]'); + + MT('h7Bogus', + 'h7. foo'); + + MT('multipleHeaders', + '[header&header-1 h1. Heading 1]', + '', + 'Some text.', + '', + '[header&header-2 h2. Heading 2]', + '', + 'More text.'); + + MT('h1inline', + '[header&header-1 h1. foo ][header&header-1&em _bar_][header&header-1 baz]'); + + /* + * Lists + */ + + MT('ul', + 'foo', + 'bar', + '', + '[variable-2 * foo]', + '[variable-2 * bar]'); + + MT('ulNoBlank', + 'foo', + 'bar', + '[variable-2 * foo]', + '[variable-2 * bar]'); + + MT('ol', + 'foo', + 'bar', + '', + '[variable-2 # foo]', + '[variable-2 # bar]'); + + MT('olNoBlank', + 'foo', + 'bar', + '[variable-2 # foo]', + '[variable-2 # bar]'); + + MT('ulFormatting', + '[variable-2 * ][variable-2&em _foo_][variable-2 bar]', + '[variable-2 * ][variable-2&strong *][variable-2&em&strong _foo_]' + + '[variable-2&strong *][variable-2 bar]', + '[variable-2 * ][variable-2&strong *foo*][variable-2 bar]'); + + MT('olFormatting', + '[variable-2 # ][variable-2&em _foo_][variable-2 bar]', + '[variable-2 # ][variable-2&strong *][variable-2&em&strong _foo_]' + + '[variable-2&strong *][variable-2 bar]', + '[variable-2 # ][variable-2&strong *foo*][variable-2 bar]'); + + MT('ulNested', + '[variable-2 * foo]', + '[variable-3 ** bar]', + '[keyword *** bar]', + '[variable-2 **** bar]', + '[variable-3 ** bar]'); + + MT('olNested', + '[variable-2 # foo]', + '[variable-3 ## bar]', + '[keyword ### bar]', + '[variable-2 #### bar]', + '[variable-3 ## bar]'); + + MT('ulNestedWithOl', + '[variable-2 * foo]', + '[variable-3 ## bar]', + '[keyword *** bar]', + '[variable-2 #### bar]', + '[variable-3 ** bar]'); + + MT('olNestedWithUl', + '[variable-2 # foo]', + '[variable-3 ** bar]', + '[keyword ### bar]', + '[variable-2 **** bar]', + '[variable-3 ## bar]'); + + MT('definitionList', + '[number - coffee := Hot ][number&em _and_][number black]', + '', + 'Normal text.'); + + MT('definitionListSpan', + '[number - coffee :=]', + '', + '[number Hot ][number&em _and_][number black =:]', + '', + 'Normal text.'); + + MT('boo', + '[number - dog := woof woof]', + '[number - cat := meow meow]', + '[number - whale :=]', + '[number Whale noises.]', + '', + '[number Also, ][number&em _splashing_][number . =:]'); + + /* + * Attributes + */ + + MT('divWithAttribute', + '[punctuation div][punctuation&attribute (#my-id)][punctuation . foo bar]'); + + MT('divWithAttributeAnd2emRightPadding', + '[punctuation div][punctuation&attribute (#my-id)((][punctuation . foo bar]'); + + MT('divWithClassAndId', + '[punctuation div][punctuation&attribute (my-class#my-id)][punctuation . foo bar]'); + + MT('paragraphWithCss', + 'p[attribute {color:red;}]. foo bar'); + + MT('paragraphNestedStyles', + 'p. [strong *foo ][strong&em _bar_][strong *]'); + + MT('paragraphWithLanguage', + 'p[attribute [[fr]]]. Parlez-vous français?'); + + MT('paragraphLeftAlign', + 'p[attribute <]. Left'); + + MT('paragraphRightAlign', + 'p[attribute >]. Right'); + + MT('paragraphRightAlign', + 'p[attribute =]. Center'); + + MT('paragraphJustified', + 'p[attribute <>]. Justified'); + + MT('paragraphWithLeftIndent1em', + 'p[attribute (]. Left'); + + MT('paragraphWithRightIndent1em', + 'p[attribute )]. Right'); + + MT('paragraphWithLeftIndent2em', + 'p[attribute ((]. Left'); + + MT('paragraphWithRightIndent2em', + 'p[attribute ))]. Right'); + + MT('paragraphWithLeftIndent3emRightIndent2em', + 'p[attribute ((())]. Right'); + + MT('divFormatting', + '[punctuation div. ][punctuation&strong *foo ]' + + '[punctuation&strong&em _bar_][punctuation&strong *]'); + + MT('phraseModifierAttributes', + 'p[attribute (my-class)]. This is a paragraph that has a class and' + + ' this [em _][em&attribute (#special-phrase)][em emphasized phrase_]' + + ' has an id.'); + + MT('linkWithClass', + '[link "(my-class). This is a link with class":http://redcloth.org]'); + + /* + * Layouts + */ + + MT('paragraphLayouts', + 'p. This is one paragraph.', + '', + 'p. This is another.'); + + MT('div', + '[punctuation div. foo bar]'); + + MT('pre', + '[operator pre. Text]'); + + MT('bq.', + '[bracket bq. foo bar]', + '', + 'Normal text.'); + + MT('footnote', + '[variable fn123. foo ][variable&strong *bar*]'); + + /* + * Spanning Layouts + */ + + MT('bq..ThenParagraph', + '[bracket bq.. foo bar]', + '', + '[bracket More quote.]', + 'p. Normal Text'); + + MT('bq..ThenH1', + '[bracket bq.. foo bar]', + '', + '[bracket More quote.]', + '[header&header-1 h1. Header Text]'); + + MT('bc..ThenParagraph', + '[atom bc.. # Some ruby code]', + '[atom obj = {foo: :bar}]', + '[atom puts obj]', + '', + '[atom obj[[:love]] = "*love*"]', + '[atom puts obj.love.upcase]', + '', + 'p. Normal text.'); + + MT('fn1..ThenParagraph', + '[variable fn1.. foo bar]', + '', + '[variable More.]', + 'p. Normal Text'); + + MT('pre..ThenParagraph', + '[operator pre.. foo bar]', + '', + '[operator More.]', + 'p. Normal Text'); + + /* + * Tables + */ + + MT('table', + '[variable-3&operator |_. name |_. age|]', + '[variable-3 |][variable-3&strong *Walter*][variable-3 | 5 |]', + '[variable-3 |Florence| 6 |]', + '', + 'p. Normal text.'); + + MT('tableWithAttributes', + '[variable-3&operator |_. name |_. age|]', + '[variable-3 |][variable-3&attribute /2.][variable-3 Jim |]', + '[variable-3 |][variable-3&attribute \\2{color: red}.][variable-3 Sam |]'); + + /* + * HTML + */ + + MT('html', + '[comment
        ]', + '[comment
        ]', + '', + '[header&header-1 h1. Welcome]', + '', + '[variable-2 * Item one]', + '[variable-2 * Item two]', + '', + '[comment Example]', + '', + '[comment
        ]', + '[comment
        ]'); + + MT('inlineHtml', + 'I can use HTML directly in my [comment Textile].'); + + /* + * No-Textile + */ + + MT('notextile', + '[string-2 notextile. *No* formatting]'); + + MT('notextileInline', + 'Use [string-2 ==*asterisks*==] for [strong *strong*] text.'); + + MT('notextileWithPre', + '[operator pre. *No* formatting]'); + + MT('notextileWithSpanningPre', + '[operator pre.. *No* formatting]', + '', + '[operator *No* formatting]'); + + /* Only toggling phrases between non-word chars. */ + + MT('phrase-in-word', + 'foo_bar_baz'); + + MT('phrase-non-word', + '[negative -x-] aaa-bbb ccc-ddd [negative -eee-] fff [negative -ggg-]'); + + MT('phrase-lone-dash', + 'foo - bar - baz'); +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/textile/textile.js b/src/main/resources/templates/editor/lib/codemirror/mode/textile/textile.js new file mode 100644 index 0000000000000000000000000000000000000000..a6f7576582e8c99740aae9c87f25ae547f575395 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/textile/textile.js @@ -0,0 +1,469 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") { // CommonJS + mod(require("../../lib/codemirror")); + } else if (typeof define == "function" && define.amd) { // AMD + define(["../../lib/codemirror"], mod); + } else { // Plain browser env + mod(CodeMirror); + } +})(function(CodeMirror) { + "use strict"; + + var TOKEN_STYLES = { + addition: "positive", + attributes: "attribute", + bold: "strong", + cite: "keyword", + code: "atom", + definitionList: "number", + deletion: "negative", + div: "punctuation", + em: "em", + footnote: "variable", + footCite: "qualifier", + header: "header", + html: "comment", + image: "string", + italic: "em", + link: "link", + linkDefinition: "link", + list1: "variable-2", + list2: "variable-3", + list3: "keyword", + notextile: "string-2", + pre: "operator", + p: "property", + quote: "bracket", + span: "quote", + specialChar: "tag", + strong: "strong", + sub: "builtin", + sup: "builtin", + table: "variable-3", + tableHeading: "operator" + }; + + function startNewLine(stream, state) { + state.mode = Modes.newLayout; + state.tableHeading = false; + + if (state.layoutType === "definitionList" && state.spanningLayout && + stream.match(RE("definitionListEnd"), false)) + state.spanningLayout = false; + } + + function handlePhraseModifier(stream, state, ch) { + if (ch === "_") { + if (stream.eat("_")) + return togglePhraseModifier(stream, state, "italic", /__/, 2); + else + return togglePhraseModifier(stream, state, "em", /_/, 1); + } + + if (ch === "*") { + if (stream.eat("*")) { + return togglePhraseModifier(stream, state, "bold", /\*\*/, 2); + } + return togglePhraseModifier(stream, state, "strong", /\*/, 1); + } + + if (ch === "[") { + if (stream.match(/\d+\]/)) state.footCite = true; + return tokenStyles(state); + } + + if (ch === "(") { + var spec = stream.match(/^(r|tm|c)\)/); + if (spec) + return tokenStylesWith(state, TOKEN_STYLES.specialChar); + } + + if (ch === "<" && stream.match(/(\w+)[^>]+>[^<]+<\/\1>/)) + return tokenStylesWith(state, TOKEN_STYLES.html); + + if (ch === "?" && stream.eat("?")) + return togglePhraseModifier(stream, state, "cite", /\?\?/, 2); + + if (ch === "=" && stream.eat("=")) + return togglePhraseModifier(stream, state, "notextile", /==/, 2); + + if (ch === "-" && !stream.eat("-")) + return togglePhraseModifier(stream, state, "deletion", /-/, 1); + + if (ch === "+") + return togglePhraseModifier(stream, state, "addition", /\+/, 1); + + if (ch === "~") + return togglePhraseModifier(stream, state, "sub", /~/, 1); + + if (ch === "^") + return togglePhraseModifier(stream, state, "sup", /\^/, 1); + + if (ch === "%") + return togglePhraseModifier(stream, state, "span", /%/, 1); + + if (ch === "@") + return togglePhraseModifier(stream, state, "code", /@/, 1); + + if (ch === "!") { + var type = togglePhraseModifier(stream, state, "image", /(?:\([^\)]+\))?!/, 1); + stream.match(/^:\S+/); // optional Url portion + return type; + } + return tokenStyles(state); + } + + function togglePhraseModifier(stream, state, phraseModifier, closeRE, openSize) { + var charBefore = stream.pos > openSize ? stream.string.charAt(stream.pos - openSize - 1) : null; + var charAfter = stream.peek(); + if (state[phraseModifier]) { + if ((!charAfter || /\W/.test(charAfter)) && charBefore && /\S/.test(charBefore)) { + var type = tokenStyles(state); + state[phraseModifier] = false; + return type; + } + } else if ((!charBefore || /\W/.test(charBefore)) && charAfter && /\S/.test(charAfter) && + stream.match(new RegExp("^.*\\S" + closeRE.source + "(?:\\W|$)"), false)) { + state[phraseModifier] = true; + state.mode = Modes.attributes; + } + return tokenStyles(state); + }; + + function tokenStyles(state) { + var disabled = textileDisabled(state); + if (disabled) return disabled; + + var styles = []; + if (state.layoutType) styles.push(TOKEN_STYLES[state.layoutType]); + + styles = styles.concat(activeStyles( + state, "addition", "bold", "cite", "code", "deletion", "em", "footCite", + "image", "italic", "link", "span", "strong", "sub", "sup", "table", "tableHeading")); + + if (state.layoutType === "header") + styles.push(TOKEN_STYLES.header + "-" + state.header); + + return styles.length ? styles.join(" ") : null; + } + + function textileDisabled(state) { + var type = state.layoutType; + + switch(type) { + case "notextile": + case "code": + case "pre": + return TOKEN_STYLES[type]; + default: + if (state.notextile) + return TOKEN_STYLES.notextile + (type ? (" " + TOKEN_STYLES[type]) : ""); + return null; + } + } + + function tokenStylesWith(state, extraStyles) { + var disabled = textileDisabled(state); + if (disabled) return disabled; + + var type = tokenStyles(state); + if (extraStyles) + return type ? (type + " " + extraStyles) : extraStyles; + else + return type; + } + + function activeStyles(state) { + var styles = []; + for (var i = 1; i < arguments.length; ++i) { + if (state[arguments[i]]) + styles.push(TOKEN_STYLES[arguments[i]]); + } + return styles; + } + + function blankLine(state) { + var spanningLayout = state.spanningLayout, type = state.layoutType; + + for (var key in state) if (state.hasOwnProperty(key)) + delete state[key]; + + state.mode = Modes.newLayout; + if (spanningLayout) { + state.layoutType = type; + state.spanningLayout = true; + } + } + + var REs = { + cache: {}, + single: { + bc: "bc", + bq: "bq", + definitionList: /- [^(?::=)]+:=+/, + definitionListEnd: /.*=:\s*$/, + div: "div", + drawTable: /\|.*\|/, + foot: /fn\d+/, + header: /h[1-6]/, + html: /\s*<(?:\/)?(\w+)(?:[^>]+)?>(?:[^<]+<\/\1>)?/, + link: /[^"]+":\S/, + linkDefinition: /\[[^\s\]]+\]\S+/, + list: /(?:#+|\*+)/, + notextile: "notextile", + para: "p", + pre: "pre", + table: "table", + tableCellAttributes: /[\/\\]\d+/, + tableHeading: /\|_\./, + tableText: /[^"_\*\[\(\?\+~\^%@|-]+/, + text: /[^!"_=\*\[\(<\?\+~\^%@-]+/ + }, + attributes: { + align: /(?:<>|<|>|=)/, + selector: /\([^\(][^\)]+\)/, + lang: /\[[^\[\]]+\]/, + pad: /(?:\(+|\)+){1,2}/, + css: /\{[^\}]+\}/ + }, + createRe: function(name) { + switch (name) { + case "drawTable": + return REs.makeRe("^", REs.single.drawTable, "$"); + case "html": + return REs.makeRe("^", REs.single.html, "(?:", REs.single.html, ")*", "$"); + case "linkDefinition": + return REs.makeRe("^", REs.single.linkDefinition, "$"); + case "listLayout": + return REs.makeRe("^", REs.single.list, RE("allAttributes"), "*\\s+"); + case "tableCellAttributes": + return REs.makeRe("^", REs.choiceRe(REs.single.tableCellAttributes, + RE("allAttributes")), "+\\."); + case "type": + return REs.makeRe("^", RE("allTypes")); + case "typeLayout": + return REs.makeRe("^", RE("allTypes"), RE("allAttributes"), + "*\\.\\.?", "(\\s+|$)"); + case "attributes": + return REs.makeRe("^", RE("allAttributes"), "+"); + + case "allTypes": + return REs.choiceRe(REs.single.div, REs.single.foot, + REs.single.header, REs.single.bc, REs.single.bq, + REs.single.notextile, REs.single.pre, REs.single.table, + REs.single.para); + + case "allAttributes": + return REs.choiceRe(REs.attributes.selector, REs.attributes.css, + REs.attributes.lang, REs.attributes.align, REs.attributes.pad); + + default: + return REs.makeRe("^", REs.single[name]); + } + }, + makeRe: function() { + var pattern = ""; + for (var i = 0; i < arguments.length; ++i) { + var arg = arguments[i]; + pattern += (typeof arg === "string") ? arg : arg.source; + } + return new RegExp(pattern); + }, + choiceRe: function() { + var parts = [arguments[0]]; + for (var i = 1; i < arguments.length; ++i) { + parts[i * 2 - 1] = "|"; + parts[i * 2] = arguments[i]; + } + + parts.unshift("(?:"); + parts.push(")"); + return REs.makeRe.apply(null, parts); + } + }; + + function RE(name) { + return (REs.cache[name] || (REs.cache[name] = REs.createRe(name))); + } + + var Modes = { + newLayout: function(stream, state) { + if (stream.match(RE("typeLayout"), false)) { + state.spanningLayout = false; + return (state.mode = Modes.blockType)(stream, state); + } + var newMode; + if (!textileDisabled(state)) { + if (stream.match(RE("listLayout"), false)) + newMode = Modes.list; + else if (stream.match(RE("drawTable"), false)) + newMode = Modes.table; + else if (stream.match(RE("linkDefinition"), false)) + newMode = Modes.linkDefinition; + else if (stream.match(RE("definitionList"))) + newMode = Modes.definitionList; + else if (stream.match(RE("html"), false)) + newMode = Modes.html; + } + return (state.mode = (newMode || Modes.text))(stream, state); + }, + + blockType: function(stream, state) { + var match, type; + state.layoutType = null; + + if (match = stream.match(RE("type"))) + type = match[0]; + else + return (state.mode = Modes.text)(stream, state); + + if (match = type.match(RE("header"))) { + state.layoutType = "header"; + state.header = parseInt(match[0][1]); + } else if (type.match(RE("bq"))) { + state.layoutType = "quote"; + } else if (type.match(RE("bc"))) { + state.layoutType = "code"; + } else if (type.match(RE("foot"))) { + state.layoutType = "footnote"; + } else if (type.match(RE("notextile"))) { + state.layoutType = "notextile"; + } else if (type.match(RE("pre"))) { + state.layoutType = "pre"; + } else if (type.match(RE("div"))) { + state.layoutType = "div"; + } else if (type.match(RE("table"))) { + state.layoutType = "table"; + } + + state.mode = Modes.attributes; + return tokenStyles(state); + }, + + text: function(stream, state) { + if (stream.match(RE("text"))) return tokenStyles(state); + + var ch = stream.next(); + if (ch === '"') + return (state.mode = Modes.link)(stream, state); + return handlePhraseModifier(stream, state, ch); + }, + + attributes: function(stream, state) { + state.mode = Modes.layoutLength; + + if (stream.match(RE("attributes"))) + return tokenStylesWith(state, TOKEN_STYLES.attributes); + else + return tokenStyles(state); + }, + + layoutLength: function(stream, state) { + if (stream.eat(".") && stream.eat(".")) + state.spanningLayout = true; + + state.mode = Modes.text; + return tokenStyles(state); + }, + + list: function(stream, state) { + var match = stream.match(RE("list")); + state.listDepth = match[0].length; + var listMod = (state.listDepth - 1) % 3; + if (!listMod) + state.layoutType = "list1"; + else if (listMod === 1) + state.layoutType = "list2"; + else + state.layoutType = "list3"; + + state.mode = Modes.attributes; + return tokenStyles(state); + }, + + link: function(stream, state) { + state.mode = Modes.text; + if (stream.match(RE("link"))) { + stream.match(/\S+/); + return tokenStylesWith(state, TOKEN_STYLES.link); + } + return tokenStyles(state); + }, + + linkDefinition: function(stream, state) { + stream.skipToEnd(); + return tokenStylesWith(state, TOKEN_STYLES.linkDefinition); + }, + + definitionList: function(stream, state) { + stream.match(RE("definitionList")); + + state.layoutType = "definitionList"; + + if (stream.match(/\s*$/)) + state.spanningLayout = true; + else + state.mode = Modes.attributes; + + return tokenStyles(state); + }, + + html: function(stream, state) { + stream.skipToEnd(); + return tokenStylesWith(state, TOKEN_STYLES.html); + }, + + table: function(stream, state) { + state.layoutType = "table"; + return (state.mode = Modes.tableCell)(stream, state); + }, + + tableCell: function(stream, state) { + if (stream.match(RE("tableHeading"))) + state.tableHeading = true; + else + stream.eat("|"); + + state.mode = Modes.tableCellAttributes; + return tokenStyles(state); + }, + + tableCellAttributes: function(stream, state) { + state.mode = Modes.tableText; + + if (stream.match(RE("tableCellAttributes"))) + return tokenStylesWith(state, TOKEN_STYLES.attributes); + else + return tokenStyles(state); + }, + + tableText: function(stream, state) { + if (stream.match(RE("tableText"))) + return tokenStyles(state); + + if (stream.peek() === "|") { // end of cell + state.mode = Modes.tableCell; + return tokenStyles(state); + } + return handlePhraseModifier(stream, state, stream.next()); + } + }; + + CodeMirror.defineMode("textile", function() { + return { + startState: function() { + return { mode: Modes.newLayout }; + }, + token: function(stream, state) { + if (stream.sol()) startNewLine(stream, state); + return state.mode(stream, state); + }, + blankLine: blankLine + }; + }); + + CodeMirror.defineMIME("text/x-textile", "textile"); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tiddlywiki/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/tiddlywiki/index.html new file mode 100644 index 0000000000000000000000000000000000000000..77dd0457c1ff3a7e5a637c3dea70b9d381a47dde --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tiddlywiki/index.html @@ -0,0 +1,154 @@ + + +CodeMirror: TiddlyWiki mode + + + + + + + + + + + +
        +

        TiddlyWiki mode

        + + +
        + + + +

        TiddlyWiki mode supports a single configuration.

        + +

        MIME types defined: text/x-tiddlywiki.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tiddlywiki/tiddlywiki.css b/src/main/resources/templates/editor/lib/codemirror/mode/tiddlywiki/tiddlywiki.css new file mode 100644 index 0000000000000000000000000000000000000000..9a69b639f8a71389a99dacb03bd03e4bb2a57ded --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tiddlywiki/tiddlywiki.css @@ -0,0 +1,14 @@ +span.cm-underlined { + text-decoration: underline; +} +span.cm-strikethrough { + text-decoration: line-through; +} +span.cm-brace { + color: #170; + font-weight: bold; +} +span.cm-table { + color: blue; + font-weight: bold; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tiddlywiki/tiddlywiki.js b/src/main/resources/templates/editor/lib/codemirror/mode/tiddlywiki/tiddlywiki.js new file mode 100644 index 0000000000000000000000000000000000000000..88c9768a72701fba114cc0df066cf78a8730ed4c --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tiddlywiki/tiddlywiki.js @@ -0,0 +1,369 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/*** + |''Name''|tiddlywiki.js| + |''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror| + |''Author''|PMario| + |''Version''|0.1.7| + |''Status''|''stable''| + |''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]| + |''Documentation''|http://codemirror.tiddlyspace.com/| + |''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]| + |''CoreVersion''|2.5.0| + |''Requires''|codemirror.js| + |''Keywords''|syntax highlighting color code mirror codemirror| + ! Info + CoreVersion parameter is needed for TiddlyWiki only! +***/ +//{{{ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("tiddlywiki", function () { + // Tokenizer + var textwords = {}; + + var keywords = function () { + function kw(type) { + return { type: type, style: "macro"}; + } + return { + "allTags": kw('allTags'), "closeAll": kw('closeAll'), "list": kw('list'), + "newJournal": kw('newJournal'), "newTiddler": kw('newTiddler'), + "permaview": kw('permaview'), "saveChanges": kw('saveChanges'), + "search": kw('search'), "slider": kw('slider'), "tabs": kw('tabs'), + "tag": kw('tag'), "tagging": kw('tagging'), "tags": kw('tags'), + "tiddler": kw('tiddler'), "timeline": kw('timeline'), + "today": kw('today'), "version": kw('version'), "option": kw('option'), + + "with": kw('with'), + "filter": kw('filter') + }; + }(); + + var isSpaceName = /[\w_\-]/i, + reHR = /^\-\-\-\-+$/, //
        + reWikiCommentStart = /^\/\*\*\*$/, // /*** + reWikiCommentStop = /^\*\*\*\/$/, // ***/ + reBlockQuote = /^<<<$/, + + reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start + reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop + reXmlCodeStart = /^$/, // xml block start + reXmlCodeStop = /^$/, // xml stop + + reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start + reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop + + reUntilCodeStop = /.*?\}\}\}/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + var type, content; + + function ret(tp, style, cont) { + type = tp; + content = cont; + return style; + } + + function jsTokenBase(stream, state) { + var sol = stream.sol(), ch; + + state.block = false; // indicates the start of a code block. + + ch = stream.peek(); // don't eat, to make matching simpler + + // check start of blocks + if (sol && /[<\/\*{}\-]/.test(ch)) { + if (stream.match(reCodeBlockStart)) { + state.block = true; + return chain(stream, state, twTokenCode); + } + if (stream.match(reBlockQuote)) { + return ret('quote', 'quote'); + } + if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) { + return ret('code', 'comment'); + } + if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) { + return ret('code', 'comment'); + } + if (stream.match(reHR)) { + return ret('hr', 'hr'); + } + } // sol + ch = stream.next(); + + if (sol && /[\/\*!#;:>|]/.test(ch)) { + if (ch == "!") { // tw header + stream.skipToEnd(); + return ret("header", "header"); + } + if (ch == "*") { // tw list + stream.eatWhile('*'); + return ret("list", "comment"); + } + if (ch == "#") { // tw numbered list + stream.eatWhile('#'); + return ret("list", "comment"); + } + if (ch == ";") { // definition list, term + stream.eatWhile(';'); + return ret("list", "comment"); + } + if (ch == ":") { // definition list, description + stream.eatWhile(':'); + return ret("list", "comment"); + } + if (ch == ">") { // single line quote + stream.eatWhile(">"); + return ret("quote", "quote"); + } + if (ch == '|') { + return ret('table', 'header'); + } + } + + if (ch == '{' && stream.match(/\{\{/)) { + return chain(stream, state, twTokenCode); + } + + // rudimentary html:// file:// link matching. TW knows much more ... + if (/[hf]/i.test(ch)) { + if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) { + return ret("link", "link"); + } + } + // just a little string indicator, don't want to have the whole string covered + if (ch == '"') { + return ret('string', 'string'); + } + if (ch == '~') { // _no_ CamelCase indicator should be bold + return ret('text', 'brace'); + } + if (/[\[\]]/.test(ch)) { // check for [[..]] + if (stream.peek() == ch) { + stream.next(); + return ret('brace', 'brace'); + } + } + if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting + stream.eatWhile(isSpaceName); + return ret("link", "link"); + } + if (/\d/.test(ch)) { // numbers + stream.eatWhile(/\d/); + return ret("number", "number"); + } + if (ch == "/") { // tw invisible comment + if (stream.eat("%")) { + return chain(stream, state, twTokenComment); + } + else if (stream.eat("/")) { // + return chain(stream, state, twTokenEm); + } + } + if (ch == "_") { // tw underline + if (stream.eat("_")) { + return chain(stream, state, twTokenUnderline); + } + } + // strikethrough and mdash handling + if (ch == "-") { + if (stream.eat("-")) { + // if strikethrough looks ugly, change CSS. + if (stream.peek() != ' ') + return chain(stream, state, twTokenStrike); + // mdash + if (stream.peek() == ' ') + return ret('text', 'brace'); + } + } + if (ch == "'") { // tw bold + if (stream.eat("'")) { + return chain(stream, state, twTokenStrong); + } + } + if (ch == "<") { // tw macro + if (stream.eat("<")) { + return chain(stream, state, twTokenMacro); + } + } + else { + return ret(ch); + } + + // core macro handling + stream.eatWhile(/[\w\$_]/); + var word = stream.current(), + known = textwords.propertyIsEnumerable(word) && textwords[word]; + + return known ? ret(known.type, known.style, word) : ret("text", null, word); + + } // jsTokenBase() + + // tw invisible comment + function twTokenComment(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "%"); + } + return ret("comment", "comment"); + } + + // tw strong / bold + function twTokenStrong(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "'" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "'"); + } + return ret("text", "strong"); + } + + // tw code + function twTokenCode(stream, state) { + var ch, sb = state.block; + + if (sb && stream.current()) { + return ret("code", "comment"); + } + + if (!sb && stream.match(reUntilCodeStop)) { + state.tokenize = jsTokenBase; + return ret("code", "comment"); + } + + if (sb && stream.sol() && stream.match(reCodeBlockStop)) { + state.tokenize = jsTokenBase; + return ret("code", "comment"); + } + + ch = stream.next(); + return (sb) ? ret("code", "comment") : ret("code", "comment"); + } + + // tw em / italic + function twTokenEm(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "/"); + } + return ret("text", "em"); + } + + // tw underlined text + function twTokenUnderline(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "_" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "_"); + } + return ret("text", "underlined"); + } + + // tw strike through text looks ugly + // change CSS if needed + function twTokenStrike(stream, state) { + var maybeEnd = false, ch; + + while (ch = stream.next()) { + if (ch == "-" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "-"); + } + return ret("text", "strikethrough"); + } + + // macro + function twTokenMacro(stream, state) { + var ch, word, known; + + if (stream.current() == '<<') { + return ret('brace', 'macro'); + } + + ch = stream.next(); + if (!ch) { + state.tokenize = jsTokenBase; + return ret(ch); + } + if (ch == ">") { + if (stream.peek() == '>') { + stream.next(); + state.tokenize = jsTokenBase; + return ret("brace", "macro"); + } + } + + stream.eatWhile(/[\w\$_]/); + word = stream.current(); + known = keywords.propertyIsEnumerable(word) && keywords[word]; + + if (known) { + return ret(known.type, known.style, word); + } + else { + return ret("macro", null, word); + } + } + + // Interface + return { + startState: function () { + return { + tokenize: jsTokenBase, + indented: 0, + level: 0 + }; + }, + + token: function (stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + }, + + electricChars: "" + }; +}); + +CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki"); +}); + +//}}} diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tiki/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/tiki/index.html new file mode 100644 index 0000000000000000000000000000000000000000..091c5fb2a6289eb76a6aaaec53744ec7348bcc01 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tiki/index.html @@ -0,0 +1,95 @@ + + +CodeMirror: Tiki wiki mode + + + + + + + + + + +
        +

        Tiki wiki mode

        + + +
        + + + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tiki/tiki.css b/src/main/resources/templates/editor/lib/codemirror/mode/tiki/tiki.css new file mode 100644 index 0000000000000000000000000000000000000000..0dbc3ea0e05228b56e76756b1516b9ae9079e27a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tiki/tiki.css @@ -0,0 +1,26 @@ +.cm-tw-syntaxerror { + color: #FFF; + background-color: #900; +} + +.cm-tw-deleted { + text-decoration: line-through; +} + +.cm-tw-header5 { + font-weight: bold; +} +.cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ + padding-left: 10px; +} + +.cm-tw-box { + border-top-width: 0px ! important; + border-style: solid; + border-width: 1px; + border-color: inherit; +} + +.cm-tw-underline { + text-decoration: underline; +} \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tiki/tiki.js b/src/main/resources/templates/editor/lib/codemirror/mode/tiki/tiki.js new file mode 100644 index 0000000000000000000000000000000000000000..c90aac9ec75882d20fbac391299d805c57f35c54 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tiki/tiki.js @@ -0,0 +1,323 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode('tiki', function(config) { + function inBlock(style, terminator, returnTokenizer) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + state.tokenize = inText; + break; + } + stream.next(); + } + + if (returnTokenizer) state.tokenize = returnTokenizer; + + return style; + }; + } + + function inLine(style) { + return function(stream, state) { + while(!stream.eol()) { + stream.next(); + } + state.tokenize = inText; + return style; + }; + } + + function inText(stream, state) { + function chain(parser) { + state.tokenize = parser; + return parser(stream, state); + } + + var sol = stream.sol(); + var ch = stream.next(); + + //non start of line + switch (ch) { //switch is generally much faster than if, so it is used here + case "{": //plugin + stream.eat("/"); + stream.eatSpace(); + var tagName = ""; + var c; + while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c; + state.tokenize = inPlugin; + return "tag"; + break; + case "_": //bold + if (stream.eat("_")) { + return chain(inBlock("strong", "__", inText)); + } + break; + case "'": //italics + if (stream.eat("'")) { + // Italic text + return chain(inBlock("em", "''", inText)); + } + break; + case "(":// Wiki Link + if (stream.eat("(")) { + return chain(inBlock("variable-2", "))", inText)); + } + break; + case "[":// Weblink + return chain(inBlock("variable-3", "]", inText)); + break; + case "|": //table + if (stream.eat("|")) { + return chain(inBlock("comment", "||")); + } + break; + case "-": + if (stream.eat("=")) {//titleBar + return chain(inBlock("header string", "=-", inText)); + } else if (stream.eat("-")) {//deleted + return chain(inBlock("error tw-deleted", "--", inText)); + } + break; + case "=": //underline + if (stream.match("==")) { + return chain(inBlock("tw-underline", "===", inText)); + } + break; + case ":": + if (stream.eat(":")) { + return chain(inBlock("comment", "::")); + } + break; + case "^": //box + return chain(inBlock("tw-box", "^")); + break; + case "~": //np + if (stream.match("np~")) { + return chain(inBlock("meta", "~/np~")); + } + break; + } + + //start of line types + if (sol) { + switch (ch) { + case "!": //header at start of line + if (stream.match('!!!!!')) { + return chain(inLine("header string")); + } else if (stream.match('!!!!')) { + return chain(inLine("header string")); + } else if (stream.match('!!!')) { + return chain(inLine("header string")); + } else if (stream.match('!!')) { + return chain(inLine("header string")); + } else { + return chain(inLine("header string")); + } + break; + case "*": //unordered list line item, or
      • at start of line + case "#": //ordered list line item, or
      • at start of line + case "+": //ordered list line item, or
      • at start of line + return chain(inLine("tw-listitem bracket")); + break; + } + } + + //stream.eatWhile(/[&{]/); was eating up plugins, turned off to act less like html and more like tiki + return null; + } + + var indentUnit = config.indentUnit; + + // Return variables for tokenizers + var pluginName, type; + function inPlugin(stream, state) { + var ch = stream.next(); + var peek = stream.peek(); + + if (ch == "}") { + state.tokenize = inText; + //type = ch == ")" ? "endPlugin" : "selfclosePlugin"; inPlugin + return "tag"; + } else if (ch == "(" || ch == ")") { + return "bracket"; + } else if (ch == "=") { + type = "equals"; + + if (peek == ">") { + ch = stream.next(); + peek = stream.peek(); + } + + //here we detect values directly after equal character with no quotes + if (!/[\'\"]/.test(peek)) { + state.tokenize = inAttributeNoQuote(); + } + //end detect values + + return "operator"; + } else if (/[\'\"]/.test(ch)) { + state.tokenize = inAttribute(ch); + return state.tokenize(stream, state); + } else { + stream.eatWhile(/[^\s\u00a0=\"\'\/?]/); + return "keyword"; + } + } + + function inAttribute(quote) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.next() == quote) { + state.tokenize = inPlugin; + break; + } + } + return "string"; + }; + } + + function inAttributeNoQuote() { + return function(stream, state) { + while (!stream.eol()) { + var ch = stream.next(); + var peek = stream.peek(); + if (ch == " " || ch == "," || /[ )}]/.test(peek)) { + state.tokenize = inPlugin; + break; + } + } + return "string"; +}; + } + +var curState, setStyle; +function pass() { + for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]); +} + +function cont() { + pass.apply(null, arguments); + return true; +} + +function pushContext(pluginName, startOfLine) { + var noIndent = curState.context && curState.context.noIndent; + curState.context = { + prev: curState.context, + pluginName: pluginName, + indent: curState.indented, + startOfLine: startOfLine, + noIndent: noIndent + }; +} + +function popContext() { + if (curState.context) curState.context = curState.context.prev; +} + +function element(type) { + if (type == "openPlugin") {curState.pluginName = pluginName; return cont(attributes, endplugin(curState.startOfLine));} + else if (type == "closePlugin") { + var err = false; + if (curState.context) { + err = curState.context.pluginName != pluginName; + popContext(); + } else { + err = true; + } + if (err) setStyle = "error"; + return cont(endcloseplugin(err)); + } + else if (type == "string") { + if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata"); + if (curState.tokenize == inText) popContext(); + return cont(); + } + else return cont(); +} + +function endplugin(startOfLine) { + return function(type) { + if ( + type == "selfclosePlugin" || + type == "endPlugin" + ) + return cont(); + if (type == "endPlugin") {pushContext(curState.pluginName, startOfLine); return cont();} + return cont(); + }; +} + +function endcloseplugin(err) { + return function(type) { + if (err) setStyle = "error"; + if (type == "endPlugin") return cont(); + return pass(); + }; +} + +function attributes(type) { + if (type == "keyword") {setStyle = "attribute"; return cont(attributes);} + if (type == "equals") return cont(attvalue, attributes); + return pass(); +} +function attvalue(type) { + if (type == "keyword") {setStyle = "string"; return cont();} + if (type == "string") return cont(attvaluemaybe); + return pass(); +} +function attvaluemaybe(type) { + if (type == "string") return cont(attvaluemaybe); + else return pass(); +} +return { + startState: function() { + return {tokenize: inText, cc: [], indented: 0, startOfLine: true, pluginName: null, context: null}; + }, + token: function(stream, state) { + if (stream.sol()) { + state.startOfLine = true; + state.indented = stream.indentation(); + } + if (stream.eatSpace()) return null; + + setStyle = type = pluginName = null; + var style = state.tokenize(stream, state); + if ((style || type) && style != "comment") { + curState = state; + while (true) { + var comb = state.cc.pop() || element; + if (comb(type || style)) break; + } + } + state.startOfLine = false; + return setStyle || style; + }, + indent: function(state, textAfter) { + var context = state.context; + if (context && context.noIndent) return 0; + if (context && /^{\//.test(textAfter)) + context = context.prev; + while (context && !context.startOfLine) + context = context.prev; + if (context) return context.indent + indentUnit; + else return 0; + }, + electricChars: "/" + }; +}); + +CodeMirror.defineMIME("text/tiki", "tiki"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/toml/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/toml/index.html new file mode 100644 index 0000000000000000000000000000000000000000..90a2a0215b79a11c23d9a4aba6708e81f1fbd07a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/toml/index.html @@ -0,0 +1,73 @@ + + +CodeMirror: TOML Mode + + + + + + + + + +
        +

        TOML Mode

        +
        + +

        The TOML Mode

        +

        Created by Forbes Lindesay.

        +

        MIME type defined: text/x-toml.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/toml/toml.js b/src/main/resources/templates/editor/lib/codemirror/mode/toml/toml.js new file mode 100644 index 0000000000000000000000000000000000000000..baeca15568001854b1f323932858d3cd343f732b --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/toml/toml.js @@ -0,0 +1,88 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("toml", function () { + return { + startState: function () { + return { + inString: false, + stringType: "", + lhs: true, + inArray: 0 + }; + }, + token: function (stream, state) { + //check for state changes + if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) { + state.stringType = stream.peek(); + stream.next(); // Skip quote + state.inString = true; // Update state + } + if (stream.sol() && state.inArray === 0) { + state.lhs = true; + } + //return state + if (state.inString) { + while (state.inString && !stream.eol()) { + if (stream.peek() === state.stringType) { + stream.next(); // Skip quote + state.inString = false; // Clear flag + } else if (stream.peek() === '\\') { + stream.next(); + stream.next(); + } else { + stream.match(/^.[^\\\"\']*/); + } + } + return state.lhs ? "property string" : "string"; // Token style + } else if (state.inArray && stream.peek() === ']') { + stream.next(); + state.inArray--; + return 'bracket'; + } else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) { + stream.next();//skip closing ] + // array of objects has an extra open & close [] + if (stream.peek() === ']') stream.next(); + return "atom"; + } else if (stream.peek() === "#") { + stream.skipToEnd(); + return "comment"; + } else if (stream.eatSpace()) { + return null; + } else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) { + return "property"; + } else if (state.lhs && stream.peek() === "=") { + stream.next(); + state.lhs = false; + return null; + } else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) { + return 'atom'; //date + } else if (!state.lhs && (stream.match('true') || stream.match('false'))) { + return 'atom'; + } else if (!state.lhs && stream.peek() === '[') { + state.inArray++; + stream.next(); + return 'bracket'; + } else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) { + return 'number'; + } else if (!stream.eatSpace()) { + stream.next(); + } + return null; + } + }; +}); + +CodeMirror.defineMIME('text/x-toml', 'toml'); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tornado/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/tornado/index.html new file mode 100644 index 0000000000000000000000000000000000000000..8ee7ef56ccd9d3b2a9a16ec8fb339cb56cfa87cf --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tornado/index.html @@ -0,0 +1,63 @@ + + +CodeMirror: Tornado template mode + + + + + + + + + + + + +
        +

        Tornado template mode

        +
        + + + +

        Mode for HTML with embedded Tornado template markup.

        + +

        MIME types defined: text/x-tornado

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/tornado/tornado.js b/src/main/resources/templates/editor/lib/codemirror/mode/tornado/tornado.js new file mode 100644 index 0000000000000000000000000000000000000000..dbfbc34890b72b63b10ef1d002cd396a3f4626ab --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/tornado/tornado.js @@ -0,0 +1,68 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), + require("../../addon/mode/overlay")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed", + "../../addon/mode/overlay"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("tornado:inner", function() { + var keywords = ["and","as","assert","autoescape","block","break","class","comment","context", + "continue","datetime","def","del","elif","else","end","escape","except", + "exec","extends","false","finally","for","from","global","if","import","in", + "include","is","json_encode","lambda","length","linkify","load","module", + "none","not","or","pass","print","put","raise","raw","return","self","set", + "squeeze","super","true","try","url_escape","while","with","without","xhtml_escape","yield"]; + keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); + + function tokenBase (stream, state) { + stream.eatWhile(/[^\{]/); + var ch = stream.next(); + if (ch == "{") { + if (ch = stream.eat(/\{|%|#/)) { + state.tokenize = inTag(ch); + return "tag"; + } + } + } + function inTag (close) { + if (close == "{") { + close = "}"; + } + return function (stream, state) { + var ch = stream.next(); + if ((ch == close) && stream.eat("}")) { + state.tokenize = tokenBase; + return "tag"; + } + if (stream.match(keywords)) { + return "keyword"; + } + return close == "#" ? "comment" : "string"; + }; + } + return { + startState: function () { + return {tokenize: tokenBase}; + }, + token: function (stream, state) { + return state.tokenize(stream, state); + } + }; + }); + + CodeMirror.defineMode("tornado", function(config) { + var htmlBase = CodeMirror.getMode(config, "text/html"); + var tornadoInner = CodeMirror.getMode(config, "tornado:inner"); + return CodeMirror.overlayMode(htmlBase, tornadoInner); + }); + + CodeMirror.defineMIME("text/x-tornado", "tornado"); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/turtle/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/turtle/index.html new file mode 100644 index 0000000000000000000000000000000000000000..a4962b61748355233c70efaabc18fd5e929846ec --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/turtle/index.html @@ -0,0 +1,50 @@ + + +CodeMirror: Turtle mode + + + + + + + + + +
        +

        Turtle mode

        +
        + + +

        MIME types defined: text/turtle.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/turtle/turtle.js b/src/main/resources/templates/editor/lib/codemirror/mode/turtle/turtle.js new file mode 100644 index 0000000000000000000000000000000000000000..0988f0a442ae8a8340bc6b55448e885c516d7793 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/turtle/turtle.js @@ -0,0 +1,162 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("turtle", function(config) { + var indentUnit = config.indentUnit; + var curPunc; + + function wordRegexp(words) { + return new RegExp("^(?:" + words.join("|") + ")$", "i"); + } + var ops = wordRegexp([]); + var keywords = wordRegexp(["@prefix", "@base", "a"]); + var operatorChars = /[*+\-<>=&|]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + curPunc = null; + if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) { + stream.match(/^[^\s\u00a0>]*>?/); + return "atom"; + } + else if (ch == "\"" || ch == "'") { + state.tokenize = tokenLiteral(ch); + return state.tokenize(stream, state); + } + else if (/[{}\(\),\.;\[\]]/.test(ch)) { + curPunc = ch; + return null; + } + else if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } + else if (operatorChars.test(ch)) { + stream.eatWhile(operatorChars); + return null; + } + else if (ch == ":") { + return "operator"; + } else { + stream.eatWhile(/[_\w\d]/); + if(stream.peek() == ":") { + return "variable-3"; + } else { + var word = stream.current(); + + if(keywords.test(word)) { + return "meta"; + } + + if(ch >= "A" && ch <= "Z") { + return "comment"; + } else { + return "keyword"; + } + } + var word = stream.current(); + if (ops.test(word)) + return null; + else if (keywords.test(word)) + return "meta"; + else + return "variable"; + } + } + + function tokenLiteral(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "string"; + }; + } + + function pushContext(state, type, col) { + state.context = {prev: state.context, indent: state.indent, col: col, type: type}; + } + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; + } + + return { + startState: function() { + return {tokenize: tokenBase, + context: null, + indent: 0, + col: 0}; + }, + + token: function(stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) state.context.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + + if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { + state.context.align = true; + } + + if (curPunc == "(") pushContext(state, ")", stream.column()); + else if (curPunc == "[") pushContext(state, "]", stream.column()); + else if (curPunc == "{") pushContext(state, "}", stream.column()); + else if (/[\]\}\)]/.test(curPunc)) { + while (state.context && state.context.type == "pattern") popContext(state); + if (state.context && curPunc == state.context.type) popContext(state); + } + else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); + else if (/atom|string|variable/.test(style) && state.context) { + if (/[\}\]]/.test(state.context.type)) + pushContext(state, "pattern", stream.column()); + else if (state.context.type == "pattern" && !state.context.align) { + state.context.align = true; + state.context.col = stream.column(); + } + } + + return style; + }, + + indent: function(state, textAfter) { + var firstChar = textAfter && textAfter.charAt(0); + var context = state.context; + if (/[\]\}]/.test(firstChar)) + while (context && context.type == "pattern") context = context.prev; + + var closing = context && firstChar == context.type; + if (!context) + return 0; + else if (context.type == "pattern") + return context.col; + else if (context.align) + return context.col + (closing ? 0 : 1); + else + return context.indent + (closing ? 0 : indentUnit); + }, + + lineComment: "#" + }; +}); + +CodeMirror.defineMIME("text/turtle", "turtle"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/vb/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/vb/index.html new file mode 100644 index 0000000000000000000000000000000000000000..adcc44fd3921768158bfff62145d2c76688824eb --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/vb/index.html @@ -0,0 +1,102 @@ + + +CodeMirror: VB.NET mode + + + + + + + + + + + +
        +

        VB.NET mode

        + + + +
        + +
        +
        
        +  

        MIME type defined: text/x-vb.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/vb/vb.js b/src/main/resources/templates/editor/lib/codemirror/mode/vb/vb.js new file mode 100644 index 0000000000000000000000000000000000000000..902203e0c03e9d3c94fb8453919e2ebf23b6725f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/vb/vb.js @@ -0,0 +1,274 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("vb", function(conf, parserConf) { + var ERRORCLASS = 'error'; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); + } + + var singleOperators = new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]"); + var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]'); + var doubleOperators = new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); + var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); + var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); + var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); + + var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try']; + var middleKeywords = ['else','elseif','case', 'catch']; + var endKeywords = ['next','loop']; + + var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'in']); + var commonkeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until', + 'goto', 'byval','byref','new','handles','property', 'return', + 'const','private', 'protected', 'friend', 'public', 'shared', 'static', 'true','false']; + var commontypes = ['integer','string','double','decimal','boolean','short','char', 'float','single']; + + var keywords = wordRegexp(commonkeywords); + var types = wordRegexp(commontypes); + var stringPrefixes = '"'; + + var opening = wordRegexp(openingKeywords); + var middle = wordRegexp(middleKeywords); + var closing = wordRegexp(endKeywords); + var doubleClosing = wordRegexp(['end']); + var doOpening = wordRegexp(['do']); + + var indentInfo = null; + + + + + function indent(_stream, state) { + state.currentIndent++; + } + + function dedent(_stream, state) { + state.currentIndent--; + } + // tokenizers + function tokenBase(stream, state) { + if (stream.eatSpace()) { + return null; + } + + var ch = stream.peek(); + + // Handle Comments + if (ch === "'") { + stream.skipToEnd(); + return 'comment'; + } + + + // Handle Number Literals + if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) { + var floatLiteral = false; + // Floats + if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; } + else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; } + else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; } + + if (floatLiteral) { + // Float literals may be "imaginary" + stream.eat(/J/i); + return 'number'; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; } + // Octal + else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; } + // Decimal + else if (stream.match(/^[1-9]\d*F?/)) { + // Decimal literals may be "imaginary" + stream.eat(/J/i); + // TODO - Can you have imaginary longs? + intLiteral = true; + } + // Zero by itself with no other piece of number. + else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } + if (intLiteral) { + // Integer literals may be "long" + stream.eat(/L/i); + return 'number'; + } + } + + // Handle Strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenStringFactory(stream.current()); + return state.tokenize(stream, state); + } + + // Handle operators and Delimiters + if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { + return null; + } + if (stream.match(doubleOperators) + || stream.match(singleOperators) + || stream.match(wordOperators)) { + return 'operator'; + } + if (stream.match(singleDelimiters)) { + return null; + } + if (stream.match(doOpening)) { + indent(stream,state); + state.doInCurrentLine = true; + return 'keyword'; + } + if (stream.match(opening)) { + if (! state.doInCurrentLine) + indent(stream,state); + else + state.doInCurrentLine = false; + return 'keyword'; + } + if (stream.match(middle)) { + return 'keyword'; + } + + if (stream.match(doubleClosing)) { + dedent(stream,state); + dedent(stream,state); + return 'keyword'; + } + if (stream.match(closing)) { + dedent(stream,state); + return 'keyword'; + } + + if (stream.match(types)) { + return 'keyword'; + } + + if (stream.match(keywords)) { + return 'keyword'; + } + + if (stream.match(identifiers)) { + return 'variable'; + } + + // Handle non-detected items + stream.next(); + return ERRORCLASS; + } + + function tokenStringFactory(delimiter) { + var singleline = delimiter.length == 1; + var OUTCLASS = 'string'; + + return function(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"]/); + if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) { + return ERRORCLASS; + } else { + state.tokenize = tokenBase; + } + } + return OUTCLASS; + }; + } + + + function tokenLexer(stream, state) { + var style = state.tokenize(stream, state); + var current = stream.current(); + + // Handle '.' connected identifiers + if (current === '.') { + style = state.tokenize(stream, state); + current = stream.current(); + if (style === 'variable') { + return 'variable'; + } else { + return ERRORCLASS; + } + } + + + var delimiter_index = '[({'.indexOf(current); + if (delimiter_index !== -1) { + indent(stream, state ); + } + if (indentInfo === 'dedent') { + if (dedent(stream, state)) { + return ERRORCLASS; + } + } + delimiter_index = '])}'.indexOf(current); + if (delimiter_index !== -1) { + if (dedent(stream, state)) { + return ERRORCLASS; + } + } + + return style; + } + + var external = { + electricChars:"dDpPtTfFeE ", + startState: function() { + return { + tokenize: tokenBase, + lastToken: null, + currentIndent: 0, + nextLineIndent: 0, + doInCurrentLine: false + + + }; + }, + + token: function(stream, state) { + if (stream.sol()) { + state.currentIndent += state.nextLineIndent; + state.nextLineIndent = 0; + state.doInCurrentLine = 0; + } + var style = tokenLexer(stream, state); + + state.lastToken = {style:style, content: stream.current()}; + + + + return style; + }, + + indent: function(state, textAfter) { + var trueText = textAfter.replace(/^\s+|\s+$/g, '') ; + if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1); + if(state.currentIndent < 0) return 0; + return state.currentIndent * conf.indentUnit; + } + + }; + return external; +}); + +CodeMirror.defineMIME("text/x-vb", "vb"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/vbscript/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/vbscript/index.html new file mode 100644 index 0000000000000000000000000000000000000000..ad7532d7df14139e1b5060be56cf902d6ffbc632 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/vbscript/index.html @@ -0,0 +1,55 @@ + + +CodeMirror: VBScript mode + + + + + + + + + +
        +

        VBScript mode

        + + +
        + + + +

        MIME types defined: text/vbscript.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/vbscript/vbscript.js b/src/main/resources/templates/editor/lib/codemirror/mode/vbscript/vbscript.js new file mode 100644 index 0000000000000000000000000000000000000000..b66df2239a44af4aa4d0f3f41b0c77a92a4652c6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/vbscript/vbscript.js @@ -0,0 +1,350 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +/* +For extra ASP classic objects, initialize CodeMirror instance with this option: + isASP: true + +E.G.: + var editor = CodeMirror.fromTextArea(document.getElementById("code"), { + lineNumbers: true, + isASP: true + }); +*/ + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("vbscript", function(conf, parserConf) { + var ERRORCLASS = 'error'; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); + } + + var singleOperators = new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]"); + var doubleOperators = new RegExp("^((<>)|(<=)|(>=))"); + var singleDelimiters = new RegExp('^[\\.,]'); + var brakets = new RegExp('^[\\(\\)]'); + var identifiers = new RegExp("^[A-Za-z][_A-Za-z0-9]*"); + + var openingKeywords = ['class','sub','select','while','if','function', 'property', 'with', 'for']; + var middleKeywords = ['else','elseif','case']; + var endKeywords = ['next','loop','wend']; + + var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'is', 'mod', 'eqv', 'imp']); + var commonkeywords = ['dim', 'redim', 'then', 'until', 'randomize', + 'byval','byref','new','property', 'exit', 'in', + 'const','private', 'public', + 'get','set','let', 'stop', 'on error resume next', 'on error goto 0', 'option explicit', 'call', 'me']; + + //This list was from: http://msdn.microsoft.com/en-us/library/f8tbc79x(v=vs.84).aspx + var atomWords = ['true', 'false', 'nothing', 'empty', 'null']; + //This list was from: http://msdn.microsoft.com/en-us/library/3ca8tfek(v=vs.84).aspx + var builtinFuncsWords = ['abs', 'array', 'asc', 'atn', 'cbool', 'cbyte', 'ccur', 'cdate', 'cdbl', 'chr', 'cint', 'clng', 'cos', 'csng', 'cstr', 'date', 'dateadd', 'datediff', 'datepart', + 'dateserial', 'datevalue', 'day', 'escape', 'eval', 'execute', 'exp', 'filter', 'formatcurrency', 'formatdatetime', 'formatnumber', 'formatpercent', 'getlocale', 'getobject', + 'getref', 'hex', 'hour', 'inputbox', 'instr', 'instrrev', 'int', 'fix', 'isarray', 'isdate', 'isempty', 'isnull', 'isnumeric', 'isobject', 'join', 'lbound', 'lcase', 'left', + 'len', 'loadpicture', 'log', 'ltrim', 'rtrim', 'trim', 'maths', 'mid', 'minute', 'month', 'monthname', 'msgbox', 'now', 'oct', 'replace', 'rgb', 'right', 'rnd', 'round', + 'scriptengine', 'scriptenginebuildversion', 'scriptenginemajorversion', 'scriptengineminorversion', 'second', 'setlocale', 'sgn', 'sin', 'space', 'split', 'sqr', 'strcomp', + 'string', 'strreverse', 'tan', 'time', 'timer', 'timeserial', 'timevalue', 'typename', 'ubound', 'ucase', 'unescape', 'vartype', 'weekday', 'weekdayname', 'year']; + + //This list was from: http://msdn.microsoft.com/en-us/library/ydz4cfk3(v=vs.84).aspx + var builtinConsts = ['vbBlack', 'vbRed', 'vbGreen', 'vbYellow', 'vbBlue', 'vbMagenta', 'vbCyan', 'vbWhite', 'vbBinaryCompare', 'vbTextCompare', + 'vbSunday', 'vbMonday', 'vbTuesday', 'vbWednesday', 'vbThursday', 'vbFriday', 'vbSaturday', 'vbUseSystemDayOfWeek', 'vbFirstJan1', 'vbFirstFourDays', 'vbFirstFullWeek', + 'vbGeneralDate', 'vbLongDate', 'vbShortDate', 'vbLongTime', 'vbShortTime', 'vbObjectError', + 'vbOKOnly', 'vbOKCancel', 'vbAbortRetryIgnore', 'vbYesNoCancel', 'vbYesNo', 'vbRetryCancel', 'vbCritical', 'vbQuestion', 'vbExclamation', 'vbInformation', 'vbDefaultButton1', 'vbDefaultButton2', + 'vbDefaultButton3', 'vbDefaultButton4', 'vbApplicationModal', 'vbSystemModal', 'vbOK', 'vbCancel', 'vbAbort', 'vbRetry', 'vbIgnore', 'vbYes', 'vbNo', + 'vbCr', 'VbCrLf', 'vbFormFeed', 'vbLf', 'vbNewLine', 'vbNullChar', 'vbNullString', 'vbTab', 'vbVerticalTab', 'vbUseDefault', 'vbTrue', 'vbFalse', + 'vbEmpty', 'vbNull', 'vbInteger', 'vbLong', 'vbSingle', 'vbDouble', 'vbCurrency', 'vbDate', 'vbString', 'vbObject', 'vbError', 'vbBoolean', 'vbVariant', 'vbDataObject', 'vbDecimal', 'vbByte', 'vbArray']; + //This list was from: http://msdn.microsoft.com/en-us/library/hkc375ea(v=vs.84).aspx + var builtinObjsWords = ['WScript', 'err', 'debug', 'RegExp']; + var knownProperties = ['description', 'firstindex', 'global', 'helpcontext', 'helpfile', 'ignorecase', 'length', 'number', 'pattern', 'source', 'value', 'count']; + var knownMethods = ['clear', 'execute', 'raise', 'replace', 'test', 'write', 'writeline', 'close', 'open', 'state', 'eof', 'update', 'addnew', 'end', 'createobject', 'quit']; + + var aspBuiltinObjsWords = ['server', 'response', 'request', 'session', 'application']; + var aspKnownProperties = ['buffer', 'cachecontrol', 'charset', 'contenttype', 'expires', 'expiresabsolute', 'isclientconnected', 'pics', 'status', //response + 'clientcertificate', 'cookies', 'form', 'querystring', 'servervariables', 'totalbytes', //request + 'contents', 'staticobjects', //application + 'codepage', 'lcid', 'sessionid', 'timeout', //session + 'scripttimeout']; //server + var aspKnownMethods = ['addheader', 'appendtolog', 'binarywrite', 'end', 'flush', 'redirect', //response + 'binaryread', //request + 'remove', 'removeall', 'lock', 'unlock', //application + 'abandon', //session + 'getlasterror', 'htmlencode', 'mappath', 'transfer', 'urlencode']; //server + + var knownWords = knownMethods.concat(knownProperties); + + builtinObjsWords = builtinObjsWords.concat(builtinConsts); + + if (conf.isASP){ + builtinObjsWords = builtinObjsWords.concat(aspBuiltinObjsWords); + knownWords = knownWords.concat(aspKnownMethods, aspKnownProperties); + }; + + var keywords = wordRegexp(commonkeywords); + var atoms = wordRegexp(atomWords); + var builtinFuncs = wordRegexp(builtinFuncsWords); + var builtinObjs = wordRegexp(builtinObjsWords); + var known = wordRegexp(knownWords); + var stringPrefixes = '"'; + + var opening = wordRegexp(openingKeywords); + var middle = wordRegexp(middleKeywords); + var closing = wordRegexp(endKeywords); + var doubleClosing = wordRegexp(['end']); + var doOpening = wordRegexp(['do']); + var noIndentWords = wordRegexp(['on error resume next', 'exit']); + var comment = wordRegexp(['rem']); + + + function indent(_stream, state) { + state.currentIndent++; + } + + function dedent(_stream, state) { + state.currentIndent--; + } + // tokenizers + function tokenBase(stream, state) { + if (stream.eatSpace()) { + return 'space'; + //return null; + } + + var ch = stream.peek(); + + // Handle Comments + if (ch === "'") { + stream.skipToEnd(); + return 'comment'; + } + if (stream.match(comment)){ + stream.skipToEnd(); + return 'comment'; + } + + + // Handle Number Literals + if (stream.match(/^((&H)|(&O))?[0-9\.]/i, false) && !stream.match(/^((&H)|(&O))?[0-9\.]+[a-z_]/i, false)) { + var floatLiteral = false; + // Floats + if (stream.match(/^\d*\.\d+/i)) { floatLiteral = true; } + else if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; } + else if (stream.match(/^\.\d+/)) { floatLiteral = true; } + + if (floatLiteral) { + // Float literals may be "imaginary" + stream.eat(/J/i); + return 'number'; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; } + // Octal + else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; } + // Decimal + else if (stream.match(/^[1-9]\d*F?/)) { + // Decimal literals may be "imaginary" + stream.eat(/J/i); + // TODO - Can you have imaginary longs? + intLiteral = true; + } + // Zero by itself with no other piece of number. + else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } + if (intLiteral) { + // Integer literals may be "long" + stream.eat(/L/i); + return 'number'; + } + } + + // Handle Strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenStringFactory(stream.current()); + return state.tokenize(stream, state); + } + + // Handle operators and Delimiters + if (stream.match(doubleOperators) + || stream.match(singleOperators) + || stream.match(wordOperators)) { + return 'operator'; + } + if (stream.match(singleDelimiters)) { + return null; + } + + if (stream.match(brakets)) { + return "bracket"; + } + + if (stream.match(noIndentWords)) { + state.doInCurrentLine = true; + + return 'keyword'; + } + + if (stream.match(doOpening)) { + indent(stream,state); + state.doInCurrentLine = true; + + return 'keyword'; + } + if (stream.match(opening)) { + if (! state.doInCurrentLine) + indent(stream,state); + else + state.doInCurrentLine = false; + + return 'keyword'; + } + if (stream.match(middle)) { + return 'keyword'; + } + + + if (stream.match(doubleClosing)) { + dedent(stream,state); + dedent(stream,state); + + return 'keyword'; + } + if (stream.match(closing)) { + if (! state.doInCurrentLine) + dedent(stream,state); + else + state.doInCurrentLine = false; + + return 'keyword'; + } + + if (stream.match(keywords)) { + return 'keyword'; + } + + if (stream.match(atoms)) { + return 'atom'; + } + + if (stream.match(known)) { + return 'variable-2'; + } + + if (stream.match(builtinFuncs)) { + return 'builtin'; + } + + if (stream.match(builtinObjs)){ + return 'variable-2'; + } + + if (stream.match(identifiers)) { + return 'variable'; + } + + // Handle non-detected items + stream.next(); + return ERRORCLASS; + } + + function tokenStringFactory(delimiter) { + var singleline = delimiter.length == 1; + var OUTCLASS = 'string'; + + return function(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"]/); + if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) { + return ERRORCLASS; + } else { + state.tokenize = tokenBase; + } + } + return OUTCLASS; + }; + } + + + function tokenLexer(stream, state) { + var style = state.tokenize(stream, state); + var current = stream.current(); + + // Handle '.' connected identifiers + if (current === '.') { + style = state.tokenize(stream, state); + + current = stream.current(); + if (style && (style.substr(0, 8) === 'variable' || style==='builtin' || style==='keyword')){//|| knownWords.indexOf(current.substring(1)) > -1) { + if (style === 'builtin' || style === 'keyword') style='variable'; + if (knownWords.indexOf(current.substr(1)) > -1) style='variable-2'; + + return style; + } else { + return ERRORCLASS; + } + } + + return style; + } + + var external = { + electricChars:"dDpPtTfFeE ", + startState: function() { + return { + tokenize: tokenBase, + lastToken: null, + currentIndent: 0, + nextLineIndent: 0, + doInCurrentLine: false, + ignoreKeyword: false + + + }; + }, + + token: function(stream, state) { + if (stream.sol()) { + state.currentIndent += state.nextLineIndent; + state.nextLineIndent = 0; + state.doInCurrentLine = 0; + } + var style = tokenLexer(stream, state); + + state.lastToken = {style:style, content: stream.current()}; + + if (style==='space') style=null; + + return style; + }, + + indent: function(state, textAfter) { + var trueText = textAfter.replace(/^\s+|\s+$/g, '') ; + if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1); + if(state.currentIndent < 0) return 0; + return state.currentIndent * conf.indentUnit; + } + + }; + return external; +}); + +CodeMirror.defineMIME("text/vbscript", "vbscript"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/velocity/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/velocity/index.html new file mode 100644 index 0000000000000000000000000000000000000000..274787866786ec959029ad826c43dabaedb14226 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/velocity/index.html @@ -0,0 +1,118 @@ + + +CodeMirror: Velocity mode + + + + + + + + + + +
        +

        Velocity mode

        +
        + + +

        MIME types defined: text/velocity.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/velocity/velocity.js b/src/main/resources/templates/editor/lib/codemirror/mode/velocity/velocity.js new file mode 100644 index 0000000000000000000000000000000000000000..8fc4f95d05034a19865445d26355cb005ceef3d6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/velocity/velocity.js @@ -0,0 +1,201 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("velocity", function() { + function parseWords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var keywords = parseWords("#end #else #break #stop #[[ #]] " + + "#{end} #{else} #{break} #{stop}"); + var functions = parseWords("#if #elseif #foreach #set #include #parse #macro #define #evaluate " + + "#{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}"); + var specials = parseWords("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent.count $foreach.parent.hasNext $foreach.parent.first $foreach.parent.last $foreach.parent $velocityCount $!bodyContent $bodyContent"); + var isOperatorChar = /[+\-*&%=<>!?:\/|]/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + function tokenBase(stream, state) { + var beforeParams = state.beforeParams; + state.beforeParams = false; + var ch = stream.next(); + // start of unparsed string? + if ((ch == "'") && state.inParams) { + state.lastTokenWasBuiltin = false; + return chain(stream, state, tokenString(ch)); + } + // start of parsed string? + else if ((ch == '"')) { + state.lastTokenWasBuiltin = false; + if (state.inString) { + state.inString = false; + return "string"; + } + else if (state.inParams) + return chain(stream, state, tokenString(ch)); + } + // is it one of the special signs []{}().,;? Seperator? + else if (/[\[\]{}\(\),;\.]/.test(ch)) { + if (ch == "(" && beforeParams) + state.inParams = true; + else if (ch == ")") { + state.inParams = false; + state.lastTokenWasBuiltin = true; + } + return null; + } + // start of a number value? + else if (/\d/.test(ch)) { + state.lastTokenWasBuiltin = false; + stream.eatWhile(/[\w\.]/); + return "number"; + } + // multi line comment? + else if (ch == "#" && stream.eat("*")) { + state.lastTokenWasBuiltin = false; + return chain(stream, state, tokenComment); + } + // unparsed content? + else if (ch == "#" && stream.match(/ *\[ *\[/)) { + state.lastTokenWasBuiltin = false; + return chain(stream, state, tokenUnparsed); + } + // single line comment? + else if (ch == "#" && stream.eat("#")) { + state.lastTokenWasBuiltin = false; + stream.skipToEnd(); + return "comment"; + } + // variable? + else if (ch == "$") { + stream.eatWhile(/[\w\d\$_\.{}]/); + // is it one of the specials? + if (specials && specials.propertyIsEnumerable(stream.current())) { + return "keyword"; + } + else { + state.lastTokenWasBuiltin = true; + state.beforeParams = true; + return "builtin"; + } + } + // is it a operator? + else if (isOperatorChar.test(ch)) { + state.lastTokenWasBuiltin = false; + stream.eatWhile(isOperatorChar); + return "operator"; + } + else { + // get the whole word + stream.eatWhile(/[\w\$_{}@]/); + var word = stream.current(); + // is it one of the listed keywords? + if (keywords && keywords.propertyIsEnumerable(word)) + return "keyword"; + // is it one of the listed functions? + if (functions && functions.propertyIsEnumerable(word) || + (stream.current().match(/^#@?[a-z0-9_]+ *$/i) && stream.peek()=="(") && + !(functions && functions.propertyIsEnumerable(word.toLowerCase()))) { + state.beforeParams = true; + state.lastTokenWasBuiltin = false; + return "keyword"; + } + if (state.inString) { + state.lastTokenWasBuiltin = false; + return "string"; + } + if (stream.pos > word.length && stream.string.charAt(stream.pos-word.length-1)=="." && state.lastTokenWasBuiltin) + return "builtin"; + // default: just a "word" + state.lastTokenWasBuiltin = false; + return null; + } + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if ((next == quote) && !escaped) { + end = true; + break; + } + if (quote=='"' && stream.peek() == '$' && !escaped) { + state.inString = true; + end = true; + break; + } + escaped = !escaped && next == "\\"; + } + if (end) state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function tokenUnparsed(stream, state) { + var maybeEnd = 0, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd == 2) { + state.tokenize = tokenBase; + break; + } + if (ch == "]") + maybeEnd++; + else if (ch != " ") + maybeEnd = 0; + } + return "meta"; + } + // Interface + + return { + startState: function() { + return { + tokenize: tokenBase, + beforeParams: false, + inParams: false, + inString: false, + lastTokenWasBuiltin: false + }; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + }, + blockCommentStart: "#*", + blockCommentEnd: "*#", + lineComment: "##", + fold: "velocity" + }; +}); + +CodeMirror.defineMIME("text/velocity", "velocity"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/verilog/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/verilog/index.html new file mode 100644 index 0000000000000000000000000000000000000000..96b3d647666e116d7cc31470f869e68a53d7e0fa --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/verilog/index.html @@ -0,0 +1,120 @@ + + +CodeMirror: Verilog/SystemVerilog mode + + + + + + + + + + +
        +

        SystemVerilog mode

        + +
        + + + +

        +Syntax highlighting and indentation for the Verilog and SystemVerilog languages (IEEE 1800). +

        Configuration options:

        +
          +
        • noIndentKeywords - List of keywords which should not cause identation to increase. E.g. ["package", "module"]. Default: None
        • +
        +

        + +

        MIME types defined: text/x-verilog and text/x-systemverilog.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/verilog/test.js b/src/main/resources/templates/editor/lib/codemirror/mode/verilog/test.js new file mode 100644 index 0000000000000000000000000000000000000000..9c8c09494082ef5b91459ea69e63747f8dfd8026 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/verilog/test.js @@ -0,0 +1,273 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + var mode = CodeMirror.getMode({indentUnit: 4}, "verilog"); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + MT("binary_literals", + "[number 1'b0]", + "[number 1'b1]", + "[number 1'bx]", + "[number 1'bz]", + "[number 1'bX]", + "[number 1'bZ]", + "[number 1'B0]", + "[number 1'B1]", + "[number 1'Bx]", + "[number 1'Bz]", + "[number 1'BX]", + "[number 1'BZ]", + "[number 1'b0]", + "[number 1'b1]", + "[number 2'b01]", + "[number 2'bxz]", + "[number 2'b11]", + "[number 2'b10]", + "[number 2'b1Z]", + "[number 12'b0101_0101_0101]", + "[number 1'b 0]", + "[number 'b0101]" + ); + + MT("octal_literals", + "[number 3'o7]", + "[number 3'O7]", + "[number 3'so7]", + "[number 3'SO7]" + ); + + MT("decimal_literals", + "[number 0]", + "[number 1]", + "[number 7]", + "[number 123_456]", + "[number 'd33]", + "[number 8'd255]", + "[number 8'D255]", + "[number 8'sd255]", + "[number 8'SD255]", + "[number 32'd123]", + "[number 32 'd123]", + "[number 32 'd 123]" + ); + + MT("hex_literals", + "[number 4'h0]", + "[number 4'ha]", + "[number 4'hF]", + "[number 4'hx]", + "[number 4'hz]", + "[number 4'hX]", + "[number 4'hZ]", + "[number 32'hdc78]", + "[number 32'hDC78]", + "[number 32 'hDC78]", + "[number 32'h DC78]", + "[number 32 'h DC78]", + "[number 32'h44x7]", + "[number 32'hFFF?]" + ); + + MT("real_number_literals", + "[number 1.2]", + "[number 0.1]", + "[number 2394.26331]", + "[number 1.2E12]", + "[number 1.2e12]", + "[number 1.30e-2]", + "[number 0.1e-0]", + "[number 23E10]", + "[number 29E-2]", + "[number 236.123_763_e-12]" + ); + + MT("operators", + "[meta ^]" + ); + + MT("keywords", + "[keyword logic]", + "[keyword logic] [variable foo]", + "[keyword reg] [variable abc]" + ); + + MT("variables", + "[variable _leading_underscore]", + "[variable _if]", + "[number 12] [variable foo]", + "[variable foo] [number 14]" + ); + + MT("tick_defines", + "[def `FOO]", + "[def `foo]", + "[def `FOO_bar]" + ); + + MT("system_calls", + "[meta $display]", + "[meta $vpi_printf]" + ); + + MT("line_comment", "[comment // Hello world]"); + + // Alignment tests + MT("align_port_map_style1", + /** + * mod mod(.a(a), + * .b(b) + * ); + */ + "[variable mod] [variable mod][bracket (].[variable a][bracket (][variable a][bracket )],", + " .[variable b][bracket (][variable b][bracket )]", + " [bracket )];", + "" + ); + + MT("align_port_map_style2", + /** + * mod mod( + * .a(a), + * .b(b) + * ); + */ + "[variable mod] [variable mod][bracket (]", + " .[variable a][bracket (][variable a][bracket )],", + " .[variable b][bracket (][variable b][bracket )]", + "[bracket )];", + "" + ); + + // Indentation tests + MT("indent_single_statement_if", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword break];", + "" + ); + + MT("no_indent_after_single_line_if", + "[keyword if] [bracket (][variable foo][bracket )] [keyword break];", + "" + ); + + MT("indent_after_if_begin_same_line", + "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]", + " [keyword break];", + " [keyword break];", + "[keyword end]", + "" + ); + + MT("indent_after_if_begin_next_line", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword begin]", + " [keyword break];", + " [keyword break];", + " [keyword end]", + "" + ); + + MT("indent_single_statement_if_else", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword break];", + "[keyword else]", + " [keyword break];", + "" + ); + + MT("indent_if_else_begin_same_line", + "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]", + " [keyword break];", + " [keyword break];", + "[keyword end] [keyword else] [keyword begin]", + " [keyword break];", + " [keyword break];", + "[keyword end]", + "" + ); + + MT("indent_if_else_begin_next_line", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword begin]", + " [keyword break];", + " [keyword break];", + " [keyword end]", + "[keyword else]", + " [keyword begin]", + " [keyword break];", + " [keyword break];", + " [keyword end]", + "" + ); + + MT("indent_if_nested_without_begin", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword if] [bracket (][variable foo][bracket )]", + " [keyword if] [bracket (][variable foo][bracket )]", + " [keyword break];", + "" + ); + + MT("indent_case", + "[keyword case] [bracket (][variable state][bracket )]", + " [variable FOO]:", + " [keyword break];", + " [variable BAR]:", + " [keyword break];", + "[keyword endcase]", + "" + ); + + MT("unindent_after_end_with_preceding_text", + "[keyword begin]", + " [keyword break]; [keyword end]", + "" + ); + + MT("export_function_one_line_does_not_indent", + "[keyword export] [string \"DPI-C\"] [keyword function] [variable helloFromSV];", + "" + ); + + MT("export_task_one_line_does_not_indent", + "[keyword export] [string \"DPI-C\"] [keyword task] [variable helloFromSV];", + "" + ); + + MT("export_function_two_lines_indents_properly", + "[keyword export]", + " [string \"DPI-C\"] [keyword function] [variable helloFromSV];", + "" + ); + + MT("export_task_two_lines_indents_properly", + "[keyword export]", + " [string \"DPI-C\"] [keyword task] [variable helloFromSV];", + "" + ); + + MT("import_function_one_line_does_not_indent", + "[keyword import] [string \"DPI-C\"] [keyword function] [variable helloFromC];", + "" + ); + + MT("import_task_one_line_does_not_indent", + "[keyword import] [string \"DPI-C\"] [keyword task] [variable helloFromC];", + "" + ); + + MT("import_package_single_line_does_not_indent", + "[keyword import] [variable p]::[variable x];", + "[keyword import] [variable p]::[variable y];", + "" + ); + + MT("covergoup_with_function_indents_properly", + "[keyword covergroup] [variable cg] [keyword with] [keyword function] [variable sample][bracket (][keyword bit] [variable b][bracket )];", + " [variable c] : [keyword coverpoint] [variable c];", + "[keyword endgroup]: [variable cg]", + "" + ); + +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/verilog/verilog.js b/src/main/resources/templates/editor/lib/codemirror/mode/verilog/verilog.js new file mode 100644 index 0000000000000000000000000000000000000000..96b9f24581e5c2e4ca804bb8773c52758de104e1 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/verilog/verilog.js @@ -0,0 +1,537 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("verilog", function(config, parserConfig) { + + var indentUnit = config.indentUnit, + statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, + dontAlignCalls = parserConfig.dontAlignCalls, + noIndentKeywords = parserConfig.noIndentKeywords || [], + multiLineStrings = parserConfig.multiLineStrings, + hooks = parserConfig.hooks || {}; + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + /** + * Keywords from IEEE 1800-2012 + */ + var keywords = words( + "accept_on alias always always_comb always_ff always_latch and assert assign assume automatic before begin bind " + + "bins binsof bit break buf bufif0 bufif1 byte case casex casez cell chandle checker class clocking cmos config " + + "const constraint context continue cover covergroup coverpoint cross deassign default defparam design disable " + + "dist do edge else end endcase endchecker endclass endclocking endconfig endfunction endgenerate endgroup " + + "endinterface endmodule endpackage endprimitive endprogram endproperty endspecify endsequence endtable endtask " + + "enum event eventually expect export extends extern final first_match for force foreach forever fork forkjoin " + + "function generate genvar global highz0 highz1 if iff ifnone ignore_bins illegal_bins implements implies import " + + "incdir include initial inout input inside instance int integer interconnect interface intersect join join_any " + + "join_none large let liblist library local localparam logic longint macromodule matches medium modport module " + + "nand negedge nettype new nexttime nmos nor noshowcancelled not notif0 notif1 null or output package packed " + + "parameter pmos posedge primitive priority program property protected pull0 pull1 pulldown pullup " + + "pulsestyle_ondetect pulsestyle_onevent pure rand randc randcase randsequence rcmos real realtime ref reg " + + "reject_on release repeat restrict return rnmos rpmos rtran rtranif0 rtranif1 s_always s_eventually s_nexttime " + + "s_until s_until_with scalared sequence shortint shortreal showcancelled signed small soft solve specify " + + "specparam static string strong strong0 strong1 struct super supply0 supply1 sync_accept_on sync_reject_on " + + "table tagged task this throughout time timeprecision timeunit tran tranif0 tranif1 tri tri0 tri1 triand trior " + + "trireg type typedef union unique unique0 unsigned until until_with untyped use uwire var vectored virtual void " + + "wait wait_order wand weak weak0 weak1 while wildcard wire with within wor xnor xor"); + + /** Operators from IEEE 1800-2012 + unary_operator ::= + + | - | ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~ + binary_operator ::= + + | - | * | / | % | == | != | === | !== | ==? | !=? | && | || | ** + | < | <= | > | >= | & | | | ^ | ^~ | ~^ | >> | << | >>> | <<< + | -> | <-> + inc_or_dec_operator ::= ++ | -- + unary_module_path_operator ::= + ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~ + binary_module_path_operator ::= + == | != | && | || | & | | | ^ | ^~ | ~^ + */ + var isOperatorChar = /[\+\-\*\/!~&|^%=?:]/; + var isBracketChar = /[\[\]{}()]/; + + var unsignedNumber = /\d[0-9_]*/; + var decimalLiteral = /\d*\s*'s?d\s*\d[0-9_]*/i; + var binaryLiteral = /\d*\s*'s?b\s*[xz01][xz01_]*/i; + var octLiteral = /\d*\s*'s?o\s*[xz0-7][xz0-7_]*/i; + var hexLiteral = /\d*\s*'s?h\s*[0-9a-fxz?][0-9a-fxz?_]*/i; + var realLiteral = /(\d[\d_]*(\.\d[\d_]*)?E-?[\d_]+)|(\d[\d_]*\.\d[\d_]*)/i; + + var closingBracketOrWord = /^((\w+)|[)}\]])/; + var closingBracket = /[)}\]]/; + + var curPunc; + var curKeyword; + + // Block openings which are closed by a matching keyword in the form of ("end" + keyword) + // E.g. "task" => "endtask" + var blockKeywords = words( + "case checker class clocking config function generate interface module package" + + "primitive program property specify sequence table task" + ); + + // Opening/closing pairs + var openClose = {}; + for (var keyword in blockKeywords) { + openClose[keyword] = "end" + keyword; + } + openClose["begin"] = "end"; + openClose["casex"] = "endcase"; + openClose["casez"] = "endcase"; + openClose["do" ] = "while"; + openClose["fork" ] = "join;join_any;join_none"; + openClose["covergroup"] = "endgroup"; + + for (var i in noIndentKeywords) { + var keyword = noIndentKeywords[i]; + if (openClose[keyword]) { + openClose[keyword] = undefined; + } + } + + // Keywords which open statements that are ended with a semi-colon + var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while"); + + function tokenBase(stream, state) { + var ch = stream.peek(), style; + if (hooks[ch] && (style = hooks[ch](stream, state)) != false) return style; + if (hooks.tokenBase && (style = hooks.tokenBase(stream, state)) != false) + return style; + + if (/[,;:\.]/.test(ch)) { + curPunc = stream.next(); + return null; + } + if (isBracketChar.test(ch)) { + curPunc = stream.next(); + return "bracket"; + } + // Macros (tick-defines) + if (ch == '`') { + stream.next(); + if (stream.eatWhile(/[\w\$_]/)) { + return "def"; + } else { + return null; + } + } + // System calls + if (ch == '$') { + stream.next(); + if (stream.eatWhile(/[\w\$_]/)) { + return "meta"; + } else { + return null; + } + } + // Time literals + if (ch == '#') { + stream.next(); + stream.eatWhile(/[\d_.]/); + return "def"; + } + // Strings + if (ch == '"') { + stream.next(); + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + // Comments + if (ch == "/") { + stream.next(); + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + stream.backUp(1); + } + + // Numeric literals + if (stream.match(realLiteral) || + stream.match(decimalLiteral) || + stream.match(binaryLiteral) || + stream.match(octLiteral) || + stream.match(hexLiteral) || + stream.match(unsignedNumber) || + stream.match(realLiteral)) { + return "number"; + } + + // Operators + if (stream.eatWhile(isOperatorChar)) { + return "meta"; + } + + // Keywords / plain variables + if (stream.eatWhile(/[\w\$_]/)) { + var cur = stream.current(); + if (keywords[cur]) { + if (openClose[cur]) { + curPunc = "newblock"; + } + if (statementKeywords[cur]) { + curPunc = "newstatement"; + } + curKeyword = cur; + return "keyword"; + } + return "variable"; + } + + stream.next(); + return null; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + var indent = state.indented; + var c = new Context(indent, col, type, null, state.context); + return state.context = c; + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") { + state.indented = state.context.indented; + } + return state.context = state.context.prev; + } + + function isClosing(text, contextClosing) { + if (text == contextClosing) { + return true; + } else { + // contextClosing may be mulitple keywords separated by ; + var closingKeywords = contextClosing.split(";"); + for (var i in closingKeywords) { + if (text == closingKeywords[i]) { + return true; + } + } + return false; + } + } + + function buildElectricInputRegEx() { + // Reindentation should occur on any bracket char: {}()[] + // or on a match of any of the block closing keywords, at + // the end of a line + var allClosings = []; + for (var i in openClose) { + if (openClose[i]) { + var closings = openClose[i].split(";"); + for (var j in closings) { + allClosings.push(closings[j]); + } + } + } + var re = new RegExp("[{}()\\[\\]]|(" + allClosings.join("|") + ")$"); + return re; + } + + // Interface + return { + + // Regex to force current line to reindent + electricInput: buildElectricInputRegEx(), + + startState: function(basecolumn) { + var state = { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + if (hooks.startState) hooks.startState(state); + return state; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (hooks.token) hooks.token(stream, state); + if (stream.eatSpace()) return null; + curPunc = null; + curKeyword = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment" || style == "meta" || style == "variable") return style; + if (ctx.align == null) ctx.align = true; + + if (curPunc == ctx.type) { + popContext(state); + } else if ((curPunc == ";" && ctx.type == "statement") || + (ctx.type && isClosing(curKeyword, ctx.type))) { + ctx = popContext(state); + while (ctx && ctx.type == "statement") ctx = popContext(state); + } else if (curPunc == "{") { + pushContext(state, stream.column(), "}"); + } else if (curPunc == "[") { + pushContext(state, stream.column(), "]"); + } else if (curPunc == "(") { + pushContext(state, stream.column(), ")"); + } else if (ctx && ctx.type == "endcase" && curPunc == ":") { + pushContext(state, stream.column(), "statement"); + } else if (curPunc == "newstatement") { + pushContext(state, stream.column(), "statement"); + } else if (curPunc == "newblock") { + if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) { + // The 'function' keyword can appear in some other contexts where it actually does not + // indicate a function (import/export DPI and covergroup definitions). + // Do nothing in this case + } else if (curKeyword == "task" && ctx && ctx.type == "statement") { + // Same thing for task + } else { + var close = openClose[curKeyword]; + pushContext(state, stream.column(), close); + } + } + + state.startOfLine = false; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass; + if (hooks.indent) { + var fromHook = hooks.indent(state); + if (fromHook >= 0) return fromHook; + } + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); + if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; + var closing = false; + var possibleClosing = textAfter.match(closingBracketOrWord); + if (possibleClosing) + closing = isClosing(possibleClosing[0], ctx.type); + if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit); + else if (closingBracket.test(ctx.type) && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1); + else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit; + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//" + }; +}); + + CodeMirror.defineMIME("text/x-verilog", { + name: "verilog" + }); + + CodeMirror.defineMIME("text/x-systemverilog", { + name: "verilog" + }); + + // SVXVerilog mode + + var svxchScopePrefixes = { + ">": "property", "->": "property", "-": "hr", "|": "link", "?$": "qualifier", "?*": "qualifier", + "@-": "variable-3", "@": "variable-3", "?": "qualifier" + }; + + function svxGenIndent(stream, state) { + var svxindentUnit = 2; + var rtnIndent = -1, indentUnitRq = 0, curIndent = stream.indentation(); + switch (state.svxCurCtlFlowChar) { + case "\\": + curIndent = 0; + break; + case "|": + if (state.svxPrevPrevCtlFlowChar == "@") { + indentUnitRq = -2; //-2 new pipe rq after cur pipe + break; + } + if (svxchScopePrefixes[state.svxPrevCtlFlowChar]) + indentUnitRq = 1; // +1 new scope + break; + case "M": // m4 + if (state.svxPrevPrevCtlFlowChar == "@") { + indentUnitRq = -2; //-2 new inst rq after pipe + break; + } + if (svxchScopePrefixes[state.svxPrevCtlFlowChar]) + indentUnitRq = 1; // +1 new scope + break; + case "@": + if (state.svxPrevCtlFlowChar == "S") + indentUnitRq = -1; // new pipe stage after stmts + if (state.svxPrevCtlFlowChar == "|") + indentUnitRq = 1; // 1st pipe stage + break; + case "S": + if (state.svxPrevCtlFlowChar == "@") + indentUnitRq = 1; // flow in pipe stage + if (svxchScopePrefixes[state.svxPrevCtlFlowChar]) + indentUnitRq = 1; // +1 new scope + break; + } + var statementIndentUnit = svxindentUnit; + rtnIndent = curIndent + (indentUnitRq*statementIndentUnit); + return rtnIndent >= 0 ? rtnIndent : curIndent; + } + + CodeMirror.defineMIME("text/x-svx", { + name: "verilog", + hooks: { + "\\": function(stream, state) { + var vxIndent = 0, style = false; + var curPunc = stream.string; + if ((stream.sol()) && (/\\SV/.test(stream.string))) { + curPunc = (/\\SVX_version/.test(stream.string)) + ? "\\SVX_version" : stream.string; + stream.skipToEnd(); + if (curPunc == "\\SV" && state.vxCodeActive) {state.vxCodeActive = false;}; + if ((/\\SVX/.test(curPunc) && !state.vxCodeActive) + || (curPunc=="\\SVX_version" && state.vxCodeActive)) {state.vxCodeActive = true;}; + style = "keyword"; + state.svxCurCtlFlowChar = state.svxPrevPrevCtlFlowChar + = state.svxPrevCtlFlowChar = ""; + if (state.vxCodeActive == true) { + state.svxCurCtlFlowChar = "\\"; + vxIndent = svxGenIndent(stream, state); + } + state.vxIndentRq = vxIndent; + } + return style; + }, + tokenBase: function(stream, state) { + var vxIndent = 0, style = false; + var svxisOperatorChar = /[\[\]=:]/; + var svxkpScopePrefixs = { + "**":"variable-2", "*":"variable-2", "$$":"variable", "$":"variable", + "^^":"attribute", "^":"attribute"}; + var ch = stream.peek(); + var vxCurCtlFlowCharValueAtStart = state.svxCurCtlFlowChar; + if (state.vxCodeActive == true) { + if (/[\[\]{}\(\);\:]/.test(ch)) { + // bypass nesting and 1 char punc + style = "meta"; + stream.next(); + } else if (ch == "/") { + stream.next(); + if (stream.eat("/")) { + stream.skipToEnd(); + style = "comment"; + state.svxCurCtlFlowChar = "S"; + } else { + stream.backUp(1); + } + } else if (ch == "@") { + // pipeline stage + style = svxchScopePrefixes[ch]; + state.svxCurCtlFlowChar = "@"; + stream.next(); + stream.eatWhile(/[\w\$_]/); + } else if (stream.match(/\b[mM]4+/, true)) { // match: function(pattern, consume, caseInsensitive) + // m4 pre proc + stream.skipTo("("); + style = "def"; + state.svxCurCtlFlowChar = "M"; + } else if (ch == "!" && stream.sol()) { + // v stmt in svx region + // state.svxCurCtlFlowChar = "S"; + style = "comment"; + stream.next(); + } else if (svxisOperatorChar.test(ch)) { + // operators + stream.eatWhile(svxisOperatorChar); + style = "operator"; + } else if (ch == "#") { + // phy hier + state.svxCurCtlFlowChar = (state.svxCurCtlFlowChar == "") + ? ch : state.svxCurCtlFlowChar; + stream.next(); + stream.eatWhile(/[+-]\d/); + style = "tag"; + } else if (svxkpScopePrefixs.propertyIsEnumerable(ch)) { + // special SVX operators + style = svxkpScopePrefixs[ch]; + state.svxCurCtlFlowChar = state.svxCurCtlFlowChar == "" ? "S" : state.svxCurCtlFlowChar; // stmt + stream.next(); + stream.match(/[a-zA-Z_0-9]+/); + } else if (style = svxchScopePrefixes[ch] || false) { + // special SVX operators + state.svxCurCtlFlowChar = state.svxCurCtlFlowChar == "" ? ch : state.svxCurCtlFlowChar; + stream.next(); + stream.match(/[a-zA-Z_0-9]+/); + } + if (state.svxCurCtlFlowChar != vxCurCtlFlowCharValueAtStart) { // flow change + vxIndent = svxGenIndent(stream, state); + state.vxIndentRq = vxIndent; + } + } + return style; + }, + token: function(stream, state) { + if (state.vxCodeActive == true && stream.sol() && state.svxCurCtlFlowChar != "") { + state.svxPrevPrevCtlFlowChar = state.svxPrevCtlFlowChar; + state.svxPrevCtlFlowChar = state.svxCurCtlFlowChar; + state.svxCurCtlFlowChar = ""; + } + }, + indent: function(state) { + return (state.vxCodeActive == true) ? state.vxIndentRq : -1; + }, + startState: function(state) { + state.svxCurCtlFlowChar = ""; + state.svxPrevCtlFlowChar = ""; + state.svxPrevPrevCtlFlowChar = ""; + state.vxCodeActive = true; + state.vxIndentRq = 0; + } + } + }); +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/xml/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/xml/index.html new file mode 100644 index 0000000000000000000000000000000000000000..7149f06b2a2ed4a8c83438acba06d91ad4d628da --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/xml/index.html @@ -0,0 +1,57 @@ + + +CodeMirror: XML mode + + + + + + + + + +
        +

        XML mode

        +
        + +

        The XML mode supports two configuration parameters:

        +
        +
        htmlMode (boolean)
        +
        This switches the mode to parse HTML instead of XML. This + means attributes do not have to be quoted, and some elements + (such as br) do not require a closing tag.
        +
        alignCDATA (boolean)
        +
        Setting this to true will force the opening tag of CDATA + blocks to not be indented.
        +
        + +

        MIME types defined: application/xml, text/html.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/xml/test.js b/src/main/resources/templates/editor/lib/codemirror/mode/xml/test.js new file mode 100644 index 0000000000000000000000000000000000000000..f48156b51749f4ff7ab9f4f0a3725e7e4a85017a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/xml/test.js @@ -0,0 +1,51 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + var mode = CodeMirror.getMode({indentUnit: 2}, "xml"), mname = "xml"; + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), mname); } + + MT("matching", + "[tag&bracket <][tag top][tag&bracket >]", + " text", + " [tag&bracket <][tag inner][tag&bracket />]", + "[tag&bracket ]"); + + MT("nonmatching", + "[tag&bracket <][tag top][tag&bracket >]", + " [tag&bracket <][tag inner][tag&bracket />]", + " [tag&bracket ]"); + + MT("doctype", + "[meta ]", + "[tag&bracket <][tag top][tag&bracket />]"); + + MT("cdata", + "[tag&bracket <][tag top][tag&bracket >]", + " [atom ]", + "[tag&bracket ]"); + + // HTML tests + mode = CodeMirror.getMode({indentUnit: 2}, "text/html"); + + MT("selfclose", + "[tag&bracket <][tag html][tag&bracket >]", + " [tag&bracket <][tag link] [attribute rel]=[string stylesheet] [attribute href]=[string \"/foobar\"][tag&bracket >]", + "[tag&bracket ]"); + + MT("list", + "[tag&bracket <][tag ol][tag&bracket >]", + " [tag&bracket <][tag li][tag&bracket >]one", + " [tag&bracket <][tag li][tag&bracket >]two", + "[tag&bracket ]"); + + MT("valueless", + "[tag&bracket <][tag input] [attribute type]=[string checkbox] [attribute checked][tag&bracket />]"); + + MT("pThenArticle", + "[tag&bracket <][tag p][tag&bracket >]", + " foo", + "[tag&bracket <][tag article][tag&bracket >]bar"); + +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/xml/xml.js b/src/main/resources/templates/editor/lib/codemirror/mode/xml/xml.js new file mode 100644 index 0000000000000000000000000000000000000000..2f3b8f87a0f53af01fb4b09927350f6e9ae81882 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/xml/xml.js @@ -0,0 +1,384 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("xml", function(config, parserConfig) { + var indentUnit = config.indentUnit; + var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1; + var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag; + if (multilineTagIndentPastTag == null) multilineTagIndentPastTag = true; + + var Kludges = parserConfig.htmlMode ? { + autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true, + 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true, + 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, + 'track': true, 'wbr': true, 'menuitem': true}, + implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, + 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, + 'th': true, 'tr': true}, + contextGrabbers: { + 'dd': {'dd': true, 'dt': true}, + 'dt': {'dd': true, 'dt': true}, + 'li': {'li': true}, + 'option': {'option': true, 'optgroup': true}, + 'optgroup': {'optgroup': true}, + 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true, + 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true, + 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, + 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true, + 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true}, + 'rp': {'rp': true, 'rt': true}, + 'rt': {'rp': true, 'rt': true}, + 'tbody': {'tbody': true, 'tfoot': true}, + 'td': {'td': true, 'th': true}, + 'tfoot': {'tbody': true}, + 'th': {'td': true, 'th': true}, + 'thead': {'tbody': true, 'tfoot': true}, + 'tr': {'tr': true} + }, + doNotIndent: {"pre": true}, + allowUnquoted: true, + allowMissing: true, + caseFold: true + } : { + autoSelfClosers: {}, + implicitlyClosed: {}, + contextGrabbers: {}, + doNotIndent: {}, + allowUnquoted: false, + allowMissing: false, + caseFold: false + }; + var alignCDATA = parserConfig.alignCDATA; + + // Return variables for tokenizers + var type, setStyle; + + function inText(stream, state) { + function chain(parser) { + state.tokenize = parser; + return parser(stream, state); + } + + var ch = stream.next(); + if (ch == "<") { + if (stream.eat("!")) { + if (stream.eat("[")) { + if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>")); + else return null; + } else if (stream.match("--")) { + return chain(inBlock("comment", "-->")); + } else if (stream.match("DOCTYPE", true, true)) { + stream.eatWhile(/[\w\._\-]/); + return chain(doctype(1)); + } else { + return null; + } + } else if (stream.eat("?")) { + stream.eatWhile(/[\w\._\-]/); + state.tokenize = inBlock("meta", "?>"); + return "meta"; + } else { + type = stream.eat("/") ? "closeTag" : "openTag"; + state.tokenize = inTag; + return "tag bracket"; + } + } else if (ch == "&") { + var ok; + if (stream.eat("#")) { + if (stream.eat("x")) { + ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); + } else { + ok = stream.eatWhile(/[\d]/) && stream.eat(";"); + } + } else { + ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); + } + return ok ? "atom" : "error"; + } else { + stream.eatWhile(/[^&<]/); + return null; + } + } + + function inTag(stream, state) { + var ch = stream.next(); + if (ch == ">" || (ch == "/" && stream.eat(">"))) { + state.tokenize = inText; + type = ch == ">" ? "endTag" : "selfcloseTag"; + return "tag bracket"; + } else if (ch == "=") { + type = "equals"; + return null; + } else if (ch == "<") { + state.tokenize = inText; + state.state = baseState; + state.tagName = state.tagStart = null; + var next = state.tokenize(stream, state); + return next ? next + " tag error" : "tag error"; + } else if (/[\'\"]/.test(ch)) { + state.tokenize = inAttribute(ch); + state.stringStartCol = stream.column(); + return state.tokenize(stream, state); + } else { + stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/); + return "word"; + } + } + + function inAttribute(quote) { + var closure = function(stream, state) { + while (!stream.eol()) { + if (stream.next() == quote) { + state.tokenize = inTag; + break; + } + } + return "string"; + }; + closure.isInAttribute = true; + return closure; + } + + function inBlock(style, terminator) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + state.tokenize = inText; + break; + } + stream.next(); + } + return style; + }; + } + function doctype(depth) { + return function(stream, state) { + var ch; + while ((ch = stream.next()) != null) { + if (ch == "<") { + state.tokenize = doctype(depth + 1); + return state.tokenize(stream, state); + } else if (ch == ">") { + if (depth == 1) { + state.tokenize = inText; + break; + } else { + state.tokenize = doctype(depth - 1); + return state.tokenize(stream, state); + } + } + } + return "meta"; + }; + } + + function Context(state, tagName, startOfLine) { + this.prev = state.context; + this.tagName = tagName; + this.indent = state.indented; + this.startOfLine = startOfLine; + if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent)) + this.noIndent = true; + } + function popContext(state) { + if (state.context) state.context = state.context.prev; + } + function maybePopContext(state, nextTagName) { + var parentTagName; + while (true) { + if (!state.context) { + return; + } + parentTagName = state.context.tagName; + if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) || + !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { + return; + } + popContext(state); + } + } + + function baseState(type, stream, state) { + if (type == "openTag") { + state.tagStart = stream.column(); + return tagNameState; + } else if (type == "closeTag") { + return closeTagNameState; + } else { + return baseState; + } + } + function tagNameState(type, stream, state) { + if (type == "word") { + state.tagName = stream.current(); + setStyle = "tag"; + return attrState; + } else { + setStyle = "error"; + return tagNameState; + } + } + function closeTagNameState(type, stream, state) { + if (type == "word") { + var tagName = stream.current(); + if (state.context && state.context.tagName != tagName && + Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName)) + popContext(state); + if (state.context && state.context.tagName == tagName) { + setStyle = "tag"; + return closeState; + } else { + setStyle = "tag error"; + return closeStateErr; + } + } else { + setStyle = "error"; + return closeStateErr; + } + } + + function closeState(type, _stream, state) { + if (type != "endTag") { + setStyle = "error"; + return closeState; + } + popContext(state); + return baseState; + } + function closeStateErr(type, stream, state) { + setStyle = "error"; + return closeState(type, stream, state); + } + + function attrState(type, _stream, state) { + if (type == "word") { + setStyle = "attribute"; + return attrEqState; + } else if (type == "endTag" || type == "selfcloseTag") { + var tagName = state.tagName, tagStart = state.tagStart; + state.tagName = state.tagStart = null; + if (type == "selfcloseTag" || + Kludges.autoSelfClosers.hasOwnProperty(tagName)) { + maybePopContext(state, tagName); + } else { + maybePopContext(state, tagName); + state.context = new Context(state, tagName, tagStart == state.indented); + } + return baseState; + } + setStyle = "error"; + return attrState; + } + function attrEqState(type, stream, state) { + if (type == "equals") return attrValueState; + if (!Kludges.allowMissing) setStyle = "error"; + return attrState(type, stream, state); + } + function attrValueState(type, stream, state) { + if (type == "string") return attrContinuedState; + if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return attrState;} + setStyle = "error"; + return attrState(type, stream, state); + } + function attrContinuedState(type, stream, state) { + if (type == "string") return attrContinuedState; + return attrState(type, stream, state); + } + + return { + startState: function() { + return {tokenize: inText, + state: baseState, + indented: 0, + tagName: null, tagStart: null, + context: null}; + }, + + token: function(stream, state) { + if (!state.tagName && stream.sol()) + state.indented = stream.indentation(); + + if (stream.eatSpace()) return null; + type = null; + var style = state.tokenize(stream, state); + if ((style || type) && style != "comment") { + setStyle = null; + state.state = state.state(type || style, stream, state); + if (setStyle) + style = setStyle == "error" ? style + " error" : setStyle; + } + return style; + }, + + indent: function(state, textAfter, fullLine) { + var context = state.context; + // Indent multi-line strings (e.g. css). + if (state.tokenize.isInAttribute) { + if (state.tagStart == state.indented) + return state.stringStartCol + 1; + else + return state.indented + indentUnit; + } + if (context && context.noIndent) return CodeMirror.Pass; + if (state.tokenize != inTag && state.tokenize != inText) + return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; + // Indent the starts of attribute names. + if (state.tagName) { + if (multilineTagIndentPastTag) + return state.tagStart + state.tagName.length + 2; + else + return state.tagStart + indentUnit * multilineTagIndentFactor; + } + if (alignCDATA && /$/, + blockCommentStart: "", + + configuration: parserConfig.htmlMode ? "html" : "xml", + helperType: parserConfig.htmlMode ? "html" : "xml" + }; +}); + +CodeMirror.defineMIME("text/xml", "xml"); +CodeMirror.defineMIME("application/xml", "xml"); +if (!CodeMirror.mimeModes.hasOwnProperty("text/html")) + CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true}); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/xquery/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/xquery/index.html new file mode 100644 index 0000000000000000000000000000000000000000..7ac5aaeff4453e1517e47143de231956ad49dbb3 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/xquery/index.html @@ -0,0 +1,210 @@ + + +CodeMirror: XQuery mode + + + + + + + + + + +
        +

        XQuery mode

        + + +
        + +
        + + + +

        MIME types defined: application/xquery.

        + +

        Development of the CodeMirror XQuery mode was sponsored by + MarkLogic and developed by + Mike Brevoort. +

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/xquery/test.js b/src/main/resources/templates/editor/lib/codemirror/mode/xquery/test.js new file mode 100644 index 0000000000000000000000000000000000000000..1f148cdbbd8c056f8251b435b4da67aa99ca8283 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/xquery/test.js @@ -0,0 +1,67 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Don't take these too seriously -- the expected results appear to be +// based on the results of actual runs without any serious manual +// verification. If a change you made causes them to fail, the test is +// as likely to wrong as the code. + +(function() { + var mode = CodeMirror.getMode({tabSize: 4}, "xquery"); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + MT("eviltest", + "[keyword xquery] [keyword version] [variable "1][keyword .][atom 0][keyword -][variable ml"][def&variable ;] [comment (: this is : a \"comment\" :)]", + " [keyword let] [variable $let] [keyword :=] [variable <x] [variable attr][keyword =][variable "value">"test"<func>][def&variable ;function]() [variable $var] {[keyword function]()} {[variable $var]}[variable <][keyword /][variable func><][keyword /][variable x>]", + " [keyword let] [variable $joe][keyword :=][atom 1]", + " [keyword return] [keyword element] [variable element] {", + " [keyword attribute] [variable attribute] { [atom 1] },", + " [keyword element] [variable test] { [variable 'a'] }, [keyword attribute] [variable foo] { [variable "bar"] },", + " [def&variable fn:doc]()[[ [variable foo][keyword /][variable @bar] [keyword eq] [variable $let] ]],", + " [keyword //][variable x] } [comment (: a more 'evil' test :)]", + " [comment (: Modified Blakeley example (: with nested comment :) ... :)]", + " [keyword declare] [keyword private] [keyword function] [def&variable local:declare]() {()}[variable ;]", + " [keyword declare] [keyword private] [keyword function] [def&variable local:private]() {()}[variable ;]", + " [keyword declare] [keyword private] [keyword function] [def&variable local:function]() {()}[variable ;]", + " [keyword declare] [keyword private] [keyword function] [def&variable local:local]() {()}[variable ;]", + " [keyword let] [variable $let] [keyword :=] [variable <let>let] [variable $let] [keyword :=] [variable "let"<][keyword /let][variable >]", + " [keyword return] [keyword element] [variable element] {", + " [keyword attribute] [variable attribute] { [keyword try] { [def&variable xdmp:version]() } [keyword catch]([variable $e]) { [def&variable xdmp:log]([variable $e]) } },", + " [keyword attribute] [variable fn:doc] { [variable "bar"] [variable castable] [keyword as] [atom xs:string] },", + " [keyword element] [variable text] { [keyword text] { [variable "text"] } },", + " [def&variable fn:doc]()[[ [qualifier child::][variable eq][keyword /]([variable @bar] [keyword |] [qualifier attribute::][variable attribute]) [keyword eq] [variable $let] ]],", + " [keyword //][variable fn:doc]", + " }"); + + MT("testEmptySequenceKeyword", + "[string \"foo\"] [keyword instance] [keyword of] [keyword empty-sequence]()"); + + MT("testMultiAttr", + "[tag

        ][variable hello] [variable world][tag

        ]"); + + MT("test namespaced variable", + "[keyword declare] [keyword namespace] [variable e] [keyword =] [string \"http://example.com/ANamespace\"][variable ;declare] [keyword variable] [variable $e:exampleComThisVarIsNotRecognized] [keyword as] [keyword element]([keyword *]) [variable external;]"); + + MT("test EQName variable", + "[keyword declare] [keyword variable] [variable $\"http://www.example.com/ns/my\":var] [keyword :=] [atom 12][variable ;]", + "[tag ]{[variable $\"http://www.example.com/ns/my\":var]}[tag ]"); + + MT("test EQName function", + "[keyword declare] [keyword function] [def&variable \"http://www.example.com/ns/my\":fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {", + " [variable $a] [keyword +] [atom 2]", + "}[variable ;]", + "[tag ]{[def&variable \"http://www.example.com/ns/my\":fn]([atom 12])}[tag ]"); + + MT("test EQName function with single quotes", + "[keyword declare] [keyword function] [def&variable 'http://www.example.com/ns/my':fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {", + " [variable $a] [keyword +] [atom 2]", + "}[variable ;]", + "[tag ]{[def&variable 'http://www.example.com/ns/my':fn]([atom 12])}[tag ]"); + + MT("testProcessingInstructions", + "[def&variable data]([comment&meta ]) [keyword instance] [keyword of] [atom xs:string]"); + + MT("testQuoteEscapeDouble", + "[keyword let] [variable $rootfolder] [keyword :=] [string \"c:\\builds\\winnt\\HEAD\\qa\\scripts\\\"]", + "[keyword let] [variable $keysfolder] [keyword :=] [def&variable concat]([variable $rootfolder], [string \"keys\\\"])"); +})(); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/xquery/xquery.js b/src/main/resources/templates/editor/lib/codemirror/mode/xquery/xquery.js new file mode 100644 index 0000000000000000000000000000000000000000..c8f3d90a9fb8a1ce1f1253f251173949d1413bcb --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/xquery/xquery.js @@ -0,0 +1,447 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("xquery", function() { + + // The keywords object is set to the result of this self executing + // function. Each keyword is a property of the keywords object whose + // value is {type: atype, style: astyle} + var keywords = function(){ + // conveinence functions used to build keywords object + function kw(type) {return {type: type, style: "keyword"};} + var A = kw("keyword a") + , B = kw("keyword b") + , C = kw("keyword c") + , operator = kw("operator") + , atom = {type: "atom", style: "atom"} + , punctuation = {type: "punctuation", style: null} + , qualifier = {type: "axis_specifier", style: "qualifier"}; + + // kwObj is what is return from this function at the end + var kwObj = { + 'if': A, 'switch': A, 'while': A, 'for': A, + 'else': B, 'then': B, 'try': B, 'finally': B, 'catch': B, + 'element': C, 'attribute': C, 'let': C, 'implements': C, 'import': C, 'module': C, 'namespace': C, + 'return': C, 'super': C, 'this': C, 'throws': C, 'where': C, 'private': C, + ',': punctuation, + 'null': atom, 'fn:false()': atom, 'fn:true()': atom + }; + + // a list of 'basic' keywords. For each add a property to kwObj with the value of + // {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"} + var basic = ['after','ancestor','ancestor-or-self','and','as','ascending','assert','attribute','before', + 'by','case','cast','child','comment','declare','default','define','descendant','descendant-or-self', + 'descending','document','document-node','element','else','eq','every','except','external','following', + 'following-sibling','follows','for','function','if','import','in','instance','intersect','item', + 'let','module','namespace','node','node','of','only','or','order','parent','precedes','preceding', + 'preceding-sibling','processing-instruction','ref','return','returns','satisfies','schema','schema-element', + 'self','some','sortby','stable','text','then','to','treat','typeswitch','union','variable','version','where', + 'xquery', 'empty-sequence']; + for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);}; + + // a list of types. For each add a property to kwObj with the value of + // {type: "atom", style: "atom"} + var types = ['xs:string', 'xs:float', 'xs:decimal', 'xs:double', 'xs:integer', 'xs:boolean', 'xs:date', 'xs:dateTime', + 'xs:time', 'xs:duration', 'xs:dayTimeDuration', 'xs:time', 'xs:yearMonthDuration', 'numeric', 'xs:hexBinary', + 'xs:base64Binary', 'xs:anyURI', 'xs:QName', 'xs:byte','xs:boolean','xs:anyURI','xf:yearMonthDuration']; + for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;}; + + // each operator will add a property to kwObj with value of {type: "operator", style: "keyword"} + var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-']; + for(var i=0, l=operators.length; i < l; i++) { kwObj[operators[i]] = operator;}; + + // each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"} + var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::", + "ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"]; + for(var i=0, l=axis_specifiers.length; i < l; i++) { kwObj[axis_specifiers[i]] = qualifier; }; + + return kwObj; + }(); + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + var type, content; + + function ret(tp, style, cont) { + type = tp; content = cont; + return style; + } + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + // the primary mode tokenizer + function tokenBase(stream, state) { + var ch = stream.next(), + mightBeFunction = false, + isEQName = isEQNameAhead(stream); + + // an XML tag (if not in some sub, chained tokenizer) + if (ch == "<") { + if(stream.match("!--", true)) + return chain(stream, state, tokenXMLComment); + + if(stream.match("![CDATA", false)) { + state.tokenize = tokenCDATA; + return ret("tag", "tag"); + } + + if(stream.match("?", false)) { + return chain(stream, state, tokenPreProcessing); + } + + var isclose = stream.eat("/"); + stream.eatSpace(); + var tagName = "", c; + while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c; + + return chain(stream, state, tokenTag(tagName, isclose)); + } + // start code block + else if(ch == "{") { + pushStateStack(state,{ type: "codeblock"}); + return ret("", null); + } + // end code block + else if(ch == "}") { + popStateStack(state); + return ret("", null); + } + // if we're in an XML block + else if(isInXmlBlock(state)) { + if(ch == ">") + return ret("tag", "tag"); + else if(ch == "/" && stream.eat(">")) { + popStateStack(state); + return ret("tag", "tag"); + } + else + return ret("word", "variable"); + } + // if a number + else if (/\d/.test(ch)) { + stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/); + return ret("number", "atom"); + } + // comment start + else if (ch === "(" && stream.eat(":")) { + pushStateStack(state, { type: "comment"}); + return chain(stream, state, tokenComment); + } + // quoted string + else if ( !isEQName && (ch === '"' || ch === "'")) + return chain(stream, state, tokenString(ch)); + // variable + else if(ch === "$") { + return chain(stream, state, tokenVariable); + } + // assignment + else if(ch ===":" && stream.eat("=")) { + return ret("operator", "keyword"); + } + // open paren + else if(ch === "(") { + pushStateStack(state, { type: "paren"}); + return ret("", null); + } + // close paren + else if(ch === ")") { + popStateStack(state); + return ret("", null); + } + // open paren + else if(ch === "[") { + pushStateStack(state, { type: "bracket"}); + return ret("", null); + } + // close paren + else if(ch === "]") { + popStateStack(state); + return ret("", null); + } + else { + var known = keywords.propertyIsEnumerable(ch) && keywords[ch]; + + // if there's a EQName ahead, consume the rest of the string portion, it's likely a function + if(isEQName && ch === '\"') while(stream.next() !== '"'){} + if(isEQName && ch === '\'') while(stream.next() !== '\''){} + + // gobble up a word if the character is not known + if(!known) stream.eatWhile(/[\w\$_-]/); + + // gobble a colon in the case that is a lib func type call fn:doc + var foundColon = stream.eat(":"); + + // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier + // which should get matched as a keyword + if(!stream.eat(":") && foundColon) { + stream.eatWhile(/[\w\$_-]/); + } + // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort) + if(stream.match(/^[ \t]*\(/, false)) { + mightBeFunction = true; + } + // is the word a keyword? + var word = stream.current(); + known = keywords.propertyIsEnumerable(word) && keywords[word]; + + // if we think it's a function call but not yet known, + // set style to variable for now for lack of something better + if(mightBeFunction && !known) known = {type: "function_call", style: "variable def"}; + + // if the previous word was element, attribute, axis specifier, this word should be the name of that + if(isInXmlConstructor(state)) { + popStateStack(state); + return ret("word", "variable", word); + } + // as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and + // push the stack so we know to look for it on the next word + if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"}); + + // if the word is known, return the details of that else just call this a generic 'word' + return known ? ret(known.type, known.style, word) : + ret("word", "variable", word); + } + } + + // handle comments, including nested + function tokenComment(stream, state) { + var maybeEnd = false, maybeNested = false, nestedCount = 0, ch; + while (ch = stream.next()) { + if (ch == ")" && maybeEnd) { + if(nestedCount > 0) + nestedCount--; + else { + popStateStack(state); + break; + } + } + else if(ch == ":" && maybeNested) { + nestedCount++; + } + maybeEnd = (ch == ":"); + maybeNested = (ch == "("); + } + + return ret("comment", "comment"); + } + + // tokenizer for string literals + // optionally pass a tokenizer function to set state.tokenize back to when finished + function tokenString(quote, f) { + return function(stream, state) { + var ch; + + if(isInString(state) && stream.current() == quote) { + popStateStack(state); + if(f) state.tokenize = f; + return ret("string", "string"); + } + + pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) }); + + // if we're in a string and in an XML block, allow an embedded code block + if(stream.match("{", false) && isInXmlAttributeBlock(state)) { + state.tokenize = tokenBase; + return ret("string", "string"); + } + + + while (ch = stream.next()) { + if (ch == quote) { + popStateStack(state); + if(f) state.tokenize = f; + break; + } + else { + // if we're in a string and in an XML block, allow an embedded code block in an attribute + if(stream.match("{", false) && isInXmlAttributeBlock(state)) { + state.tokenize = tokenBase; + return ret("string", "string"); + } + + } + } + + return ret("string", "string"); + }; + } + + // tokenizer for variables + function tokenVariable(stream, state) { + var isVariableChar = /[\w\$_-]/; + + // a variable may start with a quoted EQName so if the next character is quote, consume to the next quote + if(stream.eat("\"")) { + while(stream.next() !== '\"'){}; + stream.eat(":"); + } else { + stream.eatWhile(isVariableChar); + if(!stream.match(":=", false)) stream.eat(":"); + } + stream.eatWhile(isVariableChar); + state.tokenize = tokenBase; + return ret("variable", "variable"); + } + + // tokenizer for XML tags + function tokenTag(name, isclose) { + return function(stream, state) { + stream.eatSpace(); + if(isclose && stream.eat(">")) { + popStateStack(state); + state.tokenize = tokenBase; + return ret("tag", "tag"); + } + // self closing tag without attributes? + if(!stream.eat("/")) + pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase}); + if(!stream.eat(">")) { + state.tokenize = tokenAttribute; + return ret("tag", "tag"); + } + else { + state.tokenize = tokenBase; + } + return ret("tag", "tag"); + }; + } + + // tokenizer for XML attributes + function tokenAttribute(stream, state) { + var ch = stream.next(); + + if(ch == "/" && stream.eat(">")) { + if(isInXmlAttributeBlock(state)) popStateStack(state); + if(isInXmlBlock(state)) popStateStack(state); + return ret("tag", "tag"); + } + if(ch == ">") { + if(isInXmlAttributeBlock(state)) popStateStack(state); + return ret("tag", "tag"); + } + if(ch == "=") + return ret("", null); + // quoted string + if (ch == '"' || ch == "'") + return chain(stream, state, tokenString(ch, tokenAttribute)); + + if(!isInXmlAttributeBlock(state)) + pushStateStack(state, { type: "attribute", tokenize: tokenAttribute}); + + stream.eat(/[a-zA-Z_:]/); + stream.eatWhile(/[-a-zA-Z0-9_:.]/); + stream.eatSpace(); + + // the case where the attribute has not value and the tag was closed + if(stream.match(">", false) || stream.match("/", false)) { + popStateStack(state); + state.tokenize = tokenBase; + } + + return ret("attribute", "attribute"); + } + + // handle comments, including nested + function tokenXMLComment(stream, state) { + var ch; + while (ch = stream.next()) { + if (ch == "-" && stream.match("->", true)) { + state.tokenize = tokenBase; + return ret("comment", "comment"); + } + } + } + + + // handle CDATA + function tokenCDATA(stream, state) { + var ch; + while (ch = stream.next()) { + if (ch == "]" && stream.match("]", true)) { + state.tokenize = tokenBase; + return ret("comment", "comment"); + } + } + } + + // handle preprocessing instructions + function tokenPreProcessing(stream, state) { + var ch; + while (ch = stream.next()) { + if (ch == "?" && stream.match(">", true)) { + state.tokenize = tokenBase; + return ret("comment", "comment meta"); + } + } + } + + + // functions to test the current context of the state + function isInXmlBlock(state) { return isIn(state, "tag"); } + function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); } + function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); } + function isInString(state) { return isIn(state, "string"); } + + function isEQNameAhead(stream) { + // assume we've already eaten a quote (") + if(stream.current() === '"') + return stream.match(/^[^\"]+\"\:/, false); + else if(stream.current() === '\'') + return stream.match(/^[^\"]+\'\:/, false); + else + return false; + } + + function isIn(state, type) { + return (state.stack.length && state.stack[state.stack.length - 1].type == type); + } + + function pushStateStack(state, newState) { + state.stack.push(newState); + } + + function popStateStack(state) { + state.stack.pop(); + var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize; + state.tokenize = reinstateTokenize || tokenBase; + } + + // the interface for the mode API + return { + startState: function() { + return { + tokenize: tokenBase, + cc: [], + stack: [] + }; + }, + + token: function(stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + }, + + blockCommentStart: "(:", + blockCommentEnd: ":)" + + }; + +}); + +CodeMirror.defineMIME("application/xquery", "xquery"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/yaml/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/yaml/index.html new file mode 100644 index 0000000000000000000000000000000000000000..be9b632368ffcf747ed4d50238dc514316183ebe --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/yaml/index.html @@ -0,0 +1,80 @@ + + +CodeMirror: YAML mode + + + + + + + + + +
        +

        YAML mode

        +
        + + +

        MIME types defined: text/x-yaml.

        + +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/yaml/yaml.js b/src/main/resources/templates/editor/lib/codemirror/mode/yaml/yaml.js new file mode 100644 index 0000000000000000000000000000000000000000..b7015e599cb3f4ed6e43adf2976560d571d03d79 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/yaml/yaml.js @@ -0,0 +1,117 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("yaml", function() { + + var cons = ['true', 'false', 'on', 'off', 'yes', 'no']; + var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i'); + + return { + token: function(stream, state) { + var ch = stream.peek(); + var esc = state.escaped; + state.escaped = false; + /* comments */ + if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) { + stream.skipToEnd(); + return "comment"; + } + + if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/)) + return "string"; + + if (state.literal && stream.indentation() > state.keyCol) { + stream.skipToEnd(); return "string"; + } else if (state.literal) { state.literal = false; } + if (stream.sol()) { + state.keyCol = 0; + state.pair = false; + state.pairStart = false; + /* document start */ + if(stream.match(/---/)) { return "def"; } + /* document end */ + if (stream.match(/\.\.\./)) { return "def"; } + /* array list item */ + if (stream.match(/\s*-\s+/)) { return 'meta'; } + } + /* inline pairs/lists */ + if (stream.match(/^(\{|\}|\[|\])/)) { + if (ch == '{') + state.inlinePairs++; + else if (ch == '}') + state.inlinePairs--; + else if (ch == '[') + state.inlineList++; + else + state.inlineList--; + return 'meta'; + } + + /* list seperator */ + if (state.inlineList > 0 && !esc && ch == ',') { + stream.next(); + return 'meta'; + } + /* pairs seperator */ + if (state.inlinePairs > 0 && !esc && ch == ',') { + state.keyCol = 0; + state.pair = false; + state.pairStart = false; + stream.next(); + return 'meta'; + } + + /* start of value of a pair */ + if (state.pairStart) { + /* block literals */ + if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; }; + /* references */ + if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; } + /* numbers */ + if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; } + if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; } + /* keywords */ + if (stream.match(keywordRegex)) { return 'keyword'; } + } + + /* pairs (associative arrays) -> key */ + if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) { + state.pair = true; + state.keyCol = stream.indentation(); + return "atom"; + } + if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; } + + /* nothing found, continue */ + state.pairStart = false; + state.escaped = (ch == '\\'); + stream.next(); + return null; + }, + startState: function() { + return { + pair: false, + pairStart: false, + keyCol: 0, + inlinePairs: 0, + inlineList: 0, + literal: false, + escaped: false + }; + } + }; +}); + +CodeMirror.defineMIME("text/x-yaml", "yaml"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/z80/index.html b/src/main/resources/templates/editor/lib/codemirror/mode/z80/index.html new file mode 100644 index 0000000000000000000000000000000000000000..1ad3ace04635b82d5959676d6cafe595efcfc300 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/z80/index.html @@ -0,0 +1,52 @@ + + +CodeMirror: Z80 assembly mode + + + + + + + + + +
        +

        Z80 assembly mode

        + + +
        + + + +

        MIME type defined: text/x-z80.

        +
        diff --git a/src/main/resources/templates/editor/lib/codemirror/mode/z80/z80.js b/src/main/resources/templates/editor/lib/codemirror/mode/z80/z80.js new file mode 100644 index 0000000000000000000000000000000000000000..ec41d050ac8f93aedea01c35e487b9234c6be5f6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/mode/z80/z80.js @@ -0,0 +1,100 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode('z80', function() { + var keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i; + var keywords2 = /^(call|j[pr]|ret[in]?)\b/i; + var keywords3 = /^b_?(call|jump)\b/i; + var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i; + var variables2 = /^(n?[zc]|p[oe]?|m)\b/i; + var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i; + var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+)\b/i; + + return { + startState: function() { + return {context: 0}; + }, + token: function(stream, state) { + if (!stream.column()) + state.context = 0; + + if (stream.eatSpace()) + return null; + + var w; + + if (stream.eatWhile(/\w/)) { + w = stream.current(); + + if (stream.indentation()) { + if (state.context == 1 && variables1.test(w)) + return 'variable-2'; + + if (state.context == 2 && variables2.test(w)) + return 'variable-3'; + + if (keywords1.test(w)) { + state.context = 1; + return 'keyword'; + } else if (keywords2.test(w)) { + state.context = 2; + return 'keyword'; + } else if (keywords3.test(w)) { + state.context = 3; + return 'keyword'; + } + + if (errors.test(w)) + return 'error'; + } else if (numbers.test(w)) { + return 'number'; + } else { + return null; + } + } else if (stream.eat(';')) { + stream.skipToEnd(); + return 'comment'; + } else if (stream.eat('"')) { + while (w = stream.next()) { + if (w == '"') + break; + + if (w == '\\') + stream.next(); + } + return 'string'; + } else if (stream.eat('\'')) { + if (stream.match(/\\?.'/)) + return 'number'; + } else if (stream.eat('.') || stream.sol() && stream.eat('#')) { + state.context = 4; + + if (stream.eatWhile(/\w/)) + return 'def'; + } else if (stream.eat('$')) { + if (stream.eatWhile(/[\da-f]/i)) + return 'number'; + } else if (stream.eat('%')) { + if (stream.eatWhile(/[01]/)) + return 'number'; + } else { + stream.next(); + } + return null; + } + }; +}); + +CodeMirror.defineMIME("text/x-z80", "z80"); + +}); diff --git a/src/main/resources/templates/editor/lib/codemirror/modes.min.js b/src/main/resources/templates/editor/lib/codemirror/modes.min.js new file mode 100644 index 0000000000000000000000000000000000000000..aa5f193cc420ed968d875ad97c869813d0f07c0e --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/modes.min.js @@ -0,0 +1,10 @@ +/*! Editor.md v1.5.0 | modes.min.js | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-09 */ +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj"]},{name:"CoffeeScript",mime:"text/x-coffeescript",mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy"]},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Jade",mime:"text/x-jade",mode:"jade",ext:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"Jinja2",mime:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"kotlin",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NTriples",mime:"text/n-triples",mode:"ntriples",ext:["nt"]},{name:"Objective C",mime:"text/x-objectivec",mode:"clike",ext:["m","mm"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mime:"application/x-httpd-php",mode:"php",ext:["php","php3","php4","php5","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["py","pyw"]},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mime:"text/x-sh",mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"]},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"SmartyMixed",mime:"text/x-smarty",mode:"smartymixed"},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"MariaDB",mime:"text/x-mariadb",mode:"sql"},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"YAML",mime:"text/x-yaml",mode:"yaml",ext:["yaml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]}];for(var t=0;t-1&&t.substring(i+1,t.length);return o?e.findModeByExtension(o):void 0},e.findModeByName=function(t){t=t.toLowerCase();for(var r=0;r")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["comment","comment"]}e.defineMode("css",function(t, r){function n(e, t){return m=t,e}function i(e, t){var r=e.next();if(g[r]){var i=g[r](e,t);if(i!==!1)return i}return"@"==r?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?n(null,"compare"):'"'==r||"'"==r?(t.tokenize=o(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==r?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),n("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match(/rl(-prefix)?\(/)||"d"==r&&e.match("omain(")||"r"==r&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):e.match(/^\w+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),n(null,"(")}function s(e,t,r){this.type=e,this.indent=t,this.prev=r}function l(e,t,r){return e.context=new s(r,t.indentation()+p,e.context),r}function c(e){return e.context=e.context.prev,e.context.type}function u(e,t,r){return M[r.context.type](e,t,r)}function d(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return u(e,t,r)}function f(e){var t=e.current().toLowerCase();h=S.hasOwnProperty(t)?"atom":C.hasOwnProperty(t)?"keyword":"variable"}r.propertyKeywords||(r=e.resolveMode("text/css"));var m,h,p=t.indentUnit,g=r.tokenHooks,v=r.documentTypes||{},b=r.mediaTypes||{},y=r.mediaFeatures||{},x=r.propertyKeywords||{},k=r.nonStandardPropertyKeywords||{},w=r.fontProperties||{},_=r.counterDescriptors||{},C=r.colorKeywords||{},S=r.valueKeywords||{},T=r.allowNested,M={};return M.top=function(e,t,r){if("{"==e)return l(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(/@(media|supports|(-moz-)?document)/.test(e))return l(r,t,"atBlock");if(/@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return l(r,t,"at");if("hash"==e)h="builtin";else if("word"==e)h="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return l(r,t,"interpolation");if(":"==e)return"pseudo";if(T&&"("==e)return l(r,t,"parens")}return r.context.type},M.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return x.hasOwnProperty(n)?(h="property","maybeprop"):k.hasOwnProperty(n)?(h="string-2","maybeprop"):T?(h=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(h+=" error","maybeprop")}return"meta"==e?"block":T||"hash"!=e&&"qualifier"!=e?M.top(e,t,r):(h="error","block")},M.maybeprop=function(e,t,r){return":"==e?l(r,t,"prop"):u(e,t,r)},M.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&T)return l(r,t,"propBlock");if("}"==e||"{"==e)return d(e,t,r);if("("==e)return l(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)f(t);else if("interpolation"==e)return l(r,t,"interpolation")}else h+=" error";return"prop"},M.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(h="property","maybeprop"):r.context.type},M.parens=function(e,t,r){return"{"==e||"}"==e?d(e,t,r):")"==e?c(r):"("==e?l(r,t,"parens"):("word"==e&&f(t),"parens")},M.pseudo=function(e,t,r){return"word"==e?(h="variable-3",r.context.type):u(e,t,r)},M.atBlock=function(e,t,r){if("("==e)return l(r,t,"atBlock_parens");if("}"==e)return d(e,t,r);if("{"==e)return c(r)&&l(r,t,T?"block":"top");if("word"==e){var n=t.current().toLowerCase();h="only"==n||"not"==n||"and"==n||"or"==n?"keyword":v.hasOwnProperty(n)?"tag":b.hasOwnProperty(n)?"attribute":y.hasOwnProperty(n)?"property":x.hasOwnProperty(n)?"property":k.hasOwnProperty(n)?"string-2":S.hasOwnProperty(n)?"atom":"error"}return r.context.type},M.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?d(e,t,r,2):M.atBlock(e,t,r)},M.restricted_atBlock_before=function(e,t,r){return"{"==e?l(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(h="variable","restricted_atBlock_before"):u(e,t,r)},M.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(h="@font-face"==r.stateArg&&!w.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!_.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},M.keyframes=function(e,t,r){return"word"==e?(h="variable","keyframes"):"{"==e?l(r,t,"top"):u(e,t,r)},M.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?d(e,t,r):("word"==e?h="tag":"hash"==e&&(h="builtin"),"at")},M.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?d(e,t,r):("variable"!=e&&(h="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:"top",stateArg:null,context:new s("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(m=r[1],r=r[0]),h=r,t.state=M[t.state](m,e,t),h},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=n&&")"!=n||(r=r.prev),!r.prev||("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type)&&(")"!=n||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"atBlock"!=r.type)||(i=r.indent-p,r=r.prev),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var i=["domain","regexp","url","url-prefix"],o=t(i),a=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],s=t(a),l=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],c=t(l),u=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=t(u),f=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],m=t(f),h=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],p=t(h),g=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],v=t(g),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],y=t(b),x=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small"],k=t(x),w=i.concat(a).concat(l).concat(u).concat(f).concat(b).concat(x);e.registerHelper("hintWords","css",w),e.defineMIME("text/css",{documentTypes:o,mediaTypes:s,mediaFeatures:c,propertyKeywords:d,nonStandardPropertyKeywords:m,fontProperties:p,counterDescriptors:v,colorKeywords:y,valueKeywords:k,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=n,n(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:s,mediaFeatures:c,propertyKeywords:d,nonStandardPropertyKeywords:m,colorKeywords:y,valueKeywords:k,fontProperties:p,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*\{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:s,mediaFeatures:c,propertyKeywords:d,nonStandardPropertyKeywords:m,colorKeywords:y,valueKeywords:k,fontProperties:p,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/), +e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sass",function(e){function t(e){return new RegExp("^"+e.join("|"))}function r(e, t){var r=e.peek();return")"===r?(e.next(),t.tokenizer=l,"operator"):"("===r?(e.next(),e.eatSpace(),"operator"):"'"===r||'"'===r?(t.tokenizer=i(e.next()),"string"):(t.tokenizer=i(")",!1),"string")}function n(e, t){return function(r, n){return r.sol()&&r.indentation()<=e?(n.tokenizer=l,l(r,n)):(t&&r.skipTo("*/")?(r.next(),r.next(),n.tokenizer=l):r.skipToEnd(),"comment")}}function i(e,t){function r(n,i){var a=n.next(),s=n.peek(),c=n.string.charAt(n.pos-2),u="\\"!==a&&s===e||a===e&&"\\"!==c;return u?(a!==e&&t&&n.next(),i.tokenizer=l,"string"):"#"===a&&"{"===s?(i.tokenizer=o(r),n.next(),"operator"):"string"}return null==t&&(t=!0),r}function o(e){return function(t,r){return"}"===t.peek()?(t.next(),r.tokenizer=e,"operator"):l(t,r)}}function a(t){if(0==t.indentCount){t.indentCount++;var r=t.scopes[0].offset,n=r+e.indentUnit;t.scopes.unshift({offset:n})}}function s(e){1!=e.scopes.length&&e.scopes.shift()}function l(e,t){var c=e.peek();if(e.match("/*"))return t.tokenizer=n(e.indentation(),!0),t.tokenizer(e,t);if(e.match("//"))return t.tokenizer=n(e.indentation(),!1),t.tokenizer(e,t);if(e.match("#{"))return t.tokenizer=o(l),"operator";if('"'===c||"'"===c)return e.next(),t.tokenizer=i(c),"string";if(t.cursorHalf){if("#"===c&&(e.next(),e.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^-?[0-9\.]+/))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^(px|em|in)\b/))return e.peek()||(t.cursorHalf=0),"unit";if(e.match(d))return e.peek()||(t.cursorHalf=0),"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=r,e.peek()||(t.cursorHalf=0),"atom";if("$"===c)return e.next(),e.eatWhile(/[\w-]/),e.peek()||(t.cursorHalf=0),"variable-3";if("!"===c)return e.next(),e.peek()||(t.cursorHalf=0),e.match(/^[\w]+/)?"keyword":"operator";if(e.match(m))return e.peek()||(t.cursorHalf=0),"operator";if(e.eatWhile(/[\w-]/))return e.peek()||(t.cursorHalf=0),"attribute";if(!e.peek())return t.cursorHalf=0,null}else{if("."===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("#"===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("$"===c)return e.next(),e.eatWhile(/[\w-]/),"variable-2";if(e.match(/^-?[0-9\.]+/))return"number";if(e.match(/^(px|em|in)\b/))return"unit";if(e.match(d))return"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=r,"atom";if("="===c&&e.match(/^=[\w-]+/))return a(t),"meta";if("+"===c&&e.match(/^\+[\w-]+/))return"variable-3";if("@"===c&&e.match(/@extend/)&&(e.match(/\s*[\w]/)||s(t)),e.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return a(t),"meta";if("@"===c)return e.next(),e.eatWhile(/[\w-]/),"meta";if(e.eatWhile(/[\w-]/))return e.match(/ *: *[\w-\+\$#!\("']/,!1)?"propery":e.match(/ *:/,!1)?(a(t),t.cursorHalf=1,"atom"):e.match(/ *,/,!1)?"atom":(a(t),"atom");if(":"===c)return e.match(h)?"keyword":(e.next(),t.cursorHalf=1,"operator")}return e.match(m)?"operator":(e.next(),null)}function c(t,r){t.sol()&&(r.indentCount=0);var n=r.tokenizer(t,r),i=t.current();if(("@return"===i||"}"===i)&&s(r),null!==n){for(var o=t.pos-i.length,a=o+e.indentUnit*r.indentCount,l=[],c=0;c","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],m=t(f),h=/^::?[a-zA-Z_][\w\-]*/;return{startState:function(){return{tokenizer:l,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(e, t){var r=c(e,t);return t.lastToken={style:r,content:e.current()},r},indent:function(e){return e.scopes[0].offset}}}),e.defineMIME("text/x-sass","sass")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("shell",function(){function e(e, t){for(var r=t.split(" "),n=0; n1&&e.eat("$");var i=e.next(),o=/\w/;return"{"===i&&(o=/[^}]/),"("===i?(t.tokens[0]=r(")"),n(e,t)):(/\d/.test(i)||(e.eatWhile(o),e.eat("}")),t.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(e, t){return n(e,t)},lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sql",function(t, r){function n(e, t){var r=e.next();if(h[r]){var n=h[r](e,t);if(n!==!1)return n}if(1==m.hexNumber&&("0"==r&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==r||"X"==r)&&e.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==m.binaryNumber&&(("b"==r||"B"==r)&&e.match(/^'[01]+'/)||"0"==r&&e.match(/^b[01]+/)))return"number";if(r.charCodeAt(0)>47&&r.charCodeAt(0)<58)return e.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==m.decimallessFloat&&e.eat("."),"number";if("?"==r&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if("'"==r||'"'==r&&m.doubleQuote)return t.tokenize=i(r),t.tokenize(e,t);if((1==m.nCharCast&&("n"==r||"N"==r)||1==m.charsetCast&&"_"==r&&e.match(/[a-z][a-z0-9]*/i))&&("'"==e.peek()||'"'==e.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(r))return null;if(m.commentSlashSlash&&"/"==r&&e.eat("/"))return e.skipToEnd(),"comment";if(m.commentHash&&"#"==r||"-"==r&&e.eat("-")&&(!m.commentSpaceRequired||e.eat(" ")))return e.skipToEnd(),"comment";if("/"==r&&e.eat("*"))return t.tokenize=o,t.tokenize(e,t);if("."!=r){if(f.test(r))return e.eatWhile(f),null;if("{"==r&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var a=e.current().toLowerCase();return p.hasOwnProperty(a)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":c.hasOwnProperty(a)?"atom":u.hasOwnProperty(a)?"builtin":d.hasOwnProperty(a)?"keyword":l.hasOwnProperty(a)?"string-2":null}return 1==m.zerolessFloat&&e.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==m.ODBCdotTable&&e.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function i(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){r.tokenize=n;break}o=!o&&"\\"==i}return"string"}}function o(e,t){for(;;){if(!e.skipTo("*")){e.skipToEnd();break}if(e.next(),e.eat("/")){t.tokenize=n;break}}return"comment"}function a(e,t,r){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:r}}function s(e){e.indent=e.context.indent,e.context=e.context.prev}var l=r.client||{},c=r.atoms||{"false":!0,"true":!0,"null":!0},u=r.builtin||{},d=r.keywords||{},f=r.operatorChars||/^[*+\-%<>!=&|~^]/,m=r.support||{},h=r.hooks||{},p=r.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:n,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),e.eatSpace())return null;var r=t.tokenize(e,t);if("comment"==r)return r;t.context&&null==t.context.align&&(t.context.align=!0);var n=e.current();return"("==n?a(e,t,")"):"["==n?a(e,t,"]"):t.context&&t.context.type==n&&s(t),r},indent:function(r,n){var i=r.context;if(!i)return e.Pass;var o=n.charAt(0)==i.type;return i.align?i.col+(o?0:1):i.indent+(o?0:t.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:m.commentSlashSlash?"//":m.commentHash?"#":null}}),function(){function t(e){for(var t;null!=(t=e.next());)if("`"==t&&!e.eat("`"))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function r(e){return e.eat("@")&&(e.match(/^session\./),e.match(/^local\./),e.match(/^global\./)),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function n(e){return e.eat("N")?"atom":e.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function i(e){for(var t={},r=e.split(" "),n=0;n!=]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-mssql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered"),builtin:i("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":r}}),e.defineMIME("text/x-mysql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":n}}),e.defineMIME("text/x-mariadb",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":n}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:i("use select from using consistency where limit first reversed first and in insert into values using consistency ttl update set delete truncate begin batch apply create keyspace with columnfamily primary key index on drop alter type add any one quorum all local_quorum each_quorum"),builtin:i("ascii bigint blob boolean counter decimal double float int text timestamp uuid varchar varint"),atoms:i("false true"),operatorChars:/^[<>=]/,dateSQL:{},support:i("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:i("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:i("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:i("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:i("date time timestamp"),support:i("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:i("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:i("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")})}()}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0; n!?|\/]/;return{startState:function(e){return{tokenize:null,context:new a((e||0)-u,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,t){var r=t.context;if(e.sol()&&(null==r.align&&(r.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;c=null;var i=(t.tokenize||n)(e,t);if("comment"==i||"meta"==i)return i;if(null==r.align&&(r.align=!0),";"!=c&&":"!=c&&","!=c||"statement"!=r.type)if("{"==c)s(t,e.column(),"}");else if("["==c)s(t,e.column(),"]");else if("("==c)s(t,e.column(),")");else if("}"==c){for(;"statement"==r.type;)r=l(t);for("}"==r.type&&(r=l(t));"statement"==r.type;)r=l(t)}else c==r.type?l(t):y&&(("}"==r.type||"top"==r.type)&&";"!=c||"statement"==r.type&&"newstatement"==c)&&s(t,e.column(),"statement");else l(t);return t.startOfLine=!1,i},indent:function(t,r){if(t.tokenize!=n&&null!=t.tokenize)return e.Pass;var i=t.context,o=r&&r.charAt(0);"statement"==i.type&&"}"==o&&(i=i.prev);var a=o==i.type;return"statement"==i.type?i.indented+("{"==o?0:d):!i.align||f&&")"==i.type?")"!=i.type||a?i.indented+(a?0:u):i.indented+d:i.column+(a?0:1)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var l="auto if break int case long char register continue return default short do sizeof double static else struct entry switch extern typedef float union for unsigned goto while enum void const signed volatile";a(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(l),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),a(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(l+" asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),blockKeywords:t("catch class do else finally for if struct switch try while"),atoms:t("true false null"),hooks:{"#":r,u:n,U:n,L:n,R:n},modeProps:{fold:["brace","include"]}}),a("text/x-java",{name:"clike",keywords:t("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while"),blockKeywords:t("catch class do else finally for if switch try while"),atoms:t("true false null"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),a("text/x-csharp",{name:"clike",keywords:t("abstract as base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),builtin:t("Boolean Byte Char DateTime DateTimeOffset Decimal Double Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),atoms:t("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=i,i(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),a("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try trye type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"), +multiLineStrings:!0,blockKeywords:t("catch class do else finally for forSome if match switch try while"),atoms:t("true false null"),indentStatements:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return e.match('""')?(t.tokenize=s,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"}}}),a(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),a("text/x-nesc",{name:"clike",keywords:t(l+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":r},modeProps:{fold:["brace","include"]}}),a("text/x-objectivec",{name:"clike",keywords:t(l+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),atoms:t("YES NO NULL NILL ON OFF"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":r},modeProps:{fold:"brace"}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["./lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0; n\w/,!1)&&(t.tokenize=r([[["->",null]],[[/[\w]+/,"variable"]]],n)),"variable-2";for(var i=!1;!e.eol()&&(i||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!i&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}i="\\"==e.next()&&!i}return"string"}var o="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",a="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",s="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";e.registerHelper("hintWords","php",[o,a,s].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var l={name:"clike",helperType:"php",keywords:t(o),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),atoms:t(a),builtin:t(s),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){if(e.match(/<",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=n('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=n(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,r){function n(e,t){var r=t.curMode==o;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),r)return r&&null==t.php.tokenize&&e.match("?>")?(t.curMode=i,t.curState=t.html,"meta"):o.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=o,t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var n="string"}else if(t.pending&&e.pos/.test(s)?t.pending=a[0]:t.pending={end:e.pos,style:n},e.backUp(s.length-l)),n}var i=e.getMode(t,"text/html"),o=e.getMode(t,l);return{startState:function(){var t=e.startState(i),n=e.startState(o);return{html:t,php:n,curMode:r.startOpen?o:i,curState:r.startOpen?n:t,pending:null}},copyState:function(t){var r,n=t.html,a=e.copyState(i,n),s=t.php,l=e.copyState(o,s);return r=t.curMode==i?a:l,{html:a,php:l,curMode:t.curMode,curState:r,pending:t.pending}},token:n,indent:function(e, t){return e.curMode!=o&&/^\s*<\//.test(t)||e.curMode==o&&/^\?>/.test(t)?i.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",l)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xml",function(t, r){function n(e, t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(a("atom","]]>")):null:e.match("--")?r(a("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(s(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=a("meta","?>"),"meta"):(_=e.eat("/")?"closeTag":"openTag",t.tokenize=i,"tag bracket");if("&"==n){var o;return o=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),o?"atom":"error"}return e.eatWhile(/[^&<]/),null}function i(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=n,_=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return _="equals",null;if("<"==r){t.tokenize=n,t.state=d,t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=o(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function o(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=i;break}return"string"};return t.isInAttribute=!0,t}function a(e,t){return function(r,i){for(;!r.eol();){if(r.match(t)){i.tokenize=n;break}r.next()}return e}}function s(e){return function(t,r){for(var i;null!=(i=t.next());){if("<"==i)return r.tokenize=s(e+1),r.tokenize(t,r);if(">"==i){if(1==e){r.tokenize=n;break}return r.tokenize=s(e-1),r.tokenize(t,r)}}return"meta"}}function l(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(S.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function c(e){e.context&&(e.context=e.context.prev)}function u(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!S.contextGrabbers.hasOwnProperty(r)||!S.contextGrabbers[r].hasOwnProperty(t))return;c(e)}}function d(e,t,r){return"openTag"==e?(r.tagStart=t.column(),f):"closeTag"==e?m:d}function f(e,t,r){return"word"==e?(r.tagName=t.current(),C="tag",g):(C="error",f)}function m(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&S.implicitlyClosed.hasOwnProperty(r.context.tagName)&&c(r),r.context&&r.context.tagName==n?(C="tag",h):(C="tag error",p)}return C="error",p}function h(e,t,r){return"endTag"!=e?(C="error",h):(c(r),d)}function p(e,t,r){return C="error",h(e,t,r)}function g(e,t,r){if("word"==e)return C="attribute",v;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||S.autoSelfClosers.hasOwnProperty(n)?u(r,n):(u(r,n),r.context=new l(r,n,i==r.indented)),d}return C="error",g}function v(e,t,r){return"equals"==e?b:(S.allowMissing||(C="error"),g(e,t,r))}function b(e,t,r){return"string"==e?y:"word"==e&&S.allowUnquoted?(C="string",g):(C="error",g(e,t,r))}function y(e,t,r){return"string"==e?y:g(e,t,r)}var x=t.indentUnit,k=r.multilineTagIndentFactor||1,w=r.multilineTagIndentPastTag;null==w&&(w=!0);var _,C,S=r.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},T=r.alignCDATA;return{startState:function(){return{tokenize:n,state:d,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;_=null;var r=t.tokenize(e,t);return(r||_)&&"comment"!=r&&(C=null,t.state=t.state(_||r,e,t),C&&(r="error"==C?r+" error":C)),r},indent:function(t,r,o){var a=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+x;if(a&&a.noIndent)return e.Pass;if(t.tokenize!=i&&t.tokenize!=n)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return w?t.tagStart+t.tagName.length+2:t.tagStart+x*k;if(T&&/$/,blockCommentStart:"",configuration:r.htmlMode?"html":"xml",helperType:r.htmlMode?"html":"xml"}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["./lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t, r){function n(r){if(e.findModeByName){var n=e.findModeByName(r);n&&(r=n.mime||n.mimes[0])}var i=e.getMode(t,r);return"null"==i.name?null:i}function i(e, t, r){return t.f=t.inline=r,r(e,t)}function o(e, t, r){return t.f=t.block=r,r(e,t)}function a(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,k||e.f!=l||(e.f=m,e.block=s),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.thisLineHasContent=!1,null}function s(e,t){var o=e.sol(),a=t.list!==!1;t.list!==!1&&t.indentationDiff>=0?(t.indentationDiff<4&&(t.indentation-=t.indentationDiff),t.list=null):t.list!==!1&&t.indentation>0?(t.list=null,t.listDepth=Math.floor(t.indentation/4)):t.list!==!1&&(t.list=!1,t.listDepth=0);var s=null;if(t.indentationDiff>=4)return t.indentation-=4,e.skipToEnd(),S;if(e.eatSpace())return null;if(s=e.match(U))return t.header=s[0].length<=6?s[0].length:6,r.highlightFormatting&&(t.formatting="header"),t.f=t.inline,d(t);if(t.prevLineHasContent&&(s=e.match(W)))return t.header="="==s[0].charAt(0)?1:2,r.highlightFormatting&&(t.formatting="header"),t.f=t.inline,d(t);if(e.eat(">"))return t.indentation++,t.quote=o?1:t.quote+1,r.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),d(t);if("["===e.peek())return i(e,t,v);if(e.match(F,!0))return q;if((!t.prevLineHasContent||a)&&(e.match(H,!1)||e.match(N,!1))){var l=null;return e.match(H,!0)?l="ul":(e.match(N,!0),l="ol"),t.indentation+=4,t.list=!0,t.listDepth++,r.taskLists&&e.match(B,!1)&&(t.taskList=!0),t.f=t.inline,r.highlightFormatting&&(t.formatting=["list","list-"+l]),d(t)}return r.fencedCodeBlocks&&e.match(/^```[ \t]*([\w+#]*)/,!0)?(t.localMode=n(RegExp.$1),t.localMode&&(t.localState=t.localMode.startState()),t.f=t.block=c,r.highlightFormatting&&(t.formatting="code-block"),t.code=!0,d(t)):i(e,t,t.inline)}function l(e,t){var r=w.token(e,t.htmlState);return(k&&null===t.htmlState.tagStart&&!t.htmlState.context||t.md_inside&&e.current().indexOf(">")>-1)&&(t.f=m,t.block=s,t.htmlState=null),r}function c(e,t){return e.sol()&&e.match("```",!1)?(t.localMode=t.localState=null,t.f=t.block=u,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),S)}function u(e,t){e.match("```"),t.block=s,t.f=m,r.highlightFormatting&&(t.formatting="code-block"),t.code=!0;var n=d(t);return t.code=!1,n}function d(e){var t=[];if(e.formatting){t.push(z),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var n=0;n=e.quote?z+"-"+e.formatting[n]+"-"+e.quote:"error")}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref)return t.push(A),t.length?t.join(" "):null;if(e.strong&&t.push(O),e.em&&t.push($),e.strikethrough&&t.push(R),e.linkText&&t.push(D),e.code&&t.push(S),e.header&&(t.push(C),t.push(C+"-"+e.header)),e.quote&&(t.push(T),t.push(!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?T+"-"+e.quote:T+"-"+r.maxBlockquoteDepth)),e.list!==!1){var i=(e.listDepth-1)%3;t.push(i?1===i?L:E:M)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function f(e,t){return e.match(V,!0)?d(t):void 0}function m(t,n){var i=n.text(t,n);if("undefined"!=typeof i)return i;if(n.list)return n.list=null,d(n);if(n.taskList){var a="x"!==t.match(B,!0)[1];return a?n.taskOpen=!0:n.taskClosed=!0,r.highlightFormatting&&(n.formatting="task"),n.taskList=!1,d(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&t.match(/^#+$/,!0))return r.highlightFormatting&&(n.formatting="header"),d(n);var s=t.sol(),c=t.next();if("\\"===c&&(t.next(),r.highlightFormatting)){var u=d(n);return u?u+" formatting-escape":"formatting-escape"}if(n.linkTitle){n.linkTitle=!1;var f=c;"("===c&&(f=")"),f=(f+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var m="^\\s*(?:[^"+f+"\\\\]+|\\\\\\\\|\\\\.)"+f;if(t.match(new RegExp(m),!0))return A}if("`"===c){var g=n.formatting;r.highlightFormatting&&(n.formatting="code");var v=d(n),b=t.pos;t.eatWhile("`");var y=1+t.pos-b;return n.code?y===_?(n.code=!1,v):(n.formatting=g,d(n)):(_=y,n.code=!0,d(n))}if(n.code)return d(n);if("!"===c&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.match(/\[[^\]]*\]/),n.inline=n.f=p,j;if("["===c&&t.match(/.*\](\(.*\)| ?\[.*\])/,!1))return n.linkText=!0,r.highlightFormatting&&(n.formatting="link"),d(n);if("]"===c&&n.linkText&&t.match(/\(.*\)| ?\[.*\]/,!1)){r.highlightFormatting&&(n.formatting="link");var u=d(n);return n.linkText=!1,n.inline=n.f=p,u}if("<"===c&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=h,r.highlightFormatting&&(n.formatting="link");var u=d(n);return u?u+=" ":u="",u+I}if("<"===c&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=h,r.highlightFormatting&&(n.formatting="link");var u=d(n);return u?u+=" ":u="",u+P}if("<"===c&&t.match(/^\w/,!1)){if(-1!=t.string.indexOf(">")){var x=t.string.substring(1,t.string.indexOf(">"));/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(n.md_inside=!0)}return t.backUp(1),n.htmlState=e.startState(w),o(t,n,l)}if("<"===c&&t.match(/^\/\w*?>/))return n.md_inside=!1,"tag";var k=!1;if(!r.underscoresBreakWords&&"_"===c&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var C=t.pos-2;if(C>=0){var S=t.string.charAt(C);"_"!==S&&S.match(/(\w)/,!1)&&(k=!0)}}if("*"===c||"_"===c&&!k)if(s&&" "===t.peek());else{if(n.strong===c&&t.eat(c)){r.highlightFormatting&&(n.formatting="strong");var v=d(n);return n.strong=!1,v}if(!n.strong&&t.eat(c))return n.strong=c,r.highlightFormatting&&(n.formatting="strong"),d(n);if(n.em===c){r.highlightFormatting&&(n.formatting="em");var v=d(n);return n.em=!1,v}if(!n.em)return n.em=c,r.highlightFormatting&&(n.formatting="em"),d(n)}else if(" "===c&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return d(n);t.backUp(1)}if(r.strikethrough)if("~"===c&&t.eatWhile(c)){if(n.strikethrough){r.highlightFormatting&&(n.formatting="strikethrough");var v=d(n);return n.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return n.strikethrough=!0,r.highlightFormatting&&(n.formatting="strikethrough"),d(n)}else if(" "===c&&t.match(/^~~/,!0)){if(" "===t.peek())return d(n);t.backUp(2)}return" "===c&&(t.match(/ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),d(n)}function h(e,t){var n=e.next();if(">"===n){t.f=t.inline=m,r.highlightFormatting&&(t.formatting="link");var i=d(t);return i?i+=" ":i="",i+I}return e.match(/^[^>]+/,!0),I}function p(e,t){if(e.eatSpace())return null;var n=e.next();return"("===n||"["===n?(t.f=t.inline=g("("===n?")":"]"),r.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,d(t)):"error"}function g(e){return function(t,n){var i=t.next();if(i===e){n.f=n.inline=m,r.highlightFormatting&&(n.formatting="link-string");var o=d(n);return n.linkHref=!1,o}return t.match(x(e),!0)&&t.backUp(1),n.linkHref=!0,d(n)}}function v(e,t){return e.match(/^[^\]]*\]:/,!1)?(t.f=b,e.next(),r.highlightFormatting&&(t.formatting="link"),t.linkText=!0,d(t)):i(e,t,m)}function b(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=y,r.highlightFormatting&&(t.formatting="link");var n=d(t);return t.linkText=!1,n}return e.match(/^[^\]]+/,!0),D}function y(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=m,A)}function x(e){return K[e]||(e=(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),K[e]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+e+")")),K[e]}var k=e.modes.hasOwnProperty("xml"),w=e.getMode(t,k?{name:"xml",htmlMode:!0}:"text/plain");void 0===r.highlightFormatting&&(r.highlightFormatting=!1),void 0===r.maxBlockquoteDepth&&(r.maxBlockquoteDepth=0),void 0===r.underscoresBreakWords&&(r.underscoresBreakWords=!0),void 0===r.fencedCodeBlocks&&(r.fencedCodeBlocks=!1),void 0===r.taskLists&&(r.taskLists=!1),void 0===r.strikethrough&&(r.strikethrough=!1);var _=0,C="header",S="comment",T="quote",M="variable-2",L="variable-3",E="keyword",q="hr",j="tag",z="formatting",I="link",P="link",D="link",A="string",$="em",O="strong",R="strikethrough",F=/^([*\-=_])(?:\s*\1){2,}\s*$/,H=/^[*\-+]\s+/,N=/^[0-9]+\.\s+/,B=/^\[(x| )\](?=\s)/,U=/^#+/,W=/^(?:\={1,}|-{1,})$/,V=/^[^#!\[\]*_\\<>` "'(~]+/,K=[],Z={startState:function(){return{f:s,prevLineHasContent:!1,thisLineHasContent:!1,block:s,htmlState:null,indentation:0,inline:m,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,em:!1,strong:!1,header:0,taskList:!1,list:!1,listDepth:0,quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1}},copyState:function(t){return{f:t.f,prevLineHasContent:t.prevLineHasContent,thisLineHasContent:t.thisLineHasContent,block:t.block,htmlState:t.htmlState&&e.copyState(w,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,taskList:t.taskList,list:t.list,listDepth:t.listDepth,quote:t.quote, +trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside}},token:function(e,t){if(t.formatting=!1,e.sol()){var r=!!t.header;if(t.header=0,e.match(/^\s*$/,!0)||r)return t.prevLineHasContent=!1,a(t),r?this.token(e,t):null;t.prevLineHasContent=t.thisLineHasContent,t.thisLineHasContent=!0,t.taskList=!1,t.code=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length,i=4*Math.floor((n-t.indentation)/4);i>4&&(i=4);var o=t.indentation+i;if(t.indentationDiff=o-t.indentation,t.indentation=o,n>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==l?{state:e.htmlState,mode:w}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:Z}},blankLine:a,getType:d,fold:"markdown"};return Z},"xml"),e.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t, r){function n(e){for(var t,r=!1,n=!1; null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function i(e, t, r){return pe=e,ge=r,t}function o(e, t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=a(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==r&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return i(r);if("="==r&&e.eat(">"))return i("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==r)return e.eat("*")?(t.tokenize=s,s(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(n(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),i("regexp","string-2")):(e.eatWhile(Ce),i("operator","operator",e.current()));if("`"==r)return t.tokenize=l,l(e,t);if("#"==r)return e.skipToEnd(),i("error","error");if(Ce.test(r))return e.eatWhile(Ce),i("operator","operator",e.current());if(we.test(r)){e.eatWhile(we);var o=e.current(),c=_e.propertyIsEnumerable(o)&&_e[o];return c&&"."!=t.lastType?i(c.type,c.style,o):i("variable","variable",o)}}function a(e){return function(t,r){var n,a=!1;if(ye&&"@"==t.peek()&&t.match(Se))return r.tokenize=o,i("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||a);)a=!a&&"\\"==n;return a||(r.tokenize=o),i("string","string")}}function s(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=o;break}n="*"==r}return i("comment","comment")}function l(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=o;break}n=!n&&"\\"==r}return i("quasi","string-2",e.current())}function c(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),s=Te.indexOf(a);if(s>=0&&3>s){if(!n){++o;break}if(0==--n)break}else if(s>=3&&6>s)++n;else if(we.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function u(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function d(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(Le.state=e,Le.stream=i,Le.marked=null,Le.cc=o,Le.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():xe?w:k;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Le.marked?Le.marked:"variable"==r&&d(e,n)?"variable-2":t}}}function m(){for(var e=arguments.length-1;e>=0;e--)Le.cc.push(arguments[e])}function h(){return m.apply(null,arguments),!0}function p(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=Le.state;if(n.context){if(Le.marked="def",t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function g(){Le.state.context={prev:Le.state.context,vars:Le.state.localVars},Le.state.localVars=Ee}function v(){Le.state.localVars=Le.state.context.vars,Le.state.context=Le.state.context.prev}function b(e,t){var r=function(){var r=Le.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new u(n,Le.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function y(){var e=Le.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function x(e){function t(r){return r==e?h():";"==e?m():h(t)}return t}function k(e,t){return"var"==e?h(b("vardef",t.length),B,x(";"),y):"keyword a"==e?h(b("form"),w,k,y):"keyword b"==e?h(b("form"),k,y):"{"==e?h(b("}"),F,y):";"==e?h():"if"==e?("else"==Le.state.lexical.info&&Le.state.cc[Le.state.cc.length-1]==y&&Le.state.cc.pop()(),h(b("form"),w,k,y,Z)):"function"==e?h(ee):"for"==e?h(b("form"),G,k,y):"variable"==e?h(b("stat"),I):"switch"==e?h(b("form"),w,b("}","switch"),x("{"),F,y,y):"case"==e?h(w,x(":")):"default"==e?h(x(":")):"catch"==e?h(b("form"),g,x("("),te,x(")"),k,y,v):"module"==e?h(b("form"),g,ae,v,y):"class"==e?h(b("form"),re,y):"export"==e?h(b("form"),se,y):"import"==e?h(b("form"),le,y):m(b("stat"),w,x(";"),y)}function w(e){return C(e,!1)}function _(e){return C(e,!0)}function C(e,t){if(Le.state.fatArrowAt==Le.stream.start){var r=t?z:j;if("("==e)return h(g,b(")"),O(U,")"),y,x("=>"),r,v);if("variable"==e)return m(g,U,x("=>"),r,v)}var n=t?L:M;return Me.hasOwnProperty(e)?h(n):"function"==e?h(ee,n):"keyword c"==e?h(t?T:S):"("==e?h(b(")"),S,me,x(")"),y,n):"operator"==e||"spread"==e?h(t?_:w):"["==e?h(b("]"),de,y,n):"{"==e?R(D,"}",null,n):"quasi"==e?m(E,n):h()}function S(e){return e.match(/[;\}\)\],]/)?m():m(w)}function T(e){return e.match(/[;\}\)\],]/)?m():m(_)}function M(e,t){return","==e?h(w):L(e,t,!1)}function L(e,t,r){var n=0==r?M:L,i=0==r?w:_;return"=>"==e?h(g,r?z:j,v):"operator"==e?/\+\+|--/.test(t)?h(n):"?"==t?h(w,x(":"),i):h(i):"quasi"==e?m(E,n):";"!=e?"("==e?R(_,")","call",n):"."==e?h(P,n):"["==e?h(b("]"),S,x("]"),y,n):void 0:void 0}function E(e,t){return"quasi"!=e?m():"${"!=t.slice(t.length-2)?h(E):h(w,q)}function q(e){return"}"==e?(Le.marked="string-2",Le.state.tokenize=l,h(E)):void 0}function j(e){return c(Le.stream,Le.state),m("{"==e?k:w)}function z(e){return c(Le.stream,Le.state),m("{"==e?k:_)}function I(e){return":"==e?h(y,k):m(M,x(";"),y)}function P(e){return"variable"==e?(Le.marked="property",h()):void 0}function D(e,t){return"variable"==e||"keyword"==Le.style?(Le.marked="property",h("get"==t||"set"==t?A:$)):"number"==e||"string"==e?(Le.marked=ye?"property":Le.style+" property",h($)):"jsonld-keyword"==e?h($):"["==e?h(w,x("]"),$):void 0}function A(e){return"variable"!=e?m($):(Le.marked="property",h(ee))}function $(e){return":"==e?h(_):"("==e?m(ee):void 0}function O(e,t){function r(n){if(","==n){var i=Le.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),h(e,r)}return n==t?h():h(x(t))}return function(n){return n==t?h():m(e,r)}}function R(e,t,r){for(var n=3;n!?|~^]/,Se=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Te="([{}])",Me={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Le={state:null,column:null,marked:null,cc:null},Ee={name:"this",next:{name:"arguments"}};return y.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new u((e||0)-ve,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),c(e,t)),t.tokenize!=s&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==pe?r:(t.lastType="operator"!=pe||"++"!=ge&&"--"!=ge?pe:"incdec",f(t,r,pe,ge,e))},indent:function(t,n){if(t.tokenize==s)return e.Pass;if(t.tokenize!=o)return 0;var i=n&&n.charAt(0),a=t.lexical;if(!/^\s*else\b/.test(n))for(var l=t.cc.length-1;l>=0;--l){var c=t.cc[l];if(c==y)a=a.prev;else if(c!=Z)break}"stat"==a.type&&"}"==i&&(a=a.prev),be&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var u=a.type,d=i==u;return"vardef"==u?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==u&&"{"==i?a.indented:"form"==u?a.indented+ve:"stat"==u?a.indented+(he(t,n)?be||ve:0):"switch"!=a.info||d||0==r.doubleIndentSwitch?a.align?a.column+(d?0:1):a.indented+(d?0:ve):a.indented+(/^(?:case|default)\b/.test(n)?ve:2*ve)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:xe?null:"/*",blockCommentEnd:xe?null:"*/",lineComment:xe?null:"//",fold:"brace",helperType:xe?"json":"javascript",jsonldMode:ye,jsonMode:xe}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["./lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlmixed",function(t, r){function n(e, t){var r=t.htmlState.tagName;r&&(r=r.toLowerCase());var n=s.token(e,t.htmlState);if("script"==r&&/\btag\b/.test(n)&&">"==e.current()){var i=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);i=i?i[1]:"",i&&/[\"\']/.test(i.charAt(0))&&(i=i.slice(1,i.length-1));for(var u=0; u"==e.current()&&(t.token=a,t.localMode=l,t.localState=l.startState(s.indent(t.htmlState,"")));return n}function i(e,t,r){var n,i=e.current(),o=i.search(t);return o>-1?e.backUp(i.length-o):(n=i.match(/<\/?$/))&&(e.backUp(i.length),e.match(t,!1)||e.match(i)),r}function o(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,null):i(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function a(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,null):i(e,/<\/\s*style\s*>/,l.token(e,t.localState))}var s=e.getMode(t,{name:"xml",htmlMode:!0,multilineTagIndentFactor:r.multilineTagIndentFactor,multilineTagIndentPastTag:r.multilineTagIndentPastTag}),l=e.getMode(t,"css"),c=[],u=r&&r.scriptTypes;if(c.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:e.getMode(t,"javascript")}),u)for(var d=0;d]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i)&&"]("!=e.string.slice(e.start-2,e.start)?(t.combineTokens=!0,"link"):(e.next(),null)},blankLine:n},a={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:!0,strikethrough:!0};for(var s in r)a[s]=r[s];return a.name="markdown",e.defineMIME("gfmBase",a),e.overlayMode(e.getMode(t,"gfmBase"),o)},"markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("http",function(){function e(e, t){return e.skipToEnd(),t.cur=a,"error"}function t(t, n){return t.match(/^HTTP\/\d\.\d/)?(n.cur=r,"keyword"):t.match(/^[A-Z]+/)&&/[ \t]/.test(t.peek())?(n.cur=i,"keyword"):e(t,n)}function r(t, r){var i=t.match(/^\d+/);if(!i)return e(t,r);r.cur=n;var o=Number(i[0]);return o>=100&&200>o?"positive informational":o>=200&&300>o?"positive success":o>=300&&400>o?"positive redirect":o>=400&&500>o?"negative client-error":o>=500&&600>o?"negative server-error":"error"}function n(e,t){return e.skipToEnd(),t.cur=a,null}function i(e,t){return e.eatWhile(/\S/),t.cur=o,"string-2"}function o(t, r){return t.match(/^HTTP\/\d\.\d$/)?(r.cur=a,"keyword"):e(t,r)}function a(e){return e.sol()&&!e.eat(/[ \t]/)?e.match(/^.*?:/)?"atom":(e.skipToEnd(),"error"):(e.skipToEnd(),"string")}function s(e){return e.skipToEnd(),null}return{token:function(e, t){var r=t.cur;return r!=a&&r!=s&&e.eatSpace()?null:r(e,t)},blankLine:function(e){e.cur=s},startState:function(){return{cur:t}}}}),e.defineMIME("message/http","http")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("go",function(e){function t(e, t){var i=e.next();if('"'==i||"'"==i||"`"==i)return t.tokenize=r(i),t.tokenize(e,t);if(/[\d\.]/.test(i))return"."==i?e.match(/^[0-9]+([eE][\-+]?[0-9]+)?/):"0"==i?e.match(/^[xX][0-9a-fA-F]+/)||e.match(/^0[0-7]+/):e.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/),"number";if(/[\[\]{}\(\),;\:\.]/.test(i))return s=i,null;if("/"==i){if(e.eat("*"))return t.tokenize=n,n(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(d.test(i))return e.eatWhile(d),"operator";e.eatWhile(/[\w\$_\xa1-\uffff]/);var o=e.current();return c.propertyIsEnumerable(o)?(("case"==o||"default"==o)&&(s="case"),"keyword"):u.propertyIsEnumerable(o)?"atom":"variable"}function r(e){return function(r,n){for(var i,o=!1,a=!1;null!=(i=r.next());){if(i==e&&!o){a=!0;break}o=!o&&"\\"==i}return(a||!o&&"`"!=e)&&(n.tokenize=t),"string"}}function n(e,r){for(var n,i=!1;n=e.next();){if("/"==n&&i){r.tokenize=t;break}i="*"==n}return"comment"}function i(e,t,r,n,i){this.indented=e,this.column=t,this.type=r,this.align=n,this.prev=i}function o(e,t,r){return e.context=new i(e.indented,t,r,null,e.context)}function a(e){if(e.context.prev){var t=e.context.type;return(")"==t||"]"==t||"}"==t)&&(e.indented=e.context.indented),e.context=e.context.prev}}var s,l=e.indentUnit,c={"break":!0,"case":!0,chan:!0,"const":!0,"continue":!0,"default":!0,defer:!0,"else":!0,fallthrough:!0,"for":!0,func:!0,go:!0,"goto":!0,"if":!0,"import":!0,"interface":!0,map:!0,"package":!0,range:!0,"return":!0,select:!0,struct:!0,"switch":!0,type:!0,"var":!0,bool:!0,"byte":!0,complex64:!0,complex128:!0,float32:!0,float64:!0,int8:!0,int16:!0,int32:!0,int64:!0,string:!0,uint8:!0,uint16:!0,uint32:!0,uint64:!0,"int":!0,uint:!0,uintptr:!0},u={"true":!0,"false":!0,iota:!0,nil:!0,append:!0,cap:!0,close:!0,complex:!0,copy:!0,imag:!0,len:!0,make:!0,"new":!0,panic:!0,print:!0,println:!0,real:!0,recover:!0},d=/[+\-*&^%:=<>!|\/]/;return{startState:function(e){return{tokenize:null,context:new i((e||0)-l,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,r){var n=r.context;if(e.sol()&&(null==n.align&&(n.align=!1),r.indented=e.indentation(),r.startOfLine=!0,"case"==n.type&&(n.type="}")),e.eatSpace())return null;s=null;var i=(r.tokenize||t)(e,r);return"comment"==i?i:(null==n.align&&(n.align=!0),"{"==s?o(r,e.column(),"}"):"["==s?o(r,e.column(),"]"):"("==s?o(r,e.column(),")"):"case"==s?n.type="case":"}"==s&&"}"==n.type?n=a(r):s==n.type&&a(r),r.startOfLine=!1,i)},indent:function(e, r){if(e.tokenize!=t&&null!=e.tokenize)return 0;var n=e.context,i=r&&r.charAt(0);if("case"==n.type&&/^(?:case|default)\b/.test(r))return e.context.type="}",n.indented;var o=i==n.type;return n.align?n.column+(o?0:1):n.indented+(o?0:l)},electricChars:"{}):",fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}}),e.defineMIME("text/x-go","go")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["./lib/codemirror","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0; rr&&"coffee"==t.scope.type?"indent":r>n?"dedent":null}r>0&&s(e,t)}if(e.eatSpace())return null;var a=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return t.tokenize=o,t.tokenize(e,t);if("#"===a)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var l=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(l=!0),e.match(/^-?\d+\.\d*/)&&(l=!0),e.match(/^-?\.\d+/)&&(l=!0),l)return"."==e.peek()&&e.backUp(1),"number";var p=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(p=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(p=!0),e.match(/^-?0(?![\dx])/i)&&(p=!0),p)return"number"}if(e.match(b))return t.tokenize=i(e.current(),!1,"string"),t.tokenize(e,t);if(e.match(y)){if("/"!=e.current()||e.match(/^.*\//,!1))return t.tokenize=i(e.current(),!0,"string-2"),t.tokenize(e,t);e.backUp(1)}return e.match(u)||e.match(h)?"operator":e.match(d)?"punctuation":e.match(k)?"atom":e.match(v)?"keyword":e.match(f)?"variable":e.match(m)?"property":(e.next(),c)}function i(e,r,i){return function(o,a){for(;!o.eol();)if(o.eatWhile(/[^'"\/\\]/),o.eat("\\")){if(o.next(),r&&o.eol())return i}else{if(o.match(e))return a.tokenize=n,i;o.eat(/['"\/]/)}return r&&(t.singleLineStringErrors?i=c:a.tokenize=n),i}}function o(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=n;break}e.eatWhile("#")}return"comment"}function a(t,r,n){n=n||"coffee";for(var i=0,o=!1,a=null,s=r.scope;s;s=s.prev)if("coffee"===s.type||"}"==s.type){i=s.offset+e.indentUnit;break}"coffee"!==n?(o=null,a=t.column()+t.current().length):r.scope.align&&(r.scope.align=!1),r.scope={offset:i,type:n,prev:r.scope,align:o,alignOffset:a}}function s(e,t){if(t.scope.prev){if("coffee"===t.scope.type){for(var r=e.indentation(),n=!1,i=t.scope;i;i=i.prev)if(r===i.offset){n=!0;break}if(!n)return!0;for(;t.scope.prev&&t.scope.offset!==r;)t.scope=t.scope.prev;return!1}return t.scope=t.scope.prev,!1}}function l(e,t){var r=t.tokenize(e,t),n=e.current();if("."===n)return r=t.tokenize(e,t),n=e.current(),/^\.[\w$]+$/.test(n)?"variable":c;"return"===n&&(t.dedent=!0),("->"!==n&&"=>"!==n||t.lambda||e.peek())&&"indent"!==r||a(e,t);var i="[({".indexOf(n);if(-1!==i&&a(e,t,"])}".slice(i,i+1)),p.exec(n)&&a(e,t),"then"==n&&s(e,t),"dedent"===r&&s(e,t))return c;if(i="])}".indexOf(n),-1!==i){for(;"coffee"==t.scope.type&&t.scope.prev;)t.scope=t.scope.prev;t.scope.type==n&&(t.scope=t.scope.prev)}return t.dedent&&e.eol()&&("coffee"==t.scope.type&&t.scope.prev&&(t.scope=t.scope.prev),t.dedent=!1),r}var c="error",u=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,d=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,f=/^[_A-Za-z$][_A-Za-z$0-9]*/,m=/^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*/,h=r(["and","or","not","is","isnt","in","instanceof","typeof"]),p=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],g=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"],v=r(p.concat(g));p=r(p);var b=/^('{3}|\"{3}|['\"])/,y=/^(\/{3}|\/)/,x=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],k=r(x),w={startState:function(e){return{tokenize:n,scope:{offset:e||0,type:"coffee",prev:null,align:!1},lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var r=null===t.scope.align&&t.scope;r&&e.sol()&&(r.align=!1);var n=l(e,t);return r&&n&&"comment"!=n&&(r.align=!0),t.lastToken={style:n,content:e.current()},e.eol()&&e.lambda&&(t.lambda=!1),n},indent:function(e, t){if(e.tokenize!=n)return 0;var r=e.scope,i=t&&"])}".indexOf(t.charAt(0))>-1;if(i)for(; "coffee"==r.type&&r.prev;)r=r.prev;var o=i&&r.type===t.charAt(0);return r.align?r.alignOffset-(o?1:0):(o?r.prev:r).offset},lineComment:"#",fold:"indent"};return w}),e.defineMIME("text/x-coffeescript","coffeescript")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("nginx",function(e){function t(e){for(var t={},r=e.split(" "),n=0; n*\/]/.test(s)?r(null,"select-op"):/[;{}:\[\]]/.test(s)?r(null,s):(e.eatWhile(/[\w\\\-]/),r("variable","variable")):r(null,"compare"):void r(null,"compare")}function i(e,t){for(var i,o=!1;null!=(i=e.next());){if(o&&"/"==i){t.tokenize=n;break}o="*"==i}return r("comment","comment")}function o(e,t){for(var i,o=0;null!=(i=e.next());){if(o>=2&&">"==i){t.tokenize=n;break}o="-"==i?o+1:0}return r("comment","comment")}function a(e){return function(t,i){for(var o,a=!1;null!=(o=t.next())&&(o!=e||a);)a=!a&&"\\"==o;return a||(i.tokenize=n),r("string","string")}}var s,l=t("break return rewrite set accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"),c=t("http mail events server types location upstream charset_map limit_except if geo map"),u=t("include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"),d=e.indentUnit; + +return{startState:function(e){return{tokenize:n,baseIndent:e||0,stack:[]}},token:function(e,t){if(e.eatSpace())return null;s=null;var r=t.tokenize(e,t),n=t.stack[t.stack.length-1];return"hash"==s&&"rule"==n?r="atom":"variable"==r&&("rule"==n?r="number":n&&"@media{"!=n||(r="tag")),"rule"==n&&/^[\{\};]$/.test(s)&&t.stack.pop(),"{"==s?"@media"==n?t.stack[t.stack.length-1]="@media{":t.stack.push("{"):"}"==s?t.stack.pop():"@media"==s?t.stack.push("@media"):"{"==n&&"comment"!=s&&t.stack.push("rule"),r},indent:function(e,t){var r=e.stack.length;return/^\}/.test(t)&&(r-="rule"==e.stack[e.stack.length-1]?2:1),e.baseIndent+r*d},electricChars:"}"}}),e.defineMIME("text/nginx","text/x-nginx-conf")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function r(e){return e.scopes[e.scopes.length-1]}var n=t(["and","or","not","is"]),i=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],o=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"],a={builtins:["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"],keywords:["exec","print"]},s={builtins:["ascii","bytes","exec","print"],keywords:["nonlocal","False","True","None"]};e.registerHelper("hintWords","python",i.concat(o)),e.defineMode("python",function(l,c){function u(e,t){if(e.sol()&&"py"==r(t).type){var n=r(t).offset;if(e.eatSpace()){var i=e.indentation();return i>n?m(e,t,"py"):n>i&&h(e,t)&&(t.errorToken=!0),null}var o=d(e,t);return n>0&&h(e,t)&&(o+=" "+g),o}return d(e,t)}function d(e,t){if(e.eatSpace())return null;var r=e.peek();if("#"==r)return e.skipToEnd(),"comment";if(e.match(/^[0-9\.]/,!1)){var i=!1;if(e.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),e.match(/^\d+\.\d*/)&&(i=!0),e.match(/^\.\d+/)&&(i=!0),i)return e.eat(/J/i),"number";var o=!1;if(e.match(/^0x[0-9a-f]+/i)&&(o=!0),e.match(/^0b[01]+/i)&&(o=!0),e.match(/^0o[0-7]+/i)&&(o=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),o=!0),e.match(/^0(?![\dx])/i)&&(o=!0),o)return e.eat(/L/i),"number"}return e.match(T)?(t.tokenize=f(e.current()),t.tokenize(e,t)):e.match(x)||e.match(y)?null:e.match(b)||e.match(k)||e.match(n)?"operator":e.match(v)?null:e.match(M)?"keyword":e.match(L)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(w)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),g)}function f(e){function t(t,i){for(;!t.eol();)if(t.eatWhile(/[^'"\\]/),t.eat("\\")){if(t.next(),r&&t.eol())return n}else{if(t.match(e))return i.tokenize=u,n;t.eat(/['"]/)}if(r){if(c.singleLineStringErrors)return g;i.tokenize=u}return n}for(;"rub".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var r=1==e.length,n="string";return t.isString=!0,t}function m(e,t,n){var i=0,o=null;if("py"==n)for(;"py"!=r(t).type;)t.scopes.pop();i=r(t).offset+("py"==n?l.indentUnit:_),"py"==n||e.match(/^(\s|#.*)*$/,!1)||(o=e.column()+1),t.scopes.push({offset:i,type:n,align:o})}function h(e,t){for(var n=e.indentation();r(t).offset>n;){if("py"!=r(t).type)return!0;t.scopes.pop()}return r(t).offset!=n}function p(e,t){var n=t.tokenize(e,t),i=e.current();if("."==i)return n=e.match(w,!1)?null:g,null==n&&"meta"==t.lastStyle&&(n="meta"),n;if("@"==i)return c.version&&3==parseInt(c.version,10)?e.match(w,!1)?"meta":"operator":e.match(w,!1)?"meta":g;"variable"!=n&&"builtin"!=n||"meta"!=t.lastStyle||(n="meta"),("pass"==i||"return"==i)&&(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"!=i||t.lambda||"py"!=r(t).type||m(e,t,"py");var o=1==i.length?"[({".indexOf(i):-1;if(-1!=o&&m(e,t,"])}".slice(o,o+1)),o="])}".indexOf(i),-1!=o){if(r(t).type!=i)return g;t.scopes.pop()}return t.dedent>0&&e.eol()&&"py"==r(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}var g="error",v=c.singleDelimiters||new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),b=c.doubleOperators||new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),y=c.doubleDelimiters||new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),x=c.tripleDelimiters||new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");if(c.version&&3==parseInt(c.version,10))var k=c.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]"),w=c.identifiers||new RegExp("^[_A-Za-z¡-￿][_A-Za-z0-9¡-￿]*");else var k=c.singleOperators||new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"),w=c.identifiers||new RegExp("^[_A-Za-z][_A-Za-z0-9]*");var _=c.hangingIndent||l.indentUnit,C=i,S=o;if(void 0!=c.extra_keywords&&(C=C.concat(c.extra_keywords)),void 0!=c.extra_builtins&&(S=S.concat(c.extra_builtins)),c.version&&3==parseInt(c.version,10)){C=C.concat(s.keywords),S=S.concat(s.builtins);var T=new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))","i")}else{C=C.concat(a.keywords),S=S.concat(a.builtins);var T=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var M=t(C),L=t(S),E={startState:function(e){return{tokenize:u,scopes:[{offset:e||0,type:"py",align:null}],lastStyle:null,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var r=t.errorToken;r&&(t.errorToken=!1);var n=p(e,t);t.lastStyle=n;var i=e.current();return i&&n&&(t.lastToken=i),e.eol()&&t.lambda&&(t.lambda=!1),r?n+" "+g:n},indent:function(t,n){if(t.tokenize!=u)return t.tokenize.isString?e.Pass:0;var i=r(t),o=n&&n.charAt(0)==i.type;return null!=i.align?i.align-(o?1:0):o&&t.scopes.length>1?t.scopes[t.scopes.length-2].offset:i.offset},lineComment:"#",fold:"indent"};return E}),e.defineMIME("text/x-python","python");var l=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:l("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e, t){return e.string.charAt(e.pos+(t||0))}function r(e, t){if(t){var r=e.pos-t;return e.string.substr(r>=0?r:0,t)}return e.string.substr(0,e.pos-1)}function n(e, t){var r=e.string.length,n=r-e.pos+1;return e.string.substr(e.pos,t&&r>t?t:n)}function i(e, t){var r,n=e.pos+t;0>=n?e.pos=0:n>=(r=e.string.length-1)?e.pos=r:e.pos=n}e.defineMode("perl",function(){function e(e, t, r, n, i){return t.chain=null,t.style=null,t.tail=null,t.tokenize=function(e, t){for(var o,s=!1,l=0;o=e.next();){if(o===r[l]&&!s)return void 0!==r[++l]?(t.chain=r[l],t.style=n,t.tail=i):i&&e.eatWhile(i),t.tokenize=a,n;s=!s&&"\\"==o}return n},t.tokenize(e,t)}function o(e,t,r){return t.tokenize=function(e,t){return e.string==r&&(t.tokenize=a),e.skipToEnd(),"string"},t.tokenize(e,t)}function a(a,u){if(a.eatSpace())return null;if(u.chain)return e(a,u,u.chain,u.style,u.tail);if(a.match(/^\-?[\d\.]/,!1)&&a.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(a.match(/^<<(?=\w)/))return a.eatWhile(/\w/),o(a,u,a.current().substr(2));if(a.sol()&&a.match(/^\=item(?!\w)/))return o(a,u,"=cut");var d=a.next();if('"'==d||"'"==d){if(r(a,3)=="<<"+d){var f=a.pos;a.eatWhile(/\w/);var m=a.current().substr(1);if(m&&a.eat(d))return o(a,u,m);a.pos=f}return e(a,u,[d],"string")}if("q"==d){var h=t(a,-2);if(!h||!/\w/.test(h))if(h=t(a,0),"x"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if("q"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"string");if("["==h)return i(a,2),e(a,u,["]"],"string");if("{"==h)return i(a,2),e(a,u,["}"],"string");if("<"==h)return i(a,2),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"string")}else if("w"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"bracket");if("["==h)return i(a,2),e(a,u,["]"],"bracket");if("{"==h)return i(a,2),e(a,u,["}"],"bracket");if("<"==h)return i(a,2),e(a,u,[">"],"bracket");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"bracket")}else if("r"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if(/[\^'"!~\/(\[{<]/.test(h)){if("("==h)return i(a,1),e(a,u,[")"],"string");if("["==h)return i(a,1),e(a,u,["]"],"string");if("{"==h)return i(a,1),e(a,u,["}"],"string");if("<"==h)return i(a,1),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return e(a,u,[a.eat(h)],"string")}}if("m"==d){var h=t(a,-2);if((!h||!/\w/.test(h))&&(h=a.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(h))return e(a,u,[h],l,c);if("("==h)return e(a,u,[")"],l,c);if("["==h)return e(a,u,["]"],l,c);if("{"==h)return e(a,u,["}"],l,c);if("<"==h)return e(a,u,[">"],l,c)}}if("s"==d){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("y"==d){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("t"==d){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat("r"),h&&(h=a.eat(/[(\[{<\^'"!~\/]/))))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("`"==d)return e(a,u,[d],"variable-2");if("/"==d)return/~\s*$/.test(r(a))?e(a,u,[d],l,c):"operator";if("$"==d){var f=a.pos;if(a.eatWhile(/\d/)||a.eat("{")&&a.eatWhile(/\d/)&&a.eat("}"))return"variable-2";a.pos=f}if(/[$@%]/.test(d)){var f=a.pos;if(a.eat("^")&&a.eat(/[A-Z]/)||!/[@$%&]/.test(t(a,-2))&&a.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){var h=a.current();if(s[h])return"variable-2"}a.pos=f}if(/[$@%&]/.test(d)&&(a.eatWhile(/[\w$\[\]]/)||a.eat("{")&&a.eatWhile(/[\w$\[\]]/)&&a.eat("}"))){var h=a.current();return s[h]?"variable-2":"variable"}if("#"==d&&"$"!=t(a,-2))return a.skipToEnd(),"comment";if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(d)){var f=a.pos;if(a.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/),s[a.current()])return"operator";a.pos=f}if("_"==d&&1==a.pos){if("_END__"==n(a,6))return e(a,u,["\x00"],"comment");if("_DATA__"==n(a,7))return e(a,u,["\x00"],"variable-2");if("_C__"==n(a,7))return e(a,u,["\x00"],"string")}if(/\w/.test(d)){var f=a.pos;if("{"==t(a,-2)&&("}"==t(a,0)||a.eatWhile(/\w/)&&"}"==t(a,0)))return"string";a.pos=f}if(/[A-Z]/.test(d)){var p=t(a,-2),f=a.pos;if(a.eatWhile(/[A-Z_]/),!/[\da-z]/.test(t(a,0))){var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=p?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}a.pos=f}if(/[a-zA-Z_]/.test(d)){var p=t(a,-2);a.eatWhile(/\w/);var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=p?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}return null}var s={"->":4,"++":4,"--":4,"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,1],UNTIE:[5,1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,"@INC":5,"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,"@LAST_MATCH_START":5,"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,$FORMAT_LINES_PER_PAGE:5,"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,bind:1,binmode:1,bless:1,bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,getlogin:1,getnetbyaddr:1,getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,my:2,"new":1,next:1,no:1,oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,setservent:1,setsockopt:1,shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},l="string-2",c=/[goseximacplud]/;return{startState:function(){return{tokenize:a,chain:null,style:null,tail:null}},token:function(e, t){return(t.tokenize||a)(e,t)},lineComment:"#"}}),e.registerHelper("wordChars","perl",/[\w$]/),e.defineMIME("text/x-perl","perl")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("lua",function(e, t){function r(e){return new RegExp("^(?:"+e.join("|")+")","i")}function n(e){return new RegExp("^(?:"+e.join("|")+")$","i")}function i(e){for(var t=0; e.eat("=");)++t;return e.eat("["),t}function o(e, t){var r=e.next();return"-"==r&&e.eat("-")?e.eat("[")&&e.eat("[")?(t.cur=a(i(e),"comment"))(e,t):(e.skipToEnd(),"comment"):'"'==r||"'"==r?(t.cur=s(r))(e,t):"["==r&&/[\[=]/.test(e.peek())?(t.cur=a(i(e),"string"))(e,t):/\d/.test(r)?(e.eatWhile(/[\w.%]/),"number"):/[\w_]/.test(r)?(e.eatWhile(/[\w\\\-_.]/),"variable"):null}function a(e,t){return function(r,n){for(var i,a=null;null!=(i=r.next());)if(null==a)"]"==i&&(a=0);else if("="==i)++a;else{if("]"==i&&a==e){n.cur=o;break}a=null}return t}}function s(e){return function(t,r){for(var n,i=!1;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.cur=o),"string"}}var l=e.indentUnit,c=n(t.specials||[]),u=n(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile","io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),d=n(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),f=n(["function","if","repeat","do","\\(","{"]),m=n(["end","until","\\)","}"]),h=r(["end","until","\\)","}","else","elseif"]);return{startState:function(e){return{basecol:e||0,indentDepth:0,cur:o}},token:function(e, t){if(e.eatSpace())return null;var r=t.cur(e,t),n=e.current();return"variable"==r&&(d.test(n)?r="keyword":u.test(n)?r="builtin":c.test(n)&&(r="variable-2")),"comment"!=r&&"string"!=r&&(f.test(n)?++t.indentDepth:m.test(n)&&--t.indentDepth),r},indent:function(e, t){var r=h.test(t);return e.basecol+l*(e.indentDepth-(r?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}}),e.defineMIME("text/x-lua","lua")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("r",function(e){function t(e){for(var t=e.split(" "),r={},n=0; n=!&|~$:]/;return{startState:function(){return{tokenize:r,ctx:{type:"top",indent:-e.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(e,t){if(e.sol()&&(null==t.ctx.align&&(t.ctx.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var r=t.tokenize(e,t);"comment"!=r&&null==t.ctx.align&&(t.ctx.align=!0);var n=t.ctx.type;return";"!=a&&"{"!=a&&"}"!=a||"block"!=n||o(t),"{"==a?i(t,"}",e):"("==a?(i(t,")",e),t.afterIdent&&(t.ctx.argList=!0)):"["==a?i(t,"]",e):"block"==a?i(t,"block",e):a==n&&o(t),t.afterIdent="variable"==r||"keyword"==r,r},indent:function(t, n){if(t.tokenize!=r)return 0;var i=n&&n.charAt(0),o=t.ctx,a=i==o.type;return"block"==o.type?o.indent+("{"==i?0:e.indentUnit):o.align?o.column+(a?0:1):o.indent+(a?0:e.indentUnit)},lineComment:"#"}}),e.defineMIME("text/x-rsrc","r")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ruby",function(e){function t(e){for(var t={},r=0,n=e.length; n>r; ++r)t[e[r]]=!0;return t}function r(e, t, r){return r.tokenize.push(e),e(t,r)}function n(e, t){if(c=null,e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(l),"comment";if(e.eatSpace())return null;var n,i=e.next();if("`"==i||"'"==i||'"'==i)return r(a(i,"string",'"'==i||"`"==i),e,t);if("/"==i){var o=e.current().length;if(e.skipTo("/")){var u=e.current().length;e.backUp(e.current().length-o);for(var d=0;e.current().lengthd)break}if(e.backUp(e.current().length-o),0==d)return r(a(i,"string-2",!0),e,t)}return"operator"}if("%"==i){var h="string",p=!0;e.eat("s")?h="atom":e.eat(/[WQ]/)?h="string":e.eat(/[r]/)?h="string-2":e.eat(/[wxq]/)&&(h="string",p=!1);var g=e.eat(/[^\w\s=]/);return g?(m.propertyIsEnumerable(g)&&(g=m[g]),r(a(g,h,p,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(n=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return r(s(n[1]),e,t);if("0"==i)return e.eatWhile(e.eat("x")?/[\da-fA-F]/:e.eat("b")?/[01]/:/[0-7]/),"number";if(/\d/.test(i))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==i){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==i)return e.eat("'")?r(a("'","atom",!1),e,t):e.eat('"')?r(a('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if("@"==i&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==i)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(i))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident";if("|"!=i||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(i))return c=i,null;if("-"==i&&e.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(i)){var v=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=i||v||(c="."),"operator"}return null}return c="|",null}function i(e){return e||(e=1),function(t,r){if("}"==t.peek()){if(1==e)return r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r);r.tokenize[r.tokenize.length-1]=i(e-1)}else"{"==t.peek()&&(r.tokenize[r.tokenize.length-1]=i(e+1));return n(t,r)}}function o(){var e=!1;return function(t,r){return e?(r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r)):(e=!0,n(t,r))}}function a(e,t,r,n){return function(a,s){var l,c=!1;for("read-quoted-paused"===s.context.type&&(s.context=s.context.prev,a.eat("}"));null!=(l=a.next());){if(l==e&&(n||!c)){s.tokenize.pop();break}if(r&&"#"==l&&!c){if(a.eat("{")){"}"==e&&(s.context={prev:s.context,type:"read-quoted-paused"}),s.tokenize.push(i());break}if(/[@\$]/.test(a.peek())){s.tokenize.push(o());break}}c=!c&&"\\"==l}return t}}function s(e){return function(t,r){return t.match(e)?r.tokenize.pop():t.skipToEnd(),"string"}}function l(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}var c,u=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),d=t(["def","class","case","for","while","module","then","catch","loop","proc","begin"]),f=t(["end","until"]),m={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[n],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){e.sol()&&(t.indented=e.indentation());var r,n=t.tokenize[t.tokenize.length-1](e,t),i=c;if("ident"==n){var o=e.current();n="."==t.lastTok?"property":u.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable","keyword"==n&&(i=o,d.propertyIsEnumerable(o)?r="indent":f.propertyIsEnumerable(o)?r="dedent":"if"!=o&&"unless"!=o||e.column()!=e.indentation()?"do"==o&&t.context.indented\\?]*[^\\W_])?)",y=new RegExp(r("^{0}",b)),x="(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\./:;<=>\\?]*[^\\W_])?)",k=r("(?:{0}|`{1}`)",b,x),w="(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)",_="(?:[^\\`]+)",C=new RegExp(r("^{0}",_)),S=new RegExp("^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$"),T=new RegExp(r("^\\.\\.{0}",p)),M=new RegExp(r("^_{0}:{1}|^__:{1}",k,g)),L=new RegExp(r("^{0}::{1}",k,g)),E=new RegExp(r("^\\|{0}\\|{1}{2}::{3}",w,p,k,g)),q=new RegExp(r("^\\[(?:\\d+|#{0}?|\\*)]{1}",k,g)),j=new RegExp(r("^\\[{0}\\]{1}",k,g)),z=new RegExp(r("^\\|{0}\\|",w)),I=new RegExp(r("^\\[(?:\\d+|#{0}?|\\*)]_",k)),P=new RegExp(r("^\\[{0}\\]_",k)),D=new RegExp(r("^{0}__?",k)),A=new RegExp(r("^`{0}`_",_)),$=new RegExp(r("^:{0}:`{1}`{2}",b,_,g)),O=new RegExp(r("^`{1}`:{0}:{2}",b,_,g)),R=new RegExp(r("^:{0}:{1}",b,g)),F=new RegExp(r("^{0}",k)),H=new RegExp(r("^::{0}",g)),N=new RegExp(r("^\\|{0}\\|",w)),B=new RegExp(r("^{0}",p)),U=new RegExp(r("^{0}",k)),W=new RegExp(r("^::{0}",g)),V=new RegExp("^_"),K=new RegExp(r("^{0}|_",k)),Z=new RegExp(r("^:{0}",g)),G=new RegExp("^::\\s*$"),X=new RegExp("^\\s+(?:>>>|In \\[\\d+\\]:)\\s");return{startState:function(){return{tok:n,ctx:c(void 0,0)}},copyState:function(t){var r=t.ctx,n=t.tmp;return r.local&&(r={mode:r.mode,local:e.copyState(r.mode,r.local)}),n&&(n={mode:n.mode,local:e.copyState(n.mode,n.local)}),{tok:t.tok,ctx:r,tmp:n}},innerMode:function(e){return e.tmp?{state:e.tmp.local,mode:e.tmp.mode}:e.ctx.mode?{state:e.ctx.local,mode:e.ctx.mode}:null},token:function(e,t){return t.tok(e,t)}}},"python","stex"),e.defineMIME("text/x-rst","rst")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../smarty/smarty")):"function"==typeof define&&define.amd?define(["./lib/codemirror","../htmlmixed/htmlmixed","../smarty/smarty"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("smartymixed",function(t){function r(e){return e.replace(/[^\s\w]/g,"\\$&")}var n=e.getMode(t,"htmlmixed"),i=e.getMode(t,"smarty"),o={rightDelimiter:"}",leftDelimiter:"{"};t.hasOwnProperty("leftDelimiter")&&(o.leftDelimiter=t.leftDelimiter),t.hasOwnProperty("rightDelimiter")&&(o.rightDelimiter=t.rightDelimiter);var a=r(o.leftDelimiter),s=r(o.rightDelimiter),l={smartyComment:new RegExp("^"+s+"\\*"),literalOpen:new RegExp(a+"literal"+s),literalClose:new RegExp(a+"/literal"+s),hasLeftDelimeter:new RegExp(".*"+a),htmlHasLeftDelimeter:new RegExp("[^<>]*"+a)},c={chain:function(e,t,r){return t.tokenize=r,r(e,t)},cleanChain:function(e,t,r){return t.tokenize=null,t.localState=null,t.localMode=null,"string"==typeof r?r?r:null:r(e,t)},maybeBackup:function(e,t,r){var n,i=e.current(),o=i.search(t);return o>-1?e.backUp(i.length-o):(n=i.match(/<\/?$/))&&(e.backUp(i.length),e.match(t,!1)||e.match(i[0])),r}},u={html:function(e,t){var r=t.htmlMixedState.htmlState.context&&t.htmlMixedState.htmlState.context.tagName?t.htmlMixedState.htmlState.context.tagName:null;return!t.inLiteral&&e.match(l.htmlHasLeftDelimeter,!1)&&null===r?(t.tokenize=u.smarty,t.localMode=i,t.localState=i.startState(n.indent(t.htmlMixedState,"")),c.maybeBackup(e,o.leftDelimiter,i.token(e,t.localState))):!t.inLiteral&&e.match(o.leftDelimiter,!1)?(t.tokenize=u.smarty,t.localMode=i,t.localState=i.startState(n.indent(t.htmlMixedState,"")),c.maybeBackup(e,o.leftDelimiter,i.token(e,t.localState))):n.token(e,t.htmlMixedState)},smarty:function(e,t){if(e.match(o.leftDelimiter,!1)){if(e.match(l.smartyComment,!1))return c.chain(e,t,u.inBlock("comment","*"+o.rightDelimiter))}else if(e.match(o.rightDelimiter,!1))return e.eat(o.rightDelimiter),t.tokenize=u.html,t.localMode=n,t.localState=t.htmlMixedState,"tag";return c.maybeBackup(e,o.rightDelimiter,i.token(e,t.localState))},inBlock:function(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){c.cleanChain(r,n,"");break}r.next()}return e}}};return{startState:function(){var e=n.startState();return{token:u.html,localMode:null,localState:null,htmlMixedState:e,tokenize:null,inLiteral:!1}},copyState:function(t){var r=null,o=t.tokenize||t.token;return t.localState&&(r=e.copyState(o!=u.html?i:n,t.localState)),{token:t.token,tokenize:t.tokenize,localMode:t.localMode,localState:r,htmlMixedState:e.copyState(n,t.htmlMixedState),inLiteral:t.inLiteral}},token:function(e,t){if(e.match(o.leftDelimiter,!1)){if(!t.inLiteral&&e.match(l.literalOpen,!0))return t.inLiteral=!0,"keyword";if(t.inLiteral&&e.match(l.literalClose,!0))return t.inLiteral=!1,"keyword"}t.inLiteral&&t.localState!=t.htmlMixedState&&(t.tokenize=u.html,t.localMode=n,t.localState=t.htmlMixedState);var r=(t.tokenize||t.token)(e,t);return r},indent:function(t, r){return t.localMode==i||t.inLiteral&&!t.localMode||l.hasLeftDelimeter.test(r)?e.Pass:n.indent(t.htmlMixedState,r)},innerMode:function(e){return{state:e.localState||e.htmlMixedState,mode:e.localMode||n}}}},"htmlmixed","smarty"),e.defineMIME("text/x-smarty","smartymixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("vb",function(e, t){function r(e){return new RegExp("^(("+e.join(")|(")+"))\\b","i")}function n(e, t){t.currentIndent++}function i(e, t){t.currentIndent--}function o(e, t){if(e.eatSpace())return null;var r=e.peek();if("'"===r)return e.skipToEnd(),"comment";if(e.match(/^((&H)|(&O))?[0-9\.a-f]/i,!1)){var o=!1;if(e.match(/^\d*\.\d+F?/i)?o=!0:e.match(/^\d+\.\d*F?/)?o=!0:e.match(/^\.\d+F?/)&&(o=!0),o)return e.eat(/J/i),"number";var s=!1;if(e.match(/^&H[0-9a-f]+/i)?s=!0:e.match(/^&O[0-7]+/i)?s=!0:e.match(/^[1-9]\d*F?/)?(e.eat(/J/i),s=!0):e.match(/^0(?![\dx])/i)&&(s=!0),s)return e.eat(/L/i),"number"}return e.match(_)?(t.tokenize=a(e.current()),t.tokenize(e,t)):e.match(m)||e.match(f)?null:e.match(d)||e.match(c)||e.match(b)?"operator":e.match(u)?null:e.match(L)?(n(e,t),t.doInCurrentLine=!0,"keyword"):e.match(C)?(t.doInCurrentLine?t.doInCurrentLine=!1:n(e,t),"keyword"):e.match(S)?"keyword":e.match(M)?(i(e,t),i(e,t),"keyword"):e.match(T)?(i(e,t),"keyword"):e.match(w)?"keyword":e.match(k)?"keyword":e.match(h)?"variable":(e.next(),l)}function a(e){var r=1==e.length,n="string";return function(i,a){for(;!i.eol();){if(i.eatWhile(/[^'"]/),i.match(e))return a.tokenize=o,n;i.eat(/['"]/)}if(r){if(t.singleLineStringErrors)return l;a.tokenize=o}return n}}function s(e,t){var r=t.tokenize(e,t),o=e.current();if("."===o)return r=t.tokenize(e,t),o=e.current(),"variable"===r?"variable":l;var a="[({".indexOf(o);return-1!==a&&n(e,t),"dedent"===E&&i(e,t)?l:(a="])}".indexOf(o),-1!==a&&i(e,t)?l:r)}var l="error",c=new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]"),u=new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),d=new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"),f=new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),m=new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"),h=new RegExp("^[_A-Za-z][_A-Za-z0-9]*"),p=["class","module","sub","enum","select","while","if","function","get","set","property","try"],g=["else","elseif","case","catch"],v=["next","loop"],b=r(["and","or","not","xor","in"]),y=["as","dim","break","continue","optional","then","until","goto","byval","byref","new","handles","property","return","const","private","protected","friend","public","shared","static","true","false"],x=["integer","string","double","decimal","boolean","short","char","float","single"],k=r(y),w=r(x),_='"',C=r(p),S=r(g),T=r(v),M=r(["end"]),L=r(["do"]),E=null,q={electricChars:"dDpPtTfFeE ",startState:function(){return{tokenize:o,lastToken:null,currentIndent:0,nextLineIndent:0,doInCurrentLine:!1}},token:function(e, t){e.sol()&&(t.currentIndent+=t.nextLineIndent,t.nextLineIndent=0,t.doInCurrentLine=0);var r=s(e,t);return t.lastToken={style:r,content:e.current()},r},indent:function(t, r){var n=r.replace(/^\s+|\s+$/g,"");return n.match(T)||n.match(M)||n.match(S)?e.indentUnit*(t.currentIndent-1):t.currentIndent<0?0:t.currentIndent*e.indentUnit}};return q}),e.defineMIME("text/x-vb","vb")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("vbscript",function(e, t){function r(e){return new RegExp("^(("+e.join(")|(")+"))\\b","i")}function n(e, t){t.currentIndent++}function i(e, t){t.currentIndent--}function o(e, t){if(e.eatSpace())return"space";var r=e.peek();if("'"===r)return e.skipToEnd(),"comment";if(e.match(H))return e.skipToEnd(),"comment";if(e.match(/^((&H)|(&O))?[0-9\.]/i,!1)&&!e.match(/^((&H)|(&O))?[0-9\.]+[a-z_]/i,!1)){var o=!1;if(e.match(/^\d*\.\d+/i)?o=!0:e.match(/^\d+\.\d*/)?o=!0:e.match(/^\.\d+/)&&(o=!0),o)return e.eat(/J/i),"number";var s=!1;if(e.match(/^&H[0-9a-f]+/i)?s=!0:e.match(/^&O[0-7]+/i)?s=!0:e.match(/^[1-9]\d*F?/)?(e.eat(/J/i),s=!0):e.match(/^0(?![\dx])/i)&&(s=!0),s)return e.eat(/L/i),"number"}return e.match(P)?(t.tokenize=a(e.current()),t.tokenize(e,t)):e.match(u)||e.match(c)||e.match(v)?"operator":e.match(d)?null:e.match(f)?"bracket":e.match(F)?(t.doInCurrentLine=!0,"keyword"):e.match(R)?(n(e,t),t.doInCurrentLine=!0,"keyword"):e.match(D)?(t.doInCurrentLine?t.doInCurrentLine=!1:n(e,t),"keyword"):e.match(A)?"keyword":e.match(O)?(i(e,t),i(e,t),"keyword"):e.match($)?(t.doInCurrentLine?t.doInCurrentLine=!1:i(e,t),"keyword"):e.match(E)?"keyword":e.match(q)?"atom":e.match(I)?"variable-2":e.match(j)?"builtin":e.match(z)?"variable-2":e.match(m)?"variable":(e.next(),l)}function a(e){var r=1==e.length,n="string";return function(i,a){for(;!i.eol();){if(i.eatWhile(/[^'"]/),i.match(e))return a.tokenize=o,n;i.eat(/['"]/)}if(r){if(t.singleLineStringErrors)return l;a.tokenize=o}return n}}function s(e,t){var r=t.tokenize(e,t),n=e.current();return"."===n?(r=t.tokenize(e,t),n=e.current(),!r||"variable"!==r.substr(0,8)&&"builtin"!==r&&"keyword"!==r?l:(("builtin"===r||"keyword"===r)&&(r="variable"),L.indexOf(n.substr(1))>-1&&(r="variable-2"),r)):r}var l="error",c=new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]"),u=new RegExp("^((<>)|(<=)|(>=))"),d=new RegExp("^[\\.,]"),f=new RegExp("^[\\(\\)]"),m=new RegExp("^[A-Za-z][_A-Za-z0-9]*"),h=["class","sub","select","while","if","function","property","with","for"],p=["else","elseif","case"],g=["next","loop","wend"],v=r(["and","or","not","xor","is","mod","eqv","imp"]),b=["dim","redim","then","until","randomize","byval","byref","new","property","exit","in","const","private","public","get","set","let","stop","on error resume next","on error goto 0","option explicit","call","me"],y=["true","false","nothing","empty","null"],x=["abs","array","asc","atn","cbool","cbyte","ccur","cdate","cdbl","chr","cint","clng","cos","csng","cstr","date","dateadd","datediff","datepart","dateserial","datevalue","day","escape","eval","execute","exp","filter","formatcurrency","formatdatetime","formatnumber","formatpercent","getlocale","getobject","getref","hex","hour","inputbox","instr","instrrev","int","fix","isarray","isdate","isempty","isnull","isnumeric","isobject","join","lbound","lcase","left","len","loadpicture","log","ltrim","rtrim","trim","maths","mid","minute","month","monthname","msgbox","now","oct","replace","rgb","right","rnd","round","scriptengine","scriptenginebuildversion","scriptenginemajorversion","scriptengineminorversion","second","setlocale","sgn","sin","space","split","sqr","strcomp","string","strreverse","tan","time","timer","timeserial","timevalue","typename","ubound","ucase","unescape","vartype","weekday","weekdayname","year"],k=["vbBlack","vbRed","vbGreen","vbYellow","vbBlue","vbMagenta","vbCyan","vbWhite","vbBinaryCompare","vbTextCompare","vbSunday","vbMonday","vbTuesday","vbWednesday","vbThursday","vbFriday","vbSaturday","vbUseSystemDayOfWeek","vbFirstJan1","vbFirstFourDays","vbFirstFullWeek","vbGeneralDate","vbLongDate","vbShortDate","vbLongTime","vbShortTime","vbObjectError","vbOKOnly","vbOKCancel","vbAbortRetryIgnore","vbYesNoCancel","vbYesNo","vbRetryCancel","vbCritical","vbQuestion","vbExclamation","vbInformation","vbDefaultButton1","vbDefaultButton2","vbDefaultButton3","vbDefaultButton4","vbApplicationModal","vbSystemModal","vbOK","vbCancel","vbAbort","vbRetry","vbIgnore","vbYes","vbNo","vbCr","VbCrLf","vbFormFeed","vbLf","vbNewLine","vbNullChar","vbNullString","vbTab","vbVerticalTab","vbUseDefault","vbTrue","vbFalse","vbEmpty","vbNull","vbInteger","vbLong","vbSingle","vbDouble","vbCurrency","vbDate","vbString","vbObject","vbError","vbBoolean","vbVariant","vbDataObject","vbDecimal","vbByte","vbArray"],w=["WScript","err","debug","RegExp"],_=["description","firstindex","global","helpcontext","helpfile","ignorecase","length","number","pattern","source","value","count"],C=["clear","execute","raise","replace","test","write","writeline","close","open","state","eof","update","addnew","end","createobject","quit"],S=["server","response","request","session","application"],T=["buffer","cachecontrol","charset","contenttype","expires","expiresabsolute","isclientconnected","pics","status","clientcertificate","cookies","form","querystring","servervariables","totalbytes","contents","staticobjects","codepage","lcid","sessionid","timeout","scripttimeout"],M=["addheader","appendtolog","binarywrite","end","flush","redirect","binaryread","remove","removeall","lock","unlock","abandon","getlasterror","htmlencode","mappath","transfer","urlencode"],L=C.concat(_);w=w.concat(k),e.isASP&&(w=w.concat(S),L=L.concat(M,T));var E=r(b),q=r(y),j=r(x),z=r(w),I=r(L),P='"',D=r(h),A=r(p),$=r(g),O=r(["end"]),R=r(["do"]),F=r(["on error resume next","exit"]),H=r(["rem"]),N={electricChars:"dDpPtTfFeE ",startState:function(){return{tokenize:o,lastToken:null,currentIndent:0,nextLineIndent:0,doInCurrentLine:!1,ignoreKeyword:!1}},token:function(e, t){e.sol()&&(t.currentIndent+=t.nextLineIndent,t.nextLineIndent=0,t.doInCurrentLine=0);var r=s(e,t);return t.lastToken={style:r,content:e.current()},"space"===r&&(r=null),r},indent:function(t, r){var n=r.replace(/^\s+|\s+$/g,"");return n.match($)||n.match(O)||n.match(A)?e.indentUnit*(t.currentIndent-1):t.currentIndent<0?0:t.currentIndent*e.indentUnit}};return N}),e.defineMIME("text/vbscript","vbscript")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("velocity",function(){function e(e){for(var t={},r=e.split(" "),n=0; nf.length&&"."==e.string.charAt(e.pos-f.length-1)&&r.lastTokenWasBuiltin?"builtin":(r.lastTokenWasBuiltin=!1,null)}return r.lastTokenWasBuiltin=!1,r.inString?(r.inString=!1,"string"):r.inParams?t(e,r,n(d)):void 0}function n(e){return function(t,n){for(var i,o=!1,a=!1;null!=(i=t.next());){if(i==e&&!o){a=!0;break}if('"'==e&&"$"==t.peek()&&!o){n.inString=!0,a=!0;break}o=!o&&"\\"==i}return a&&(n.tokenize=r),"string"}}function i(e,t){for(var n,i=!1;n=e.next();){if("#"==n&&i){t.tokenize=r;break}i="*"==n}return"comment"}function o(e,t){for(var n,i=0;n=e.next();){if("#"==n&&2==i){t.tokenize=r;break}"]"==n?i++:" "!=n&&(i=0)}return"meta"}var a=e("#end #else #break #stop #[[ #]] #{end} #{else} #{break} #{stop}"),s=e("#if #elseif #foreach #set #include #parse #macro #define #evaluate #{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}"),l=e("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent.count $foreach.parent.hasNext $foreach.parent.first $foreach.parent.last $foreach.parent $velocityCount $!bodyContent $bodyContent"),c=/[+\-*&%=<>!?:\/|]/;return{startState:function(){return{tokenize:r,beforeParams:!1,inParams:!1,inString:!1,lastTokenWasBuiltin:!1}},token:function(e, t){return e.eatSpace()?null:t.tokenize(e,t)},blockCommentStart:"#*",blockCommentEnd:"*#",lineComment:"##",fold:"velocity"}}),e.defineMIME("text/velocity","velocity")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xquery",function(){function e(e, t, r){return y=e,x=r,t}function t(e, t, r){return t.tokenize=r,r(e,t)}function r(r, s){var f=r.next(),h=!1,g=p(r);if("<"==f){if(r.match("!--",!0))return t(r,s,l);if(r.match("![CDATA",!1))return s.tokenize=c,e("tag","tag");if(r.match("?",!1))return t(r,s,u);var y=r.eat("/");r.eatSpace();for(var x,w=""; x=r.eat(/[^\s\u00a0=<>\"\'\/?]/);)w+=x;return t(r,s,a(w,y))}if("{"==f)return v(s,{type:"codeblock"}),e("",null);if("}"==f)return b(s),e("",null);if(d(s))return">"==f?e("tag","tag"):"/"==f&&r.eat(">")?(b(s),e("tag","tag")):e("word","variable");if(/\d/.test(f))return r.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/),e("number","atom");if("("===f&&r.eat(":"))return v(s,{type:"comment"}),t(r,s,n);if(g||'"'!==f&&"'"!==f){if("$"===f)return t(r,s,o);if(":"===f&&r.eat("="))return e("operator","keyword");if("("===f)return v(s,{type:"paren"}),e("",null);if(")"===f)return b(s),e("",null);if("["===f)return v(s,{type:"bracket"}),e("",null);if("]"===f)return b(s),e("",null);var _=k.propertyIsEnumerable(f)&&k[f];if(g&&'"'===f)for(;'"'!==r.next(););if(g&&"'"===f)for(;"'"!==r.next(););_||r.eatWhile(/[\w\$_-]/);var C=r.eat(":");!r.eat(":")&&C&&r.eatWhile(/[\w\$_-]/),r.match(/^[ \t]*\(/,!1)&&(h=!0);var S=r.current();return _=k.propertyIsEnumerable(S)&&k[S],h&&!_&&(_={type:"function_call",style:"variable def"}),m(s)?(b(s),e("word","variable",S)):(("element"==S||"attribute"==S||"axis_specifier"==_.type)&&v(s,{type:"xmlconstructor"}),_?e(_.type,_.style,S):e("word","variable",S))}return t(r,s,i(f))}function n(t,r){for(var n,i=!1,o=!1,a=0;n=t.next();){if(")"==n&&i){if(!(a>0)){b(r);break}a--}else":"==n&&o&&a++;i=":"==n,o="("==n}return e("comment","comment")}function i(t,n){return function(o,a){var s;if(h(a)&&o.current()==t)return b(a),n&&(a.tokenize=n),e("string","string");if(v(a,{type:"string",name:t,tokenize:i(t,n)}),o.match("{",!1)&&f(a))return a.tokenize=r,e("string","string");for(;s=o.next();){if(s==t){b(a),n&&(a.tokenize=n);break}if(o.match("{",!1)&&f(a))return a.tokenize=r,e("string","string")}return e("string","string")}}function o(t,n){var i=/[\w\$_-]/;if(t.eat('"')){for(;'"'!==t.next(););t.eat(":")}else t.eatWhile(i),t.match(":=",!1)||t.eat(":");return t.eatWhile(i),n.tokenize=r,e("variable","variable")}function a(t,n){return function(i,o){return i.eatSpace(),n&&i.eat(">")?(b(o),o.tokenize=r,e("tag","tag")):(i.eat("/")||v(o,{type:"tag",name:t,tokenize:r}),i.eat(">")?(o.tokenize=r,e("tag","tag")):(o.tokenize=s,e("tag","tag")))}}function s(n,o){var a=n.next();return"/"==a&&n.eat(">")?(f(o)&&b(o),d(o)&&b(o),e("tag","tag")):">"==a?(f(o)&&b(o),e("tag","tag")):"="==a?e("",null):'"'==a||"'"==a?t(n,o,i(a,s)):(f(o)||v(o,{type:"attribute",tokenize:s}),n.eat(/[a-zA-Z_:]/),n.eatWhile(/[-a-zA-Z0-9_:.]/),n.eatSpace(),(n.match(">",!1)||n.match("/",!1))&&(b(o),o.tokenize=r),e("attribute","attribute"))}function l(t,n){for(var i;i=t.next();)if("-"==i&&t.match("->",!0))return n.tokenize=r,e("comment","comment")}function c(t,n){for(var i;i=t.next();)if("]"==i&&t.match("]",!0))return n.tokenize=r,e("comment","comment")}function u(t,n){for(var i;i=t.next();)if("?"==i&&t.match(">",!0))return n.tokenize=r,e("comment","comment meta")}function d(e){return g(e,"tag")}function f(e){return g(e,"attribute")}function m(e){return g(e,"xmlconstructor")}function h(e){return g(e,"string")}function p(e){return'"'===e.current()?e.match(/^[^\"]+\"\:/,!1):"'"===e.current()?e.match(/^[^\"]+\'\:/,!1):!1}function g(e,t){return e.stack.length&&e.stack[e.stack.length-1].type==t}function v(e,t){e.stack.push(t)}function b(e){e.stack.pop();var t=e.stack.length&&e.stack[e.stack.length-1].tokenize;e.tokenize=t||r}var y,x,k=function(){function e(e){return{type:e,style:"keyword"}}for(var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={type:"punctuation",style:null},s={type:"axis_specifier",style:"qualifier"},l={"if":t,"switch":t,"while":t,"for":t,"else":r,then:r,"try":r,"finally":r,"catch":r,element:n,attribute:n,let:n,"implements":n,"import":n,module:n,namespace:n,"return":n,"super":n,"this":n,"throws":n,where:n,"private":n,",":a,"null":o,"fn:false()":o,"fn:true()":o},c=["after","ancestor","ancestor-or-self","and","as","ascending","assert","attribute","before","by","case","cast","child","comment","declare","default","define","descendant","descendant-or-self","descending","document","document-node","element","else","eq","every","except","external","following","following-sibling","follows","for","function","if","import","in","instance","intersect","item","let","module","namespace","node","node","of","only","or","order","parent","precedes","preceding","preceding-sibling","processing-instruction","ref","return","returns","satisfies","schema","schema-element","self","some","sortby","stable","text","then","to","treat","typeswitch","union","variable","version","where","xquery","empty-sequence"],u=0,d=c.length;d>u;u++)l[c[u]]=e(c[u]);for(var f=["xs:string","xs:float","xs:decimal","xs:double","xs:integer","xs:boolean","xs:date","xs:dateTime","xs:time","xs:duration","xs:dayTimeDuration","xs:time","xs:yearMonthDuration","numeric","xs:hexBinary","xs:base64Binary","xs:anyURI","xs:QName","xs:byte","xs:boolean","xs:anyURI","xf:yearMonthDuration"],u=0,d=f.length;d>u;u++)l[f[u]]=o;for(var m=["eq","ne","lt","le","gt","ge",":=","=",">",">=","<","<=",".","|","?","and","or","div","idiv","mod","*","/","+","-"],u=0,d=m.length;d>u;u++)l[m[u]]=i;for(var h=["self::","attribute::","child::","descendant::","descendant-or-self::","parent::","ancestor::","ancestor-or-self::","following::","preceding::","following-sibling::","preceding-sibling::"],u=0,d=h.length; d>u; u++)l[h[u]]=s;return l}();return{startState:function(){return{tokenize:r,cc:[],stack:[]}},token:function(e, t){if(e.eatSpace())return null;var r=t.tokenize(e,t);return r},blockCommentStart:"(:",blockCommentEnd:":)"}}),e.defineMIME("application/xquery","xquery")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("yaml",function(){var e=["true","false","on","off","yes","no"],t=new RegExp("\\b(("+e.join(")|(")+"))$","i");return{token:function(e, r){var n=e.peek(),i=r.escaped;if(r.escaped=!1,"#"==n&&(0==e.pos||/\s/.test(e.string.charAt(e.pos-1))))return e.skipToEnd(),"comment";if(e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(r.literal&&e.indentation()>r.keyCol)return e.skipToEnd(),"string";if(r.literal&&(r.literal=!1),e.sol()){if(r.keyCol=0,r.pair=!1,r.pairStart=!1,e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return"{"==n?r.inlinePairs++:"}"==n?r.inlinePairs--:"["==n?r.inlineList++:r.inlineList--,"meta";if(r.inlineList>0&&!i&&","==n)return e.next(),"meta";if(r.inlinePairs>0&&!i&&","==n)return r.keyCol=0,r.pair=!1,r.pairStart=!1,e.next(),"meta";if(r.pairStart){if(e.match(/^\s*(\||\>)\s*/))return r.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==r.inlinePairs&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(r.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!r.pair&&e.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(r.pair=!0,r.keyCol=e.indentation(),"atom"):r.pair&&e.match(/^:\s*/)?(r.pairStart=!0,"meta"):(r.pairStart=!1,r.escaped="\\"==n,e.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),e.defineMIME("text/x-yaml","yaml")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror")):"function"==typeof define&&define.amd?define(["./lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMIME("text/x-erlang","erlang"),e.defineMode("erlang",function(t){function r(e, t){if(t.in_string)return t.in_string=!o(e),u(t,e,"string");if(t.in_atom)return t.in_atom=!a(e),u(t,e,"atom");if(e.eatSpace())return u(t,e,"whitespace");if(!h(t)&&e.match(/-\s*[a-zß-öø-ÿ][\wØ-ÞÀ-Öß-öø-ÿ]*/))return c(e.current(),T)?u(t,e,"type"):u(t,e,"attribute");var r=e.next();if("%"==r)return e.skipToEnd(),u(t,e,"comment");if(":"==r)return u(t,e,"colon");if("?"==r)return e.eatSpace(),e.eatWhile(R),u(t,e,"macro");if("#"==r)return e.eatSpace(),e.eatWhile(R),u(t,e,"record");if("$"==r)return"\\"!=e.next()||e.match(F)?u(t,e,"number"):u(t,e,"error");if("."==r)return u(t,e,"dot");if("'"==r){if(!(t.in_atom=!a(e))){if(e.match(/\s*\/\s*[0-9]/,!1))return e.match(/\s*\/\s*[0-9]/,!0),u(t,e,"fun");if(e.match(/\s*\(/,!1)||e.match(/\s*:/,!1))return u(t,e,"function")}return u(t,e,"atom")}if('"'==r)return t.in_string=!o(e),u(t,e,"string");if(/[A-Z_Ø-ÞÀ-Ö]/.test(r))return e.eatWhile(R),u(t,e,"variable");if(/[a-z_ß-öø-ÿ]/.test(r)){if(e.eatWhile(R),e.match(/\s*\/\s*[0-9]/,!1))return e.match(/\s*\/\s*[0-9]/,!0),u(t,e,"fun");var s=e.current();return c(s,M)?u(t,e,"keyword"):c(s,q)?u(t,e,"operator"):e.match(/\s*\(/,!1)?!c(s,O)||":"==h(t).token&&"erlang"!=h(t,2).token?c(s,$)?u(t,e,"guard"):u(t,e,"function"):u(t,e,"builtin"):c(s,q)?u(t,e,"operator"):":"==l(e)?"erlang"==s?u(t,e,"builtin"):u(t,e,"function"):c(s,["true","false"])?u(t,e,"boolean"):c(s,["true","false"])?u(t,e,"boolean"):u(t,e,"atom")}var d=/[0-9]/,f=/[0-9a-zA-Z]/;return d.test(r)?(e.eatWhile(d),e.eat("#")?e.eatWhile(f)||e.backUp(1):e.eat(".")&&(e.eatWhile(d)?e.eat(/[eE]/)&&(e.eat(/[-+]/)?e.eatWhile(d)||e.backUp(2):e.eatWhile(d)||e.backUp(1)):e.backUp(1)),u(t,e,"number")):n(e,I,P)?u(t,e,"open_paren"):n(e,D,A)?u(t,e,"close_paren"):i(e,L,E)?u(t,e,"separator"):i(e,j,z)?u(t,e,"operator"):u(t,e,null)}function n(e,t,r){if(1==e.current().length&&t.test(e.current())){for(e.backUp(1);t.test(e.peek());)if(e.next(),c(e.current(),r))return!0;e.backUp(e.current().length-1)}return!1}function i(e,t,r){if(1==e.current().length&&t.test(e.current())){for(;t.test(e.peek());)e.next();for(;0r?!1:e.tokenStack[r-n]}function p(e,t){"comment"!=t.type&&"whitespace"!=t.type&&(e.tokenStack=g(e.tokenStack,t),e.tokenStack=v(e.tokenStack))}function g(e,t){var r=e.length-1;return r>0&&"record"===e[r].type&&"dot"===t.type?e.pop():r>0&&"group"===e[r].type?(e.pop(),e.push(t)):e.push(t),e}function v(e){var t=e.length-1;if("dot"===e[t].type)return[];if("fun"===e[t].type&&"fun"===e[t-1].token)return e.slice(0,t-1);switch(e[e.length-1].token){case"}":return b(e,{g:["{"]});case"]":return b(e,{i:["["]});case")":return b(e,{i:["("]});case">>":return b(e,{i:["<<"]});case"end":return b(e,{i:["begin","case","fun","if","receive","try"]});case",":return b(e,{e:["begin","try","when","->",",","(","[","{","<<"]});case"->":return b(e,{r:["when"],m:["try","if","case","receive"]});case";":return b(e,{E:["case","fun","if","receive","try","when"]});case"catch":return b(e,{e:["try"]});case"of":return b(e,{e:["case"]});case"after":return b(e,{e:["receive","try"]});default:return e}}function b(e,t){for(var r in t)for(var n=e.length-1,i=t[r],o=n-1;o>-1;o--)if(c(e[o].token,i)){var a=e.slice(0,o);switch(r){case"m":return a.concat(e[o]).concat(e[n]);case"r":return a.concat(e[n]);case"i":return a;case"g":return a.concat(m("group"));case"E":return a.concat(e[o]);case"e":return a.concat(e[o])}}return"E"==r?[]:e}function y(r,n){var i,o=t.indentUnit,a=x(n),s=h(r,1),l=h(r,2);return r.in_string||r.in_atom?e.Pass:l?"when"==s.token?s.column+o:"when"===a&&"function"===l.type?l.indent+o:"("===a&&"fun"===s.token?s.column+3:"catch"===a&&(i=_(r,["try"]))?i.column:c(a,["end","after","of"])?(i=_(r,["begin","case","fun","if","receive","try"]),i?i.column:e.Pass):c(a,A)?(i=_(r,P),i?i.column:e.Pass):c(s.token,[",","|","||"])||c(a,[",","|","||"])?(i=k(r),i?i.column+i.token.length:o):"->"==s.token?c(l.token,["receive","case","if","try"])?l.column+o+o:l.column+o:c(s.token,P)?s.column+s.token.length:(i=w(r),S(i)?i.column+o:0):0}function x(e){var t=e.match(/,|[a-z]+|\}|\]|\)|>>|\|+|\(/);return S(t)&&0===t.index?t[0]:""}function k(e){var t=e.tokenStack.slice(0,-1),r=C(t,"type",["open_paren"]);return S(t[r])?t[r]:!1}function w(e){var t=e.tokenStack,r=C(t,"type",["open_paren","separator","keyword"]),n=C(t,"type",["operator"]);return S(r)&&S(n)&&n>r?t[r+1]:S(r)?t[r]:!1}function _(e,t){var r=e.tokenStack,n=C(r,"token",t); + +return S(r[n])?r[n]:!1}function C(e,t,r){for(var n=e.length-1;n>-1;n--)if(c(e[n][t],r))return n;return!1}function S(e){return e!==!1&&null!=e}var T=["-type","-spec","-export_type","-opaque"],M=["after","begin","catch","case","cond","end","fun","if","let","of","query","receive","try","when"],L=/[\->,;]/,E=["->",";",","],q=["and","andalso","band","bnot","bor","bsl","bsr","bxor","div","not","or","orelse","rem","xor"],j=/[\+\-\*\/<>=\|:!]/,z=["=","+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-","!"],I=/[<\(\[\{]/,P=["<<","(","[","{"],D=/[>\)\]\}]/,A=["}","]",")",">>"],$=["is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_record","is_reference","is_tuple","atom","binary","bitstring","boolean","function","integer","list","number","pid","port","record","reference","tuple"],O=["abs","adler32","adler32_combine","alive","apply","atom_to_binary","atom_to_list","binary_to_atom","binary_to_existing_atom","binary_to_list","binary_to_term","bit_size","bitstring_to_list","byte_size","check_process_code","contact_binary","crc32","crc32_combine","date","decode_packet","delete_module","disconnect_node","element","erase","exit","float","float_to_list","garbage_collect","get","get_keys","group_leader","halt","hd","integer_to_list","internal_bif","iolist_size","iolist_to_binary","is_alive","is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_process_alive","is_record","is_reference","is_tuple","length","link","list_to_atom","list_to_binary","list_to_bitstring","list_to_existing_atom","list_to_float","list_to_integer","list_to_pid","list_to_tuple","load_module","make_ref","module_loaded","monitor_node","node","node_link","node_unlink","nodes","notalive","now","open_port","pid_to_list","port_close","port_command","port_connect","port_control","pre_loaded","process_flag","process_info","processes","purge_module","put","register","registered","round","self","setelement","size","spawn","spawn_link","spawn_monitor","spawn_opt","split_binary","statistics","term_to_binary","time","throw","tl","trunc","tuple_size","tuple_to_list","unlink","unregister","whereis"],R=/[\w@Ø-ÞÀ-Öß-öø-ÿ]/,F=/[0-7]{1,3}|[bdefnrstv\\"']|\^[a-zA-Z]|x[0-9a-zA-Z]{2}|x{[0-9a-zA-Z]+}/;return{startState:function(){return{tokenStack:[],in_string:!1,in_atom:!1}},token:function(e,t){return r(e,t)},indent:function(e,t){return y(e,t)},lineComment:"%"}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("./lib/codemirror"),require("../javascript/javascript"),require("../css/css"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["./lib/codemirror","../javascript/javascript","../css/css","../htmlmixed/htmlmixed"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("jade",function(t){function r(){this.javaScriptLine=!1,this.javaScriptLineExcludesColon=!1,this.javaScriptArguments=!1,this.javaScriptArgumentsDepth=0,this.isInterpolating=!1,this.interpolationNesting=0,this.jsState=Q.startState(),this.restOfLine="",this.isIncludeFiltered=!1,this.isEach=!1,this.lastTag="",this.scriptType="",this.isAttrs=!1,this.attrsNest=[],this.inAttributeName=!0,this.attributeIsType=!1,this.attrValue="",this.indentOf=1/0,this.indentToken="",this.innerMode=null,this.innerState=null,this.innerModeForLine=!1}function n(e,t){if(e.sol()&&(t.javaScriptLine=!1,t.javaScriptLineExcludesColon=!1),t.javaScriptLine){if(t.javaScriptLineExcludesColon&&":"===e.peek())return t.javaScriptLine=!1,void(t.javaScriptLineExcludesColon=!1);var r=Q.token(e,t.jsState);return e.eol()&&(t.javaScriptLine=!1),r||!0}}function i(e,t){if(t.javaScriptArguments){if(0===t.javaScriptArgumentsDepth&&"("!==e.peek())return void(t.javaScriptArguments=!1);if("("===e.peek()?t.javaScriptArgumentsDepth++:")"===e.peek()&&t.javaScriptArgumentsDepth--,0===t.javaScriptArgumentsDepth)return void(t.javaScriptArguments=!1);var r=Q.token(e,t.jsState);return r||!0}}function o(e){return e.match(/^yield\b/)?"keyword":void 0}function a(e){return e.match(/^(?:doctype) *([^\n]+)?/)?K:void 0}function s(e,t){return e.match("#{")?(t.isInterpolating=!0,t.interpolationNesting=0,"punctuation"):void 0}function l(e,t){if(t.isInterpolating){if("}"===e.peek()){if(t.interpolationNesting--,t.interpolationNesting<0)return e.next(),t.isInterpolating=!1,"puncutation"}else"{"===e.peek()&&t.interpolationNesting++;return Q.token(e,t.jsState)||!0}}function c(e,t){return e.match(/^case\b/)?(t.javaScriptLine=!0,V):void 0}function u(e,t){return e.match(/^when\b/)?(t.javaScriptLine=!0,t.javaScriptLineExcludesColon=!0,V):void 0}function d(e){return e.match(/^default\b/)?V:void 0}function f(e,t){return e.match(/^extends?\b/)?(t.restOfLine="string",V):void 0}function m(e,t){return e.match(/^append\b/)?(t.restOfLine="variable",V):void 0}function h(e,t){return e.match(/^prepend\b/)?(t.restOfLine="variable",V):void 0}function p(e,t){return e.match(/^block\b *(?:(prepend|append)\b)?/)?(t.restOfLine="variable",V):void 0}function g(e,t){return e.match(/^include\b/)?(t.restOfLine="string",V):void 0}function v(e,t){return e.match(/^include:([a-zA-Z0-9\-]+)/,!1)&&e.match("include")?(t.isIncludeFiltered=!0,V):void 0}function b(e,t){if(t.isIncludeFiltered){var r=M(e,t);return t.isIncludeFiltered=!1,t.restOfLine="string",r}}function y(e,t){return e.match(/^mixin\b/)?(t.javaScriptLine=!0,V):void 0}function x(e,t){return e.match(/^\+([-\w]+)/)?(e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),"variable"):e.match(/^\+#{/,!1)?(e.next(),t.mixinCallAfter=!0,s(e,t)):void 0}function k(e,t){return t.mixinCallAfter?(t.mixinCallAfter=!1,e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),!0):void 0}function w(e,t){return e.match(/^(if|unless|else if|else)\b/)?(t.javaScriptLine=!0,V):void 0}function _(e,t){return e.match(/^(- *)?(each|for)\b/)?(t.isEach=!0,V):void 0}function C(e,t){if(t.isEach){if(e.match(/^ in\b/))return t.javaScriptLine=!0,t.isEach=!1,V;if(e.sol()||e.eol())t.isEach=!1;else if(e.next()){for(;!e.match(/^ in\b/,!1)&&e.next(););return"variable"}}}function S(e,t){return e.match(/^while\b/)?(t.javaScriptLine=!0,V):void 0}function T(e,t){var r;return(r=e.match(/^(\w(?:[-:\w]*\w)?)\/?/))?(t.lastTag=r[1].toLowerCase(),"script"===t.lastTag&&(t.scriptType="application/javascript"),"tag"):void 0}function M(r,n){if(r.match(/^:([\w\-]+)/)){var i;return t&&t.innerModes&&(i=t.innerModes(r.current().substring(1))),i||(i=r.current().substring(1)),"string"==typeof i&&(i=e.getMode(t,i)),F(r,n,i),"atom"}}function L(e,t){return e.match(/^(!?=|-)/)?(t.javaScriptLine=!0,"punctuation"):void 0}function E(e){return e.match(/^#([\w-]+)/)?Z:void 0}function q(e){return e.match(/^\.([\w-]+)/)?G:void 0}function j(e,t){return"("==e.peek()?(e.next(),t.isAttrs=!0,t.attrsNest=[],t.inAttributeName=!0,t.attrValue="",t.attributeIsType=!1,"punctuation"):void 0}function z(e,t){if(t.isAttrs){if(X[e.peek()]&&t.attrsNest.push(X[e.peek()]),t.attrsNest[t.attrsNest.length-1]===e.peek())t.attrsNest.pop();else if(e.eat(")"))return t.isAttrs=!1,"punctuation";if(t.inAttributeName&&e.match(/^[^=,\)!]+/))return("="===e.peek()||"!"===e.peek())&&(t.inAttributeName=!1,t.jsState=Q.startState(),"script"===t.lastTag&&"type"===e.current().trim().toLowerCase()?t.attributeIsType=!0:t.attributeIsType=!1),"attribute";var r=Q.token(e,t.jsState);if(t.attributeIsType&&"string"===r&&(t.scriptType=e.current().toString()),0===t.attrsNest.length&&("string"===r||"variable"===r||"keyword"===r))try{return Function("","var x "+t.attrValue.replace(/,\s*$/,"").replace(/^!/,"")),t.inAttributeName=!0,t.attrValue="",e.backUp(e.current().length),z(e,t)}catch(n){}return t.attrValue+=e.current(),r||!0}}function I(e,t){return e.match(/^&attributes\b/)?(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0,"keyword"):void 0}function P(e){return e.sol()&&e.eatSpace()?"indent":void 0}function D(e,t){return e.match(/^ *\/\/(-)?([^\n]*)/)?(t.indentOf=e.indentation(),t.indentToken="comment","comment"):void 0}function A(e){return e.match(/^: */)?"colon":void 0}function $(e,t){return e.match(/^(?:\| ?| )([^\n]+)/)?"string":e.match(/^(<[^\n]*)/,!1)?(F(e,t,"htmlmixed"),t.innerModeForLine=!0,H(e,t,!0)):void 0}function O(e,t){if(e.eat(".")){var r=null;return"script"===t.lastTag&&-1!=t.scriptType.toLowerCase().indexOf("javascript")?r=t.scriptType.toLowerCase().replace(/"|'/g,""):"style"===t.lastTag&&(r="css"),F(e,t,r),"dot"}}function R(e){return e.next(),null}function F(r,n,i){i=e.mimeModes[i]||i,i=t.innerModes?t.innerModes(i)||i:i,i=e.mimeModes[i]||i,i=e.getMode(t,i),n.indentOf=r.indentation(),i&&"null"!==i.name?n.innerMode=i:n.indentToken="string"}function H(e,t,r){return e.indentation()>t.indentOf||t.innerModeForLine&&!e.sol()||r?t.innerMode?(t.innerState||(t.innerState=t.innerMode.startState?t.innerMode.startState(e.indentation()):{}),e.hideFirstChars(t.indentOf+2,function(){return t.innerMode.token(e,t.innerState)||!0})):(e.skipToEnd(),t.indentToken):void(e.sol()&&(t.indentOf=1/0,t.indentToken=null,t.innerMode=null,t.innerState=null))}function N(e,t){if(e.sol()&&(t.restOfLine=""),t.restOfLine){e.skipToEnd();var r=t.restOfLine;return t.restOfLine="",r}}function B(){return new r}function U(e){return e.copy()}function W(e,t){var r=H(e,t)||N(e,t)||l(e,t)||b(e,t)||C(e,t)||z(e,t)||n(e,t)||i(e,t)||k(e,t)||o(e,t)||a(e,t)||s(e,t)||c(e,t)||u(e,t)||d(e,t)||f(e,t)||m(e,t)||h(e,t)||p(e,t)||g(e,t)||v(e,t)||y(e,t)||x(e,t)||w(e,t)||_(e,t)||S(e,t)||T(e,t)||M(e,t)||L(e,t)||E(e,t)||q(e,t)||j(e,t)||I(e,t)||P(e,t)||$(e,t)||D(e,t)||A(e,t)||O(e,t)||R(e,t);return r===!0?null:r}var V="keyword",K="meta",Z="builtin",G="qualifier",X={"{":"}","(":")","[":"]"},Q=e.getMode(t,"javascript");return r.prototype.copy=function(){var t=new r;return t.javaScriptLine=this.javaScriptLine,t.javaScriptLineExcludesColon=this.javaScriptLineExcludesColon,t.javaScriptArguments=this.javaScriptArguments,t.javaScriptArgumentsDepth=this.javaScriptArgumentsDepth,t.isInterpolating=this.isInterpolating,t.interpolationNesting=this.intpolationNesting,t.jsState=e.copyState(Q,this.jsState),t.innerMode=this.innerMode,this.innerMode&&this.innerState&&(t.innerState=e.copyState(this.innerMode,this.innerState)),t.restOfLine=this.restOfLine,t.isIncludeFiltered=this.isIncludeFiltered,t.isEach=this.isEach,t.lastTag=this.lastTag,t.scriptType=this.scriptType,t.isAttrs=this.isAttrs,t.attrsNest=this.attrsNest.slice(),t.inAttributeName=this.inAttributeName,t.attributeIsType=this.attributeIsType,t.attrValue=this.attrValue,t.indentOf=this.indentOf,t.indentToken=this.indentToken,t.innerModeForLine=this.innerModeForLine,t},{startState:B,copyState:U,token:W}}),e.defineMIME("text/x-jade","jade")}); \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/codemirror/package.json b/src/main/resources/templates/editor/lib/codemirror/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b4a9b53fe6d2a55ef0dc58ac5dc3ecabe66d553f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/package.json @@ -0,0 +1,21 @@ +{ + "name": "codemirror", + "version":"5.0.0", + "main": "lib/codemirror.js", + "description": "In-browser code editing made bearable", + "licenses": [{"type": "MIT", + "url": "http://codemirror.net/LICENSE"}], + "directories": {"lib": "./lib"}, + "scripts": {"test": "node ./test/run.js"}, + "devDependencies": {"node-static": "0.6.0", + "phantomjs": "1.9.2-5", + "blint": ">=0.1.1"}, + "bugs": "http://github.com/codemirror/CodeMirror/issues", + "keywords": ["JavaScript", "CodeMirror", "Editor"], + "homepage": "http://codemirror.net", + "maintainers":[{"name": "Marijn Haverbeke", + "email": "marijnh@gmail.com", + "web": "http://marijnhaverbeke.nl"}], + "repository": {"type": "git", + "url": "https://github.com/codemirror/CodeMirror.git"} +} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/3024-day.css b/src/main/resources/templates/editor/lib/codemirror/theme/3024-day.css new file mode 100644 index 0000000000000000000000000000000000000000..359281621bc2a12d67a0811236d625fd8adf494d --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/3024-day.css @@ -0,0 +1,40 @@ +/* + + Name: 3024 day + Author: Jan T. Sott (http://github.com/idleberg) + + CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) + Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) + +*/ + +.cm-s-3024-day.CodeMirror {background: #f7f7f7; color: #3a3432;} +.cm-s-3024-day div.CodeMirror-selected {background: #d6d5d4 !important;} +.cm-s-3024-day.CodeMirror ::selection { background: #d6d5d4; } +.cm-s-3024-day.CodeMirror ::-moz-selection { background: #d9d9d9; } + +.cm-s-3024-day .CodeMirror-gutters {background: #f7f7f7; border-right: 0px;} +.cm-s-3024-day .CodeMirror-guttermarker { color: #db2d20; } +.cm-s-3024-day .CodeMirror-guttermarker-subtle { color: #807d7c; } +.cm-s-3024-day .CodeMirror-linenumber {color: #807d7c;} + +.cm-s-3024-day .CodeMirror-cursor {border-left: 1px solid #5c5855 !important;} + +.cm-s-3024-day span.cm-comment {color: #cdab53;} +.cm-s-3024-day span.cm-atom {color: #a16a94;} +.cm-s-3024-day span.cm-number {color: #a16a94;} + +.cm-s-3024-day span.cm-property, .cm-s-3024-day span.cm-attribute {color: #01a252;} +.cm-s-3024-day span.cm-keyword {color: #db2d20;} +.cm-s-3024-day span.cm-string {color: #fded02;} + +.cm-s-3024-day span.cm-variable {color: #01a252;} +.cm-s-3024-day span.cm-variable-2 {color: #01a0e4;} +.cm-s-3024-day span.cm-def {color: #e8bbd0;} +.cm-s-3024-day span.cm-bracket {color: #3a3432;} +.cm-s-3024-day span.cm-tag {color: #db2d20;} +.cm-s-3024-day span.cm-link {color: #a16a94;} +.cm-s-3024-day span.cm-error {background: #db2d20; color: #5c5855;} + +.cm-s-3024-day .CodeMirror-activeline-background {background: #e8f2ff !important;} +.cm-s-3024-day .CodeMirror-matchingbracket { text-decoration: underline; color: #a16a94 !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/3024-night.css b/src/main/resources/templates/editor/lib/codemirror/theme/3024-night.css new file mode 100644 index 0000000000000000000000000000000000000000..ccab9d50bfa3e20923acbdfbe65bff60a6d2adc7 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/3024-night.css @@ -0,0 +1,39 @@ +/* + + Name: 3024 night + Author: Jan T. Sott (http://github.com/idleberg) + + CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) + Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) + +*/ + +.cm-s-3024-night.CodeMirror {background: #090300; color: #d6d5d4;} +.cm-s-3024-night div.CodeMirror-selected {background: #3a3432 !important;} +.cm-s-3024-night.CodeMirror ::selection { background: rgba(58, 52, 50, .99); } +.cm-s-3024-night.CodeMirror ::-moz-selection { background: rgba(58, 52, 50, .99); } +.cm-s-3024-night .CodeMirror-gutters {background: #090300; border-right: 0px;} +.cm-s-3024-night .CodeMirror-guttermarker { color: #db2d20; } +.cm-s-3024-night .CodeMirror-guttermarker-subtle { color: #5c5855; } +.cm-s-3024-night .CodeMirror-linenumber {color: #5c5855;} + +.cm-s-3024-night .CodeMirror-cursor {border-left: 1px solid #807d7c !important;} + +.cm-s-3024-night span.cm-comment {color: #cdab53;} +.cm-s-3024-night span.cm-atom {color: #a16a94;} +.cm-s-3024-night span.cm-number {color: #a16a94;} + +.cm-s-3024-night span.cm-property, .cm-s-3024-night span.cm-attribute {color: #01a252;} +.cm-s-3024-night span.cm-keyword {color: #db2d20;} +.cm-s-3024-night span.cm-string {color: #fded02;} + +.cm-s-3024-night span.cm-variable {color: #01a252;} +.cm-s-3024-night span.cm-variable-2 {color: #01a0e4;} +.cm-s-3024-night span.cm-def {color: #e8bbd0;} +.cm-s-3024-night span.cm-bracket {color: #d6d5d4;} +.cm-s-3024-night span.cm-tag {color: #db2d20;} +.cm-s-3024-night span.cm-link {color: #a16a94;} +.cm-s-3024-night span.cm-error {background: #db2d20; color: #807d7c;} + +.cm-s-3024-night .CodeMirror-activeline-background {background: #2F2F2F !important;} +.cm-s-3024-night .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/ambiance-mobile.css b/src/main/resources/templates/editor/lib/codemirror/theme/ambiance-mobile.css new file mode 100644 index 0000000000000000000000000000000000000000..88d332e1a79c7d763701d2331d33bbc3c5d5301a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/ambiance-mobile.css @@ -0,0 +1,5 @@ +.cm-s-ambiance.CodeMirror { + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/ambiance.css b/src/main/resources/templates/editor/lib/codemirror/theme/ambiance.css new file mode 100644 index 0000000000000000000000000000000000000000..afcf15a37af5bb3752a4f788d0886855a4ae850a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/ambiance.css @@ -0,0 +1,75 @@ +/* ambiance theme for codemirror */ + +/* Color scheme */ + +.cm-s-ambiance .cm-keyword { color: #cda869; } +.cm-s-ambiance .cm-atom { color: #CF7EA9; } +.cm-s-ambiance .cm-number { color: #78CF8A; } +.cm-s-ambiance .cm-def { color: #aac6e3; } +.cm-s-ambiance .cm-variable { color: #ffb795; } +.cm-s-ambiance .cm-variable-2 { color: #eed1b3; } +.cm-s-ambiance .cm-variable-3 { color: #faded3; } +.cm-s-ambiance .cm-property { color: #eed1b3; } +.cm-s-ambiance .cm-operator {color: #fa8d6a;} +.cm-s-ambiance .cm-comment { color: #555; font-style:italic; } +.cm-s-ambiance .cm-string { color: #8f9d6a; } +.cm-s-ambiance .cm-string-2 { color: #9d937c; } +.cm-s-ambiance .cm-meta { color: #D2A8A1; } +.cm-s-ambiance .cm-qualifier { color: yellow; } +.cm-s-ambiance .cm-builtin { color: #9999cc; } +.cm-s-ambiance .cm-bracket { color: #24C2C7; } +.cm-s-ambiance .cm-tag { color: #fee4ff } +.cm-s-ambiance .cm-attribute { color: #9B859D; } +.cm-s-ambiance .cm-header {color: blue;} +.cm-s-ambiance .cm-quote { color: #24C2C7; } +.cm-s-ambiance .cm-hr { color: pink; } +.cm-s-ambiance .cm-link { color: #F4C20B; } +.cm-s-ambiance .cm-special { color: #FF9D00; } +.cm-s-ambiance .cm-error { color: #AF2018; } + +.cm-s-ambiance .CodeMirror-matchingbracket { color: #0f0; } +.cm-s-ambiance .CodeMirror-nonmatchingbracket { color: #f22; } + +.cm-s-ambiance .CodeMirror-selected { background: rgba(255, 255, 255, 0.15); } +.cm-s-ambiance.CodeMirror-focused .CodeMirror-selected { background: rgba(255, 255, 255, 0.10); } +.cm-s-ambiance.CodeMirror ::selection { background: rgba(255, 255, 255, 0.10); } +.cm-s-ambiance.CodeMirror ::-moz-selection { background: rgba(255, 255, 255, 0.10); } + +/* Editor styling */ + +.cm-s-ambiance.CodeMirror { + line-height: 1.40em; + color: #E6E1DC; + background-color: #202020; + -webkit-box-shadow: inset 0 0 10px black; + -moz-box-shadow: inset 0 0 10px black; + box-shadow: inset 0 0 10px black; +} + +.cm-s-ambiance .CodeMirror-gutters { + background: #3D3D3D; + border-right: 1px solid #4D4D4D; + box-shadow: 0 10px 20px black; +} + +.cm-s-ambiance .CodeMirror-linenumber { + text-shadow: 0px 1px 1px #4d4d4d; + color: #111; + padding: 0 5px; +} + +.cm-s-ambiance .CodeMirror-guttermarker { color: #aaa; } +.cm-s-ambiance .CodeMirror-guttermarker-subtle { color: #111; } + +.cm-s-ambiance .CodeMirror-lines .CodeMirror-cursor { + border-left: 1px solid #7991E8; +} + +.cm-s-ambiance .CodeMirror-activeline-background { + background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.031); +} + +.cm-s-ambiance.CodeMirror, +.cm-s-ambiance .CodeMirror-gutters { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ2cBDbmtHA043VFhHwXxClWmeYAdLhV00Bd85go8VmaFCkbVkzlQENzfBDZ5gtN7HwF0KDrTwJ0dypSOzpaKCMwQHKTIreYIxlmhXTzTWkVm+LTynZhiSBT3RZQ7aGfjGEd3qyXQ1FDymqbKxpspERQN2MiRjNZlFFQXfCNFm9nM1zpAsoYjmtRTc5ajwuaXc5xrWskT97RaKzAGe5ARHhVUsDbjKklziiX5WROcJwSNCNI+9w1Jwv4Zb2r7lCMZ4oq5C0EdTx+2GzNuKpJ+iFf38JEWkHJn9DNF7mmBDITrWEg0VWL3pHU20tSZnuqWu+R3BtYa8XxV1HO7GyD32UkOpL/yDloINFTmvtId+nmAjxRw40VMwVKiwrKLE4bK5UOVntYwhOcSSXKrJHKPJedocpGjVz/ZMIbnYUPB10/eKCrs5apqpgVmWzBYWpmtKHecJPjaUuEgRDDaU0oZghCJ6zNMQ5ZhDYx05r5v2muQdM0EILtXUsaKiQX9WMEUotagQzFbUNN6NUPC2nm5pxEWGCjMc3GdJHjSU2kORLK/JGSrkfGEIjncU/CYUnOipoYemwj8tST9NsJmB7TUVXtbUtXATJVZXBMvYeTXJfobgJUPmGMP/yFaWonaa6BcFO3nqcIqCozSZoZoSr1g4zJOzuyGnxTEX3lUEJ7WcZgme8ddaWvWJo2AJR9DZU3CUIbhCSG6ybSwN6qtJVnCU2svDTP2ZInOw2cBTrqtQahtNZn9NcJ4l2NaSmSkkP1noZWnVwkLmdUPOwLZEwy2Z3S3R+4rIG9hcbpPXHFVWcQdZkn2FOta3cKWQnNRC5g1LsJah4GCzSVsKnCOY5OAFRTBekyyryeyilhFKva75r4Mc0aWanGEaThcy31s439KKxTzJYY5WTHPU1FtIHjQU3Oip4xlNzj/lBw23dYZVliQa7WAXf4shetcQfatI+jWRDBPmyNeW6A1P5kdDgyYJlba0BIM8BZu1JfrFwItyjcAMR3K0BWOIrtMEXyhyrlVEx3ui5dUBjmB/Q3CXW85R4mBD0s7B+4q5tKUjOlb9qqmhi5AZ6GFIC5HXtOobdYGlVdMVbNJ8toNTFcHxnoL+muBagcctjWnbNMuR00uI7nQESwg5q2qqrKWIfrNUmeQocY6HuyxJV02wj36w00yhpmUFenv4p6fUkZYqLyuinx2RGOjhCXYyJF84oiU00YMOOhhquNdfbOB7gU88pY4xJO8LVdp6/q2voeB4R04vIdhSE40xZObx1HGGJ/ja0LBthFInKaLPPFzuCaYaoj8JjPME8yoyxo6zlBqkiUZYgq00OYMswbWO5NGmq+xhipxHLRW29ARjNKXO0wRnear8XSg4XFPLKEPUS1GqvyLwiuBUoa7zpZ0l5xxFwWmWZC1H5h5FwU8eQ7K+g8UcVY6TMQreVQT/8uQ8Z+ALIXnSEa2pYZQneE9RZbSBNYXfWYJzW/h/4j4Dp1tYVcFIC5019Vyi4ThPqSFCzjGWaHQTBU8q6vrVwgxP9Lkm840imWKpcLCjYTtrKuwvsKSnrvHCXGkSMk9p6lhckfRpIeis+N2PiszT+mFLspyGleUhDwcLrZqmyeylxwjBcKHEapqkmyangyLZRVOijwOtCY5SsG5zL0OwlCJ4y5KznF3EUNDDrinwiyLZRzOXtlBbK5ITHFGLp8Q0R6ab6mS7enI2cFrxOyHvOCFaT1HThS1krjCwqWeurCkk+willhCC+RSZnRXBiZaC5RXRIZYKp2lyfrHwiKPKR0JDzrdU2EFgpidawlFDR6FgXUMNa+g1FY3bUQh2cLCwosRdnuQTS/S+JVrGLeWIvtQUvONJxlqSQYYKpwoN2kaocLjdVsis4Mk80ESF2YpSkzwldjHkjFCUutI/r+EHDU8oCs6yzL3PhWiEooZdFMkymlas4AcI3KmoMMNSQ3tHzjGWCrcJJdYyZC7QFGwjRL9p+MrRkAGWzIaWCn9W0F3TsK01c2ZvQw0byvxuQU0r1lM0qJO7wW0kRIMdDTtXEdzi4VIh+EoIHm0mWtAtpCixlabgn83fKTI7anJe9ST7WIK1DMGpQmYeA58ImV6ezOGOzK2Kgq01pd60cKWiUi9Lievb/0vIDPHQ05Kzt4ddPckQBQtoaurjyHnek/nKzpQLrVgKPjIkh2v4uyezpv+Xoo7fPFXaGFp1vaLKxQ4uUpQQS5VuQs7BCq4xRJv7fwpVvvFEB3j+620haOuocqMhWd6TTPAEx+mdFNGHdranFe95WrWmIvlY4F1Dle2ECgc6cto7SryuqGGGha0tFQ5V53migUKmg6XKAo4qS3mik+0OZpAhOLeZKicacgaYcyx5hypYQE02ZA4xi/pNhOQxR4klNKyqacj+mpxnLTnnGSo85++3ZCZq6lrZkXlGEX3o+C9FieccJbZWVFjC0Yo1FZnJhoYMFoI1hEZ9r6hwg75HwzBNhbZCdJEfJwTPGzJvaKImw1yYX1HDAmpXR+ZJQ/SmgqMNVQb5vgamGwLtt7VwvP7Qk1xpiM5x5Cyv93E06MZmgs0Nya2azIKOYKCGBQQW97RmhKNKF02JZqHEJ4o58qp7X5EcZmc56trXEqzjCBZ1MFGR87Ql2tSTs6CGxS05PTzRQorkbw7aKoKXFDXsYW42VJih/q+FP2BdTzDTwVqOYB13liM50vG7wy28qagyuIXMeQI/Oqq8bcn5wJI50xH00CRntyfpL1T4hydYpoXgNiFzoIUTDZnLNRzh4TBHwbYGDvZkxmlyJloyr6tRihpeUG94GnKtIznREF0tzJG/OOr73JBcrSh1k6WuTprgLU+mnSGnv6Zge0NNz+kTDdH8nuAuTdJDCNb21LCiIuqlYbqGzT3RAoZofQfjFazkqeNWdYaGvYTM001EW2oKPvVk1ldUGSgUtHFwjKM1h9jnFcmy5lChoLNaQMGGDsYbKixlaMBmmsx1QjCfflwTfO/gckW0ruZ3jugKR3R5W9hGUWqCgxuFgsuaCHorotGKzGaeZB9DMsaTnKCpMtwTvOzhYk0rdrArKCqcaWmVk1+F372ur1YkKxgatI8Qfe1gIX9wE9FgS8ESmuABIXnRUbCapcKe+nO7slClSZFzpV/LkLncEb1qiO42fS3R855Su2mCLh62t1SYZZYVmKwIHjREF2uihTzB20JOkz7dkxzYQnK0UOU494wh+VWRc6Un2kpTaVgLDFEkJ/uhzRcI0YKGgpGWOlocBU/a4fKoJ/pEaNV6jip3+Es9VXY078rGnmAdf7t9ylPXS34RBSuYPs1UecZTU78WanhBCHpZ5sAoTz0LGZKjPf9TRypqWEiTvOFglL1fCEY3wY/++rbk7C8bWebA6p6om6PgOL2kp44TFJlVNBXae2rqqdZztOJpT87GQsE9jqCPIe9VReZuQ/CIgacsyZdCpIScSYqcZk8r+nsyCzhyfhOqHGOIvrLknC8wTpFcaYiGC/RU1NRbUeUpocQOnkRpGOrIOcNRx+1uA0UrzhSSt+VyS3SJpnFWkzNDqOFGIWcfR86DnmARTQ1HKIL33ExPiemeOhYSSjzlSUZZuE4TveoJLnBUOFof6KiysCbnAEcZgcUNTDOwkqWu3RWtmGpZwlHhJENdZ3miGz0lJlsKnjbwqSHQjpxnFDlTLLwqJPMZMjd7KrzkSG7VsxXBZE+F8YZkb01Oe00yyRK9psh5SYh29ySPKBo2ylNht7ZkZnsKenjKNJu9PNEyZpaCHv4Kt6RQsLvAVp7M9kIimmCUwGeWqLMmGuIotYMmWNpSahkhZw9FqZsVnKJhsjAHvtHMsTM9fCI06Dx/u3vfUXCqfsKRc4oFY2jMsoo/7DJDwZ1CsIKnJu+J9ldkpmiCxQx1rWjI+T9FwcWWzOuaYH0Hj7klNRVWEQpmaqosakiGNTFHdjS/qnUdmf0NJW5xsL0HhimCCZZSRzmSPTXJQ4aaztAwtZnoabebJ+htCaZ7Cm535ByoqXKbX1WRc4Eh2MkRXWzImVc96Cj4VdOKVxR84VdQsIUM8Psoou2byVHyZFuq7O8otbSQ2UAoeEWTudATLGSpZzVLlXVkPU2Jc+27lsw2jmg5T5VhbeE3BT083K9WsTTkFU/Osi0rC5lRlpwRHUiesNS0sOvmqGML1aRbPAxTJD9ZKtxuob+hhl8cwYGWpJ8nub7t5p6coYbMovZ1BTdaKn1jYD6h4GFDNFyT/Kqe1XCXphXHOKLZmuRSRdBPEfVUXQzJm5YGPGGJdvAEr7hHNdGZnuBvrpciGmopOLf5N0uVMy0FfYToJk90uUCbJupaVpO53UJXR2bVpoU00V2KOo4zMFrBd0Jtz2pa0clT5Q5L8IpQ177mWQejPMEJhuQjS10ref6HHjdEhy1P1EYR7GtO0uSsKJQYLiTnG1rVScj5lyazpqWGl5uBbRWl7m6ixGOOnEsMJR7z8J0n6KMnCdxhiNYQCoZ6CmYLnO8omC3MkW3bktlPmEt/VQQHejL3+dOE5FlPdK/Mq8hZxxJtLyRrepLThYKbLZxkSb5W52vYxNOaOxUF0yxMUPwBTYqCzy01XayYK0sJyWBLqX0MwU5CzoymRzV0EjjeUeLgDpTo6ij42ZAzvD01dHUUTPLU96MdLbBME8nFBn7zJCMtJcZokn8YoqU0FS5WFKyniHobguMcmW8N0XkWZjkyN3hqOMtS08r+/xTBwpZSZ3qiVRX8SzMHHjfUNFjgHEPmY9PL3ykEzxkSre/1ZD6z/NuznuB0RcE1TWTm9zRgfUWVJiG6yrzgmWPXC8EAR4Wxhlad0ZbgQyEz3pG5RVEwwDJH2mgKpjcTiCOzn1lfUWANFbZ2BA8balnEweJC9J0iuaeZoI+ippFCztEKVvckR2iice1JvhVytrQwUAZpgsubCPaU7xUe9vWnaOpaSBEspalykhC9bUlOMpT42ZHca6hyrqKmw/wMR8H5ZmdFoBVJb03O4UL0tSNnvIeRmkrLWqrs78gcrEn2tpcboh0UPOW3UUR9PMk4T4nnNKWmCjlrefhCwxRNztfmIQVdDElvS4m1/WuOujoZCs5XVOjtKPGokJzsYCtFYoWonSPT21DheU/wWhM19FcElwqNGOsp9Q8N/cwXaiND1MmeL1Q5XROtYYgGeFq1aTMsoMmcrKjQrOFQTQ1fmBYhmW6o8Jkjc7iDJRTBIo5kgJD5yMEYA3srCg7VFKwiVJkmRCc5ohGOKhsYMn/XBLdo5taZjlb9YAlGWRimqbCsoY7HFAXLa5I1HPRxMMsQDHFkWtRNniqT9UEeNjcE7RUlrCJ4R2CSJuqlKHWvJXjAUNcITYkenuBRB84TbeepcqTj3zZyFJzgYQdHnqfgI0ddUwS6GqWpsKWhjq9cV0vBAEMN2znq+EBfIWT+pClYw5xsTlJU6GeIBsjGmmANTzJZiIYpgrM0Oa8ZMjd7NP87jxhqGOhJlnQtjuQpB+8aEE00wZFznSJPyHxgH3HkPOsJFvYk8zqCHzTs1BYOa4J3PFU+UVRZxlHDM4YavlNUuMoRveiZA2d7grMNc2g+RbSCEKzmgYsUmWmazFJyoiOZ4KnyhKOGRzWJa0+moyV4TVHDzn51Awtqaphfk/lRQ08FX1iiqxTB/kLwd0VynKfEvI6cd4XMV5bMhZ7gZUWVzYQ6Nm2BYzxJbw3bGthEUUMfgbGeorae6DxHtJoZ6alhZ0+ytiVoK1R4z5PTrOECT/SugseEOlb1MMNR4VRNcJy+V1Hg9ONClSZFZjdHlc6W6FBLdJja2MC5hhpu0DBYEY1TFGwiFAxRRCsYkiM9JRb0JNMVkW6CZYT/2EiTGWmo8k+h4FhDNE7BvppoTSFnmCV5xZKzvcCdDo7VVPnIU+I+Rc68juApC90MwcFCsJ5hDqxgScYKreruyQwTqrzoqDCmhWi4IbhB0Yrt3RGa6GfDv52rKXWhh28dyZaWUvcZeMTBaZoSGyiCtRU5J8iviioHaErs7Jkj61syVzTTgOcUOQ8buFBTYWdL5g3T4qlpe0+wvD63heAXRfCCIed9RbCsp2CiI7raUOYOTU13N8PNHvpaGvayo4a3LLT1lDrVEPT2zLUlheB1R+ZTRfKWJ+dcocLJfi11vyJ51lLqJ0WD7tRwryezjiV5W28uJO9qykzX8JDe2lHl/9oyBwa2UMfOngpXCixvKdXTk3wrsKmiVYdZIqsoWEERjbcUNDuiaQomGoIbFdEHmsyWnuR+IeriKDVLnlawlyNHKwKlSU631PKep8J4Q+ayjkSLKYLhalNHlYvttb6fHm0p6OApsZ4l2VfdqZkjuysy6ysKLlckf1KUutCTs39bmCgEyyoasIWlVaMF7mgmWtBT8Kol5xpH9IGllo8cJdopcvZ2sImlDmMIbtDk3KIpeNiS08lQw11NFPTwVFlPP6pJ2gvRfI7gQUfmNAtf6Gs0wQxDsKGlVBdF8rCa3jzdwMaGHOsItrZk7hAyOzpK9VS06j5F49b0VNGOOfKs3lDToMsMBe9ZWtHFEgxTJLs7qrygKZjUnmCYoeAqeU6jqWuLJup4WghOdvCYJnrSkSzoyRkm5M2StQwVltPkfCAk58tET/CSg+8MUecmotMEnhBKfWBIZsg2ihruMJQaoIm+tkTLKEqspMh00w95gvFCQRtDwTT1gVDDSEVdlwqZfxoQRbK0g+tbiBZxzKlpnpypejdDwTaeOvorMk/IJE10h9CqRe28hhLbe0pMsdSwv4ZbhKivo2BjDWfL8UKJgeavwlwb5KlwhyE4u4XkGE2ytZCznKLCDZZq42VzT8HLCrpruFbIfOIINmh/qCdZ1ZBc65kLHR1Bkyf5zn6pN3SvGKIlFNGplhrO9QSXanLOMQTLCa0YJCRrCZm/CZmrLTm7WzCK4GJDiWUdFeYx1LCFg3NMd0XmCuF3Y5rITLDUsYS9zoHVzwnJoYpSTQoObyEzr4cFBNqYTopoaU/wkyLZ2lPhX/5Y95ulxGTV7KjhWrOZgl8MyUUafjYraNjNU1N3IWcjT5WzWqjwtoarHSUObGYO3GCJZpsBlnJGPd6ZYLyl1GdCA2625IwwJDP8GUKymbzuyPlZlvTUsaUh5zFDhRWFzPKKZLAlWdcQbObgF9tOqOsmB1dqcqYJmWstFbZRRI9poolmqiLnU0POvxScpah2iSL5UJNzgScY5+AuIbpO0YD3NCW+dLMszFSdFCWGqG6eVq2uYVNDdICGD6W7EPRWZEY5gpsE9rUkS3mijzzJnm6UpUFXG1hCUeVoS5WfNcFpblELL2qqrCvMvRfd45oalvKU2tiQ6ePJOVMRXase9iTtLJztPxJKLWpo2CRDcJwn2sWSLKIO1WQWNTCvpVUvOZhgSC40JD0dOctaSqzkCRbXsKlb11Oip6PCJ0IwSJM31j3akRxlP7Rwn6aGaUL0qiLnJkvB3xWZ2+Q1TfCwpQH3G0o92UzmX4o/oJNQMMSQc547wVHhdk+VCw01DFYEnTxzZKAm74QmeNNR1w6WzEhNK15VJzuCdxQ53dRUDws5KvwgBMOEgpcVNe0hZI6RXT1Jd0cyj5nsaEAHgVmGaJIlWdsc5Ui2ElrRR6jrRAttNMEAIWrTDFubkZaok7/AkzfIwfuWVq0jHzuCK4QabtLUMVPB3kJ0oyHTSVFlqMALilJf2Rf8k5aaHtMfayocLBS8L89oKoxpJvnAkDPa0qp5DAUTHKWmCcnthlou8iCKaFFLHWcINd1nyIwXqrSxMNmSs6KmoL2QrKuWtlQ5V0120xQ5vRyZS1rgFkWwhiOwiuQbR0OOVhQM9iS3tiXp4RawRPMp5tDletOOBL95MpM01dZTBM9pkn5qF010rIeHFcFZhmSGpYpTsI6nwhqe5C9ynhlpp5ophuRb6WcJFldkVnVEwwxVfrVkvnWUuNLCg5bgboFHPDlDPDmnK7hUrWiIbjadDclujlZcaokOFup4Ri1kacV6jmrrK1hN9bGwpKEBQ4Q6DvIUXOmo6U5LqQM6EPyiKNjVkPnJkDPNEaxhiFay5ExW1NXVUGqcpYYdPcGiCq7z/TSlbhL4pplWXKd7NZO5QQFrefhRQW/NHOsqcIglc4UhWklR8K0QzbAw08CBDnpbgqXdeD/QUsM4RZXDFBW6WJKe/mFPdH0LtBgiq57wFLzlyQzz82qYx5D5WJP5yVJDW01BfyHnS6HKO/reZqId1WGa4Hkh2kWodJ8i6KoIPlAj2hPt76CzXsVR6koPRzWTfKqIentatYpQw2me4AA3y1Kind3SwoOKZDcFXTwl9tWU6mfgRk9d71sKtlNwrjnYw5tC5n5LdKiGry3JKNlHEd3oaMCFHrazBPMp/uNJ+V7IudcSbeOIdjUEdwl0VHCOZo5t6YluEuaC9mQeMgSfOyKnYGFHcIeQ84yQWbuJYJpZw5CzglDH7gKnWqqM9ZTaXcN0TeYhR84eQtJT76JJ1lREe7WnnvsMmRc9FQ7SBBM9mV3lCUdmHk/S2RAMt0QjFNFqQpWjDPQ01DXWUdDBkXziKPjGEP3VP+zIWU2t7im41FOloyWzn/L6dkUy3VLDaZ6appgDLHPjJEsyvJngWEPUyVBiAaHCTEXwrLvSEbV1e1gKJniicWorC1MUrVjB3uDhJE/wgSOzk1DXpk0k73qCM8xw2UvD5kJmDUfOomqMpWCkJRlvKXGmoeBm18USjVIk04SClxTB6YrgLAPLWYK9HLUt5cmc0vYES8GnTeRc6skZbQkWdxRsIcyBRzx1DbTk9FbU0caTPOgJHhJKnOGIVhQqvKmo0llRw9sabrZkDtdg3PqaKi9oatjY8B+G371paMg6+mZFNNtQ04mWBq3rYLOmtWWQp8KJnpy9DdFensyjdqZ+yY40VJlH8wcdLzC8PZnvHMFUTZUrDTkLyQaGus5X5LzpYAf3i+e/ZlhqGqWhh6Ou6xTR9Z6oi5AZZtp7Mj2EEm8oSpxiYZCHU/1fbGdNNNRRoZMhmilEb2gqHOEJDtXkHK/JnG6IrvbPCwV3NhONVdS1thBMs1T4QOBcTWa2IzhMk2nW5Kyn9tXUtpv9RsG2msxk+ZsQzRQacJncpgke0+T8y5Fzj8BiGo7XlJjaTIlpQs7KFjpqGnKuoyEPeIKnFMkZHvopgh81ySxNFWvJWcKRs70j2FOT012IllEEO1n4pD1513Yg2ssQPOThOkvyrqHUdEXOSEsihmBbTbKX1kLBPWqWkLOqJbjB3GBIZmoa8qWl4CG/iZ7oiA72ZL7TJNeZUY7kFQftDcHHluBzRbCegzMtrRjVQpX2lgoPKKLJAkcbMl01XK2p7yhL8pCBbQ3BN2avJgKvttcrWDK3CiUOVxQ8ZP+pqXKyIxnmBymCg5vJjNfkPK4+c8cIfK8ocVt7kmfd/I5SR1hKvCzUtb+lhgc00ZaO6CyhIQP1Uv4yIZjload72PXX0OIJvnFU+0Zf6MhsJwTfW0r0UwQfW4LNLZl5HK261JCZ4qnBaAreVAS3WrjV0LBnNDUNNDToCEeFfwgcb4gOEqLRhirWkexrCEYKVV711DLYEE1XBEsp5tpTGjorkomKYF9FDXv7fR3BGwbettSxnyL53MBPjsxDZjMh+VUW9NRxq1DhVk+FSxQcaGjV9Pawv6eGByw5qzoy7xk4RsOShqjJwWKe/1pEEfzkobeD/dQJmpqedcyBTy2sr4nGNRH0c0SPWTLrqAc0OQcb/gemKgqucQT7ySWKCn2EUotoCvpZct7RO2sy/QW0IWcXd7pQRQyZVwT2USRO87uhjioTLKV2brpMUcMQRbKH/N2T+UlTpaMls6cmc6CCNy3JdYYSUzzJQ4oSD3oKLncULOiJvjBEC2oqnCJkJluCYy2ZQ5so9YYlZ1VLlQU1mXEW1jZERwj/MUSRc24TdexlqLKfQBtDTScJUV8FszXBEY5ktpD5Ur9hYB4Nb1iikw3JoYpkKX+RodRKFt53MMuRnKSpY31PwYaGaILh3wxJGz9TkTPEETxoCWZrgvOlmyMzxFEwVJE5xZKzvyJ4WxEc16Gd4Xe3Weq4XH2jKRikqOkGQ87hQnC7wBmGYLAnesX3M+S87eFATauuN+Qcrh7xIxXJbUIdMw3JGE3ylCWzrieaqCn4zhGM19TQ3z1oH1AX+pWEqIc7wNGAkULBo/ZxRaV9NNyh4Br3rCHZzbzmSfawBL0dNRwpW1kK9mxPXR9povcdrGSZK9c2k0xwFGzjuniCtRSZCZ6ccZ7gaktmgAOtKbG/JnOkJrjcQTdFMsxRQ2cLY3WTIrlCw1eWKn8R6pvt4GFDso3QoL4a3nLk3G6JrtME3dSenpx7PNFTmga0EaJTLQ061sEeQoWXhSo9LTXsaSjoJQRXeZLtDclbCrYzfzHHeaKjHCVOUkQHO3JeEepr56mhiyaYYKjjNU+Fed1wS5VlhWSqI/hYUdDOkaxiKehoyOnrCV5yBHtbWFqTHCCwtpDcYolesVR5yUzTZBb3RNMd0d6WP+SvhuBmRcGxnuQzT95IC285cr41cLGQ6aJJhmi4TMGempxeimBRQw1tFKV+8jd6KuzoSTqqDxzRtpZkurvKEHxlqXKRIjjfUNNXQsNOsRScoWFLT+YeRZVD3GRN0MdQcKqQjHDMrdGGVu3iYJpQx3WGUvfbmxwFfR20WBq0oYY7LMFhhgYtr8jpaEnaOzjawWWaTP8mMr0t/EPDPoqcnxTBI5o58L7uoWnMrpoqPwgVrlAUWE+V+TQl9rawoyP6QGAlQw2TPRX+YSkxyBC8Z6jhHkXBgQL7WII3DVFnRfCrBfxewv9D6xsyjys4VkhWb9pUU627JllV0YDNHMku/ldNMMXDEo4aFnAkk4U6frNEU4XgZUPmEKHUl44KrzmYamjAbh0JFvGnaTLPu1s9jPCwjFpYiN7z1DTOk/nc07CfDFzmCf7i+bfNHXhDtLeBXzTBT5rkMvWOIxpl4EMh2LGJBu2syDnAEx2naEhHDWMMzPZEhygyS1mS5RTJr5ZkoKbEUoYqr2kqdDUE8ztK7OaIntJkFrIECwv8LJTaVx5XJE86go8dFeZ3FN3rjabCAYpoYEeC9zzJVULBbmZhDyd7ko09ydpNZ3nm2Kee4FPPXHnYEF1nqOFEC08LUVcDvYXkJHW8gTaKCk9YGOeIJhqiE4ToPEepdp7IWFjdwnWaufGMwJJCMtUTTBBK9BGCOy2tGGrJTHIwyEOzp6aPzNMOtlZkDvcEWpP5SVNhfkvDxhmSazTJXYrM9U1E0xwFVwqZQwzJxw6+kGGGUj2FglGGmnb1/G51udRSMNlTw6GGnCcUwVcOpmsqTHa06o72sw1RL02p9z0VbnMLOaIX3QKaYKSCFQzBKEUNHTSc48k53RH9wxGMtpQa5KjjW0W0n6XCCCG4yxNNdhQ4R4l1Ff+2sSd6UFHiIEOyqqFgT01mEUMD+joy75jPhOA+oVVLm309FR4yVOlp4RhLiScNmSmaYF5Pw0STrOIoWMSR2UkRXOMp+M4SHW8o8Zoi6OZgjKOaFar8zZDzkWzvKOjkKBjmCXby8JahhjXULY4KlzgKLvAwxVGhvyd4zxB1d9T0piazmKLCVZY5sKiD0y2ZSYrkUEPUbIk+dlQ4SJHTR50k1DPaUWIdTZW9NJwnJMOECgd7ou/MnppMJ02O1VT4Wsh85MnZzcFTngpXGKo84qmwgKbCL/orR/SzJ2crA+t6Mp94KvxJUeIbT3CQu1uIdlQEOzlKfS3UMcrTiFmOuroocrZrT2AcmamOKg8YomeEKm/rlT2sociMaybaUlFhuqHCM2qIJ+rg4EcDFymiDSxzaHdPcpE62pD5kyM5SBMoA1PaUtfIthS85ig1VPiPPYXgYEMNk4Qq7TXBgo7oT57gPUdwgCHzhIVFPFU6OYJzHAX9m5oNrVjeE61miDrqQ4VSa1oiURTsKHC0IfjNwU2WzK6eqK8jWln4g15TVBnqmDteCJ501PGAocJhhqjZdtBEB6lnhLreFJKxmlKbeGrqLiSThVIbCdGzloasa6lpMQXHCME2boLpJgT7yWaemu6wBONbqGNVRS0PKIL7LckbjmQtR7K8I5qtqel+T/ChJTNIKLjdUMNIRyvOEko9YYl2cwQveBikCNawJKcLBbc7+JM92mysNvd/Fqp8a0k6CNEe7cnZrxlW0wQXaXjaktnRwNOGZKYiONwS7a1JVheq3WgJHlQUGKHKmp4KAxXR/ULURcNgoa4zhKSLpZR3kxRRb0NmD0OFn+UCS7CzI1nbP6+o4x47QZE5xRCt3ZagnYcvmpYQktXdk5YKXTzBC57kKEe0VVuiSYqapssMS3C9p2CKkHOg8B8Pa8p5atrIw3qezIWanMGa5HRDNF6RM9wcacl0N+Q8Z8hsIkSnaIIdHRUOEebAPy1zbCkhM062FCJtif7PU+UtoVXzWKqM1PxXO8cfdruhFQ/a6x3JKYagvVDhQEtNiyiiSQ7OsuRsZUku0CRNDs4Sog6KKjsZgk2bYJqijgsEenoKeniinRXBn/U3lgpPdyDZynQx8IiioMnCep5Ky8mjGs6Wty0l1hUQTcNWswS3WRp2kCNZwJG8omG8JphPUaFbC8lEfabwP7VtM9yoaNCAjpR41VNhrD9LkbN722v0CoZMByFzhaW+MyzRYEWFDQwN2M4/JiT76PuljT3VU/A36eaIThb+R9oZGOAJ9tewkgGvqOMNRWYjT/Cwu99Q8LqDE4TgbLWxJ1jaDDAERsFOFrobgjUsBScaguXU8kKm2RL19tRypSHnHNlHiIZqgufs4opgQdVdwxBNNFBR6kVFqb8ogimOzB6a6HTzrlDHEpYaxjiiA4TMQobkDg2vejjfwJGWmnbVFAw3H3hq2NyQfG7hz4aC+w3BbwbesG0swYayvpAs6++Ri1Vfzx93mFChvyN5xVHTS+0p9aqCAxyZ6ZacZyw5+7uuQkFPR9DDk9NOiE7X1PCYJVjVUqq7JlrHwWALF5nfHNGjApdpqgzx5OwilDhCiDYTgnc9waGW4BdLNNUQvOtpzDOWHDH8D7TR/A/85KljEQu3NREc4Pl/6B1Hhc8Umb5CsKMmGC9EPcxoT2amwHNCmeOEnOPbklnMkbOgIvO5UMOpQrS9UGVdt6iH/fURjhI/WOpaW9OKLYRod6HCUEdOX000wpDZQ6hwg6LgZfOqo1RfT/CrJzjekXOGhpc1VW71ZLbXyyp+93ILbC1kPtIEYx0FIx1VDrLoVzXRKRYWk809yYlC9ImcrinxtabKnzRJk3lAU1OLEN1j2zrYzr2myHRXJFf4h4QKT1qSTzTB5+ZNTzTRkAxX8FcLV2uS8eoQQ2aAkFzvCM72sJIcJET3WPjRk5wi32uSS9rfZajpWEvj9hW42F4o5NytSXYy8IKHay10VYdrcl4SkqscrXpMwyGOgtkajheSxdQqmpxP1L3t4R5PqasFnrQEjytq6qgp9Y09Qx9o4S1FzhUCn1kyHSzBWLemoSGvOqLNhZyBjmCaAUYpMgt4Ck7wBBMMwWKWgjsUwTaGVsxWC1mYoKiyqqeGKYqonSIRQ3KIkHO0pmAxTdBHkbOvfllfr+AA+7gnc50huVKYK393FOyg7rbPO/izI7hE4CnHHHnJ0ogNPRUGeUpsrZZTBJcrovUcJe51BPsr6GkJdhCCsZ6aTtMEb2pqWkqeVtDXE/QVggsU/Nl86d9RMF3DxvZTA58agu810RWawCiSzzXBeU3MMW9oyJUedvNEvQyNu1f10BSMddR1vaLCYpYa/mGocLSiYDcLbQz8aMn5iyF4xBNMs1P0QEOV7o5gaWGuzSeLue4tt3ro7y4Tgm4G/mopdZgl6q0o6KzJWE3mMksNr3r+a6CbT8g5wZNzT9O7fi/zpaOmnz3BRoqos+tv9zMbdpxsqDBOEewtJLt7cg5wtKKbvldpSzRRCD43VFheCI7yZLppggMVBS/KMAdHODJvOwq2NQSbKKKPLdFWQs7Fqo+mpl01JXYRgq8dnGLhTiFzqmWsUMdpllZdbKlyvSdYxhI9YghOtxR8LgSLWHK62mGGVoxzBE8LNWzqH9CUesQzFy5RQzTc56mhi6fgXEWwpKfE5Z7M05ZgZUPmo6auiv8YKzDYwWBLMErIbKHJvOwIrvEdhOBcQ9JdU1NHQ7CXn2XIDFBKU2WAgcX9UAUzDXWd5alwuyJ41Z9rjKLCL4aCp4WarhPm2rH+SaHUYE001JDZ2ZAzXPjdMpZWvC9wmqIB2lLhQ01D5jO06hghWMndbM7yRJMsoCj1vYbnFQVrW9jak3OlEJ3s/96+p33dEPRV5GxiqaGjIthUU6FFEZyqCa5qJrpBdzSw95IUnOPIrCUUjRZQFrbw5PR0R1qiYx3cb6nrWUMrBmmiBQxVHtTew5ICP/ip6g4hed/Akob/32wvBHsIOX83cI8hGeNeNPCIkPmXe8fPKx84OMSRM1MTdXSwjCZ4S30jVGhvqTRak/OVhgGazHuOCud5onEO1lJr6ecVyaOK6H7zqlBlIaHE0oroCgfvGJIdPcmfLNGLjpz7hZwZQpUbFME0A1cIJa7VNORkgfsMBatbKgwwJM9bSvQXeNOvbIjelg6WWvo5kvbKaJJNHexkKNHL9xRyFlH8Ti2riB5wVPhUk7nGkJnoCe428LR/wRGdYIlmWebCyxou1rCk4g/ShugBDX0V0ZQWkh0dOVsagkM0yV6OoLd5ye+pRlsCr0n+KiQrGuq5yJDzrTAXHtLUMduTDBVKrSm3eHL+6ijxhFDX9Z5gVU/wliHYTMiMFpKLNMEywu80wd3meoFmt6VbRMPenhrOc6DVe4pgXU8DnnHakLOIIrlF4FZPIw6R+zxBP0dyq6OOZ4Q5sLKCcz084ok+VsMMyQhNZmmBgX5xIXOEJTmi7VsGTvMTNdHHhpzdbE8Du2oKxgvBqQKdDDnTFOylCFaxR1syz2iqrOI/FEpNc3C6f11/7+ASS6l2inq2ciTrCCzgyemrCL5SVPjQkdPZUmGy2c9Sw9FtR1sS30RmsKPCS4rkIC/2U0MduwucYolGaPjKEyhzmiPYXagyWbYz8LWBDdzRimAXzxx4z8K9hpzlhLq+NiQ97HuKorMUfK/OVvC2JfiHUPCQI/q7J2gjK+tTDNxkCc4TMssqCs4TGtLVwQihyoAWgj9bosU80XGW6Ac9TJGziaUh5+hnFcHOnlaM1iRn29NaqGENTTTSUHCH2tWTeV0osUhH6psuVLjRUmGWhm6OZEshGeNowABHcJ2Bpy2ZszRcKkRXd2QuKVEeXnbfaEq825FguqfgfE2whlChSRMdron+LATTPQ2Z369t4B9C5gs/ylzv+CMmepIDPclFQl13W0rspPd1JOcbghGOEutqCv5qacURQl3dDKyvyJlqKXGPgcM9FfawJAMVmdcspcYKOZc4GjDYkFlK05olNMHyHn4zFNykyOxt99RkHlfwmiHo60l2EKI+mhreEKp080Tbug08BVPcgoqC5zWt+NLDTZ7oNSF51N1qie7Va3uCCwyZbkINf/NED6jzOsBdZjFN8oqG3wxVunqCSYYKf3EdhJyf9YWGf7tRU2oH3VHgPr1fe5J9hOgHd7xQ0y7qBwXr23aGErP0cm64JVjZwsOGqL+mhNgZmhJLW2oY4UhedsyBgzrCKrq7BmcpNVhR6jBPq64Vgi+kn6XE68pp8J5/+0wRHGOpsKenQn9DZntPzjRLZpDAdD2fnSgkG9tmIXnUwQ6WVighs7Yi2MxQ0N3CqYaCXkJ0oyOztMDJjmSSpcpvlrk0RMMOjmArQ04PRV1DO1FwhCVaUVPpKUM03JK5SxPsIWRu8/CGHi8UHChiqGFDTbSRJWeYUDDcH6vJWUxR4k1FXbMUwV6e4AJFXS8oMqsZKqzvYQ9DDQdZckY4aGsIhtlubbd2r3j4QBMoTamdPZk7O/Bf62lacZwneNjQoGcdVU7zJOd7ghsUHOkosagic6cnWc8+4gg285R6zZP5s1/LUbCKIznTwK36PkdwlOrl4U1LwfdCCa+IrvFkmgw1PCAUXKWo0sURXWcI2muKJlgyFzhynCY4RBOsqCjoI1R5zREco0n2Vt09BQtYSizgKNHfUmUrQ5UOCh51BFcLmY7umhYqXKQomOop8bUnWNNQcIiBcYaC6xzMNOS8JQQfeqKBmmglB+97ok/lfk3ygaHSyZaCRTzRxQo6GzLfa2jWBPepw+UmT7SQEJyiyRkhBLMVOfcoMjcK0eZChfUNzFAUzCsEN5vP/X1uP/n/aoMX+K+nw/Hjr/9xOo7j7Pju61tLcgvJpTWXNbfN5jLpi6VfCOviTktKlFusQixdEKWmEBUKNaIpjZRSSOXSgzaaKLdabrm1/9nZ+/f+vd/vz/v9+Xy+zZ7PRorYoZqyLrCwQdEAixxVOEXNNnjX2nUSRlkqGmWowk8lxR50JPy9Bo6qJXaXwNvREBvnThPEPrewryLhcAnj5WE15Fqi8W7R1sAuEu86S4ENikItFN4xkv9Af4nXSnUVcLiA9xzesFpivRRVeFKtsMRaKBhuSbjOELnAUtlSQUpXgdfB4Z1oSbnFEetbQ0IrAe+Y+pqnDcEJFj6S8LDZzZHwY4e3XONNlARraomNEt2bkvGsosA3ioyHm+6jCMbI59wqt4eeara28IzEmyPgoRaUOEDhTVdEJhmCoTWfC0p8aNkCp0oYqih2iqGi4yXeMkOsn4LdLLnmKfh/YogjNsPebeFGR4m9BJHLzB61XQ3BtpISfS2FugsK9FAtLWX1dCRcrCnUp44CNzuCowUZmxSRgYaE6Za0W2u/E7CVXCiI/UOR8aAm1+OSyE3mOUcwyc1zBBeoX1kiKy0Zfxck1Gsyulti11i83QTBF5Kg3pDQThFMVHiPSlK+0cSedng/VaS8bOZbtsBcTcZAR8JP5KeqQ1OYKAi20njdNNRpgnsU//K+JnaXJaGTomr7aYIphoRn9aeShJWKEq9LcozSF7QleEfDI5LYm5bgVkFkRwVDBCVu0DDIkGupo8TZBq+/pMQURYErJQmPKGKjNDkWOLx7Jd5QizdUweIaKrlP7SwJDhZvONjLkOsBBX9UpGxnydhXkfBLQ8IxgojQbLFnJf81JytSljclYYyEFyx0kVBvKWOFJmONpshGAcsduQY5giVNCV51eOdJYo/pLhbvM0uDHSevNKRcrKZIqnCtJeEsO95RoqcgGK4ocZcho1tTYtcZvH41pNQ7vA0WrhIfOSraIIntIAi+NXWCErdbkvrWwjRLrt0NKUdL6KSOscTOdMSOUtBHwL6OLA0vNSdynaWQEnCpIvKaIrJJEbvHkmuNhn6OjM8VkSGSqn1uYJCGHnq9I3aLhNME3t6GjIkO7xrNFumpyTNX/NrwX7CrIRiqqWijI9JO4d1iieykyfiposQIQ8YjjsjlBh6oHWbwRjgYJQn2NgSnNycmJAk3NiXhx44Sxykihxm8ybUwT1OVKySc7vi3OXVkdBJ4AyXBeksDXG0IhgtYY0lY5ahCD0ehborIk5aUWRJviMA7Xt5kyRjonrXENkm8yYqgs8VzgrJmClK20uMM3jRJ0FiQICQF9hdETlLQWRIb5ki6WDfWRPobvO6a4GP5mcOrNzDFELtTkONLh9dXE8xypEg7z8A9jkhrQ6Fhjlg/QVktJXxt4WXzT/03Q8IaQWSqIuEvloQ2mqC9Jfi7wRul4RX3pSPlzpoVlmCtI2jvKHCFhjcM3sN6lqF6HxnKelLjXWbwrpR4xzuCrTUZx2qq9oAh8p6ixCUGr78g8oyjRAtB5CZFwi80VerVpI0h+IeBxa6Zg6kWvpDHaioYYuEsRbDC3eOmC2JvGYLeioxGknL2UATNJN6hmtj1DlpLvDVmocYbrGCVJKOrg4X6DgddLA203BKMFngdJJFtFd7vJLm6KEpc5yjQrkk7M80SGe34X24nSex1Ra5Omgb71JKyg8SrU3i/kARKwWpH0kOGhKkObyfd0ZGjvyXlAkVZ4xRbYJ2irFMkFY1SwyWxr2oo4zlNiV+7zmaweFpT4kR3kaDAFW6xpSqzJay05FtYR4HmZhc9UxKbbfF2V8RG1MBmSaE+kmC6JnaRXK9gsiXhJHl/U0qM0WTcbyhwkYIvFGwjSbjfwhiJt8ZSQU+Bd5+marPMOkVkD0muxYLIfEuhh60x/J92itguihJSEMySVPQnTewnEm+620rTQEMsOfo4/kP/0ARvWjitlpSX7GxBgcMEsd3EEeYWvdytd+Saawi6aCIj1CkGb6Aj9rwhx16Cf3vAwFy5pyLhVonXzy51FDpdEblbkdJbUcEPDEFzQ8qNmhzzLTmmKWKbFCXeEuRabp6rxbvAtLF442QjQ+wEA9eL1xSR7Q0JXzlSHjJ4exq89yR0laScJ/FW6z4a73pFMEfDiRZvuvijIt86RaSFOl01riV2mD1UEvxGk/Geg5aWwGki1zgKPG9J2U8PEg8qYvMsZeytiTRXBMslCU8JSlxi8EabjwUldlDNLfzTUmCgxWsjqWCOHavYAqsknKFIO0yQ61VL5AVFxk6WhEaCAkdJgt9aSkzXlKNX2jEa79waYuc7gq0N3GDJGCBhoiTXUEPsdknCUE1CK0fwsiaylSF2uiDyO4XX3pFhNd7R4itFGc0k/ElBZwWvq+GC6szVeEoS/MZ+qylwpKNKv9Z469UOjqCjwlusicyTxG6VpNxcQ8IncoR4RhLbR+NdpGGmJWOcIzJGUuKPGpQg8rrG21dOMqQssJQ4RxH5jaUqnZuQ0F4Q+cjxLwPtpZbIAk3QTJHQWBE5S1BokoVtDd6lhqr9UpHSUxMcIYl9pojsb8h4SBOsMQcqvOWC2E8EVehqiJ1hrrAEbQxeK0NGZ0Gkq+guSRgniM23bIHVkqwx4hiHd7smaOyglyIyQuM978j4VS08J/A2G1KeMBRo4fBaSNhKUEZfQewVQ/C1I+MgfbEleEzCUw7mKXI0M3hd1EESVji8x5uQ41nxs1q4RMJCCXs7Iq9acpxn22oSDnQ/sJTxsCbHIYZiLyhY05TY0ZLIOQrGaSJDDN4t8pVaIrsqqFdEegtizc1iTew5Q4ayBDMUsQMkXocaYkc0hZua412siZ1rSXlR460zRJ5SlHGe5j801RLMlJTxtaOM3Q1pvxJ45zUlWFD7rsAbpfEm1JHxG0eh8w2R7QQVzBUw28FhFp5QZzq8t2rx2joqulYTWSuJdTYfWwqMFMcovFmSyJPNyLhE4E10pHzYjOC3huArRa571ZsGajQpQx38SBP5pyZB6lMU3khDnp0MBV51BE9o2E+TY5Ml2E8S7C0o6w1xvCZjf0HkVEHCzFoyNmqC+9wdcqN+Tp7jSDheE9ws8Y5V0NJCn2bk2tqSY4okdrEhx1iDN8cSudwepWmAGXKcJXK65H9to8jYQRH7SBF01ESUJdd0TayVInaWhLkOjlXE5irKGOnI6GSWGCJa482zBI9rCr0jyTVcEuzriC1vcr6mwFGSiqy5zMwxBH/TJHwjSPhL8+01kaaSUuMFKTcLEvaUePcrSmwn8DZrgikWb7CGPxkSjhQwrRk57tctmxLsb9sZvL9LSlyuSLlWkqOjwduo8b6Uv1DkmudIeFF2dHCgxVtk8dpIvHpBxhEOdhKk7OLIUSdJ+cSRY57B+0DgGUUlNfpthTfGkauzxrvTsUUaCVhlKeteTXCoJDCa2NOKhOmC4G1H8JBd4OBZReSRGkqcb/CO1PyLJTLB4j1q8JYaIutEjSLX8YKM+a6phdMsdLFUoV5RTm9JSkuDN8WcIon0NZMNZWh1q8C7SJEwV5HxrmnnTrf3KoJBlmCYI2ilSLlfEvlE4011NNgjgthzEua0oKK7JLE7HZHlEl60BLMVFewg4EWNt0ThrVNEVkkiTwpKXSWJzdRENgvKGq4IhjsiezgSFtsfCUq8qki5S1LRQeYQQ4nemmCkImWMw3tFUoUBZk4NOeZYEp4XRKTGa6wJjrWNHBVJR4m3FCnbuD6aak2WsMTh3SZImGCIPKNgsDpVwnsa70K31lCFJZYcwwSMFcQulGTsZuEaSdBXkPGZhu0FsdUO73RHjq8MPGGIfaGIbVTk6iuI3GFgucHrIQkmWSJdBd7BBu+uOryWAhY7+Lki9rK5wtEQzWwvtbqGhIMFwWRJsElsY4m9IIg9L6lCX0VklaPAYkfkZEGDnOWowlBJjtMUkcGK4Lg6EtoZInMUBVYLgn0UsdmCyCz7gIGHFfk+k1QwTh5We7A9x+IdJ6CvIkEagms0hR50eH9UnTQJ+2oiKyVlLFUE+8gBGu8MQ3CppUHesnjTHN4QB/UGPhCTHLFPHMFrCqa73gqObUJGa03wgbhHkrCfpEpzNLE7JDS25FMKhlhKKWKfCgqstLCPu1zBXy0J2ztwjtixBu8UTRn9LVtkmCN2iyFhtME70JHRQ1KVZXqKI/KNIKYMCYs1GUMEKbM1bKOI9LDXC7zbHS+bt+1MTWS9odA9DtrYtpbImQJ2VHh/lisEwaHqUk1kjKTAKknkBEXkbkdMGwq0dnhzLJF3NJH3JVwrqOB4Sca2hti75nmJN0WzxS6UxDYoEpxpa4htVlRjkYE7DZGzJVU72uC9IyhQL4i8YfGWSYLLNcHXloyz7QhNifmKSE9JgfGmuyLhc403Xm9vqcp6gXe3xuuv8F6VJNxkyTHEkHG2g0aKXL0MsXc1bGfgas2//dCONXiNLCX+5mB7eZIl1kHh7ajwpikyzlUUWOVOsjSQlsS+M0R+pPje/dzBXRZGO0rMtgQrLLG9VSu9n6CMXS3BhwYmSoIBhsjNBmZbgusE9BCPCP5triU4VhNbJfE+swSP27aayE8tuTpYYjtrYjMVGZdp2NpS1s6aBnKSHDsbKuplKbHM4a0wMFd/5/DmGyKrJSUaW4IBrqUhx0vyfzTBBLPIUcnZdrAkNsKR0sWRspumSns6Ch0v/qqIbBYUWKvPU/CFoyrDJGwSNFhbA/MlzKqjrO80hRbpKx0Jewsi/STftwGSlKc1JZyAzx05dhLEdnfQvhZOqiHWWEAHC7+30FuRcZUgaO5gpaIK+xsiHRUsqaPElTV40xQZQ107Q9BZE1nryDVGU9ZSQ47bmhBpLcYpUt7S+xuK/FiT8qKjwXYw5ypS2iuCv7q1gtgjhuBuB8LCFY5cUuCNtsQOFcT+4Ih9JX+k8Ea6v0iCIRZOtCT0Et00JW5UeC85Cg0ScK0k411HcG1zKtre3SeITBRk7WfwDhEvaYLTHP9le0m8By0JDwn4TlLW/aJOvGHxdjYUes+ScZigCkYQdNdEOhkiezgShqkx8ueKjI8lDfK2oNiOFvrZH1hS+tk7NV7nOmLHicGWEgubkXKdwdtZknCLJXaCpkrjZBtLZFsDP9CdxWsSr05Sxl6CMmoFbCOgryX40uDtamB7SVmXW4Ihlgpmq+00tBKUUa83WbjLUNkzDmY7cow1JDygyPGlhgGKYKz4vcV7QBNbJIgM11TUqZaMdwTeSguH6rOaw1JRKzaaGyxVm2EJ/uCIrVWUcZUkcp2grMsEjK+DMwS59jQk3Kd6SEq1d0S6uVmO4Bc1lDXTUcHjluCXEq+1OlBDj1pi9zgiXxnKuE0SqTXwhqbETW6RggMEnGl/q49UT2iCzgJvRwVXS2K/d6+ZkyUl7jawSVLit46EwxVljDZwoSQ20sDBihztHfk2yA8NVZghiXwrYHQdfKAOtzsayjhY9bY0yE2CWEeJ9xfzO423xhL5syS2TFJofO2pboHob0nY4GiAgRrvGQEDa/FWSsoaaYl0syRsEt3kWoH3B01shCXhTUWe9w3Bt44SC9QCh3eShQctwbaK2ApLroGCMlZrYqvlY3qYhM0aXpFkPOuoqJ3Dm6fxXrGwVF9gCWZagjPqznfkuMKQ8DPTQRO8ZqG1hPGKEm9IgpGW4DZDgTNriTxvFiq+Lz+0cKfp4wj6OCK9JSnzNSn9LFU7UhKZZMnYwcJ8s8yRsECScK4j5UOB95HFO0CzhY4xJxuCix0lDlEUeMdS6EZBkTsUkZ4K74dugyTXS7aNgL8aqjDfkCE0ZbwkCXpaWCKhl8P7VD5jxykivSyxyZrYERbe168LYu9ZYh86IkscgVLE7tWPKmJv11CgoyJltMEbrohtVAQfO4ImltiHEroYEs7RxAarVpY8AwXMcMReFOTYWe5iiLRQxJ5Q8DtJ8LQhWOhIeFESPGsILhbNDRljNbHzNRlTFbk2S3L0NOS6V1KFJYKUbSTcIIhM0wQ/s2TM0SRMNcQmSap3jCH4yhJZKSkwyRHpYYgsFeQ4U7xoCB7VVOExhXepo9ABBsYbvGWKXPME3lyH95YioZ0gssQRWWbI+FaSMkXijZXwgiTlYdPdkNLaETxlyDVIwqeaEus0aTcYcg0RVOkpR3CSJqIddK+90JCxzsDVloyrFd5ZAr4TBKfaWa6boEA7C7s6EpYaeFPjveooY72mjIccLHJ9HUwVlDhKkmutJDJBwnp1rvulJZggKDRfbXAkvC/4l3ozQOG9a8lxjx0i7nV4jSXc7vhe3OwIxjgSHjdEhhsif9YkPGlus3iLFDnWOFhtCZbJg0UbQcIaR67JjthoCyMEZRwhiXWyxO5QxI6w5NhT4U1WsJvDO60J34fW9hwzwlKij6ZAW9ne4L0s8C6XeBMEkd/LQy1VucBRot6QMlbivaBhoBgjqGiCJNhsqVp/S2SsG6DIONCR0dXhvWbJ+MRRZJkkuEjgDXJjFQW6SSL7GXK8Z2CZg7cVsbWGoKmEpzQ5elpiy8Ryg7dMkLLUEauzeO86CuwlSOlgYLojZWeJ9xM3S1PWfEfKl5ISLQ0MEKR8YOB2QfCxJBjrKPCN4f9MkaSsqoVXJBmP7EpFZ9UQfOoOFwSzBN4MQ8LsGrymlipcJQhmy0GaQjPqCHaXRwuCZwRbqK2Fg9wlClZqYicrIgMdZfxTQ0c7TBIbrChxmuzoKG8XRaSrIhhiyNFJkrC7oIAWMEOQa5aBekPCRknCo4IKPrYkvCDI8aYmY7WFtprgekcJZ3oLIqssCSMtFbQTJKwXYy3BY5oCh2iKPCpJOE+zRdpYgi6O2KmOAgvVCYaU4ySRek1sgyFhJ403QFHiVEmJHwtybO1gs8Hr5+BETQX3War0qZngYGgtVZtoqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC"); +} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/base16-dark.css b/src/main/resources/templates/editor/lib/codemirror/theme/base16-dark.css new file mode 100644 index 0000000000000000000000000000000000000000..b009d2b9d686a64466b2b41bcad5d78a1976c759 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/base16-dark.css @@ -0,0 +1,38 @@ +/* + + Name: Base16 Default Dark + Author: Chris Kempson (http://chriskempson.com) + + CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools) + Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) + +*/ + +.cm-s-base16-dark.CodeMirror {background: #151515; color: #e0e0e0;} +.cm-s-base16-dark div.CodeMirror-selected {background: #303030 !important;} +.cm-s-base16-dark.CodeMirror ::selection { background: rgba(48, 48, 48, .99); } +.cm-s-base16-dark.CodeMirror ::-moz-selection { background: rgba(48, 48, 48, .99); } +.cm-s-base16-dark .CodeMirror-gutters {background: #151515; border-right: 0px;} +.cm-s-base16-dark .CodeMirror-guttermarker { color: #ac4142; } +.cm-s-base16-dark .CodeMirror-guttermarker-subtle { color: #505050; } +.cm-s-base16-dark .CodeMirror-linenumber {color: #505050;} +.cm-s-base16-dark .CodeMirror-cursor {border-left: 1px solid #b0b0b0 !important;} + +.cm-s-base16-dark span.cm-comment {color: #8f5536;} +.cm-s-base16-dark span.cm-atom {color: #aa759f;} +.cm-s-base16-dark span.cm-number {color: #aa759f;} + +.cm-s-base16-dark span.cm-property, .cm-s-base16-dark span.cm-attribute {color: #90a959;} +.cm-s-base16-dark span.cm-keyword {color: #ac4142;} +.cm-s-base16-dark span.cm-string {color: #f4bf75;} + +.cm-s-base16-dark span.cm-variable {color: #90a959;} +.cm-s-base16-dark span.cm-variable-2 {color: #6a9fb5;} +.cm-s-base16-dark span.cm-def {color: #d28445;} +.cm-s-base16-dark span.cm-bracket {color: #e0e0e0;} +.cm-s-base16-dark span.cm-tag {color: #ac4142;} +.cm-s-base16-dark span.cm-link {color: #aa759f;} +.cm-s-base16-dark span.cm-error {background: #ac4142; color: #b0b0b0;} + +.cm-s-base16-dark .CodeMirror-activeline-background {background: #202020 !important;} +.cm-s-base16-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/base16-light.css b/src/main/resources/templates/editor/lib/codemirror/theme/base16-light.css new file mode 100644 index 0000000000000000000000000000000000000000..15df6d3807ebe1df7ed29b9d95228c44a5d2748f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/base16-light.css @@ -0,0 +1,38 @@ +/* + + Name: Base16 Default Light + Author: Chris Kempson (http://chriskempson.com) + + CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools) + Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) + +*/ + +.cm-s-base16-light.CodeMirror {background: #f5f5f5; color: #202020;} +.cm-s-base16-light div.CodeMirror-selected {background: #e0e0e0 !important;} +.cm-s-base16-light.CodeMirror ::selection { background: #e0e0e0; } +.cm-s-base16-light.CodeMirror ::-moz-selection { background: #e0e0e0; } +.cm-s-base16-light .CodeMirror-gutters {background: #f5f5f5; border-right: 0px;} +.cm-s-base16-light .CodeMirror-guttermarker { color: #ac4142; } +.cm-s-base16-light .CodeMirror-guttermarker-subtle { color: #b0b0b0; } +.cm-s-base16-light .CodeMirror-linenumber {color: #b0b0b0;} +.cm-s-base16-light .CodeMirror-cursor {border-left: 1px solid #505050 !important;} + +.cm-s-base16-light span.cm-comment {color: #8f5536;} +.cm-s-base16-light span.cm-atom {color: #aa759f;} +.cm-s-base16-light span.cm-number {color: #aa759f;} + +.cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute {color: #90a959;} +.cm-s-base16-light span.cm-keyword {color: #ac4142;} +.cm-s-base16-light span.cm-string {color: #f4bf75;} + +.cm-s-base16-light span.cm-variable {color: #90a959;} +.cm-s-base16-light span.cm-variable-2 {color: #6a9fb5;} +.cm-s-base16-light span.cm-def {color: #d28445;} +.cm-s-base16-light span.cm-bracket {color: #202020;} +.cm-s-base16-light span.cm-tag {color: #ac4142;} +.cm-s-base16-light span.cm-link {color: #aa759f;} +.cm-s-base16-light span.cm-error {background: #ac4142; color: #505050;} + +.cm-s-base16-light .CodeMirror-activeline-background {background: #DDDCDC !important;} +.cm-s-base16-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/blackboard.css b/src/main/resources/templates/editor/lib/codemirror/theme/blackboard.css new file mode 100644 index 0000000000000000000000000000000000000000..02289b630b8bb09047bf799017aa80102bbd78cb --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/blackboard.css @@ -0,0 +1,32 @@ +/* Port of TextMate's Blackboard theme */ + +.cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; } +.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } +.cm-s-blackboard.CodeMirror ::selection { background: rgba(37, 59, 118, .99); } +.cm-s-blackboard.CodeMirror ::-moz-selection { background: rgba(37, 59, 118, .99); } +.cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; } +.cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; } +.cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; } +.cm-s-blackboard .CodeMirror-linenumber { color: #888; } +.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } + +.cm-s-blackboard .cm-keyword { color: #FBDE2D; } +.cm-s-blackboard .cm-atom { color: #D8FA3C; } +.cm-s-blackboard .cm-number { color: #D8FA3C; } +.cm-s-blackboard .cm-def { color: #8DA6CE; } +.cm-s-blackboard .cm-variable { color: #FF6400; } +.cm-s-blackboard .cm-operator { color: #FBDE2D;} +.cm-s-blackboard .cm-comment { color: #AEAEAE; } +.cm-s-blackboard .cm-string { color: #61CE3C; } +.cm-s-blackboard .cm-string-2 { color: #61CE3C; } +.cm-s-blackboard .cm-meta { color: #D8FA3C; } +.cm-s-blackboard .cm-builtin { color: #8DA6CE; } +.cm-s-blackboard .cm-tag { color: #8DA6CE; } +.cm-s-blackboard .cm-attribute { color: #8DA6CE; } +.cm-s-blackboard .cm-header { color: #FF6400; } +.cm-s-blackboard .cm-hr { color: #AEAEAE; } +.cm-s-blackboard .cm-link { color: #8DA6CE; } +.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } + +.cm-s-blackboard .CodeMirror-activeline-background {background: #3C3636 !important;} +.cm-s-blackboard .CodeMirror-matchingbracket {outline:1px solid grey;color:white !important} \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/cobalt.css b/src/main/resources/templates/editor/lib/codemirror/theme/cobalt.css new file mode 100644 index 0000000000000000000000000000000000000000..39155894941743f68d3f6d7a15c88e13046c1139 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/cobalt.css @@ -0,0 +1,25 @@ +.cm-s-cobalt.CodeMirror { background: #002240; color: white; } +.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } +.cm-s-cobalt.CodeMirror ::selection { background: rgba(179, 101, 57, .99); } +.cm-s-cobalt.CodeMirror ::-moz-selection { background: rgba(179, 101, 57, .99); } +.cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } +.cm-s-cobalt .CodeMirror-guttermarker { color: #ffee80; } +.cm-s-cobalt .CodeMirror-guttermarker-subtle { color: #d0d0d0; } +.cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; } +.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-cobalt span.cm-comment { color: #08f; } +.cm-s-cobalt span.cm-atom { color: #845dc4; } +.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } +.cm-s-cobalt span.cm-keyword { color: #ffee80; } +.cm-s-cobalt span.cm-string { color: #3ad900; } +.cm-s-cobalt span.cm-meta { color: #ff9d00; } +.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } +.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } +.cm-s-cobalt span.cm-bracket { color: #d8d8d8; } +.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } +.cm-s-cobalt span.cm-link { color: #845dc4; } +.cm-s-cobalt span.cm-error { color: #9d1e15; } + +.cm-s-cobalt .CodeMirror-activeline-background {background: #002D57 !important;} +.cm-s-cobalt .CodeMirror-matchingbracket {outline:1px solid grey;color:white !important} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/colorforth.css b/src/main/resources/templates/editor/lib/codemirror/theme/colorforth.css new file mode 100644 index 0000000000000000000000000000000000000000..73fbf80824de0180c3d789038a25871e4c2ec023 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/colorforth.css @@ -0,0 +1,33 @@ +.cm-s-colorforth.CodeMirror { background: #000000; color: #f8f8f8; } +.cm-s-colorforth .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } +.cm-s-colorforth .CodeMirror-guttermarker { color: #FFBD40; } +.cm-s-colorforth .CodeMirror-guttermarker-subtle { color: #78846f; } +.cm-s-colorforth .CodeMirror-linenumber { color: #bababa; } +.cm-s-colorforth .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-colorforth span.cm-comment { color: #ededed; } +.cm-s-colorforth span.cm-def { color: #ff1c1c; font-weight:bold; } +.cm-s-colorforth span.cm-keyword { color: #ffd900; } +.cm-s-colorforth span.cm-builtin { color: #00d95a; } +.cm-s-colorforth span.cm-variable { color: #73ff00; } +.cm-s-colorforth span.cm-string { color: #007bff; } +.cm-s-colorforth span.cm-number { color: #00c4ff; } +.cm-s-colorforth span.cm-atom { color: #606060; } + +.cm-s-colorforth span.cm-variable-2 { color: #EEE; } +.cm-s-colorforth span.cm-variable-3 { color: #DDD; } +.cm-s-colorforth span.cm-property {} +.cm-s-colorforth span.cm-operator {} + +.cm-s-colorforth span.cm-meta { color: yellow; } +.cm-s-colorforth span.cm-qualifier { color: #FFF700; } +.cm-s-colorforth span.cm-bracket { color: #cc7; } +.cm-s-colorforth span.cm-tag { color: #FFBD40; } +.cm-s-colorforth span.cm-attribute { color: #FFF700; } +.cm-s-colorforth span.cm-error { color: #f00; } + +.cm-s-colorforth .CodeMirror-selected { background: #333d53 !important; } + +.cm-s-colorforth span.cm-compilation { background: rgba(255, 255, 255, 0.12); } + +.cm-s-colorforth .CodeMirror-activeline-background {background: #253540 !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/eclipse.css b/src/main/resources/templates/editor/lib/codemirror/theme/eclipse.css new file mode 100644 index 0000000000000000000000000000000000000000..317218e3d2879f0bbb3cc1de6c756d042f9c6a4e --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/eclipse.css @@ -0,0 +1,23 @@ +.cm-s-eclipse span.cm-meta {color: #FF1717;} +.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } +.cm-s-eclipse span.cm-atom {color: #219;} +.cm-s-eclipse span.cm-number {color: #164;} +.cm-s-eclipse span.cm-def {color: #00f;} +.cm-s-eclipse span.cm-variable {color: black;} +.cm-s-eclipse span.cm-variable-2 {color: #0000C0;} +.cm-s-eclipse span.cm-variable-3 {color: #0000C0;} +.cm-s-eclipse span.cm-property {color: black;} +.cm-s-eclipse span.cm-operator {color: black;} +.cm-s-eclipse span.cm-comment {color: #3F7F5F;} +.cm-s-eclipse span.cm-string {color: #2A00FF;} +.cm-s-eclipse span.cm-string-2 {color: #f50;} +.cm-s-eclipse span.cm-qualifier {color: #555;} +.cm-s-eclipse span.cm-builtin {color: #30a;} +.cm-s-eclipse span.cm-bracket {color: #cc7;} +.cm-s-eclipse span.cm-tag {color: #170;} +.cm-s-eclipse span.cm-attribute {color: #00c;} +.cm-s-eclipse span.cm-link {color: #219;} +.cm-s-eclipse span.cm-error {color: #f00;} + +.cm-s-eclipse .CodeMirror-activeline-background {background: #e8f2ff !important;} +.cm-s-eclipse .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/elegant.css b/src/main/resources/templates/editor/lib/codemirror/theme/elegant.css new file mode 100644 index 0000000000000000000000000000000000000000..dd7df7b73c5048e92f716c7ee0a9be152d4f679a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/elegant.css @@ -0,0 +1,13 @@ +.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} +.cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} +.cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} +.cm-s-elegant span.cm-variable {color: black;} +.cm-s-elegant span.cm-variable-2 {color: #b11;} +.cm-s-elegant span.cm-qualifier {color: #555;} +.cm-s-elegant span.cm-keyword {color: #730;} +.cm-s-elegant span.cm-builtin {color: #30a;} +.cm-s-elegant span.cm-link {color: #762;} +.cm-s-elegant span.cm-error {background-color: #fdd;} + +.cm-s-elegant .CodeMirror-activeline-background {background: #e8f2ff !important;} +.cm-s-elegant .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/erlang-dark.css b/src/main/resources/templates/editor/lib/codemirror/theme/erlang-dark.css new file mode 100644 index 0000000000000000000000000000000000000000..25c7e0a2aad79e3edfc2028c45fcdbd754191a77 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/erlang-dark.css @@ -0,0 +1,34 @@ +.cm-s-erlang-dark.CodeMirror { background: #002240; color: white; } +.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } +.cm-s-erlang-dark.CodeMirror ::selection { background: rgba(179, 101, 57, .99); } +.cm-s-erlang-dark.CodeMirror ::-moz-selection { background: rgba(179, 101, 57, .99); } +.cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } +.cm-s-erlang-dark .CodeMirror-guttermarker { color: white; } +.cm-s-erlang-dark .CodeMirror-guttermarker-subtle { color: #d0d0d0; } +.cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; } +.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-erlang-dark span.cm-atom { color: #f133f1; } +.cm-s-erlang-dark span.cm-attribute { color: #ff80e1; } +.cm-s-erlang-dark span.cm-bracket { color: #ff9d00; } +.cm-s-erlang-dark span.cm-builtin { color: #eaa; } +.cm-s-erlang-dark span.cm-comment { color: #77f; } +.cm-s-erlang-dark span.cm-def { color: #e7a; } +.cm-s-erlang-dark span.cm-keyword { color: #ffee80; } +.cm-s-erlang-dark span.cm-meta { color: #50fefe; } +.cm-s-erlang-dark span.cm-number { color: #ffd0d0; } +.cm-s-erlang-dark span.cm-operator { color: #d55; } +.cm-s-erlang-dark span.cm-property { color: #ccc; } +.cm-s-erlang-dark span.cm-qualifier { color: #ccc; } +.cm-s-erlang-dark span.cm-quote { color: #ccc; } +.cm-s-erlang-dark span.cm-special { color: #ffbbbb; } +.cm-s-erlang-dark span.cm-string { color: #3ad900; } +.cm-s-erlang-dark span.cm-string-2 { color: #ccc; } +.cm-s-erlang-dark span.cm-tag { color: #9effff; } +.cm-s-erlang-dark span.cm-variable { color: #50fe50; } +.cm-s-erlang-dark span.cm-variable-2 { color: #e0e; } +.cm-s-erlang-dark span.cm-variable-3 { color: #ccc; } +.cm-s-erlang-dark span.cm-error { color: #9d1e15; } + +.cm-s-erlang-dark .CodeMirror-activeline-background {background: #013461 !important;} +.cm-s-erlang-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/lesser-dark.css b/src/main/resources/templates/editor/lib/codemirror/theme/lesser-dark.css new file mode 100644 index 0000000000000000000000000000000000000000..5af8b7f6271676d74cbecfd05f608e849d457106 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/lesser-dark.css @@ -0,0 +1,47 @@ +/* +http://lesscss.org/ dark theme +Ported to CodeMirror by Peter Kroon +*/ +.cm-s-lesser-dark { + line-height: 1.3em; +} +.cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } +.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ +.cm-s-lesser-dark.CodeMirror ::selection { background: rgba(69, 68, 59, .99); } +.cm-s-lesser-dark.CodeMirror ::-moz-selection { background: rgba(69, 68, 59, .99); } +.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } +.cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/ + +.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ + +.cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; } +.cm-s-lesser-dark .CodeMirror-guttermarker { color: #599eff; } +.cm-s-lesser-dark .CodeMirror-guttermarker-subtle { color: #777; } +.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; } + +.cm-s-lesser-dark span.cm-keyword { color: #599eff; } +.cm-s-lesser-dark span.cm-atom { color: #C2B470; } +.cm-s-lesser-dark span.cm-number { color: #B35E4D; } +.cm-s-lesser-dark span.cm-def {color: white;} +.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } +.cm-s-lesser-dark span.cm-variable-2 { color: #669199; } +.cm-s-lesser-dark span.cm-variable-3 { color: white; } +.cm-s-lesser-dark span.cm-property {color: #92A75C;} +.cm-s-lesser-dark span.cm-operator {color: #92A75C;} +.cm-s-lesser-dark span.cm-comment { color: #666; } +.cm-s-lesser-dark span.cm-string { color: #BCD279; } +.cm-s-lesser-dark span.cm-string-2 {color: #f50;} +.cm-s-lesser-dark span.cm-meta { color: #738C73; } +.cm-s-lesser-dark span.cm-qualifier {color: #555;} +.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } +.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } +.cm-s-lesser-dark span.cm-tag { color: #669199; } +.cm-s-lesser-dark span.cm-attribute {color: #00c;} +.cm-s-lesser-dark span.cm-header {color: #a0a;} +.cm-s-lesser-dark span.cm-quote {color: #090;} +.cm-s-lesser-dark span.cm-hr {color: #999;} +.cm-s-lesser-dark span.cm-link {color: #00c;} +.cm-s-lesser-dark span.cm-error { color: #9d1e15; } + +.cm-s-lesser-dark .CodeMirror-activeline-background {background: #3C3A3A !important;} +.cm-s-lesser-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/mbo.css b/src/main/resources/templates/editor/lib/codemirror/theme/mbo.css new file mode 100644 index 0000000000000000000000000000000000000000..e39879522e37fbb6799f35d9937123256b119ec7 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/mbo.css @@ -0,0 +1,37 @@ +/****************************************************************/ +/* Based on mbonaci's Brackets mbo theme */ +/* https://github.com/mbonaci/global/blob/master/Mbo.tmTheme */ +/* Create your own: http://tmtheme-editor.herokuapp.com */ +/****************************************************************/ + +.cm-s-mbo.CodeMirror {background: #2c2c2c; color: #ffffec;} +.cm-s-mbo div.CodeMirror-selected {background: #716C62 !important;} +.cm-s-mbo.CodeMirror ::selection { background: rgba(113, 108, 98, .99); } +.cm-s-mbo.CodeMirror ::-moz-selection { background: rgba(113, 108, 98, .99); } +.cm-s-mbo .CodeMirror-gutters {background: #4e4e4e; border-right: 0px;} +.cm-s-mbo .CodeMirror-guttermarker { color: white; } +.cm-s-mbo .CodeMirror-guttermarker-subtle { color: grey; } +.cm-s-mbo .CodeMirror-linenumber {color: #dadada;} +.cm-s-mbo .CodeMirror-cursor {border-left: 1px solid #ffffec !important;} + +.cm-s-mbo span.cm-comment {color: #95958a;} +.cm-s-mbo span.cm-atom {color: #00a8c6;} +.cm-s-mbo span.cm-number {color: #00a8c6;} + +.cm-s-mbo span.cm-property, .cm-s-mbo span.cm-attribute {color: #9ddfe9;} +.cm-s-mbo span.cm-keyword {color: #ffb928;} +.cm-s-mbo span.cm-string {color: #ffcf6c;} +.cm-s-mbo span.cm-string.cm-property {color: #ffffec;} + +.cm-s-mbo span.cm-variable {color: #ffffec;} +.cm-s-mbo span.cm-variable-2 {color: #00a8c6;} +.cm-s-mbo span.cm-def {color: #ffffec;} +.cm-s-mbo span.cm-bracket {color: #fffffc; font-weight: bold;} +.cm-s-mbo span.cm-tag {color: #9ddfe9;} +.cm-s-mbo span.cm-link {color: #f54b07;} +.cm-s-mbo span.cm-error {border-bottom: #636363; color: #ffffec;} +.cm-s-mbo span.cm-qualifier {color: #ffffec;} + +.cm-s-mbo .CodeMirror-activeline-background {background: #494b41 !important;} +.cm-s-mbo .CodeMirror-matchingbracket {color: #222 !important;} +.cm-s-mbo .CodeMirror-matchingtag {background: rgba(255, 255, 255, .37);} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/mdn-like.css b/src/main/resources/templates/editor/lib/codemirror/theme/mdn-like.css new file mode 100644 index 0000000000000000000000000000000000000000..93293c01c85f186d6c58c08b79d5d37b3d2bac27 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/mdn-like.css @@ -0,0 +1,46 @@ +/* + MDN-LIKE Theme - Mozilla + Ported to CodeMirror by Peter Kroon + Report bugs/issues here: https://github.com/codemirror/CodeMirror/issues + GitHub: @peterkroon + + The mdn-like theme is inspired on the displayed code examples at: https://developer.mozilla.org/en-US/docs/Web/CSS/animation + +*/ +.cm-s-mdn-like.CodeMirror { color: #999; background-color: #fff; } +.cm-s-mdn-like .CodeMirror-selected { background: #cfc !important; } +.cm-s-mdn-like.CodeMirror ::selection { background: #cfc; } +.cm-s-mdn-like.CodeMirror ::-moz-selection { background: #cfc; } + +.cm-s-mdn-like .CodeMirror-gutters { background: #f8f8f8; border-left: 6px solid rgba(0,83,159,0.65); color: #333; } +.cm-s-mdn-like .CodeMirror-linenumber { color: #aaa; margin-left: 3px; } +div.cm-s-mdn-like .CodeMirror-cursor { border-left: 2px solid #222; } + +.cm-s-mdn-like .cm-keyword { color: #6262FF; } +.cm-s-mdn-like .cm-atom { color: #F90; } +.cm-s-mdn-like .cm-number { color: #ca7841; } +.cm-s-mdn-like .cm-def { color: #8DA6CE; } +.cm-s-mdn-like span.cm-variable-2, .cm-s-mdn-like span.cm-tag { color: #690; } +.cm-s-mdn-like span.cm-variable-3, .cm-s-mdn-like span.cm-def { color: #07a; } + +.cm-s-mdn-like .cm-variable { color: #07a; } +.cm-s-mdn-like .cm-property { color: #905; } +.cm-s-mdn-like .cm-qualifier { color: #690; } + +.cm-s-mdn-like .cm-operator { color: #cda869; } +.cm-s-mdn-like .cm-comment { color:#777; font-weight:normal; } +.cm-s-mdn-like .cm-string { color:#07a; font-style:italic; } +.cm-s-mdn-like .cm-string-2 { color:#bd6b18; } /*?*/ +.cm-s-mdn-like .cm-meta { color: #000; } /*?*/ +.cm-s-mdn-like .cm-builtin { color: #9B7536; } /*?*/ +.cm-s-mdn-like .cm-tag { color: #997643; } +.cm-s-mdn-like .cm-attribute { color: #d6bb6d; } /*?*/ +.cm-s-mdn-like .cm-header { color: #FF6400; } +.cm-s-mdn-like .cm-hr { color: #AEAEAE; } +.cm-s-mdn-like .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } +.cm-s-mdn-like .cm-error { border-bottom: 1px solid red; } + +div.cm-s-mdn-like .CodeMirror-activeline-background {background: #efefff;} +div.cm-s-mdn-like span.CodeMirror-matchingbracket {outline:1px solid grey; color: inherit;} + +.cm-s-mdn-like.CodeMirror { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAAyCAYAAAAp8UeFAAAHvklEQVR42s2b63bcNgyEQZCSHCdt2vd/0tWF7I+Q6XgMXiTtuvU5Pl57ZQKkKHzEAOtF5KeIJBGJ8uvL599FRFREZhFx8DeXv8trn68RuGaC8TRfo3SNp9dlDDHedyLyTUTeRWStXKPZrjtpZxaRw5hPqozRs1N8/enzIiQRWcCgy4MUA0f+XWliDhyL8Lfyvx7ei/Ae3iQFHyw7U/59pQVIMEEPEz0G7XiwdRjzSfC3UTtz9vchIntxvry5iMgfIhJoEflOz2CQr3F5h/HfeFe+GTdLaKcu9L8LTeQb/R/7GgbsfKedyNdoHsN31uRPWrfZ5wsj/NzzRQHuToIdU3ahwnsKPxXCjJITuOsi7XLc7SG/v5GdALs7wf8JjTFiB5+QvTEfRyGOfX3Lrx8wxyQi3sNq46O7QahQiCsRFgqddjBouVEHOKDgXAQHD9gJCr5sMKkEdjwsarG/ww3BMHBU7OBjXnzdyY7SfCxf5/z6ATccrwlKuwC/jhznnPF4CgVzhhVf4xp2EixcBActO75iZ8/fM9zAs2OMzKdslgXWJ9XG8PQoOAMA5fGcsvORgv0doBXyHrCwfLJAOwo71QLNkb8n2Pl6EWiR7OCibtkPaz4Kc/0NNAze2gju3zOwekALDaCFPI5vjPFmgGY5AZqyGEvH1x7QfIb8YtxMnA/b+QQ0aQDAwc6JMFg8CbQZ4qoYEEHbRwNojuK3EHwd7VALSgq+MNDKzfT58T8qdpADrgW0GmgcAS1lhzztJmkAzcPNOQbsWEALBDSlMKUG0Eq4CLAQWvEVQ9WU57gZJwZtgPO3r9oBTQ9WO8TjqXINx8R0EYpiZEUWOF3FxkbJkgU9B2f41YBrIj5ZfsQa0M5kTgiAAqM3ShXLgu8XMqcrQBvJ0CL5pnTsfMB13oB8athpAq2XOQmcGmoACCLydx7nToa23ATaSIY2ichfOdPTGxlasXMLaL0MLZAOwAKIM+y8CmicobGdCcbbK9DzN+yYGVoNNI5iUKTMyYOjPse4A8SM1MmcXgU0toOq1yO/v8FOxlASyc7TgeYaAMBJHcY1CcCwGI/TK4AmDbDyKYBBtFUkRwto8gygiQEaByFgJ00BH2M8JWwQS1nafDXQCidWyOI8AcjDCSjCLk8ngObuAm3JAHAdubAmOaK06V8MNEsKPJOhobSprwQa6gD7DclRQdqcwL4zxqgBrQcabUiBLclRDKAlWp+etPkBaNMA0AKlrHwTdEByZAA4GM+SNluSY6wAzcMNewxmgig5Ks0nkrSpBvSaQHMdKTBAnLojOdYyGpQ254602ZILPdTD1hdlggdIm74jbTp8vDwF5ZYUeLWGJpWsh6XNyXgcYwVoJQTEhhTYkxzZjiU5npU2TaB979TQehlaAVq4kaGpiPwwwLkYUuBbQwocyQTv1tA0+1UFWoJF3iv1oq+qoSk8EQdJmwHkziIF7oOZk14EGitibAdjLYYK78H5vZOhtWpoI0ATGHs0Q8OMb4Ey+2bU2UYztCtA0wFAs7TplGLRVQCcqaFdGSPCeTI1QNIC52iWNzof6Uib7xjEp07mNNoUYmVosVItHrHzRlLgBn9LFyRHaQCtVUMbtTNhoXWiTOO9k/V8BdAc1Oq0ArSQs6/5SU0hckNy9NnXqQY0PGYo5dWJ7nINaN6o958FWin27aBaWRka1r5myvLOAm0j30eBJqCxHLReVclxhxOEN2JfDWjxBtAC7MIH1fVaGdoOp4qJYDgKtKPSFNID2gSnGldrCqkFZ+5UeQXQBIRrSwocbdZYQT/2LwRahBPBXoHrB8nxaGROST62DKUbQOMMzZIC9abkuELfQzQALWTnDNAm8KHWFOJgJ5+SHIvTPcmx1xQyZRhNL5Qci689aXMEaN/uNIWkEwDAvFpOZmgsBaaGnbs1NPa1Jm32gBZAIh1pCtG7TSH4aE0y1uVY4uqoFPisGlpP2rSA5qTecWn5agK6BzSpgAyD+wFaqhnYoSZ1Vwr8CmlTQbrcO3ZaX0NAEyMbYaAlyquFoLKK3SPby9CeVUPThrSJmkCAE0CrKUQadi4DrdSlWhmah0YL9z9vClH59YGbHx1J8VZTyAjQepJjmXwAKTDQI3omc3p1U4gDUf6RfcdYfrUp5ClAi2J3Ba6UOXGo+K+bQrjjssitG2SJzshaLwMtXgRagUNpYYoVkMSBLM+9GGiJZMvduG6DRZ4qc04DMPtQQxOjEtACmhO7K1AbNbQDEggZyJwscFpAGwENhoBeUwh3bWolhe8BTYVKxQEWrSUn/uhcM5KhvUu/+eQu0Lzhi+VrK0PrZZNDQKs9cpYUuFYgMVpD4/NxenJTiMCNqdUEUf1qZWjppLT5qSkkUZbCwkbZMSuVnu80hfSkzRbQeqCZSAh6huR4VtoM2gHAlLf72smuWgE+VV7XpE25Ab2WFDgyhnSuKbs4GuGzCjR+tIoUuMFg3kgcWKLTwRqanJQ2W00hAsenfaApRC42hbCvK1SlE0HtE9BGgneJO+ELamitD1YjjOYnNYVcraGhtKkW0EqVVeDx733I2NH581k1NNxNLG0i0IJ8/NjVaOZ0tYZ2Vtr0Xv7tPV3hkWp9EFkgS/J0vosngTaSoaG06WHi+xObQkaAdlbanP8B2+2l0f90LmUAAAAASUVORK5CYII=); } diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/midnight.css b/src/main/resources/templates/editor/lib/codemirror/theme/midnight.css new file mode 100644 index 0000000000000000000000000000000000000000..296af4f7d221a05c335db51683d34f4ce47f18da --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/midnight.css @@ -0,0 +1,47 @@ +/* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */ + +/**/ +.cm-s-midnight span.CodeMirror-matchhighlight { background: #494949; } +.cm-s-midnight.CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67 !important; } + +/**/ +.cm-s-midnight .CodeMirror-activeline-background {background: #253540 !important;} + +.cm-s-midnight.CodeMirror { + background: #0F192A; + color: #D1EDFF; +} + +.cm-s-midnight.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} + +.cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;} +.cm-s-midnight.CodeMirror ::selection { background: rgba(49, 77, 103, .99); } +.cm-s-midnight.CodeMirror ::-moz-selection { background: rgba(49, 77, 103, .99); } +.cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;} +.cm-s-midnight .CodeMirror-guttermarker { color: white; } +.cm-s-midnight .CodeMirror-guttermarker-subtle { color: #d0d0d0; } +.cm-s-midnight .CodeMirror-linenumber {color: #D0D0D0;} +.cm-s-midnight .CodeMirror-cursor { + border-left: 1px solid #F8F8F0 !important; +} + +.cm-s-midnight span.cm-comment {color: #428BDD;} +.cm-s-midnight span.cm-atom {color: #AE81FF;} +.cm-s-midnight span.cm-number {color: #D1EDFF;} + +.cm-s-midnight span.cm-property, .cm-s-midnight span.cm-attribute {color: #A6E22E;} +.cm-s-midnight span.cm-keyword {color: #E83737;} +.cm-s-midnight span.cm-string {color: #1DC116;} + +.cm-s-midnight span.cm-variable {color: #FFAA3E;} +.cm-s-midnight span.cm-variable-2 {color: #FFAA3E;} +.cm-s-midnight span.cm-def {color: #4DD;} +.cm-s-midnight span.cm-bracket {color: #D1EDFF;} +.cm-s-midnight span.cm-tag {color: #449;} +.cm-s-midnight span.cm-link {color: #AE81FF;} +.cm-s-midnight span.cm-error {background: #F92672; color: #F8F8F0;} + +.cm-s-midnight .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/monokai.css b/src/main/resources/templates/editor/lib/codemirror/theme/monokai.css new file mode 100644 index 0000000000000000000000000000000000000000..6dfcc73ce424507424b5b1f153993b7e665e8eb6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/monokai.css @@ -0,0 +1,33 @@ +/* Based on Sublime Text's Monokai theme */ + +.cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;} +.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} +.cm-s-monokai.CodeMirror ::selection { background: rgba(73, 72, 62, .99); } +.cm-s-monokai.CodeMirror ::-moz-selection { background: rgba(73, 72, 62, .99); } +.cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;} +.cm-s-monokai .CodeMirror-guttermarker { color: white; } +.cm-s-monokai .CodeMirror-guttermarker-subtle { color: #d0d0d0; } +.cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;} +.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} + +.cm-s-monokai span.cm-comment {color: #75715e;} +.cm-s-monokai span.cm-atom {color: #ae81ff;} +.cm-s-monokai span.cm-number {color: #ae81ff;} + +.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} +.cm-s-monokai span.cm-keyword {color: #f92672;} +.cm-s-monokai span.cm-string {color: #e6db74;} + +.cm-s-monokai span.cm-variable {color: #a6e22e;} +.cm-s-monokai span.cm-variable-2 {color: #9effff;} +.cm-s-monokai span.cm-def {color: #fd971f;} +.cm-s-monokai span.cm-bracket {color: #f8f8f2;} +.cm-s-monokai span.cm-tag {color: #f92672;} +.cm-s-monokai span.cm-link {color: #ae81ff;} +.cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} + +.cm-s-monokai .CodeMirror-activeline-background {background: #373831 !important;} +.cm-s-monokai .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/neat.css b/src/main/resources/templates/editor/lib/codemirror/theme/neat.css new file mode 100644 index 0000000000000000000000000000000000000000..115083b8120d24d1e2bc331719fd231638c7cf0b --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/neat.css @@ -0,0 +1,12 @@ +.cm-s-neat span.cm-comment { color: #a86; } +.cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } +.cm-s-neat span.cm-string { color: #a22; } +.cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } +.cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } +.cm-s-neat span.cm-variable { color: black; } +.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } +.cm-s-neat span.cm-meta {color: #555;} +.cm-s-neat span.cm-link { color: #3a3; } + +.cm-s-neat .CodeMirror-activeline-background {background: #e8f2ff !important;} +.cm-s-neat .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/neo.css b/src/main/resources/templates/editor/lib/codemirror/theme/neo.css new file mode 100644 index 0000000000000000000000000000000000000000..cecaaf28014c3b88a795226c9728bfec3411536f --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/neo.css @@ -0,0 +1,43 @@ +/* neo theme for codemirror */ + +/* Color scheme */ + +.cm-s-neo.CodeMirror { + background-color:#ffffff; + color:#2e383c; + line-height:1.4375; +} +.cm-s-neo .cm-comment {color:#75787b} +.cm-s-neo .cm-keyword, .cm-s-neo .cm-property {color:#1d75b3} +.cm-s-neo .cm-atom,.cm-s-neo .cm-number {color:#75438a} +.cm-s-neo .cm-node,.cm-s-neo .cm-tag {color:#9c3328} +.cm-s-neo .cm-string {color:#b35e14} +.cm-s-neo .cm-variable,.cm-s-neo .cm-qualifier {color:#047d65} + + +/* Editor styling */ + +.cm-s-neo pre { + padding:0; +} + +.cm-s-neo .CodeMirror-gutters { + border:none; + border-right:10px solid transparent; + background-color:transparent; +} + +.cm-s-neo .CodeMirror-linenumber { + padding:0; + color:#e0e2e5; +} + +.cm-s-neo .CodeMirror-guttermarker { color: #1d75b3; } +.cm-s-neo .CodeMirror-guttermarker-subtle { color: #e0e2e5; } + +.cm-s-neo div.CodeMirror-cursor { + width: auto; + border: 0; + background: rgba(155,157,162,0.37); + z-index: 1; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/night.css b/src/main/resources/templates/editor/lib/codemirror/theme/night.css new file mode 100644 index 0000000000000000000000000000000000000000..6b2ac6c7cf02d2fe8905c7d3d89d43ca00100b9c --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/night.css @@ -0,0 +1,28 @@ +/* Loosely based on the Midnight Textmate theme */ + +.cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } +.cm-s-night div.CodeMirror-selected { background: #447 !important; } +.cm-s-night.CodeMirror ::selection { background: rgba(68, 68, 119, .99); } +.cm-s-night.CodeMirror ::-moz-selection { background: rgba(68, 68, 119, .99); } +.cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } +.cm-s-night .CodeMirror-guttermarker { color: white; } +.cm-s-night .CodeMirror-guttermarker-subtle { color: #bbb; } +.cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } +.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-night span.cm-comment { color: #6900a1; } +.cm-s-night span.cm-atom { color: #845dc4; } +.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } +.cm-s-night span.cm-keyword { color: #599eff; } +.cm-s-night span.cm-string { color: #37f14a; } +.cm-s-night span.cm-meta { color: #7678e2; } +.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } +.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } +.cm-s-night span.cm-bracket { color: #8da6ce; } +.cm-s-night span.cm-comment { color: #6900a1; } +.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } +.cm-s-night span.cm-link { color: #845dc4; } +.cm-s-night span.cm-error { color: #9d1e15; } + +.cm-s-night .CodeMirror-activeline-background {background: #1C005A !important;} +.cm-s-night .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/paraiso-dark.css b/src/main/resources/templates/editor/lib/codemirror/theme/paraiso-dark.css new file mode 100644 index 0000000000000000000000000000000000000000..af914b60bf288d33e3be2856cc0e0d96c36f2f18 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/paraiso-dark.css @@ -0,0 +1,38 @@ +/* + + Name: Paraíso (Dark) + Author: Jan T. Sott + + Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror) + Inspired by the art of Rubens LP (http://www.rubenslp.com.br) + +*/ + +.cm-s-paraiso-dark.CodeMirror {background: #2f1e2e; color: #b9b6b0;} +.cm-s-paraiso-dark div.CodeMirror-selected {background: #41323f !important;} +.cm-s-paraiso-dark.CodeMirror ::selection { background: rgba(65, 50, 63, .99); } +.cm-s-paraiso-dark.CodeMirror ::-moz-selection { background: rgba(65, 50, 63, .99); } +.cm-s-paraiso-dark .CodeMirror-gutters {background: #2f1e2e; border-right: 0px;} +.cm-s-paraiso-dark .CodeMirror-guttermarker { color: #ef6155; } +.cm-s-paraiso-dark .CodeMirror-guttermarker-subtle { color: #776e71; } +.cm-s-paraiso-dark .CodeMirror-linenumber {color: #776e71;} +.cm-s-paraiso-dark .CodeMirror-cursor {border-left: 1px solid #8d8687 !important;} + +.cm-s-paraiso-dark span.cm-comment {color: #e96ba8;} +.cm-s-paraiso-dark span.cm-atom {color: #815ba4;} +.cm-s-paraiso-dark span.cm-number {color: #815ba4;} + +.cm-s-paraiso-dark span.cm-property, .cm-s-paraiso-dark span.cm-attribute {color: #48b685;} +.cm-s-paraiso-dark span.cm-keyword {color: #ef6155;} +.cm-s-paraiso-dark span.cm-string {color: #fec418;} + +.cm-s-paraiso-dark span.cm-variable {color: #48b685;} +.cm-s-paraiso-dark span.cm-variable-2 {color: #06b6ef;} +.cm-s-paraiso-dark span.cm-def {color: #f99b15;} +.cm-s-paraiso-dark span.cm-bracket {color: #b9b6b0;} +.cm-s-paraiso-dark span.cm-tag {color: #ef6155;} +.cm-s-paraiso-dark span.cm-link {color: #815ba4;} +.cm-s-paraiso-dark span.cm-error {background: #ef6155; color: #8d8687;} + +.cm-s-paraiso-dark .CodeMirror-activeline-background {background: #4D344A !important;} +.cm-s-paraiso-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/paraiso-light.css b/src/main/resources/templates/editor/lib/codemirror/theme/paraiso-light.css new file mode 100644 index 0000000000000000000000000000000000000000..e198066faa7d2009280b420999132494d7d09978 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/paraiso-light.css @@ -0,0 +1,38 @@ +/* + + Name: Paraíso (Light) + Author: Jan T. Sott + + Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror) + Inspired by the art of Rubens LP (http://www.rubenslp.com.br) + +*/ + +.cm-s-paraiso-light.CodeMirror {background: #e7e9db; color: #41323f;} +.cm-s-paraiso-light div.CodeMirror-selected {background: #b9b6b0 !important;} +.cm-s-paraiso-light.CodeMirror ::selection { background: #b9b6b0; } +.cm-s-paraiso-light.CodeMirror ::-moz-selection { background: #b9b6b0; } +.cm-s-paraiso-light .CodeMirror-gutters {background: #e7e9db; border-right: 0px;} +.cm-s-paraiso-light .CodeMirror-guttermarker { color: black; } +.cm-s-paraiso-light .CodeMirror-guttermarker-subtle { color: #8d8687; } +.cm-s-paraiso-light .CodeMirror-linenumber {color: #8d8687;} +.cm-s-paraiso-light .CodeMirror-cursor {border-left: 1px solid #776e71 !important;} + +.cm-s-paraiso-light span.cm-comment {color: #e96ba8;} +.cm-s-paraiso-light span.cm-atom {color: #815ba4;} +.cm-s-paraiso-light span.cm-number {color: #815ba4;} + +.cm-s-paraiso-light span.cm-property, .cm-s-paraiso-light span.cm-attribute {color: #48b685;} +.cm-s-paraiso-light span.cm-keyword {color: #ef6155;} +.cm-s-paraiso-light span.cm-string {color: #fec418;} + +.cm-s-paraiso-light span.cm-variable {color: #48b685;} +.cm-s-paraiso-light span.cm-variable-2 {color: #06b6ef;} +.cm-s-paraiso-light span.cm-def {color: #f99b15;} +.cm-s-paraiso-light span.cm-bracket {color: #41323f;} +.cm-s-paraiso-light span.cm-tag {color: #ef6155;} +.cm-s-paraiso-light span.cm-link {color: #815ba4;} +.cm-s-paraiso-light span.cm-error {background: #ef6155; color: #776e71;} + +.cm-s-paraiso-light .CodeMirror-activeline-background {background: #CFD1C4 !important;} +.cm-s-paraiso-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/pastel-on-dark.css b/src/main/resources/templates/editor/lib/codemirror/theme/pastel-on-dark.css new file mode 100644 index 0000000000000000000000000000000000000000..0d06f63284d30ec080e97de16446ce4be86beeae --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/pastel-on-dark.css @@ -0,0 +1,53 @@ +/** + * Pastel On Dark theme ported from ACE editor + * @license MIT + * @copyright AtomicPages LLC 2014 + * @author Dennis Thompson, AtomicPages LLC + * @version 1.1 + * @source https://github.com/atomicpages/codemirror-pastel-on-dark-theme + */ + +.cm-s-pastel-on-dark.CodeMirror { + background: #2c2827; + color: #8F938F; + line-height: 1.5; + font-size: 14px; +} +.cm-s-pastel-on-dark div.CodeMirror-selected { background: rgba(221,240,255,0.2) !important; } +.cm-s-pastel-on-dark.CodeMirror ::selection { background: rgba(221,240,255,0.2); } +.cm-s-pastel-on-dark.CodeMirror ::-moz-selection { background: rgba(221,240,255,0.2); } + +.cm-s-pastel-on-dark .CodeMirror-gutters { + background: #34302f; + border-right: 0px; + padding: 0 3px; +} +.cm-s-pastel-on-dark .CodeMirror-guttermarker { color: white; } +.cm-s-pastel-on-dark .CodeMirror-guttermarker-subtle { color: #8F938F; } +.cm-s-pastel-on-dark .CodeMirror-linenumber { color: #8F938F; } +.cm-s-pastel-on-dark .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } +.cm-s-pastel-on-dark span.cm-comment { color: #A6C6FF; } +.cm-s-pastel-on-dark span.cm-atom { color: #DE8E30; } +.cm-s-pastel-on-dark span.cm-number { color: #CCCCCC; } +.cm-s-pastel-on-dark span.cm-property { color: #8F938F; } +.cm-s-pastel-on-dark span.cm-attribute { color: #a6e22e; } +.cm-s-pastel-on-dark span.cm-keyword { color: #AEB2F8; } +.cm-s-pastel-on-dark span.cm-string { color: #66A968; } +.cm-s-pastel-on-dark span.cm-variable { color: #AEB2F8; } +.cm-s-pastel-on-dark span.cm-variable-2 { color: #BEBF55; } +.cm-s-pastel-on-dark span.cm-variable-3 { color: #DE8E30; } +.cm-s-pastel-on-dark span.cm-def { color: #757aD8; } +.cm-s-pastel-on-dark span.cm-bracket { color: #f8f8f2; } +.cm-s-pastel-on-dark span.cm-tag { color: #C1C144; } +.cm-s-pastel-on-dark span.cm-link { color: #ae81ff; } +.cm-s-pastel-on-dark span.cm-qualifier,.cm-s-pastel-on-dark span.cm-builtin { color: #C1C144; } +.cm-s-pastel-on-dark span.cm-error { + background: #757aD8; + color: #f8f8f0; +} +.cm-s-pastel-on-dark .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.031) !important; } +.cm-s-pastel-on-dark .CodeMirror-matchingbracket { + border: 1px solid rgba(255,255,255,0.25); + color: #8F938F !important; + margin: -1px -1px 0 -1px; +} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/rubyblue.css b/src/main/resources/templates/editor/lib/codemirror/theme/rubyblue.css new file mode 100644 index 0000000000000000000000000000000000000000..d2fc0ecdbcf07099cb828faf20d842caeb763c51 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/rubyblue.css @@ -0,0 +1,25 @@ +.cm-s-rubyblue.CodeMirror { background: #112435; color: white; } +.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } +.cm-s-rubyblue.CodeMirror ::selection { background: rgba(56, 86, 111, 0.99); } +.cm-s-rubyblue.CodeMirror ::-moz-selection { background: rgba(56, 86, 111, 0.99); } +.cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; } +.cm-s-rubyblue .CodeMirror-guttermarker { color: white; } +.cm-s-rubyblue .CodeMirror-guttermarker-subtle { color: #3E7087; } +.cm-s-rubyblue .CodeMirror-linenumber { color: white; } +.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } +.cm-s-rubyblue span.cm-atom { color: #F4C20B; } +.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } +.cm-s-rubyblue span.cm-keyword { color: #F0F; } +.cm-s-rubyblue span.cm-string { color: #F08047; } +.cm-s-rubyblue span.cm-meta { color: #F0F; } +.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } +.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; } +.cm-s-rubyblue span.cm-bracket { color: #F0F; } +.cm-s-rubyblue span.cm-link { color: #F4C20B; } +.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } +.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } +.cm-s-rubyblue span.cm-error { color: #AF2018; } + +.cm-s-rubyblue .CodeMirror-activeline-background {background: #173047 !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/solarized.css b/src/main/resources/templates/editor/lib/codemirror/theme/solarized.css new file mode 100644 index 0000000000000000000000000000000000000000..4a10b7c05924734cbc66df6b31797615615efdb4 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/solarized.css @@ -0,0 +1,165 @@ +/* +Solarized theme for code-mirror +http://ethanschoonover.com/solarized +*/ + +/* +Solarized color pallet +http://ethanschoonover.com/solarized/img/solarized-palette.png +*/ + +.solarized.base03 { color: #002b36; } +.solarized.base02 { color: #073642; } +.solarized.base01 { color: #586e75; } +.solarized.base00 { color: #657b83; } +.solarized.base0 { color: #839496; } +.solarized.base1 { color: #93a1a1; } +.solarized.base2 { color: #eee8d5; } +.solarized.base3 { color: #fdf6e3; } +.solarized.solar-yellow { color: #b58900; } +.solarized.solar-orange { color: #cb4b16; } +.solarized.solar-red { color: #dc322f; } +.solarized.solar-magenta { color: #d33682; } +.solarized.solar-violet { color: #6c71c4; } +.solarized.solar-blue { color: #268bd2; } +.solarized.solar-cyan { color: #2aa198; } +.solarized.solar-green { color: #859900; } + +/* Color scheme for code-mirror */ + +.cm-s-solarized { + line-height: 1.45em; + color-profile: sRGB; + rendering-intent: auto; +} +.cm-s-solarized.cm-s-dark { + color: #839496; + background-color: #002b36; + text-shadow: #002b36 0 1px; +} +.cm-s-solarized.cm-s-light { + background-color: #fdf6e3; + color: #657b83; + text-shadow: #eee8d5 0 1px; +} + +.cm-s-solarized .CodeMirror-widget { + text-shadow: none; +} + + +.cm-s-solarized .cm-keyword { color: #cb4b16 } +.cm-s-solarized .cm-atom { color: #d33682; } +.cm-s-solarized .cm-number { color: #d33682; } +.cm-s-solarized .cm-def { color: #2aa198; } + +.cm-s-solarized .cm-variable { color: #268bd2; } +.cm-s-solarized .cm-variable-2 { color: #b58900; } +.cm-s-solarized .cm-variable-3 { color: #6c71c4; } + +.cm-s-solarized .cm-property { color: #2aa198; } +.cm-s-solarized .cm-operator {color: #6c71c4;} + +.cm-s-solarized .cm-comment { color: #586e75; font-style:italic; } + +.cm-s-solarized .cm-string { color: #859900; } +.cm-s-solarized .cm-string-2 { color: #b58900; } + +.cm-s-solarized .cm-meta { color: #859900; } +.cm-s-solarized .cm-qualifier { color: #b58900; } +.cm-s-solarized .cm-builtin { color: #d33682; } +.cm-s-solarized .cm-bracket { color: #cb4b16; } +.cm-s-solarized .CodeMirror-matchingbracket { color: #859900; } +.cm-s-solarized .CodeMirror-nonmatchingbracket { color: #dc322f; } +.cm-s-solarized .cm-tag { color: #93a1a1 } +.cm-s-solarized .cm-attribute { color: #2aa198; } +.cm-s-solarized .cm-header { color: #586e75; } +.cm-s-solarized .cm-quote { color: #93a1a1; } +.cm-s-solarized .cm-hr { + color: transparent; + border-top: 1px solid #586e75; + display: block; +} +.cm-s-solarized .cm-link { color: #93a1a1; cursor: pointer; } +.cm-s-solarized .cm-special { color: #6c71c4; } +.cm-s-solarized .cm-em { + color: #999; + text-decoration: underline; + text-decoration-style: dotted; +} +.cm-s-solarized .cm-strong { color: #eee; } +.cm-s-solarized .cm-error, +.cm-s-solarized .cm-invalidchar { + color: #586e75; + border-bottom: 1px dotted #dc322f; +} + +.cm-s-solarized.cm-s-dark .CodeMirror-selected { background: #073642; } +.cm-s-solarized.cm-s-dark.CodeMirror ::selection { background: rgba(7, 54, 66, 0.99); } +.cm-s-solarized.cm-s-dark.CodeMirror ::-moz-selection { background: rgba(7, 54, 66, 0.99); } + +.cm-s-solarized.cm-s-light .CodeMirror-selected { background: #eee8d5; } +.cm-s-solarized.cm-s-light.CodeMirror ::selection { background: #eee8d5; } +.cm-s-solarized.cm-s-lightCodeMirror ::-moz-selection { background: #eee8d5; } + +/* Editor styling */ + + + +/* Little shadow on the view-port of the buffer view */ +.cm-s-solarized.CodeMirror { + -moz-box-shadow: inset 7px 0 12px -6px #000; + -webkit-box-shadow: inset 7px 0 12px -6px #000; + box-shadow: inset 7px 0 12px -6px #000; +} + +/* Gutter border and some shadow from it */ +.cm-s-solarized .CodeMirror-gutters { + border-right: 1px solid; +} + +/* Gutter colors and line number styling based of color scheme (dark / light) */ + +/* Dark */ +.cm-s-solarized.cm-s-dark .CodeMirror-gutters { + background-color: #002b36; + border-color: #00232c; +} + +.cm-s-solarized.cm-s-dark .CodeMirror-linenumber { + text-shadow: #021014 0 -1px; +} + +/* Light */ +.cm-s-solarized.cm-s-light .CodeMirror-gutters { + background-color: #fdf6e3; + border-color: #eee8d5; +} + +/* Common */ +.cm-s-solarized .CodeMirror-linenumber { + color: #586e75; + padding: 0 5px; +} +.cm-s-solarized .CodeMirror-guttermarker-subtle { color: #586e75; } +.cm-s-solarized.cm-s-dark .CodeMirror-guttermarker { color: #ddd; } +.cm-s-solarized.cm-s-light .CodeMirror-guttermarker { color: #cb4b16; } + +.cm-s-solarized .CodeMirror-gutter .CodeMirror-gutter-text { + color: #586e75; +} + +.cm-s-solarized .CodeMirror-lines .CodeMirror-cursor { + border-left: 1px solid #819090; +} + +/* +Active line. Negative margin compensates left padding of the text in the +view-port +*/ +.cm-s-solarized.cm-s-dark .CodeMirror-activeline-background { + background: rgba(255, 255, 255, 0.10); +} +.cm-s-solarized.cm-s-light .CodeMirror-activeline-background { + background: rgba(0, 0, 0, 0.10); +} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/the-matrix.css b/src/main/resources/templates/editor/lib/codemirror/theme/the-matrix.css new file mode 100644 index 0000000000000000000000000000000000000000..f29b22b0da4d5bcf16d9306626ef4119f578fae0 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/the-matrix.css @@ -0,0 +1,30 @@ +.cm-s-the-matrix.CodeMirror { background: #000000; color: #00FF00; } +.cm-s-the-matrix div.CodeMirror-selected { background: #2D2D2D !important; } +.cm-s-the-matrix.CodeMirror ::selection { background: rgba(45, 45, 45, 0.99); } +.cm-s-the-matrix.CodeMirror ::-moz-selection { background: rgba(45, 45, 45, 0.99); } +.cm-s-the-matrix .CodeMirror-gutters { background: #060; border-right: 2px solid #00FF00; } +.cm-s-the-matrix .CodeMirror-guttermarker { color: #0f0; } +.cm-s-the-matrix .CodeMirror-guttermarker-subtle { color: white; } +.cm-s-the-matrix .CodeMirror-linenumber { color: #FFFFFF; } +.cm-s-the-matrix .CodeMirror-cursor { border-left: 1px solid #00FF00 !important; } + +.cm-s-the-matrix span.cm-keyword {color: #008803; font-weight: bold;} +.cm-s-the-matrix span.cm-atom {color: #3FF;} +.cm-s-the-matrix span.cm-number {color: #FFB94F;} +.cm-s-the-matrix span.cm-def {color: #99C;} +.cm-s-the-matrix span.cm-variable {color: #F6C;} +.cm-s-the-matrix span.cm-variable-2 {color: #C6F;} +.cm-s-the-matrix span.cm-variable-3 {color: #96F;} +.cm-s-the-matrix span.cm-property {color: #62FFA0;} +.cm-s-the-matrix span.cm-operator {color: #999} +.cm-s-the-matrix span.cm-comment {color: #CCCCCC;} +.cm-s-the-matrix span.cm-string {color: #39C;} +.cm-s-the-matrix span.cm-meta {color: #C9F;} +.cm-s-the-matrix span.cm-qualifier {color: #FFF700;} +.cm-s-the-matrix span.cm-builtin {color: #30a;} +.cm-s-the-matrix span.cm-bracket {color: #cc7;} +.cm-s-the-matrix span.cm-tag {color: #FFBD40;} +.cm-s-the-matrix span.cm-attribute {color: #FFF700;} +.cm-s-the-matrix span.cm-error {color: #FF0000;} + +.cm-s-the-matrix .CodeMirror-activeline-background {background: #040;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/tomorrow-night-bright.css b/src/main/resources/templates/editor/lib/codemirror/theme/tomorrow-night-bright.css new file mode 100644 index 0000000000000000000000000000000000000000..decb82d3e0861191ae0ac2564d8e5aa7f1ca21f6 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/tomorrow-night-bright.css @@ -0,0 +1,35 @@ +/* + + Name: Tomorrow Night - Bright + Author: Chris Kempson + + Port done by Gerard Braad + +*/ + +.cm-s-tomorrow-night-bright.CodeMirror {background: #000000; color: #eaeaea;} +.cm-s-tomorrow-night-bright div.CodeMirror-selected {background: #424242 !important;} +.cm-s-tomorrow-night-bright .CodeMirror-gutters {background: #000000; border-right: 0px;} +.cm-s-tomorrow-night-bright .CodeMirror-guttermarker { color: #e78c45; } +.cm-s-tomorrow-night-bright .CodeMirror-guttermarker-subtle { color: #777; } +.cm-s-tomorrow-night-bright .CodeMirror-linenumber {color: #424242;} +.cm-s-tomorrow-night-bright .CodeMirror-cursor {border-left: 1px solid #6A6A6A !important;} + +.cm-s-tomorrow-night-bright span.cm-comment {color: #d27b53;} +.cm-s-tomorrow-night-bright span.cm-atom {color: #a16a94;} +.cm-s-tomorrow-night-bright span.cm-number {color: #a16a94;} + +.cm-s-tomorrow-night-bright span.cm-property, .cm-s-tomorrow-night-bright span.cm-attribute {color: #99cc99;} +.cm-s-tomorrow-night-bright span.cm-keyword {color: #d54e53;} +.cm-s-tomorrow-night-bright span.cm-string {color: #e7c547;} + +.cm-s-tomorrow-night-bright span.cm-variable {color: #b9ca4a;} +.cm-s-tomorrow-night-bright span.cm-variable-2 {color: #7aa6da;} +.cm-s-tomorrow-night-bright span.cm-def {color: #e78c45;} +.cm-s-tomorrow-night-bright span.cm-bracket {color: #eaeaea;} +.cm-s-tomorrow-night-bright span.cm-tag {color: #d54e53;} +.cm-s-tomorrow-night-bright span.cm-link {color: #a16a94;} +.cm-s-tomorrow-night-bright span.cm-error {background: #d54e53; color: #6A6A6A;} + +.cm-s-tomorrow-night-bright .CodeMirror-activeline-background {background: #2a2a2a !important;} +.cm-s-tomorrow-night-bright .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/tomorrow-night-eighties.css b/src/main/resources/templates/editor/lib/codemirror/theme/tomorrow-night-eighties.css new file mode 100644 index 0000000000000000000000000000000000000000..5fca3cafbf3fabb42acb034b1d2210324d01d345 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/tomorrow-night-eighties.css @@ -0,0 +1,38 @@ +/* + + Name: Tomorrow Night - Eighties + Author: Chris Kempson + + CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) + Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) + +*/ + +.cm-s-tomorrow-night-eighties.CodeMirror {background: #000000; color: #CCCCCC;} +.cm-s-tomorrow-night-eighties div.CodeMirror-selected {background: #2D2D2D !important;} +.cm-s-tomorrow-night-eighties.CodeMirror ::selection { background: rgba(45, 45, 45, 0.99); } +.cm-s-tomorrow-night-eighties.CodeMirror ::-moz-selection { background: rgba(45, 45, 45, 0.99); } +.cm-s-tomorrow-night-eighties .CodeMirror-gutters {background: #000000; border-right: 0px;} +.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker { color: #f2777a; } +.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker-subtle { color: #777; } +.cm-s-tomorrow-night-eighties .CodeMirror-linenumber {color: #515151;} +.cm-s-tomorrow-night-eighties .CodeMirror-cursor {border-left: 1px solid #6A6A6A !important;} + +.cm-s-tomorrow-night-eighties span.cm-comment {color: #d27b53;} +.cm-s-tomorrow-night-eighties span.cm-atom {color: #a16a94;} +.cm-s-tomorrow-night-eighties span.cm-number {color: #a16a94;} + +.cm-s-tomorrow-night-eighties span.cm-property, .cm-s-tomorrow-night-eighties span.cm-attribute {color: #99cc99;} +.cm-s-tomorrow-night-eighties span.cm-keyword {color: #f2777a;} +.cm-s-tomorrow-night-eighties span.cm-string {color: #ffcc66;} + +.cm-s-tomorrow-night-eighties span.cm-variable {color: #99cc99;} +.cm-s-tomorrow-night-eighties span.cm-variable-2 {color: #6699cc;} +.cm-s-tomorrow-night-eighties span.cm-def {color: #f99157;} +.cm-s-tomorrow-night-eighties span.cm-bracket {color: #CCCCCC;} +.cm-s-tomorrow-night-eighties span.cm-tag {color: #f2777a;} +.cm-s-tomorrow-night-eighties span.cm-link {color: #a16a94;} +.cm-s-tomorrow-night-eighties span.cm-error {background: #f2777a; color: #6A6A6A;} + +.cm-s-tomorrow-night-eighties .CodeMirror-activeline-background {background: #343600 !important;} +.cm-s-tomorrow-night-eighties .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/twilight.css b/src/main/resources/templates/editor/lib/codemirror/theme/twilight.css new file mode 100644 index 0000000000000000000000000000000000000000..889a83d7993e210d8fbb0925d4911f241ad62d6d --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/twilight.css @@ -0,0 +1,32 @@ +.cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/ +.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/ +.cm-s-twilight.CodeMirror ::selection { background: rgba(50, 50, 50, 0.99); } +.cm-s-twilight.CodeMirror ::-moz-selection { background: rgba(50, 50, 50, 0.99); } + +.cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; } +.cm-s-twilight .CodeMirror-guttermarker { color: white; } +.cm-s-twilight .CodeMirror-guttermarker-subtle { color: #aaa; } +.cm-s-twilight .CodeMirror-linenumber { color: #aaa; } +.cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-twilight .cm-keyword { color: #f9ee98; } /**/ +.cm-s-twilight .cm-atom { color: #FC0; } +.cm-s-twilight .cm-number { color: #ca7841; } /**/ +.cm-s-twilight .cm-def { color: #8DA6CE; } +.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/ +.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/ +.cm-s-twilight .cm-operator { color: #cda869; } /**/ +.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/ +.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/ +.cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/ +.cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/ +.cm-s-twilight .cm-builtin { color: #cda869; } /*?*/ +.cm-s-twilight .cm-tag { color: #997643; } /**/ +.cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/ +.cm-s-twilight .cm-header { color: #FF6400; } +.cm-s-twilight .cm-hr { color: #AEAEAE; } +.cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/ +.cm-s-twilight .cm-error { border-bottom: 1px solid red; } + +.cm-s-twilight .CodeMirror-activeline-background {background: #27282E !important;} +.cm-s-twilight .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/vibrant-ink.css b/src/main/resources/templates/editor/lib/codemirror/theme/vibrant-ink.css new file mode 100644 index 0000000000000000000000000000000000000000..8ea535973c6ce574fa272b4d2d467a394d422188 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/vibrant-ink.css @@ -0,0 +1,34 @@ +/* Taken from the popular Visual Studio Vibrant Ink Schema */ + +.cm-s-vibrant-ink.CodeMirror { background: black; color: white; } +.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } +.cm-s-vibrant-ink.CodeMirror ::selection { background: rgba(53, 73, 60, 0.99); } +.cm-s-vibrant-ink.CodeMirror ::-moz-selection { background: rgba(53, 73, 60, 0.99); } + +.cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } +.cm-s-vibrant-ink .CodeMirror-guttermarker { color: white; } +.cm-s-vibrant-ink .CodeMirror-guttermarker-subtle { color: #d0d0d0; } +.cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; } +.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-vibrant-ink .cm-keyword { color: #CC7832; } +.cm-s-vibrant-ink .cm-atom { color: #FC0; } +.cm-s-vibrant-ink .cm-number { color: #FFEE98; } +.cm-s-vibrant-ink .cm-def { color: #8DA6CE; } +.cm-s-vibrant-ink span.cm-variable-2, .cm-s-vibrant span.cm-tag { color: #FFC66D } +.cm-s-vibrant-ink span.cm-variable-3, .cm-s-vibrant span.cm-def { color: #FFC66D } +.cm-s-vibrant-ink .cm-operator { color: #888; } +.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; } +.cm-s-vibrant-ink .cm-string { color: #A5C25C } +.cm-s-vibrant-ink .cm-string-2 { color: red } +.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; } +.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; } +.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; } +.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; } +.cm-s-vibrant-ink .cm-header { color: #FF6400; } +.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; } +.cm-s-vibrant-ink .cm-link { color: blue; } +.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; } + +.cm-s-vibrant-ink .CodeMirror-activeline-background {background: #27282E !important;} +.cm-s-vibrant-ink .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/xq-dark.css b/src/main/resources/templates/editor/lib/codemirror/theme/xq-dark.css new file mode 100644 index 0000000000000000000000000000000000000000..d537993e89f97046903f8da727c61d782a33915a --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/xq-dark.css @@ -0,0 +1,53 @@ +/* +Copyright (C) 2011 by MarkLogic Corporation +Author: Mike Brevoort + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +.cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; } +.cm-s-xq-dark .CodeMirror-selected { background: #27007A !important; } +.cm-s-xq-dark.CodeMirror ::selection { background: rgba(39, 0, 122, 0.99); } +.cm-s-xq-dark.CodeMirror ::-moz-selection { background: rgba(39, 0, 122, 0.99); } +.cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } +.cm-s-xq-dark .CodeMirror-guttermarker { color: #FFBD40; } +.cm-s-xq-dark .CodeMirror-guttermarker-subtle { color: #f8f8f8; } +.cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; } +.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; } + +.cm-s-xq-dark span.cm-keyword {color: #FFBD40;} +.cm-s-xq-dark span.cm-atom {color: #6C8CD5;} +.cm-s-xq-dark span.cm-number {color: #164;} +.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;} +.cm-s-xq-dark span.cm-variable {color: #FFF;} +.cm-s-xq-dark span.cm-variable-2 {color: #EEE;} +.cm-s-xq-dark span.cm-variable-3 {color: #DDD;} +.cm-s-xq-dark span.cm-property {} +.cm-s-xq-dark span.cm-operator {} +.cm-s-xq-dark span.cm-comment {color: gray;} +.cm-s-xq-dark span.cm-string {color: #9FEE00;} +.cm-s-xq-dark span.cm-meta {color: yellow;} +.cm-s-xq-dark span.cm-qualifier {color: #FFF700;} +.cm-s-xq-dark span.cm-builtin {color: #30a;} +.cm-s-xq-dark span.cm-bracket {color: #cc7;} +.cm-s-xq-dark span.cm-tag {color: #FFBD40;} +.cm-s-xq-dark span.cm-attribute {color: #FFF700;} +.cm-s-xq-dark span.cm-error {color: #f00;} + +.cm-s-xq-dark .CodeMirror-activeline-background {background: #27282E !important;} +.cm-s-xq-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/xq-light.css b/src/main/resources/templates/editor/lib/codemirror/theme/xq-light.css new file mode 100644 index 0000000000000000000000000000000000000000..20b5c796147de7c32c74d3264f16468732c25751 --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/xq-light.css @@ -0,0 +1,43 @@ +/* +Copyright (C) 2011 by MarkLogic Corporation +Author: Mike Brevoort + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +.cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; } +.cm-s-xq-light span.cm-atom {color: #6C8CD5;} +.cm-s-xq-light span.cm-number {color: #164;} +.cm-s-xq-light span.cm-def {text-decoration:underline;} +.cm-s-xq-light span.cm-variable {color: black; } +.cm-s-xq-light span.cm-variable-2 {color:black;} +.cm-s-xq-light span.cm-variable-3 {color: black; } +.cm-s-xq-light span.cm-property {} +.cm-s-xq-light span.cm-operator {} +.cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;} +.cm-s-xq-light span.cm-string {color: red;} +.cm-s-xq-light span.cm-meta {color: yellow;} +.cm-s-xq-light span.cm-qualifier {color: grey} +.cm-s-xq-light span.cm-builtin {color: #7EA656;} +.cm-s-xq-light span.cm-bracket {color: #cc7;} +.cm-s-xq-light span.cm-tag {color: #3F7F7F;} +.cm-s-xq-light span.cm-attribute {color: #7F007F;} +.cm-s-xq-light span.cm-error {color: #f00;} + +.cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;} +.cm-s-xq-light .CodeMirror-matchingbracket {outline:1px solid grey;color:black !important;background:yellow;} \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/codemirror/theme/zenburn.css b/src/main/resources/templates/editor/lib/codemirror/theme/zenburn.css new file mode 100644 index 0000000000000000000000000000000000000000..f817198af02fda2b3803e08910d6f9719caa8c7c --- /dev/null +++ b/src/main/resources/templates/editor/lib/codemirror/theme/zenburn.css @@ -0,0 +1,37 @@ +/** + * " + * Using Zenburn color palette from the Emacs Zenburn Theme + * https://github.com/bbatsov/zenburn-emacs/blob/master/zenburn-theme.el + * + * Also using parts of https://github.com/xavi/coderay-lighttable-theme + * " + * From: https://github.com/wisenomad/zenburn-lighttable-theme/blob/master/zenburn.css + */ + +.cm-s-zenburn .CodeMirror-gutters { background: #3f3f3f !important; } +.cm-s-zenburn .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded { color: #999; } +.cm-s-zenburn .CodeMirror-cursor { border-left: 1px solid white !important; } +.cm-s-zenburn { background-color: #3f3f3f; color: #dcdccc; } +.cm-s-zenburn span.cm-builtin { color: #dcdccc; font-weight: bold; } +.cm-s-zenburn span.cm-comment { color: #7f9f7f; } +.cm-s-zenburn span.cm-keyword { color: #f0dfaf; font-weight: bold; } +.cm-s-zenburn span.cm-atom { color: #bfebbf; } +.cm-s-zenburn span.cm-def { color: #dcdccc; } +.cm-s-zenburn span.cm-variable { color: #dfaf8f; } +.cm-s-zenburn span.cm-variable-2 { color: #dcdccc; } +.cm-s-zenburn span.cm-string { color: #cc9393; } +.cm-s-zenburn span.cm-string-2 { color: #cc9393; } +.cm-s-zenburn span.cm-number { color: #dcdccc; } +.cm-s-zenburn span.cm-tag { color: #93e0e3; } +.cm-s-zenburn span.cm-property { color: #dfaf8f; } +.cm-s-zenburn span.cm-attribute { color: #dfaf8f; } +.cm-s-zenburn span.cm-qualifier { color: #7cb8bb; } +.cm-s-zenburn span.cm-meta { color: #f0dfaf; } +.cm-s-zenburn span.cm-header { color: #f0efd0; } +.cm-s-zenburn span.cm-operator { color: #f0efd0; } +.cm-s-zenburn span.CodeMirror-matchingbracket { box-sizing: border-box; background: transparent; border-bottom: 1px solid; } +.cm-s-zenburn span.CodeMirror-nonmatchingbracket { border-bottom: 1px solid; background: none; } +.cm-s-zenburn .CodeMirror-activeline { background: #000000; } +.cm-s-zenburn .CodeMirror-activeline-background { background: #000000; } +.cm-s-zenburn .CodeMirror-selected { background: #545454; } +.cm-s-zenburn .CodeMirror-focused .CodeMirror-selected { background: #4f4f4f; } diff --git a/src/main/resources/templates/editor/lib/flowchart.min.js b/src/main/resources/templates/editor/lib/flowchart.min.js new file mode 100644 index 0000000000000000000000000000000000000000..780802102a35739ba321b4989e2621842a4bcf18 --- /dev/null +++ b/src/main/resources/templates/editor/lib/flowchart.min.js @@ -0,0 +1,5 @@ +// flowchart, v1.3.4 +// Copyright (c)2014 Adriano Raiano (adrai). +// Distributed under MIT license +// http://adrai.github.io/flowchart.js +!function(){function a(b,c){if(!b||"function"==typeof b)return c;var d={};for(var e in c)d[e]=c[e];for(e in b)b[e]&&(d[e]="object"==typeof d[e]?a(d[e],b[e]):b[e]);return d}function b(a,b){if("function"==typeof Object.create)a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});else{a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}}function c(a,b,c){var d,e,f="M{0},{1}";for(d=2,e=2*c.length+2;e>d;d+=2)f+=" L{"+d+"},{"+(d+1)+"}";var g=[b.x,b.y];for(d=0,e=c.length;e>d;d++)g.push(c[d].x),g.push(c[d].y);var h=a.paper.path(f,g);h.attr("stroke",a.options["element-color"]),h.attr("stroke-width",a.options["line-width"]);var i=a.options.font,j=a.options["font-family"],k=a.options["font-weight"];return i&&h.attr({font:i}),j&&h.attr({"font-family":j}),k&&h.attr({"font-weight":k}),h}function d(a,b,c,d){var e,f;"[object Array]"!==Object.prototype.toString.call(c)&&(c=[c]);var g="M{0},{1}";for(e=2,f=2*c.length+2;f>e;e+=2)g+=" L{"+e+"},{"+(e+1)+"}";var h=[b.x,b.y];for(e=0,f=c.length;f>e;e++)h.push(c[e].x),h.push(c[e].y);var i=a.paper.path(g,h);i.attr({stroke:a.options["line-color"],"stroke-width":a.options["line-width"],"arrow-end":a.options["arrow-end"]});var j=a.options.font,k=a.options["font-family"],l=a.options["font-weight"];if(j&&i.attr({font:j}),k&&i.attr({"font-family":k}),l&&i.attr({"font-weight":l}),d){var m=!1,n=a.paper.text(0,0,d),o=!1,p=c[0];b.y===p.y&&(o=!0);var q=0,r=0;m?(q=b.x>p.x?b.x-(b.x-p.x)/2:p.x-(p.x-b.x)/2,r=b.y>p.y?b.y-(b.y-p.y)/2:p.y-(p.y-b.y)/2,o?(q-=n.getBBox().width/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"],r-=n.getBBox().height/2)):(q=b.x,r=b.y,o?(q+=a.options["text-margin"]/2,r-=a.options["text-margin"]):(q+=a.options["text-margin"]/2,r+=a.options["text-margin"])),n.attr({"text-anchor":"start","font-size":a.options["font-size"],fill:a.options["font-color"],x:q,y:r}),j&&n.attr({font:j}),k&&n.attr({"font-family":k}),l&&n.attr({"font-weight":l})}return i}function e(a,b,c,d,e,f,g,h){var i,j,k,l,m,n={x:null,y:null,onLine1:!1,onLine2:!1};return i=(h-f)*(c-a)-(g-e)*(d-b),0===i?n:(j=b-f,k=a-e,l=(g-e)*j-(h-f)*k,m=(c-a)*j-(d-b)*k,j=l/i,k=m/i,n.x=a+j*(c-a),n.y=b+j*(d-b),j>0&&1>j&&(n.onLine1=!0),k>0&&1>k&&(n.onLine2=!0),n)}function f(a,b){b=b||{},this.paper=new Raphael(a),this.options=r.defaults(b,q),this.symbols=[],this.lines=[],this.start=null}function g(a,b,c){this.chart=a,this.group=this.chart.paper.set(),this.symbol=c,this.connectedTo=[],this.symbolType=b.symbolType,this.flowstate=b.flowstate||"future",this.next_direction=b.next&&b.direction_next?b.direction_next:void 0,this.text=this.chart.paper.text(0,0,b.text),b.key&&(this.text.node.id=b.key+"t"),this.text.node.setAttribute("class",this.getAttr("class")+"t"),this.text.attr({"text-anchor":"start",x:this.getAttr("text-margin"),fill:this.getAttr("font-color"),"font-size":this.getAttr("font-size")});var d=this.getAttr("font"),e=this.getAttr("font-family"),f=this.getAttr("font-weight");d&&this.text.attr({font:d}),e&&this.text.attr({"font-family":e}),f&&this.text.attr({"font-weight":f}),b.link&&this.text.attr("href",b.link),b.target&&this.text.attr("target",b.target);var g=this.getAttr("maxWidth");if(g){for(var h=b.text.split(" "),i="",j=0,k=h.length;k>j;j++){var l=h[j];this.text.attr("text",i+" "+l),i+=this.text.getBBox().width>g?"\n"+l:" "+l}this.text.attr("text",i.substring(1))}if(this.group.push(this.text),c){var m=this.getAttr("text-margin");c.attr({fill:this.getAttr("fill"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*m,height:this.text.getBBox().height+2*m}),c.node.setAttribute("class",this.getAttr("class")),b.link&&c.attr("href",b.link),b.target&&c.attr("target",b.target),b.key&&(c.node.id=b.key),this.group.push(c),c.insertBefore(this.text),this.text.attr({y:c.getBBox().height/2}),this.initialize()}}function h(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"Start",g.call(this,a,b,c)}function i(a,b){var c=a.paper.rect(0,0,0,0,20);b=b||{},b.text=b.text||"End",g.call(this,a,b,c)}function j(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c)}function k(a,b){var c=a.paper.rect(0,0,0,0);b=b||{},g.call(this,a,b,c),c.attr({width:this.text.getBBox().width+4*this.getAttr("text-margin")}),this.text.attr({x:2*this.getAttr("text-margin")});var d=a.paper.rect(0,0,0,0);d.attr({x:this.getAttr("text-margin"),stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),width:this.text.getBBox().width+2*this.getAttr("text-margin"),height:this.text.getBBox().height+2*this.getAttr("text-margin"),fill:this.getAttr("fill")}),b.key&&(d.node.id=b.key+"i");var e=this.getAttr("font"),f=this.getAttr("font-family"),h=this.getAttr("font-weight");e&&d.attr({font:e}),f&&d.attr({"font-family":f}),h&&d.attr({"font-weight":h}),b.link&&d.attr("href",b.link),b.target&&d.attr("target",b.target),this.group.push(d),d.insertBefore(this.text),this.initialize()}function l(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.text.attr({x:3*this.textMargin});var d=this.text.getBBox().width+4*this.textMargin,e=this.text.getBBox().height+2*this.textMargin,f=this.textMargin,h=e/2,i={x:f,y:h},j=[{x:f-this.textMargin,y:e},{x:f-this.textMargin+d,y:e},{x:f-this.textMargin+d+2*this.textMargin,y:0},{x:f-this.textMargin+2*this.textMargin,y:0},{x:f,y:h}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function m(a,b){b=b||{},g.call(this,a,b),this.textMargin=this.getAttr("text-margin"),this.yes_direction="bottom",this.no_direction="right",b.yes&&b.direction_yes&&b.no&&!b.direction_no?"right"===b.direction_yes?(this.no_direction="bottom",this.yes_direction="right"):(this.no_direction="right",this.yes_direction="bottom"):b.yes&&!b.direction_yes&&b.no&&b.direction_no?"right"===b.direction_no?(this.yes_direction="bottom",this.no_direction="right"):(this.yes_direction="right",this.no_direction="bottom"):(this.yes_direction="bottom",this.no_direction="right"),this.yes_direction=this.yes_direction||"bottom",this.no_direction=this.no_direction||"right",this.text.attr({x:2*this.textMargin});var d=this.text.getBBox().width+3*this.textMargin;d+=d/2;var e=this.text.getBBox().height+2*this.textMargin;e+=e/2,e=Math.max(.5*d,e);var f=d/4,h=e/4;this.text.attr({x:f+this.textMargin/2});var i={x:f,y:h},j=[{x:f-d/4,y:h+e/4},{x:f-d/4+d/2,y:h+e/4+e/2},{x:f-d/4+d,y:h+e/4},{x:f-d/4+d/2,y:h+e/4-e/2},{x:f-d/4,y:h+e/4}],k=c(a,i,j);k.attr({stroke:this.getAttr("element-color"),"stroke-width":this.getAttr("line-width"),fill:this.getAttr("fill")}),b.link&&k.attr("href",b.link),b.target&&k.attr("target",b.target),b.key&&(k.node.id=b.key),k.node.setAttribute("class",this.getAttr("class")),this.text.attr({y:k.getBBox().height/2}),this.group.push(k),k.insertBefore(this.text),this.initialize()}function n(a){function b(a){var b=a.indexOf("(")+1,c=a.indexOf(")");return b>=0&&c>=0?d.symbols[a.substring(0,b-1)]:d.symbols[a]}function c(a){var b="next",c=a.indexOf("(")+1,d=a.indexOf(")");return c>=0&&d>=0&&(b=D.substring(c,d),b.indexOf(",")<0&&"yes"!==b&&"no"!==b&&(b="next, "+b)),b}a=a||"",a=a.trim();for(var d={symbols:{},start:null,drawSVG:function(a,b){function c(a){if(g[a.key])return g[a.key];switch(a.symbolType){case"start":g[a.key]=new h(e,a);break;case"end":g[a.key]=new i(e,a);break;case"operation":g[a.key]=new j(e,a);break;case"inputoutput":g[a.key]=new l(e,a);break;case"subroutine":g[a.key]=new k(e,a);break;case"condition":g[a.key]=new m(e,a);break;default:return new Error("Wrong symbol type!")}return g[a.key]}var d=this;this.diagram&&this.diagram.clean();var e=new f(a,b);this.diagram=e;var g={};!function n(a,b,f){var g=c(a);return d.start===a?e.startWith(g):b&&f&&!b.pathOk&&(b instanceof m?(f.yes===a&&b.yes(g),f.no===a&&b.no(g)):b.then(g)),g.pathOk?g:(g instanceof m?(a.yes&&n(a.yes,g,a),a.no&&n(a.no,g,a)):a.next&&n(a.next,g,a),g)}(this.start),e.render()},clean:function(){this.diagram.clean()}},e=[],g=0,n=1,o=a.length;o>n;n++)if("\n"===a[n]&&"\\"!==a[n-1]){var p=a.substring(g,n);g=n+1,e.push(p.replace(/\\\n/g,"\n"))}gq;){var s=e[q];s.indexOf(": ")<0&&s.indexOf("(")<0&&s.indexOf(")")<0&&s.indexOf("->")<0&&s.indexOf("=>")<0?(e[q-1]+="\n"+s,e.splice(q,1),r--):q++}for(;e.length>0;){var t=e.splice(0,1)[0];if(t.indexOf("=>")>=0){var u,v=t.split("=>"),w={key:v[0],symbolType:v[1],text:null,link:null,target:null,flowstate:null};if(w.symbolType.indexOf(": ")>=0&&(u=w.symbolType.split(": "),w.symbolType=u[0],w.text=u[1]),w.text&&w.text.indexOf(":>")>=0?(u=w.text.split(":>"),w.text=u[0],w.link=u[1]):w.symbolType.indexOf(":>")>=0&&(u=w.symbolType.split(":>"),w.symbolType=u[0],w.link=u[1]),w.symbolType.indexOf("\n")>=0&&(w.symbolType=w.symbolType.split("\n")[0]),w.link){var x=w.link.indexOf("[")+1,y=w.link.indexOf("]");x>=0&&y>=0&&(w.target=w.link.substring(x,y),w.link=w.link.substring(0,x-1))}if(w.text&&w.text.indexOf("|")>=0){var z=w.text.split("|");w.text=z[0],w.flowstate=z[1].trim()}d.symbols[w.key]=w}else if(t.indexOf("->")>=0)for(var A=t.split("->"),B=0,C=A.length;C>B;B++){var D=A[B],E=b(D),F=c(D),G=null;if(F.indexOf(",")>=0){var H=F.split(",");F=H[0],G=H[1].trim()}if(d.start||(d.start=E),C>B+1){var I=A[B+1];E[F]=b(I),E["direction_"+F]=G,G=null}}}return d}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&1/0!=d&&d!=-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=c;arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));for(var e=d>=0?Math.min(d,c-1):c-Math.abs(d);e>=0;e--)if(e in b&&b[e]===a)return e;return-1}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var o=this,p={};"undefined"!=typeof module&&module.exports?module.exports=p:o.flowchart=o.flowchart||p;var q={x:0,y:0,"line-width":3,"line-length":50,"text-margin":10,"font-size":14,"font-color":"black","line-color":"black","element-color":"black",fill:"white","yes-text":"yes","no-text":"no","arrow-end":"block","class":"flowchart",symbols:{start:{},end:{},condition:{},inputoutput:{},operation:{},subroutine:{}}},r={defaults:a,inherits:b};f.prototype.handle=function(a){this.symbols.indexOf(a)<=-1&&this.symbols.push(a);var b=this;return a instanceof m?(a.yes=function(c){return a.yes_symbol=c,a.no_symbol&&(a.pathOk=!0),b.handle(c)},a.no=function(c){return a.no_symbol=c,a.yes_symbol&&(a.pathOk=!0),b.handle(c)}):a.then=function(c){return a.next=c,a.pathOk=!0,b.handle(c)},a},f.prototype.startWith=function(a){return this.start=a,this.handle(a)},f.prototype.render=function(){var a,b=0,c=0,d=0,e=0,f=0,g=0;for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.width>b&&(b=a.width),a.height>c&&(c=a.height);for(d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.shiftX(this.options.x+(b-a.width)/2+this.options["line-width"]),a.shiftY(this.options.y+(c-a.height)/2+this.options["line-width"]);for(this.start.render(),d=0,e=this.symbols.length;e>d;d++)a=this.symbols[d],a.renderLines();for(f=this.maxXFromLine,d=0,e=this.symbols.length;e>d;d++){a=this.symbols[d];var h=a.getX()+a.width,i=a.getY()+a.height;h>f&&(f=h),i>g&&(g=i)}this.paper.setSize(f+this.options["line-width"],g+this.options["line-width"])},f.prototype.clean=function(){if(this.paper){var a=this.paper.canvas;a.parentNode.removeChild(a)}},g.prototype.getAttr=function(a){if(!this.chart)return void 0;var b,c=this.chart.options?this.chart.options[a]:void 0,d=this.chart.options.symbols?this.chart.options.symbols[this.symbolType][a]:void 0;return this.chart.options.flowstate&&this.chart.options.flowstate[this.flowstate]&&(b=this.chart.options.flowstate[this.flowstate][a]),b||d||c},g.prototype.initialize=function(){this.group.transform("t"+this.getAttr("line-width")+","+this.getAttr("line-width")),this.width=this.group.getBBox().width,this.height=this.group.getBBox().height},g.prototype.getCenter=function(){return{x:this.getX()+this.width/2,y:this.getY()+this.height/2}},g.prototype.getX=function(){return this.group.getBBox().x},g.prototype.getY=function(){return this.group.getBBox().y},g.prototype.shiftX=function(a){this.group.transform("t"+(this.getX()+a)+","+this.getY())},g.prototype.setX=function(a){this.group.transform("t"+a+","+this.getY())},g.prototype.shiftY=function(a){this.group.transform("t"+this.getX()+","+(this.getY()+a))},g.prototype.setY=function(a){this.group.transform("t"+this.getX()+","+a)},g.prototype.getTop=function(){var a=this.getY(),b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getBottom=function(){var a=this.getY()+this.height,b=this.getX()+this.width/2;return{x:b,y:a}},g.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX();return{x:b,y:a}},g.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width;return{x:b,y:a}},g.prototype.render=function(){if(this.next){var a=this.getAttr("line-length");if("right"===this.next_direction){var b=this.getRight();if(this.next.getLeft(),!this.next.isPositioned){this.next.setY(b.y-this.next.height/2),this.next.shiftX(this.group.getBBox().x+this.width+a);var c=this;!function e(){for(var b,d=!1,f=0,g=c.chart.symbols.length;g>f;f++){b=c.chart.symbols[f];var h=Math.abs(b.getCenter().x-c.next.getCenter().x);if(b.getCenter().y>c.next.getCenter().y&&h<=c.next.width/2){d=!0;break}}d&&(c.next.setX(b.getX()+b.width+a),e())}(),this.next.isPositioned=!0,this.next.render()}}else{var d=this.getBottom();this.next.getTop(),this.next.isPositioned||(this.next.shiftY(this.getY()+this.height+a),this.next.setX(d.x-this.next.width/2),this.next.isPositioned=!0,this.next.render())}}},g.prototype.renderLines=function(){this.next&&(this.next_direction?this.drawLineTo(this.next,"",this.next_direction):this.drawLineTo(this.next))},g.prototype.drawLineTo=function(a,b,c){this.connectedTo.indexOf(a)<0&&this.connectedTo.push(a);var f,g=this.getCenter().x,h=this.getCenter().y,i=(this.getTop(),this.getRight()),j=this.getBottom(),k=this.getLeft(),l=a.getCenter().x,m=a.getCenter().y,n=a.getTop(),o=a.getRight(),p=(a.getBottom(),a.getLeft()),q=g===l,r=h===m,s=m>h,t=h>m,u=g>l,v=l>g,w=0,x=this.getAttr("line-length"),y=this.getAttr("line-width");if(c&&"bottom"!==c||!q||!s)if(c&&"right"!==c||!r||!v)if(c&&"left"!==c||!r||!u)if(c&&"right"!==c||!q||!t)if(c&&"right"!==c||!q||!s)if(c&&"bottom"!==c||!u)if(c&&"bottom"!==c||!v)if(c&&"right"===c&&u)f=d(this.chart,i,[{x:i.x+x/2,y:i.y},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"right"===c&&v)f=d(this.chart,i,[{x:n.x,y:i.y},{x:n.x,y:n.y}],b),this.rightStart=!0,a.topEnd=!0,w=i.x+x/2;else if(c&&"bottom"===c&&q&&t)f=d(this.chart,j,[{x:j.x,y:j.y+x/2},{x:i.x+x/2,y:j.y+x/2},{x:i.x+x/2,y:n.y-x/2},{x:n.x,y:n.y-x/2},{x:n.x,y:n.y}],b),this.bottomStart=!0,a.topEnd=!0,w=j.x+x/2;else if("left"===c&&q&&t){var z=k.x-x/2;p.xA;A++)for(var C,D=this.chart.lines[A],E=D.attr("path"),F=f.attr("path"),G=0,H=E.length-1;H>G;G++){var I=[];I.push(["M",E[G][1],E[G][2]]),I.push(["L",E[G+1][1],E[G+1][2]]);for(var J=I[0][1],K=I[0][2],L=I[1][1],M=I[1][2],N=0,O=F.length-1;O>N;N++){var P=[];P.push(["M",F[N][1],F[N][2]]),P.push(["L",F[N+1][1],F[N+1][2]]);var Q=P[0][1],R=P[0][2],S=P[1][1],T=P[1][2],U=e(J,K,L,M,Q,R,S,T);if(U.onLine1&&U.onLine2){var V;R===T?Q>S?(V=["L",U.x+2*y,R],F.splice(N+1,0,V),V=["C",U.x+2*y,R,U.x,R-4*y,U.x-2*y,R],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",U.x-2*y,R],F.splice(N+1,0,V),V=["C",U.x-2*y,R,U.x,R-4*y,U.x+2*y,R],F.splice(N+2,0,V),f.attr("path",F)):R>T?(V=["L",Q,U.y+2*y],F.splice(N+1,0,V),V=["C",Q,U.y+2*y,Q+4*y,U.y,Q,U.y-2*y],F.splice(N+2,0,V),f.attr("path",F)):(V=["L",Q,U.y-2*y],F.splice(N+1,0,V),V=["C",Q,U.y-2*y,Q+4*y,U.y,Q,U.y+2*y],F.splice(N+2,0,V),f.attr("path",F)),N+=2,C+=2}}}this.chart.lines.push(f)}(!this.chart.maxXFromLine||this.chart.maxXFromLine&&w>this.chart.maxXFromLine)&&(this.chart.maxXFromLine=w)},r.inherits(h,g),r.inherits(i,g),r.inherits(j,g),r.inherits(k,g),r.inherits(l,g),l.prototype.getLeft=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.textMargin;return{x:b,y:a}},l.prototype.getRight=function(){var a=this.getY()+this.group.getBBox().height/2,b=this.getX()+this.group.getBBox().width-this.textMargin;return{x:b,y:a}},r.inherits(m,g),m.prototype.render=function(){this.yes_direction&&(this[this.yes_direction+"_symbol"]=this.yes_symbol),this.no_direction&&(this[this.no_direction+"_symbol"]=this.no_symbol);var a=this.getAttr("line-length");if(this.bottom_symbol){var b=this.getBottom();this.bottom_symbol.getTop(),this.bottom_symbol.isPositioned||(this.bottom_symbol.shiftY(this.getY()+this.height+a),this.bottom_symbol.setX(b.x-this.bottom_symbol.width/2),this.bottom_symbol.isPositioned=!0,this.bottom_symbol.render())}if(this.right_symbol){var c=this.getRight();if(this.right_symbol.getLeft(),!this.right_symbol.isPositioned){this.right_symbol.setY(c.y-this.right_symbol.height/2),this.right_symbol.shiftX(this.group.getBBox().x+this.width+a);var d=this;!function e(){for(var b,c=!1,f=0,g=d.chart.symbols.length;g>f;f++){b=d.chart.symbols[f];var h=Math.abs(b.getCenter().x-d.right_symbol.getCenter().x);if(b.getCenter().y>d.right_symbol.getCenter().y&&h<=d.right_symbol.width/2){c=!0;break}}c&&(d.right_symbol.setX(b.getX()+b.width+a),e())}(),this.right_symbol.isPositioned=!0,this.right_symbol.render()}}},m.prototype.renderLines=function(){this.yes_symbol&&this.drawLineTo(this.yes_symbol,this.getAttr("yes-text"),this.yes_direction),this.no_symbol&&this.drawLineTo(this.no_symbol,this.getAttr("no-text"),this.no_direction)},p.parse=n}(); \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/jquery.flowchart.min.js b/src/main/resources/templates/editor/lib/jquery.flowchart.min.js new file mode 100644 index 0000000000000000000000000000000000000000..a30a8fd1e039df64051ed45576b073124ed6d5b1 --- /dev/null +++ b/src/main/resources/templates/editor/lib/jquery.flowchart.min.js @@ -0,0 +1,2 @@ +/*! jQuery.flowchart.js v1.1.0 | jquery.flowchart.min.js | jQuery plugin for flowchart.js. | MIT License | By: Pandao | https://github.com/pandao/jquery.flowchart.js | 2015-03-09 */ +(function(factory){if(typeof require==="function"&&typeof exports==="object"&&typeof module==="object"){module.exports=factory}else{if(typeof define==="function"){factory(jQuery,flowchart)}else{factory($,flowchart)}}}(function(jQuery,flowchart){(function($){$.fn.flowChart=function(options){options=options||{};var defaults={"x":0,"y":0,"line-width":2,"line-length":50,"text-margin":10,"font-size":14,"font-color":"black","line-color":"black","element-color":"black","fill":"white","yes-text":"yes","no-text":"no","arrow-end":"block","symbols":{"start":{"font-color":"black","element-color":"black","fill":"white"},"end":{"class":"end-element"}},"flowstate":{"past":{"fill":"#CCCCCC","font-size":12},"current":{"fill":"black","font-color":"white","font-weight":"bold"},"future":{"fill":"white"},"request":{"fill":"blue"},"invalid":{"fill":"#444444"},"approved":{"fill":"#58C4A3","font-size":12,"yes-text":"APPROVED","no-text":"n/a"},"rejected":{"fill":"#C45879","font-size":12,"yes-text":"n/a","no-text":"REJECTED"}}};return this.each(function(){var $this=$(this);var diagram=flowchart.parse($this.text());var settings=$.extend(true,defaults,options);$this.html("");diagram.drawSVG(this,settings)})}})(jQuery)})); \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/marked.min.js b/src/main/resources/templates/editor/lib/marked.min.js new file mode 100644 index 0000000000000000000000000000000000000000..5597fa44426b7330f7975f038966219d56263cf9 --- /dev/null +++ b/src/main/resources/templates/editor/lib/marked.min.js @@ -0,0 +1,9 @@ +/** + * marked v0.3.3 - a markdown parser + * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) + * https://github.com/chjj/marked + */ +(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose){loose=next}}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq); +this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if((!bq&&top)&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else{if(this.options.pedantic){this.rules=inline.pedantic}}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^/i.test(cap[0])){this.inLink=false}}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue +}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants){return text}return text.replace(/--/g,"\u2014").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201c").replace(/"/g,"\u201d").replace(/\.{3}/g,"\u2026")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i0.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
        "+(escaped?code:escape(code,true))+"\n
        "}return'
        '+(escaped?code:escape(code,true))+"\n
        \n"};Renderer.prototype.blockquote=function(quote){return"
        \n"+quote+"
        \n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
        \n":"
        \n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
      • "+text+"
      • \n"};Renderer.prototype.paragraph=function(text){return"

        "+text+"

        \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
        \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return this.options.xhtml?"
        ":"
        "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0||prot.indexOf("vbscript:")===0){return""}}var out='
        ";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'":">";return out};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon"){return":"}if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name){return new RegExp(regex,opt)}val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

        "+escape(e.message+"",true)+"
        "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else{if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/prettify.min.js b/src/main/resources/templates/editor/lib/prettify.min.js new file mode 100644 index 0000000000000000000000000000000000000000..056f9689810723327ded93c5c9b9479881bc80c9 --- /dev/null +++ b/src/main/resources/templates/editor/lib/prettify.min.js @@ -0,0 +1,15 @@ +// Copyright (C) 2006 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +var IN_GLOBAL_SCOPE=true;window["PR_SHOULD_USE_CONTINUATION"]=true;var prettyPrintOne;var prettyPrint;(function(){var P=window;var i=["break,continue,do,else,for,if,return,while"];var u=[i,"auto,case,char,const,default,"+"double,enum,extern,float,goto,inline,int,long,register,short,signed,"+"sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,"+"new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,"+"concept,concept_map,const_cast,constexpr,decltype,delegate,"+"dynamic_cast,explicit,export,friend,generic,late_check,"+"mutable,namespace,nullptr,property,reinterpret_cast,static_assert,"+"static_cast,template,typeid,typename,using,virtual,where"];var y=[p,"abstract,assert,boolean,byte,extends,final,finally,implements,import,"+"instanceof,interface,null,native,package,strictfp,super,synchronized,"+"throws,transient"];var U=[y,"as,base,by,checked,decimal,delegate,descending,dynamic,event,"+"fixed,foreach,from,group,implicit,in,internal,into,is,let,"+"lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,"+"sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,"+"var,virtual,where"];var r="all,and,by,catch,class,else,extends,false,finally,"+"for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,"+"throw,true,try,unless,until,when,while,yes";var x=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,"+"Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,"+"goto,if,import,last,local,my,next,no,our,print,package,redo,require,"+"sub,undef,unless,until,use,wantarray,while,BEGIN,END";var K=[i,"and,as,assert,class,def,del,"+"elif,except,exec,finally,from,global,import,in,is,lambda,"+"nonlocal,not,or,pass,print,raise,try,with,yield,"+"False,True,None"];var g=[i,"alias,and,begin,case,class,"+"def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,"+"rescue,retry,self,super,then,true,undef,unless,until,when,yield,"+"BEGIN,END"];var z=[i,"as,assert,const,copy,drop,"+"enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,"+"pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"];var J=[i,"case,done,elif,esac,eval,fi,"+"function,in,local,set,then,until"];var C=[l,U,x,s,K,g,J];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;var E="str";var B="kwd";var j="com";var R="typ";var I="lit";var N="pun";var H="pln";var m="tag";var G="dec";var L="src";var S="atn";var n="atv";var Q="nocode";var O="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(ac){var ag=0;var V=false;var af=false;for(var Y=0,X=ac.length;Y122)){if(!(an<65||aj>90)){ai.push([Math.max(65,aj)|32,Math.min(an,90)|32])}if(!(an<97||aj>122)){ai.push([Math.max(97,aj)&~32,Math.min(an,122)&~32])}}}}ai.sort(function(ax,aw){return(ax[0]-aw[0])||(aw[1]-ax[1])});var al=[];var ar=[];for(var au=0;auav[0]){if(av[1]+1>av[0]){ap.push("-")}ap.push(W(av[1]))}}ap.push("]");return ap.join("")}function Z(ao){var am=ao.source.match(new RegExp("(?:"+"\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]"+"|\\\\u[A-Fa-f0-9]{4}"+"|\\\\x[A-Fa-f0-9]{2}"+"|\\\\[0-9]+"+"|\\\\[^ux0-9]"+"|\\(\\?[:!=]"+"|[\\(\\)\\^]"+"|[^\\x5B\\x5C\\(\\)\\^]+"+")","g"));var ak=am.length;var aq=[];for(var an=0,ap=0;an=2&&al==="["){am[an]=aa(aj)}else{if(al!=="\\"){am[an]=aj.replace(/[a-zA-Z]/g,function(ar){var at=ar.charCodeAt(0);return"["+String.fromCharCode(at&~32,at|32)+"]"})}}}}return am.join("")}var ad=[];for(var Y=0,X=ac.length;Y=0;){V[af.charAt(ah)]=ab}}var ai=ab[1];var ad=""+ai;if(!aj.hasOwnProperty(ad)){ak.push(ai);aj[ad]=null}}ak.push(/[\0-\uffff]/);Y=k(ak)})();var aa=W.length;var Z=function(ak){var ac=ak.sourceCode,ab=ak.basePos;var ag=[ab,H];var ai=0;var aq=ac.match(Y)||[];var am={};for(var ah=0,au=aq.length;ah=5&&"lang-"===at.substring(0,5);if(ap&&!(al&&typeof al[1]==="string")){ap=false;at=L}if(!ap){am[aj]=at}}var ae=ai;ai+=aj.length;if(!ap){ag.push(ab+ae,at)}else{var ao=al[1];var an=aj.indexOf(ao);var af=an+ao.length;if(al[2]){af=aj.length-al[2].length;an=af-ao.length}var av=at.substring(5);D(ab+ae,aj.substring(0,an),Z,ag);D(ab+ae+an,ao,q(av,ao),ag);D(ab+ae+af,aj.substring(af),Z,ag)}}ak.decorations=ag};return Z}function h(af){var X=[],ab=[];if(af["tripleQuotedStrings"]){X.push([E,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(af["multiLineStrings"]){X.push([E,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{X.push([E,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(af["verbatimStrings"]){ab.push([E,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var ad=af["hashComments"];if(ad){if(af["cStyleComments"]){if(ad>1){X.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{X.push([j,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}ab.push([E,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])}else{X.push([j,/^#[^\r\n]*/,null,"#"])}}if(af["cStyleComments"]){ab.push([j,/^\/\/[^\r\n]*/,null]);ab.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}var W=af["regexLiterals"];if(W){var Y=W>1?"":"\n\r";var aa=Y?".":"[\\S\\s]";var Z=("/(?=[^/*"+Y+"])"+"(?:[^/\\x5B\\x5C"+Y+"]"+"|\\x5C"+aa+"|\\x5B(?:[^\\x5C\\x5D"+Y+"]"+"|\\x5C"+aa+")*(?:\\x5D|$))+"+"/");ab.push(["lang-regex",RegExp("^"+O+"("+Z+")")])}var ae=af["types"];if(ae){ab.push([R,ae])}var ac=(""+af["keywords"]).replace(/^ | $/g,"");if(ac.length){ab.push([B,new RegExp("^(?:"+ac.replace(/[\s,]+/g,"|")+")\\b"),null])}X.push([H,/^\s+/,null," \r\n\t\xA0"]);var V="^.[^\\s\\w.$@'\"`/\\\\]*";if(af["regexLiterals"]){V+="(?!s*/)"}ab.push([I,/^@[a-z_$][a-z_$@0-9]*/i,null],[R,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[H,/^[a-z_$][a-z_$@0-9]*/i,null],[I,new RegExp("^(?:"+"0x[a-f0-9]+"+"|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)"+"(?:e[+\\-]?\\d+)?"+")"+"[a-z]*","i"),null,"0123456789"],[H,/^\\[\s\S]?/,null],[N,new RegExp(V),null]);return f(X,ab)}var M=h({"keywords":C,"hashComments":true,"cStyleComments":true,"multiLineStrings":true,"regexLiterals":true});function T(X,ai,ab){var W=/(?:^|\s)nocode(?:\s|$)/;var ad=/\r\n?|\n/;var ae=X.ownerDocument;var ah=ae.createElement("li");while(X.firstChild){ah.appendChild(X.firstChild)}var Y=[ah];function ag(ao){var an=ao.nodeType;if(an==1&&!W.test(ao.className)){if("br"===ao.nodeName){af(ao);if(ao.parentNode){ao.parentNode.removeChild(ao)}}else{for(var aq=ao.firstChild;aq;aq=aq.nextSibling){ag(aq)}}}else{if((an==3||an==4)&&ab){var ap=ao.nodeValue;var al=ap.match(ad);if(al){var ak=ap.substring(0,al.index);ao.nodeValue=ak;var aj=ap.substring(al.index+al[0].length);if(aj){var am=ao.parentNode;am.insertBefore(ae.createTextNode(aj),ao.nextSibling)}af(ao);if(!ak){ao.parentNode.removeChild(ao)}}}}}function af(am){while(!am.nextSibling){am=am.parentNode;if(!am){return}}function ak(an,au){var at=au?an.cloneNode(false):an;var aq=an.parentNode;if(aq){var ar=ak(aq,1);var ap=an.nextSibling;ar.appendChild(at);for(var ao=ap;ao;ao=ap){ap=ao.nextSibling;ar.appendChild(ao)}}return at}var aj=ak(am.nextSibling,0);for(var al;(al=aj.parentNode)&&al.nodeType===1;){aj=al}Y.push(aj)}for(var aa=0;aa=V){ak+=2}if(Z>=at){ad+=2}}}finally{if(av){av.style.display=al}}}var t={};function c(X,Y){for(var V=Y.length;--V>=0;){var W=Y[V];if(!t.hasOwnProperty(W)){t[W]=X}else{if(P["console"]){console["warn"]("cannot override language handler %s",W)}}}}function q(W,V){if(!(W&&t.hasOwnProperty(W))){W=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[N,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(f([[H,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[S,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[N,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(f([],[[n,/^[\s\S]+/]]),["uq.val"]);c(h({"keywords":l,"hashComments":true,"cStyleComments":true,"types":e}),["c","cc","cpp","cxx","cyc","m"]);c(h({"keywords":"null,true,false"}),["json"]);c(h({"keywords":U,"hashComments":true,"cStyleComments":true,"verbatimStrings":true,"types":e}),["cs"]);c(h({"keywords":y,"cStyleComments":true}),["java"]);c(h({"keywords":J,"hashComments":true,"multiLineStrings":true}),["bash","bsh","csh","sh"]);c(h({"keywords":K,"hashComments":true,"multiLineStrings":true,"tripleQuotedStrings":true}),["cv","py","python"]);c(h({"keywords":s,"hashComments":true,"multiLineStrings":true,"regexLiterals":2}),["perl","pl","pm"]);c(h({"keywords":g,"hashComments":true,"multiLineStrings":true,"regexLiterals":true}),["rb","ruby"]);c(h({"keywords":x,"cStyleComments":true,"regexLiterals":true}),["javascript","js"]);c(h({"keywords":r,"hashComments":3,"cStyleComments":true,"multilineStrings":true,"tripleQuotedStrings":true,"regexLiterals":true}),["coffee"]);c(h({"keywords":z,"cStyleComments":true,"multilineStrings":true}),["rc","rs","rust"]);c(f([],[[E,/^[\s\S]+/]]),["regex"]);function d(Y){var X=Y.langExtension;try{var V=b(Y.sourceNode,Y.pre);var W=V.sourceCode;Y.sourceCode=W;Y.spans=V.spans;Y.basePos=0;q(X,W)(Y);F(Y)}catch(Z){if(P["console"]){console["log"](Z&&Z["stack"]||Z)}}}function A(Z,Y,X){var V=document.createElement("div");V.innerHTML="
        "+Z+"
        ";V=V.firstChild;if(X){T(V,X,true)}var W={langExtension:Y,numberLines:X,sourceNode:V,pre:1};d(W);return V.innerHTML}function w(al,ab){var ah=ab||document.body;var ao=ah.ownerDocument||document;function aa(aq){return ah.getElementsByTagName(aq)}var ad=[aa("pre"),aa("code"),aa("xmp")];var ae=[];for(var ak=0;akp;p++)"zIndex"in h[p]&&(l.push(h[p].zIndex),h[p].zIndex<0&&(m[h[p].zIndex]=h[p]));for(l.sort(i);l[j]<0;)if(e=m[l[j++]],n.push(e.apply(d,g)),c)return c=f,n;for(p=0;q>p;p++)if(e=h[p],"zIndex"in e)if(e.zIndex==l[j]){if(n.push(e.apply(d,g)),c)break;do if(j++,e=m[l[j]],e&&n.push(e.apply(d,g)),c)break;while(e)}else m[e.zIndex]=e;else if(n.push(e.apply(d,g)),c)break;return c=f,b=o,n.length?n:null};k._events=j,k.listeners=function(a){var b,c,d,e,h,i,k,l,m=a.split(f),n=j,o=[n],p=[];for(e=0,h=m.length;h>e;e++){for(l=[],i=0,k=o.length;k>i;i++)for(n=o[i].n,c=[n[m[e]],n[g]],d=2;d--;)b=c[d],b&&(l.push(b),p=p.concat(b.f||[]));o=l}return p},k.on=function(a,b){if(a=String(a),"function"!=typeof b)return function(){};for(var c=a.split(f),d=j,e=0,g=c.length;g>e;e++)d=d.n,d=d.hasOwnProperty(c[e])&&d[c[e]]||(d[c[e]]={n:{}});for(d.f=d.f||[],e=0,g=d.f.length;g>e;e++)if(d.f[e]==b)return h;return d.f.push(b),function(a){+a==+a&&(b.zIndex=+a)}},k.f=function(a){var b=[].slice.call(arguments,1);return function(){k.apply(null,[a,null].concat(b).concat([].slice.call(arguments,0)))}},k.stop=function(){c=1},k.nt=function(a){return a?new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)").test(b):b},k.nts=function(){return b.split(f)},k.off=k.unbind=function(a,b){if(!a)return void(k._events=j={n:{}});var c,d,h,i,l,m,n,o=a.split(f),p=[j];for(i=0,l=o.length;l>i;i++)for(m=0;mi;i++)for(c=p[i];c.n;){if(b){if(c.f){for(m=0,n=c.f.length;n>m;m++)if(c.f[m]==b){c.f.splice(m,1);break}!c.f.length&&delete c.f}for(d in c.n)if(c.n[e](d)&&c.n[d].f){var q=c.n[d].f;for(m=0,n=q.length;n>m;m++)if(q[m]==b){q.splice(m,1);break}!q.length&&delete c.n[d].f}}else{delete c.f;for(d in c.n)c.n[e](d)&&c.n[d].f&&delete c.n[d].f}c=c.n}},k.once=function(a,b){var c=function(){return k.unbind(a,c),b.apply(this,arguments)};return k.on(a,c)},k.version=d,k.toString=function(){return"You are running Eve "+d},"undefined"!=typeof module&&module.exports?module.exports=k:"undefined"!=typeof define?define("eve",[],function(){return k}):a.eve=k}(window||this),function(a,b){"function"==typeof define&&define.amd?define(["eve"],function(c){return b(a,c)}):b(a,a.eve||"function"==typeof require&&require("eve"))}(this,function(a,b){function c(a){if(c.is(a,"function"))return u?a():b.on("raphael.DOMload",a);if(c.is(a,V))return c._engine.create[D](c,a.splice(0,3+c.is(a[0],T))).add(a);var d=Array.prototype.slice.call(arguments,0);if(c.is(d[d.length-1],"function")){var e=d.pop();return u?e.call(c._engine.create[D](c,d)):b.on("raphael.DOMload",function(){e.call(c._engine.create[D](c,d))})}return c._engine.create[D](c,arguments)}function d(a){if("function"==typeof a||Object(a)!==a)return a;var b=new a.constructor;for(var c in a)a[z](c)&&(b[c]=d(a[c]));return b}function e(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function f(a,b,c){function d(){var f=Array.prototype.slice.call(arguments,0),g=f.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];return h[z](g)?(e(i,g),c?c(h[g]):h[g]):(i.length>=1e3&&delete h[i.shift()],i.push(g),h[g]=a[D](b,f),c?c(h[g]):h[g])}return d}function g(){return this.hex}function h(a,b){for(var c=[],d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function i(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function j(a,b,c,d,e,f,g,h,j){null==j&&(j=1),j=j>1?1:0>j?0:j;for(var k=j/2,l=12,m=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],n=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],o=0,p=0;l>p;p++){var q=k*m[p]+k,r=i(q,a,c,e,g),s=i(q,b,d,f,h),t=r*r+s*s;o+=n[p]*N.sqrt(t)}return k*o}function k(a,b,c,d,e,f,g,h,i){if(!(0>i||j(a,b,c,d,e,f,g,h)o;)m/=2,n+=(i>k?1:-1)*m,k=j(a,b,c,d,e,f,g,h,n);return n}}function l(a,b,c,d,e,f,g,h){if(!(O(a,c)O(e,g)||O(b,d)O(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(k){var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(!(n<+P(a,c).toFixed(2)||n>+O(a,c).toFixed(2)||n<+P(e,g).toFixed(2)||n>+O(e,g).toFixed(2)||o<+P(b,d).toFixed(2)||o>+O(b,d).toFixed(2)||o<+P(f,h).toFixed(2)||o>+O(f,h).toFixed(2)))return{x:l,y:m}}}}function m(a,b,d){var e=c.bezierBBox(a),f=c.bezierBBox(b);if(!c.isBBoxIntersect(e,f))return d?0:[];for(var g=j.apply(0,a),h=j.apply(0,b),i=O(~~(g/5),1),k=O(~~(h/5),1),m=[],n=[],o={},p=d?0:[],q=0;i+1>q;q++){var r=c.findDotsAtSegment.apply(c,a.concat(q/i));m.push({x:r.x,y:r.y,t:q/i})}for(q=0;k+1>q;q++)r=c.findDotsAtSegment.apply(c,b.concat(q/k)),n.push({x:r.x,y:r.y,t:q/k});for(q=0;i>q;q++)for(var s=0;k>s;s++){var t=m[q],u=m[q+1],v=n[s],w=n[s+1],x=Q(u.x-t.x)<.001?"y":"x",y=Q(w.x-v.x)<.001?"y":"x",z=l(t.x,t.y,u.x,u.y,v.x,v.y,w.x,w.y);if(z){if(o[z.x.toFixed(4)]==z.y.toFixed(4))continue;o[z.x.toFixed(4)]=z.y.toFixed(4);var A=t.t+Q((z[x]-t[x])/(u[x]-t[x]))*(u.t-t.t),B=v.t+Q((z[y]-v[y])/(w[y]-v[y]))*(w.t-v.t);A>=0&&1.001>=A&&B>=0&&1.001>=B&&(d?p++:p.push({x:z.x,y:z.y,t1:P(A,1),t2:P(B,1)}))}}return p}function n(a,b,d){a=c._path2curve(a),b=c._path2curve(b);for(var e,f,g,h,i,j,k,l,n,o,p=d?0:[],q=0,r=a.length;r>q;q++){var s=a[q];if("M"==s[0])e=i=s[1],f=j=s[2];else{"C"==s[0]?(n=[e,f].concat(s.slice(1)),e=n[6],f=n[7]):(n=[e,f,e,f,i,j,i,j],e=i,f=j);for(var t=0,u=b.length;u>t;t++){var v=b[t];if("M"==v[0])g=k=v[1],h=l=v[2];else{"C"==v[0]?(o=[g,h].concat(v.slice(1)),g=o[6],h=o[7]):(o=[g,h,g,h,k,l,k,l],g=k,h=l);var w=m(n,o,d);if(d)p+=w;else{for(var x=0,y=w.length;y>x;x++)w[x].segment1=q,w[x].segment2=t,w[x].bez1=n,w[x].bez2=o;p=p.concat(w)}}}}}return p}function o(a,b,c,d,e,f){null!=a?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function p(){return this.x+H+this.y+H+this.width+" × "+this.height}function q(a,b,c,d,e,f){function g(a){return((l*a+k)*a+j)*a}function h(a,b){var c=i(a,b);return((o*c+n)*c+m)*c}function i(a,b){var c,d,e,f,h,i;for(e=a,i=0;8>i;i++){if(f=g(e)-a,Q(f)e)return c;if(e>d)return d;for(;d>c;){if(f=g(e),Q(f-a)f?c=e:d=e,e=(d-c)/2+c}return e}var j=3*b,k=3*(d-b)-j,l=1-j-k,m=3*c,n=3*(e-c)-m,o=1-m-n;return h(a,1/(200*f))}function r(a,b){var c=[],d={};if(this.ms=b,this.times=1,a){for(var e in a)a[z](e)&&(d[_(e)]=a[e],c.push(_(e)));c.sort(lb)}this.anim=d,this.top=c[c.length-1],this.percents=c}function s(a,d,e,f,g,h){e=_(e);var i,j,k,l,m,n,p=a.ms,r={},s={},t={};if(f)for(v=0,x=ic.length;x>v;v++){var u=ic[v];if(u.el.id==d.id&&u.anim==a){u.percent!=e?(ic.splice(v,1),k=1):j=u,d.attr(u.totalOrigin);break}}else f=+s;for(var v=0,x=a.percents.length;x>v;v++){if(a.percents[v]==e||a.percents[v]>f*a.top){e=a.percents[v],m=a.percents[v-1]||0,p=p/a.top*(e-m),l=a.percents[v+1],i=a.anim[e];break}f&&d.attr(a.anim[a.percents[v]])}if(i){if(j)j.initstatus=f,j.start=new Date-j.ms*f;else{for(var y in i)if(i[z](y)&&(db[z](y)||d.paper.customAttributes[z](y)))switch(r[y]=d.attr(y),null==r[y]&&(r[y]=cb[y]),s[y]=i[y],db[y]){case T:t[y]=(s[y]-r[y])/p;break;case"colour":r[y]=c.getRGB(r[y]);var A=c.getRGB(s[y]);t[y]={r:(A.r-r[y].r)/p,g:(A.g-r[y].g)/p,b:(A.b-r[y].b)/p};break;case"path":var B=Kb(r[y],s[y]),C=B[1];for(r[y]=B[0],t[y]=[],v=0,x=r[y].length;x>v;v++){t[y][v]=[0];for(var D=1,F=r[y][v].length;F>D;D++)t[y][v][D]=(C[v][D]-r[y][v][D])/p}break;case"transform":var G=d._,H=Pb(G[y],s[y]);if(H)for(r[y]=H.from,s[y]=H.to,t[y]=[],t[y].real=!0,v=0,x=r[y].length;x>v;v++)for(t[y][v]=[r[y][v][0]],D=1,F=r[y][v].length;F>D;D++)t[y][v][D]=(s[y][v][D]-r[y][v][D])/p;else{var K=d.matrix||new o,L={_:{transform:G.transform},getBBox:function(){return d.getBBox(1)}};r[y]=[K.a,K.b,K.c,K.d,K.e,K.f],Nb(L,s[y]),s[y]=L._.transform,t[y]=[(L.matrix.a-K.a)/p,(L.matrix.b-K.b)/p,(L.matrix.c-K.c)/p,(L.matrix.d-K.d)/p,(L.matrix.e-K.e)/p,(L.matrix.f-K.f)/p]}break;case"csv":var M=I(i[y])[J](w),N=I(r[y])[J](w);if("clip-rect"==y)for(r[y]=N,t[y]=[],v=N.length;v--;)t[y][v]=(M[v]-r[y][v])/p;s[y]=M;break;default:for(M=[][E](i[y]),N=[][E](r[y]),t[y]=[],v=d.paper.customAttributes[y].length;v--;)t[y][v]=((M[v]||0)-(N[v]||0))/p}var O=i.easing,P=c.easing_formulas[O];if(!P)if(P=I(O).match(Z),P&&5==P.length){var Q=P;P=function(a){return q(a,+Q[1],+Q[2],+Q[3],+Q[4],p)}}else P=nb;if(n=i.start||a.start||+new Date,u={anim:a,percent:e,timestamp:n,start:n+(a.del||0),status:0,initstatus:f||0,stop:!1,ms:p,easing:P,from:r,diff:t,to:s,el:d,callback:i.callback,prev:m,next:l,repeat:h||a.times,origin:d.attr(),totalOrigin:g},ic.push(u),f&&!j&&!k&&(u.stop=!0,u.start=new Date-p*f,1==ic.length))return kc();k&&(u.start=new Date-u.ms*f),1==ic.length&&jc(kc)}b("raphael.anim.start."+d.id,d,a)}}function t(a){for(var b=0;be;e++)for(i=a[e],f=1,h=i.length;h>f;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d;return a};if(c._g=A,c.type=A.win.SVGAngle||A.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML","VML"==c.type){var sb,tb=A.doc.createElement("div");if(tb.innerHTML='',sb=tb.firstChild,sb.style.behavior="url(#default#VML)",!sb||"object"!=typeof sb.adj)return c.type=G;tb=null}c.svg=!(c.vml="VML"==c.type),c._Paper=C,c.fn=v=C.prototype=c.prototype,c._id=0,c._oid=0,c.is=function(a,b){return b=M.call(b),"finite"==b?!Y[z](+a):"array"==b?a instanceof Array:"null"==b&&null===a||b==typeof a&&null!==a||"object"==b&&a===Object(a)||"array"==b&&Array.isArray&&Array.isArray(a)||W.call(a).slice(8,-1).toLowerCase()==b},c.angle=function(a,b,d,e,f,g){if(null==f){var h=a-d,i=b-e;return h||i?(180+180*N.atan2(-i,-h)/S+360)%360:0}return c.angle(a,b,f,g)-c.angle(d,e,f,g)},c.rad=function(a){return a%360*S/180},c.deg=function(a){return 180*a/S%360},c.snapTo=function(a,b,d){if(d=c.is(d,"finite")?d:10,c.is(a,V)){for(var e=a.length;e--;)if(Q(a[e]-b)<=d)return a[e]}else{a=+a;var f=b%a;if(d>f)return b-f;if(f>a-d)return b-f+a}return b};c.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=16*N.random()|0,c="x"==a?b:3&b|8;return c.toString(16)});c.setWindow=function(a){b("raphael.setWindow",c,A.win,a),A.win=a,A.doc=A.win.document,c._engine.initWin&&c._engine.initWin(A.win)};var ub=function(a){if(c.vml){var b,d=/^\s+|\s+$/g;try{var e=new ActiveXObject("htmlfile");e.write(""),e.close(),b=e.body}catch(g){b=createPopup().document.body}var h=b.createTextRange();ub=f(function(a){try{b.style.color=I(a).replace(d,G);var c=h.queryCommandValue("ForeColor");return c=(255&c)<<16|65280&c|(16711680&c)>>>16,"#"+("000000"+c.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=A.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",A.doc.body.appendChild(i),ub=f(function(a){return i.style.color=a,A.doc.defaultView.getComputedStyle(i,G).getPropertyValue("color")})}return ub(a)},vb=function(){return"hsb("+[this.h,this.s,this.b]+")"},wb=function(){return"hsl("+[this.h,this.s,this.l]+")"},xb=function(){return this.hex},yb=function(a,b,d){if(null==b&&c.is(a,"object")&&"r"in a&&"g"in a&&"b"in a&&(d=a.b,b=a.g,a=a.r),null==b&&c.is(a,U)){var e=c.getRGB(a);a=e.r,b=e.g,d=e.b}return(a>1||b>1||d>1)&&(a/=255,b/=255,d/=255),[a,b,d]},zb=function(a,b,d,e){a*=255,b*=255,d*=255;var f={r:a,g:b,b:d,hex:c.rgb(a,b,d),toString:xb};return c.is(e,"finite")&&(f.opacity=e),f};c.color=function(a){var b;return c.is(a,"object")&&"h"in a&&"s"in a&&"b"in a?(b=c.hsb2rgb(a),a.r=b.r,a.g=b.g,a.b=b.b,a.hex=b.hex):c.is(a,"object")&&"h"in a&&"s"in a&&"l"in a?(b=c.hsl2rgb(a),a.r=b.r,a.g=b.g,a.b=b.b,a.hex=b.hex):(c.is(a,"string")&&(a=c.getRGB(a)),c.is(a,"object")&&"r"in a&&"g"in a&&"b"in a?(b=c.rgb2hsl(a),a.h=b.h,a.s=b.s,a.l=b.l,b=c.rgb2hsb(a),a.v=b.b):(a={hex:"none"},a.r=a.g=a.b=a.h=a.s=a.v=a.l=-1)),a.toString=xb,a},c.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,d=a.o,a=a.h),a*=360;var e,f,g,h,i;return a=a%360/60,i=c*b,h=i*(1-Q(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],zb(e,f,g,d)},c.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h),(a>1||b>1||c>1)&&(a/=360,b/=100,c/=100),a*=360;var e,f,g,h,i;return a=a%360/60,i=2*b*(.5>c?c:1-c),h=i*(1-Q(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a],zb(e,f,g,d)},c.rgb2hsb=function(a,b,c){c=yb(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;return f=O(a,b,c),g=f-P(a,b,c),d=0==g?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=0==g?0:g/f,{h:d,s:e,b:f,toString:vb}},c.rgb2hsl=function(a,b,c){c=yb(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;return g=O(a,b,c),h=P(a,b,c),i=g-h,d=0==i?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=0==i?0:.5>f?i/(2*f):i/(2-2*f),{h:d,s:e,l:f,toString:wb}},c._path2string=function(){return this.join(",").replace(gb,"$1")};c._preload=function(a,b){var c=A.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,A.doc.body.removeChild(this)},c.onerror=function(){A.doc.body.removeChild(this)},A.doc.body.appendChild(c),c.src=a};c.getRGB=f(function(a){if(!a||(a=I(a)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:g};if("none"==a)return{r:-1,g:-1,b:-1,hex:"none",toString:g};!(fb[z](a.toLowerCase().substring(0,2))||"#"==a.charAt())&&(a=ub(a));var b,d,e,f,h,i,j=a.match(X);return j?(j[2]&&(e=ab(j[2].substring(5),16),d=ab(j[2].substring(3,5),16),b=ab(j[2].substring(1,3),16)),j[3]&&(e=ab((h=j[3].charAt(3))+h,16),d=ab((h=j[3].charAt(2))+h,16),b=ab((h=j[3].charAt(1))+h,16)),j[4]&&(i=j[4][J](eb),b=_(i[0]),"%"==i[0].slice(-1)&&(b*=2.55),d=_(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=_(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),"rgba"==j[1].toLowerCase().slice(0,4)&&(f=_(i[3])),i[3]&&"%"==i[3].slice(-1)&&(f/=100)),j[5]?(i=j[5][J](eb),b=_(i[0]),"%"==i[0].slice(-1)&&(b*=2.55),d=_(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=_(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),("deg"==i[0].slice(-3)||"°"==i[0].slice(-1))&&(b/=360),"hsba"==j[1].toLowerCase().slice(0,4)&&(f=_(i[3])),i[3]&&"%"==i[3].slice(-1)&&(f/=100),c.hsb2rgb(b,d,e,f)):j[6]?(i=j[6][J](eb),b=_(i[0]),"%"==i[0].slice(-1)&&(b*=2.55),d=_(i[1]),"%"==i[1].slice(-1)&&(d*=2.55),e=_(i[2]),"%"==i[2].slice(-1)&&(e*=2.55),("deg"==i[0].slice(-3)||"°"==i[0].slice(-1))&&(b/=360),"hsla"==j[1].toLowerCase().slice(0,4)&&(f=_(i[3])),i[3]&&"%"==i[3].slice(-1)&&(f/=100),c.hsl2rgb(b,d,e,f)):(j={r:b,g:d,b:e,toString:g},j.hex="#"+(16777216|e|d<<8|b<<16).toString(16).slice(1),c.is(f,"finite")&&(j.opacity=f),j)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:g}},c),c.hsb=f(function(a,b,d){return c.hsb2rgb(a,b,d).hex}),c.hsl=f(function(a,b,d){return c.hsl2rgb(a,b,d).hex}),c.rgb=f(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),c.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);return b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b})),c.hex},c.getColor.reset=function(){delete this.start},c.parsePathString=function(a){if(!a)return null;var b=Ab(a);if(b.arr)return Cb(b.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];return c.is(a,V)&&c.is(a[0],V)&&(e=Cb(a)),e.length||I(a).replace(hb,function(a,b,c){var f=[],g=b.toLowerCase();if(c.replace(jb,function(a,b){b&&f.push(+b)}),"m"==g&&f.length>2&&(e.push([b][E](f.splice(0,2))),g="l",b="m"==b?"l":"L"),"r"==g)e.push([b][E](f));else for(;f.length>=d[g]&&(e.push([b][E](f.splice(0,d[g]))),d[g]););}),e.toString=c._path2string,b.arr=Cb(e),e},c.parseTransformString=f(function(a){if(!a)return null;var b=[];return c.is(a,V)&&c.is(a[0],V)&&(b=Cb(a)),b.length||I(a).replace(ib,function(a,c,d){{var e=[];M.call(c)}d.replace(jb,function(a,b){b&&e.push(+b)}),b.push([c][E](e))}),b.toString=c._path2string,b});var Ab=function(a){var b=Ab.ps=Ab.ps||{};return b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[z](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])}),b[a]};c.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=R(j,3),l=R(j,2),m=i*i,n=m*i,o=k*a+3*l*i*c+3*j*i*i*e+n*g,p=k*b+3*l*i*d+3*j*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,w=j*e+i*g,x=j*f+i*h,y=90-180*N.atan2(q-s,r-t)/S;return(q>s||t>r)&&(y+=180),{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:w,y:x},alpha:y}},c.bezierBBox=function(a,b,d,e,f,g,h,i){c.is(a,"array")||(a=[a,b,d,e,f,g,h,i]);var j=Jb.apply(null,a);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},c.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},c.isBBoxIntersect=function(a,b){var d=c.isPointInsideBBox;return d(b,a.x,a.y)||d(b,a.x2,a.y)||d(b,a.x,a.y2)||d(b,a.x2,a.y2)||d(a,b.x,b.y)||d(a,b.x2,b.y)||d(a,b.x,b.y2)||d(a,b.x2,b.y2)||(a.xb.x||b.xa.x)&&(a.yb.y||b.ya.y)},c.pathIntersection=function(a,b){return n(a,b)},c.pathIntersectionNumber=function(a,b){return n(a,b,1)},c.isPointInsidePath=function(a,b,d){var e=c.pathBBox(a);return c.isPointInsideBBox(e,b,d)&&n(a,[["M",b,d],["H",e.x2+10]],1)%2==1},c._removedFactory=function(a){return function(){b("raphael.log",null,"Raphaël: you are calling to method “"+a+"” of removed object",a)}};var Bb=c.pathBBox=function(a){var b=Ab(a);if(b.bbox)return d(b.bbox);if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=Kb(a);for(var c,e=0,f=0,g=[],h=[],i=0,j=a.length;j>i;i++)if(c=a[i],"M"==c[0])e=c[1],f=c[2],g.push(e),h.push(f);else{var k=Jb(e,f,c[1],c[2],c[3],c[4],c[5],c[6]);g=g[E](k.min.x,k.max.x),h=h[E](k.min.y,k.max.y),e=c[5],f=c[6]}var l=P[D](0,g),m=P[D](0,h),n=O[D](0,g),o=O[D](0,h),p=n-l,q=o-m,r={x:l,y:m,x2:n,y2:o,width:p,height:q,cx:l+p/2,cy:m+q/2};return b.bbox=d(r),r},Cb=function(a){var b=d(a);return b.toString=c._path2string,b},Db=c._pathToRelative=function(a){var b=Ab(a);if(b.rel)return Cb(b.rel);c.is(a,V)&&c.is(a&&a[0],V)||(a=c.parsePathString(a));var d=[],e=0,f=0,g=0,h=0,i=0;"M"==a[0][0]&&(e=a[0][1],f=a[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=a.length;k>j;j++){var l=d[j]=[],m=a[j];if(m[0]!=M.call(m[0]))switch(l[0]=M.call(m[0]),l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;o>n;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}else{l=d[j]=[],"m"==m[0]&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;q>p;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}return d.toString=c._path2string,b.rel=Cb(d),d},Eb=c._pathToAbsolute=function(a){var b=Ab(a);if(b.abs)return Cb(b.abs);if(c.is(a,V)&&c.is(a&&a[0],V)||(a=c.parsePathString(a)),!a||!a.length)return[["M",0,0]];var d=[],e=0,f=0,g=0,i=0,j=0;"M"==a[0][0]&&(e=+a[0][1],f=+a[0][2],g=e,i=f,j++,d[0]=["M",e,f]);for(var k,l,m=3==a.length&&"M"==a[0][0]&&"R"==a[1][0].toUpperCase()&&"Z"==a[2][0].toUpperCase(),n=j,o=a.length;o>n;n++){if(d.push(k=[]),l=a[n],l[0]!=bb.call(l[0]))switch(k[0]=bb.call(l[0]),k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":for(var p=[e,f][E](l.slice(1)),q=2,r=p.length;r>q;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[E](h(p,m));break;case"M":g=+l[1]+e,i=+l[2]+f;default:for(q=1,r=l.length;r>q;q++)k[q]=+l[q]+(q%2?e:f)}else if("R"==l[0])p=[e,f][E](l.slice(1)),d.pop(),d=d[E](h(p,m)),k=["R"][E](l.slice(-2));else for(var s=0,t=l.length;t>s;s++)k[s]=l[s];switch(k[0]){case"Z":e=g,f=i;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":g=k[k.length-2],i=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}return d.toString=c._path2string,b.abs=Cb(d),d},Fb=function(a,b,c,d){return[a,b,c,d,c,d]},Gb=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},Hb=function(a,b,c,d,e,g,h,i,j,k){var l,m=120*S/180,n=S/180*(+e||0),o=[],p=f(function(a,b,c){var d=a*N.cos(c)-b*N.sin(c),e=a*N.sin(c)+b*N.cos(c);return{x:d,y:e}});if(k)y=k[0],z=k[1],w=k[2],x=k[3];else{l=p(a,b,-n),a=l.x,b=l.y,l=p(i,j,-n),i=l.x,j=l.y;var q=(N.cos(S/180*e),N.sin(S/180*e),(a-i)/2),r=(b-j)/2,s=q*q/(c*c)+r*r/(d*d);s>1&&(s=N.sqrt(s),c=s*c,d=s*d);var t=c*c,u=d*d,v=(g==h?-1:1)*N.sqrt(Q((t*u-t*r*r-u*q*q)/(t*r*r+u*q*q))),w=v*c*r/d+(a+i)/2,x=v*-d*q/c+(b+j)/2,y=N.asin(((b-x)/d).toFixed(9)),z=N.asin(((j-x)/d).toFixed(9));y=w>a?S-y:y,z=w>i?S-z:z,0>y&&(y=2*S+y),0>z&&(z=2*S+z),h&&y>z&&(y-=2*S),!h&&z>y&&(z-=2*S)}var A=z-y;if(Q(A)>m){var B=z,C=i,D=j;z=y+m*(h&&z>y?1:-1),i=w+c*N.cos(z),j=x+d*N.sin(z),o=Hb(i,j,c,d,e,0,h,C,D,[z,B,w,x])}A=z-y;var F=N.cos(y),G=N.sin(y),H=N.cos(z),I=N.sin(z),K=N.tan(A/4),L=4/3*c*K,M=4/3*d*K,O=[a,b],P=[a+L*G,b-M*F],R=[i+L*I,j-M*H],T=[i,j];if(P[0]=2*O[0]-P[0],P[1]=2*O[1]-P[1],k)return[P,R,T][E](o);o=[P,R,T][E](o).join()[J](",");for(var U=[],V=0,W=o.length;W>V;V++)U[V]=V%2?p(o[V-1],o[V],n).y:p(o[V],o[V+1],n).x;return U},Ib=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:R(j,3)*a+3*R(j,2)*i*c+3*j*i*i*e+R(i,3)*g,y:R(j,3)*b+3*R(j,2)*i*d+3*j*i*i*f+R(i,3)*h}},Jb=f(function(a,b,c,d,e,f,g,h){var i,j=e-2*c+a-(g-2*e+c),k=2*(c-a)-2*(e-c),l=a-c,m=(-k+N.sqrt(k*k-4*j*l))/2/j,n=(-k-N.sqrt(k*k-4*j*l))/2/j,o=[b,h],p=[a,g];return Q(m)>"1e12"&&(m=.5),Q(n)>"1e12"&&(n=.5),m>0&&1>m&&(i=Ib(a,b,c,d,e,f,g,h,m),p.push(i.x),o.push(i.y)),n>0&&1>n&&(i=Ib(a,b,c,d,e,f,g,h,n),p.push(i.x),o.push(i.y)),j=f-2*d+b-(h-2*f+d),k=2*(d-b)-2*(f-d),l=b-d,m=(-k+N.sqrt(k*k-4*j*l))/2/j,n=(-k-N.sqrt(k*k-4*j*l))/2/j,Q(m)>"1e12"&&(m=.5),Q(n)>"1e12"&&(n=.5),m>0&&1>m&&(i=Ib(a,b,c,d,e,f,g,h,m),p.push(i.x),o.push(i.y)),n>0&&1>n&&(i=Ib(a,b,c,d,e,f,g,h,n),p.push(i.x),o.push(i.y)),{min:{x:P[D](0,p),y:P[D](0,o)},max:{x:O[D](0,p),y:O[D](0,o)}}}),Kb=c._path2curve=f(function(a,b){var c=!b&&Ab(a);if(!b&&c.curve)return Cb(c.curve);for(var d=Eb(a),e=b&&Eb(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=(function(a,b,c){var d,e,f={T:1,Q:1};if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];switch(!(a[0]in f)&&(b.qx=b.qy=null),a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][E](Hb[D](0,[b.x,b.y][E](a.slice(1))));break;case"S":"C"==c||"S"==c?(d=2*b.x-b.bx,e=2*b.y-b.by):(d=b.x,e=b.y),a=["C",d,e][E](a.slice(1));break;case"T":"Q"==c||"T"==c?(b.qx=2*b.x-b.qx,b.qy=2*b.y-b.qy):(b.qx=b.x,b.qy=b.y),a=["C"][E](Gb(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][E](Gb(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][E](Fb(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][E](Fb(b.x,b.y,a[1],b.y));break;case"V":a=["C"][E](Fb(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][E](Fb(b.x,b.y,b.X,b.Y))}return a}),i=function(a,b){if(a[b].length>7){a[b].shift();for(var c=a[b];c.length;)k[b]="A",e&&(l[b]="A"),a.splice(b++,0,["C"][E](c.splice(0,6)));a.splice(b,1),p=O(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&"M"==a[g][0]&&"M"!=b[g][0]&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],p=O(d.length,e&&e.length||0))},k=[],l=[],m="",n="",o=0,p=O(d.length,e&&e.length||0);p>o;o++){d[o]&&(m=d[o][0]),"C"!=m&&(k[o]=m,o&&(n=k[o-1])),d[o]=h(d[o],f,n),"A"!=k[o]&&"C"==m&&(k[o]="C"),i(d,o),e&&(e[o]&&(m=e[o][0]),"C"!=m&&(l[o]=m,o&&(n=l[o-1])),e[o]=h(e[o],g,n),"A"!=l[o]&&"C"==m&&(l[o]="C"),i(e,o)),j(d,e,f,g,o),j(e,d,g,f,o);var q=d[o],r=e&&e[o],s=q.length,t=e&&r.length;f.x=q[s-2],f.y=q[s-1],f.bx=_(q[s-4])||f.x,f.by=_(q[s-3])||f.y,g.bx=e&&(_(r[t-4])||g.x),g.by=e&&(_(r[t-3])||g.y),g.x=e&&r[t-2],g.y=e&&r[t-1]}return e||(c.curve=Cb(d)),e?[d,e]:d},null,Cb),Lb=(c._parseDots=f(function(a){for(var b=[],d=0,e=a.length;e>d;d++){var f={},g=a[d].match(/^([^:]*):?([\d\.]*)/);if(f.color=c.getRGB(g[1]),f.color.error)return null;f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),b.push(f)}for(d=1,e=b.length-1;e>d;d++)if(!b[d].offset){for(var h=_(b[d-1].offset||0),i=0,j=d+1;e>j;j++)if(b[j].offset){i=b[j].offset;break}i||(i=100,j=e),i=_(i);for(var k=(i-h)/(j-d+1);j>d;d++)h+=k,b[d].offset=h+"%"}return b}),c._tear=function(a,b){a==b.top&&(b.top=a.prev),a==b.bottom&&(b.bottom=a.next),a.next&&(a.next.prev=a.prev),a.prev&&(a.prev.next=a.next)}),Mb=(c._tofront=function(a,b){b.top!==a&&(Lb(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},c._toback=function(a,b){b.bottom!==a&&(Lb(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},c._insertafter=function(a,b,c){Lb(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},c._insertbefore=function(a,b,c){Lb(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},c.toMatrix=function(a,b){var c=Bb(a),d={_:{transform:G},getBBox:function(){return c}};return Nb(d,b),d.matrix}),Nb=(c.transformPath=function(a,b){return rb(a,Mb(a,b))},c._extractTransform=function(a,b){if(null==b)return a._.transform;b=I(b).replace(/\.{3}|\u2026/g,a._.transform||G);var d=c.parseTransformString(b),e=0,f=0,g=0,h=1,i=1,j=a._,k=new o;if(j.transform=d||[],d)for(var l=0,m=d.length;m>l;l++){var n,p,q,r,s,t=d[l],u=t.length,v=I(t[0]).toLowerCase(),w=t[0]!=v,x=w?k.invert():0;"t"==v&&3==u?w?(n=x.x(0,0),p=x.y(0,0),q=x.x(t[1],t[2]),r=x.y(t[1],t[2]),k.translate(q-n,r-p)):k.translate(t[1],t[2]):"r"==v?2==u?(s=s||a.getBBox(1),k.rotate(t[1],s.x+s.width/2,s.y+s.height/2),e+=t[1]):4==u&&(w?(q=x.x(t[2],t[3]),r=x.y(t[2],t[3]),k.rotate(t[1],q,r)):k.rotate(t[1],t[2],t[3]),e+=t[1]):"s"==v?2==u||3==u?(s=s||a.getBBox(1),k.scale(t[1],t[u-1],s.x+s.width/2,s.y+s.height/2),h*=t[1],i*=t[u-1]):5==u&&(w?(q=x.x(t[3],t[4]),r=x.y(t[3],t[4]),k.scale(t[1],t[2],q,r)):k.scale(t[1],t[2],t[3],t[4]),h*=t[1],i*=t[2]):"m"==v&&7==u&&k.add(t[1],t[2],t[3],t[4],t[5],t[6]),j.dirtyT=1,a.matrix=k}a.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,1==h&&1==i&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1}),Ob=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return 4==a.length?[b,0,a[2],a[3]]:[b,0];case"s":return 5==a.length?[b,1,1,a[3],a[4]]:3==a.length?[b,1,1]:[b,1]}},Pb=c._equaliseTransform=function(a,b){b=I(b).replace(/\.{3}|\u2026/g,a),a=c.parseTransformString(a)||[],b=c.parseTransformString(b)||[]; +for(var d,e,f,g,h=O(a.length,b.length),i=[],j=[],k=0;h>k;k++){if(f=a[k]||Ob(b[k]),g=b[k]||Ob(f),f[0]!=g[0]||"r"==f[0].toLowerCase()&&(f[2]!=g[2]||f[3]!=g[3])||"s"==f[0].toLowerCase()&&(f[3]!=g[3]||f[4]!=g[4]))return;for(i[k]=[],j[k]=[],d=0,e=O(f.length,g.length);e>d;d++)d in f&&(i[k][d]=f[d]),d in g&&(j[k][d]=g[d])}return{from:i,to:j}};c._getContainer=function(a,b,d,e){var f;return f=null!=e||c.is(a,"object")?a:A.doc.getElementById(a),null!=f?f.tagName?null==b?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:b,height:d}:{container:1,x:a,y:b,width:d,height:e}:void 0},c.pathToRelative=Db,c._engine={},c.path2curve=Kb,c.matrix=function(a,b,c,d,e,f){return new o(a,b,c,d,e,f)},function(a){function b(a){return a[0]*a[0]+a[1]*a[1]}function d(a){var c=N.sqrt(b(a));a[0]&&(a[0]/=c),a[1]&&(a[1]/=c)}a.add=function(a,b,c,d,e,f){var g,h,i,j,k=[[],[],[]],l=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],m=[[a,c,e],[b,d,f],[0,0,1]];for(a&&a instanceof o&&(m=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]),g=0;3>g;g++)for(h=0;3>h;h++){for(j=0,i=0;3>i;i++)j+=l[g][i]*m[i][h];k[g][h]=j}this.a=k[0][0],this.b=k[1][0],this.c=k[0][1],this.d=k[1][1],this.e=k[0][2],this.f=k[1][2]},a.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new o(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},a.clone=function(){return new o(this.a,this.b,this.c,this.d,this.e,this.f)},a.translate=function(a,b){this.add(1,0,0,1,a,b)},a.scale=function(a,b,c,d){null==b&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},a.rotate=function(a,b,d){a=c.rad(a),b=b||0,d=d||0;var e=+N.cos(a).toFixed(9),f=+N.sin(a).toFixed(9);this.add(e,f,-f,e,b,d),this.add(1,0,0,1,-b,-d)},a.x=function(a,b){return a*this.a+b*this.c+this.e},a.y=function(a,b){return a*this.b+b*this.d+this.f},a.get=function(a){return+this[I.fromCharCode(97+a)].toFixed(4)},a.toString=function(){return c.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},a.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},a.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},a.split=function(){var a={};a.dx=this.e,a.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];a.scalex=N.sqrt(b(e[0])),d(e[0]),a.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*a.shear,e[1][1]-e[0][1]*a.shear],a.scaley=N.sqrt(b(e[1])),d(e[1]),a.shear/=a.scaley;var f=-e[0][1],g=e[1][1];return 0>g?(a.rotate=c.deg(N.acos(g)),0>f&&(a.rotate=360-a.rotate)):a.rotate=c.deg(N.asin(f)),a.isSimple=!(+a.shear.toFixed(9)||a.scalex.toFixed(9)!=a.scaley.toFixed(9)&&a.rotate),a.isSuperSimple=!+a.shear.toFixed(9)&&a.scalex.toFixed(9)==a.scaley.toFixed(9)&&!a.rotate,a.noRotation=!+a.shear.toFixed(9)&&!a.rotate,a},a.toTransformString=function(a){var b=a||this[J]();return b.isSimple?(b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4),(b.dx||b.dy?"t"+[b.dx,b.dy]:G)+(1!=b.scalex||1!=b.scaley?"s"+[b.scalex,b.scaley,0,0]:G)+(b.rotate?"r"+[b.rotate,0,0]:G)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(o.prototype);var Qb=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);v.safari="Apple Computer, Inc."==navigator.vendor&&(Qb&&Qb[1]<4||"iP"==navigator.platform.slice(0,2))||"Google Inc."==navigator.vendor&&Qb&&Qb[1]<8?function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:mb;for(var Rb=function(){this.returnValue=!1},Sb=function(){return this.originalEvent.preventDefault()},Tb=function(){this.cancelBubble=!0},Ub=function(){return this.originalEvent.stopPropagation()},Vb=function(a){var b=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,c=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft;return{x:a.clientX+c,y:a.clientY+b}},Wb=function(){return A.doc.addEventListener?function(a,b,c,d){var e=function(a){var b=Vb(a);return c.call(d,a,b.x,b.y)};if(a.addEventListener(b,e,!1),F&&L[b]){var f=function(b){for(var e=Vb(b),f=b,g=0,h=b.targetTouches&&b.targetTouches.length;h>g;g++)if(b.targetTouches[g].target==a){b=b.targetTouches[g],b.originalEvent=f,b.preventDefault=Sb,b.stopPropagation=Ub;break}return c.call(d,b,e.x,e.y)};a.addEventListener(L[b],f,!1)}return function(){return a.removeEventListener(b,e,!1),F&&L[b]&&a.removeEventListener(L[b],f,!1),!0}}:A.doc.attachEvent?function(a,b,c,d){var e=function(a){a=a||A.win.event;var b=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,e=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;return a.preventDefault=a.preventDefault||Rb,a.stopPropagation=a.stopPropagation||Tb,c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){return a.detachEvent("on"+b,e),!0};return f}:void 0}(),Xb=[],Yb=function(a){for(var c,d=a.clientX,e=a.clientY,f=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,g=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft,h=Xb.length;h--;){if(c=Xb[h],F&&a.touches){for(var i,j=a.touches.length;j--;)if(i=a.touches[j],i.identifier==c.el._drag.id){d=i.clientX,e=i.clientY,(a.originalEvent?a.originalEvent:a).preventDefault();break}}else a.preventDefault();var k,l=c.el.node,m=l.nextSibling,n=l.parentNode,o=l.style.display;A.win.opera&&n.removeChild(l),l.style.display="none",k=c.el.paper.getElementByPoint(d,e),l.style.display=o,A.win.opera&&(m?n.insertBefore(l,m):n.appendChild(l)),k&&b("raphael.drag.over."+c.el.id,c.el,k),d+=g,e+=f,b("raphael.drag.move."+c.el.id,c.move_scope||c.el,d-c.el._drag.x,e-c.el._drag.y,d,e,a)}},Zb=function(a){c.unmousemove(Yb).unmouseup(Zb);for(var d,e=Xb.length;e--;)d=Xb[e],d.el._drag={},b("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,a);Xb=[]},$b=c.el={},_b=K.length;_b--;)!function(a){c[a]=$b[a]=function(b,d){return c.is(b,"function")&&(this.events=this.events||[],this.events.push({name:a,f:b,unbind:Wb(this.shape||this.node||A.doc,a,b,d||this)})),this},c["un"+a]=$b["un"+a]=function(b){for(var d=this.events||[],e=d.length;e--;)d[e].name!=a||!c.is(b,"undefined")&&d[e].f!=b||(d[e].unbind(),d.splice(e,1),!d.length&&delete this.events);return this}}(K[_b]);$b.data=function(a,d){var e=kb[this.id]=kb[this.id]||{};if(0==arguments.length)return e;if(1==arguments.length){if(c.is(a,"object")){for(var f in a)a[z](f)&&this.data(f,a[f]);return this}return b("raphael.data.get."+this.id,this,e[a],a),e[a]}return e[a]=d,b("raphael.data.set."+this.id,this,d,a),this},$b.removeData=function(a){return null==a?kb[this.id]={}:kb[this.id]&&delete kb[this.id][a],this},$b.getData=function(){return d(kb[this.id]||{})},$b.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},$b.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var ac=[];$b.drag=function(a,d,e,f,g,h){function i(i){(i.originalEvent||i).preventDefault();var j=i.clientX,k=i.clientY,l=A.doc.documentElement.scrollTop||A.doc.body.scrollTop,m=A.doc.documentElement.scrollLeft||A.doc.body.scrollLeft;if(this._drag.id=i.identifier,F&&i.touches)for(var n,o=i.touches.length;o--;)if(n=i.touches[o],this._drag.id=n.identifier,n.identifier==this._drag.id){j=n.clientX,k=n.clientY;break}this._drag.x=j+m,this._drag.y=k+l,!Xb.length&&c.mousemove(Yb).mouseup(Zb),Xb.push({el:this,move_scope:f,start_scope:g,end_scope:h}),d&&b.on("raphael.drag.start."+this.id,d),a&&b.on("raphael.drag.move."+this.id,a),e&&b.on("raphael.drag.end."+this.id,e),b("raphael.drag.start."+this.id,g||f||this,i.clientX+m,i.clientY+l,i)}return this._drag={},ac.push({el:this,start:i}),this.mousedown(i),this},$b.onDragOver=function(a){a?b.on("raphael.drag.over."+this.id,a):b.unbind("raphael.drag.over."+this.id)},$b.undrag=function(){for(var a=ac.length;a--;)ac[a].el==this&&(this.unmousedown(ac[a].start),ac.splice(a,1),b.unbind("raphael.drag.*."+this.id));!ac.length&&c.unmousemove(Yb).unmouseup(Zb),Xb=[]},v.circle=function(a,b,d){var e=c._engine.circle(this,a||0,b||0,d||0);return this.__set__&&this.__set__.push(e),e},v.rect=function(a,b,d,e,f){var g=c._engine.rect(this,a||0,b||0,d||0,e||0,f||0);return this.__set__&&this.__set__.push(g),g},v.ellipse=function(a,b,d,e){var f=c._engine.ellipse(this,a||0,b||0,d||0,e||0);return this.__set__&&this.__set__.push(f),f},v.path=function(a){a&&!c.is(a,U)&&!c.is(a[0],V)&&(a+=G);var b=c._engine.path(c.format[D](c,arguments),this);return this.__set__&&this.__set__.push(b),b},v.image=function(a,b,d,e,f){var g=c._engine.image(this,a||"about:blank",b||0,d||0,e||0,f||0);return this.__set__&&this.__set__.push(g),g},v.text=function(a,b,d){var e=c._engine.text(this,a||0,b||0,I(d));return this.__set__&&this.__set__.push(e),e},v.set=function(a){!c.is(a,"array")&&(a=Array.prototype.splice.call(arguments,0,arguments.length));var b=new mc(a);return this.__set__&&this.__set__.push(b),b.paper=this,b.type="set",b},v.setStart=function(a){this.__set__=a||this.set()},v.setFinish=function(){var a=this.__set__;return delete this.__set__,a},v.getSize=function(){var a=this.canvas.parentNode;return{width:a.offsetWidth,height:a.offsetHeight}},v.setSize=function(a,b){return c._engine.setSize.call(this,a,b)},v.setViewBox=function(a,b,d,e,f){return c._engine.setViewBox.call(this,a,b,d,e,f)},v.top=v.bottom=null,v.raphael=c;var bc=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,h=b.top+(A.win.pageYOffset||e.scrollTop||d.scrollTop)-f,i=b.left+(A.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:h,x:i}};v.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=A.doc.elementFromPoint(a,b);if(A.win.opera&&"svg"==e.tagName){var f=bc(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var h=d.getIntersectionList(g,null);h.length&&(e=h[h.length-1])}if(!e)return null;for(;e.parentNode&&e!=d.parentNode&&!e.raphael;)e=e.parentNode;return e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null},v.getElementsByBBox=function(a){var b=this.set();return this.forEach(function(d){c.isBBoxIntersect(d.getBBox(),a)&&b.push(d)}),b},v.getById=function(a){for(var b=this.bottom;b;){if(b.id==a)return b;b=b.next}return null},v.forEach=function(a,b){for(var c=this.bottom;c;){if(a.call(b,c)===!1)return this;c=c.next}return this},v.getElementsByPoint=function(a,b){var c=this.set();return this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)}),c},$b.isPointInside=function(a,b){var d=this.realPath=qb[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(d=c.transformPath(d,this.attr("transform"))),c.isPointInsidePath(d,a,b)},$b.getBBox=function(a){if(this.removed)return{};var b=this._;return a?((b.dirty||!b.bboxwt)&&(this.realPath=qb[this.type](this),b.bboxwt=Bb(this.realPath),b.bboxwt.toString=p,b.dirty=0),b.bboxwt):((b.dirty||b.dirtyT||!b.bbox)&&((b.dirty||!this.realPath)&&(b.bboxwt=0,this.realPath=qb[this.type](this)),b.bbox=Bb(rb(this.realPath,this.matrix)),b.bbox.toString=p,b.dirty=b.dirtyT=0),b.bbox)},$b.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(a),a},$b.glow=function(a){if("text"==this.type)return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:a.opacity||.5,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||qb[this.type](this);f=this.matrix?rb(f,this.matrix):f;for(var g=1;c+1>g;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var cc=function(a,b,d,e,f,g,h,i,l){return null==l?j(a,b,d,e,f,g,h,i):c.findDotsAtSegment(a,b,d,e,f,g,h,i,k(a,b,d,e,f,g,h,i,l))},dc=function(a,b){return function(d,e,f){d=Kb(d);for(var g,h,i,j,k,l="",m={},n=0,o=0,p=d.length;p>o;o++){if(i=d[o],"M"==i[0])g=+i[1],h=+i[2];else{if(j=cc(g,h,i[1],i[2],i[3],i[4],i[5],i[6]),n+j>e){if(b&&!m.start){if(k=cc(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),l+=["C"+k.start.x,k.start.y,k.m.x,k.m.y,k.x,k.y],f)return l;m.start=l,l=["M"+k.x,k.y+"C"+k.n.x,k.n.y,k.end.x,k.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!a&&!b)return k=cc(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),{x:k.x,y:k.y,alpha:k.alpha}}n+=j,g=+i[5],h=+i[6]}l+=i.shift()+i}return m.end=l,k=a?n:b?m:c.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),k.alpha&&(k={x:k.x,y:k.y,alpha:k.alpha}),k}},ec=dc(1),fc=dc(),gc=dc(0,1);c.getTotalLength=ec,c.getPointAtLength=fc,c.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return gc(a,b).end;var d=gc(a,c,1);return b?gc(d,b).end:d},$b.getTotalLength=function(){var a=this.getPath();if(a)return this.node.getTotalLength?this.node.getTotalLength():ec(a)},$b.getPointAtLength=function(a){var b=this.getPath();if(b)return fc(b,a)},$b.getPath=function(){var a,b=c._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return b&&(a=b(this)),a},$b.getSubpath=function(a,b){var d=this.getPath();if(d)return c.getSubpath(d,a,b)};var hc=c.easing_formulas={linear:function(a){return a},"<":function(a){return R(a,1.7)},">":function(a){return R(a,.48)},"<>":function(a){var b=.48-a/1.04,c=N.sqrt(.1734+b*b),d=c-b,e=R(Q(d),1/3)*(0>d?-1:1),f=-c-b,g=R(Q(f),1/3)*(0>f?-1:1),h=e+g+.5;return 3*(1-h)*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a-=1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){return a==!!a?a:R(2,-10*a)*N.sin(2*(a-.075)*S/.3)+1},bounce:function(a){var b,c=7.5625,d=2.75;return 1/d>a?b=c*a*a:2/d>a?(a-=1.5/d,b=c*a*a+.75):2.5/d>a?(a-=2.25/d,b=c*a*a+.9375):(a-=2.625/d,b=c*a*a+.984375),b}};hc.easeIn=hc["ease-in"]=hc["<"],hc.easeOut=hc["ease-out"]=hc[">"],hc.easeInOut=hc["ease-in-out"]=hc["<>"],hc["back-in"]=hc.backIn,hc["back-out"]=hc.backOut;var ic=[],jc=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||function(a){setTimeout(a,16)},kc=function(){for(var a=+new Date,d=0;dh))if(i>h){var q=j(h/i);for(var r in k)if(k[z](r)){switch(db[r]){case T:f=+k[r]+q*i*l[r];break;case"colour":f="rgb("+[lc($(k[r].r+q*i*l[r].r)),lc($(k[r].g+q*i*l[r].g)),lc($(k[r].b+q*i*l[r].b))].join(",")+")";break;case"path":f=[];for(var t=0,u=k[r].length;u>t;t++){f[t]=[k[r][t][0]];for(var v=1,w=k[r][t].length;w>v;v++)f[t][v]=+k[r][t][v]+q*i*l[r][t][v];f[t]=f[t].join(H)}f=f.join(H);break;case"transform":if(l[r].real)for(f=[],t=0,u=k[r].length;u>t;t++)for(f[t]=[k[r][t][0]],v=1,w=k[r][t].length;w>v;v++)f[t][v]=k[r][t][v]+q*i*l[r][t][v];else{var x=function(a){return+k[r][a]+q*i*l[r][a]};f=[["m",x(0),x(1),x(2),x(3),x(4),x(5)]]}break;case"csv":if("clip-rect"==r)for(f=[],t=4;t--;)f[t]=+k[r][t]+q*i*l[r][t];break;default:var y=[][E](k[r]);for(f=[],t=n.paper.customAttributes[r].length;t--;)f[t]=+y[t]+q*i*l[r][t]}o[r]=f}n.attr(o),function(a,c,d){setTimeout(function(){b("raphael.anim.frame."+a,c,d)})}(n.id,n,e.anim)}else{if(function(a,d,e){setTimeout(function(){b("raphael.anim.frame."+d.id,d,e),b("raphael.anim.finish."+d.id,d,e),c.is(a,"function")&&a.call(d)})}(e.callback,n,e.anim),n.attr(m),ic.splice(d--,1),e.repeat>1&&!e.next){for(g in m)m[z](g)&&(p[g]=e.totalOrigin[g]);e.el.attr(p),s(e.anim,e.el,e.anim.percents[0],null,e.totalOrigin,e.repeat-1)}e.next&&!e.stop&&s(e.anim,e.el,e.next,null,e.totalOrigin,e.repeat)}}}c.svg&&n&&n.paper&&n.paper.safari(),ic.length&&jc(kc)},lc=function(a){return a>255?255:0>a?0:a};$b.animateWith=function(a,b,d,e,f,g){var h=this;if(h.removed)return g&&g.call(h),h;var i=d instanceof r?d:c.animation(d,e,f,g);s(i,h,i.percents[0],null,h.attr());for(var j=0,k=ic.length;k>j;j++)if(ic[j].anim==b&&ic[j].el==a){ic[k-1].start=ic[j].start;break}return h},$b.onAnimation=function(a){return a?b.on("raphael.anim.frame."+this.id,a):b.unbind("raphael.anim.frame."+this.id),this},r.prototype.delay=function(a){var b=new r(this.anim,this.ms);return b.times=this.times,b.del=+a||0,b},r.prototype.repeat=function(a){var b=new r(this.anim,this.ms);return b.del=this.del,b.times=N.floor(O(a,0))||1,b},c.animation=function(a,b,d,e){if(a instanceof r)return a;(c.is(d,"function")||!d)&&(e=e||d||null,d=null),a=Object(a),b=+b||0;var f,g,h={};for(g in a)a[z](g)&&_(g)!=g&&_(g)+"%"!=g&&(f=!0,h[g]=a[g]);if(f)return d&&(h.easing=d),e&&(h.callback=e),new r({100:h},b);if(e){var i=0;for(var j in a){var k=ab(j);a[z](j)&&k>i&&(i=k)}i+="%",!a[i].callback&&(a[i].callback=e)}return new r(a,b)},$b.animate=function(a,b,d,e){var f=this;if(f.removed)return e&&e.call(f),f;var g=a instanceof r?a:c.animation(a,b,d,e);return s(g,f,g.percents[0],null,f.attr()),f},$b.setTime=function(a,b){return a&&null!=b&&this.status(a,P(b,a.ms)/a.ms),this},$b.status=function(a,b){var c,d,e=[],f=0;if(null!=b)return s(a,this,-1,P(b,1)),this;for(c=ic.length;c>f;f++)if(d=ic[f],d.el.id==this.id&&(!a||d.anim==a)){if(a)return d.status;e.push({anim:d.anim,status:d.status})}return a?0:e},$b.pause=function(a){for(var c=0;cb;b++)!a[b]||a[b].constructor!=$b.constructor&&a[b].constructor!=mc||(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},nc=mc.prototype;nc.push=function(){for(var a,b,c=0,d=arguments.length;d>c;c++)a=arguments[c],!a||a.constructor!=$b.constructor&&a.constructor!=mc||(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},nc.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},nc.forEach=function(a,b){for(var c=0,d=this.items.length;d>c;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var oc in $b)$b[z](oc)&&(nc[oc]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][D](c,b)})}}(oc));return nc.attr=function(a,b){if(a&&c.is(a,V)&&c.is(a[0],"object"))for(var d=0,e=a.length;e>d;d++)this.items[d].attr(a[d]);else for(var f=0,g=this.items.length;g>f;f++)this.items[f].attr(a,b);return this},nc.clear=function(){for(;this.length;)this.pop()},nc.splice=function(a,b){a=0>a?O(this.length+a,0):a,b=O(0,P(this.length-a,b));var c,d=[],e=[],f=[];for(c=2;cc;c++)e.push(this[a+c]);for(;cc?f[c]:d[c-g];for(c=this.items.length=this.length-=b-g;this[c];)delete this[c++];return new mc(e)},nc.exclude=function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]==a)return this.splice(b,1),!0},nc.animate=function(a,b,d,e){(c.is(d,"function")||!d)&&(e=d||null);var f,g,h=this.items.length,i=h,j=this;if(!h)return this;e&&(g=function(){!--h&&e.call(j)}),d=c.is(d,U)?d:g;var k=c.animation(a,b,d,g);for(f=this.items[--i].animate(k);i--;)this.items[i]&&!this.items[i].removed&&this.items[i].animateWith(f,k,k),this.items[i]&&!this.items[i].removed||h--;return this},nc.insertAfter=function(a){for(var b=this.items.length;b--;)this.items[b].insertAfter(a);return this},nc.getBBox=function(){for(var a=[],b=[],c=[],d=[],e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}return a=P[D](0,a),b=P[D](0,b),c=O[D](0,c),d=O[D](0,d),{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},nc.clone=function(a){a=this.paper.set();for(var b=0,c=this.items.length;c>b;b++)a.push(this.items[b].clone());return a},nc.toString=function(){return"Raphaël‘s set"},nc.glow=function(a){var b=this.paper.set();return this.forEach(function(c){var d=c.glow(a);null!=d&&d.forEach(function(a){b.push(a)})}),b},nc.isPointInside=function(a,b){var c=!1;return this.forEach(function(d){return d.isPointInside(a,b)?(c=!0,!1):void 0}),c},c.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[z](d)&&(b.face[d]=a.face[d]);if(this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b],!a.svg){b.face["units-per-em"]=ab(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[z](e)){var f=a.glyphs[e];if(b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"},f.k)for(var g in f.k)f[z](g)&&(b.glyphs[e].k[g]=f.k[g])}}return a},v.getFont=function(a,b,d,e){if(e=e||"normal",d=d||"normal",b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400,c.fonts){var f=c.fonts[a];if(!f){var g=new RegExp("(^|\\s)"+a.replace(/[^\w\d\s+!~.:_-]/g,G)+"(\\s|$)","i");for(var h in c.fonts)if(c.fonts[z](h)&&g.test(h)){f=c.fonts[h];break}}var i;if(f)for(var j=0,k=f.length;k>j&&(i=f[j],i.face["font-weight"]!=b||i.face["font-style"]!=d&&i.face["font-style"]||i.face["font-stretch"]!=e);j++);return i}},v.print=function(a,b,d,e,f,g,h,i){g=g||"middle",h=O(P(h||0,1),-1),i=O(P(i||1,3),1);var j,k=I(d)[J](G),l=0,m=0,n=G;if(c.is(e,"string")&&(e=this.getFont(e)),e){j=(f||16)/e.face["units-per-em"];for(var o=e.face.bbox[J](w),p=+o[0],q=o[3]-o[1],r=0,s=+o[1]+("baseline"==g?q+ +e.face.descent:q/2),t=0,u=k.length;u>t;t++){if("\n"==k[t])l=0,x=0,m=0,r+=q*i;else{var v=m&&e.glyphs[k[t-1]]||{},x=e.glyphs[k[t]];l+=m?(v.w||e.w)+(v.k&&v.k[k[t]]||0)+e.w*h:0,m=1}x&&x.d&&(n+=c.transformPath(x.d,["t",l*j,r*j,"s",j,j,p,s,"t",(a-p)/j,(b-s)/j]))}}return this.path(n).attr({fill:"#000",stroke:"none"})},v.add=function(a){if(c.is(a,"array"))for(var b,d=this.set(),e=0,f=a.length;f>e;e++)b=a[e]||{},x[z](b.type)&&d.push(this[b.type]().attr(b));return d},c.format=function(a,b){var d=c.is(b,V)?[0][E](b):arguments;return a&&c.is(a,U)&&d.length-1&&(a=a.replace(y,function(a,b){return null==d[++b]?G:d[b]})),a||G},c.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;return c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),"function"==typeof e&&f&&(e=e()))}),e=(null==e||e==d?a:e)+""};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),c.ninja=function(){return B.was?A.win.Raphael=B.is:delete Raphael,c},c.st=nc,b.on("raphael.DOMload",function(){u=!0}),function(a,b,d){function e(){/in/.test(a.readyState)?setTimeout(e,9):c.eve("raphael.DOMload")}null==a.readyState&&a.addEventListener&&(a.addEventListener(b,d=function(){a.removeEventListener(b,d,!1),a.readyState="complete"},!1),a.readyState="loading"),e()}(document,"DOMContentLoaded"),function(){if(c.svg){var a="hasOwnProperty",b=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=c.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};c.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){"string"==typeof d&&(d=q(d));for(var f in e)e[a](f)&&("xlink:"==f.substring(0,6)?d.setAttributeNS(n,f.substring(6),b(e[f])):d.setAttribute(f,b(e[f])))}else d=c._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(a,e){var j="linear",k=a.id+e,m=.5,n=.5,o=a.node,p=a.paper,r=o.style,s=c._g.doc.getElementById(k);if(!s){if(e=b(e).replace(c._radial_gradient,function(a,b,c){if(j="radial",b&&c){m=d(b),n=d(c);var e=2*(n>.5)-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&.5!=n&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/),"linear"==j){var t=e.shift();if(t=-d(t),isNaN(t))return null;var u=[0,0,f.cos(c.rad(t)),f.sin(c.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=c._parseDots(e);if(!w)return null;if(k=k.replace(/[\(\)\s,\xb0#]/g,"_"),a.gradient&&k!=a.gradient.id&&(p.defs.removeChild(a.gradient),delete a.gradient),!a.gradient){s=q(j+"Gradient",{id:k}),a.gradient=s,q(s,"radial"==j?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:a.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;y>x;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"0%","stop-color":w[x].color||"#fff"}))}}return q(o,{fill:"url("+document.location+"#"+k+")",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1,1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if("path"==d.type){for(var g,h,i,j,k,m=b(e).toLowerCase().split("-"),n=d.paper,r=f?"end":"start",s=d.node,t=d.attrs,u=t["stroke-width"],v=m.length,w="classic",x=3,y=3,z=5;v--;)switch(m[v]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":w=m[v];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}if("open"==w?(x+=2,y+=2,z+=2,i=1,j=f?4:1,k={fill:"none",stroke:t.stroke}):(j=i=x/2,k={fill:t.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={},"none"!=w){var A="raphael-marker-"+w,B="raphael-marker-"+r+w+x+y+"-obj"+d.id;c._g.doc.getElementById(A)?p[A]++:(n.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[w],id:A})),p[A]=1);var C,D=c._g.doc.getElementById(B);D?(p[B]++,C=D.getElementsByTagName("use")[0]):(D=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:j,refY:y/2}),C=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),D.appendChild(C),n.defs.appendChild(D),p[B]=1),q(C,k);var E=i*("diamond"!=w&&"oval"!=w);f?(g=d._.arrows.startdx*u||0,h=c.getTotalLength(t.path)-E*u):(g=E*u,h=c.getTotalLength(t.path)-(d._.arrows.enddx*u||0)),k={},k["marker-"+r]="url(#"+B+")",(h||g)&&(k.d=c.getSubpath(t.path,g,h)),q(s,k),d._.arrows[r+"Path"]=A,d._.arrows[r+"Marker"]=B,d._.arrows[r+"dx"]=E,d._.arrows[r+"Type"]=w,d._.arrows[r+"String"]=e}else f?(g=d._.arrows.startdx*u||0,h=c.getTotalLength(t.path)-g):(g=0,h=c.getTotalLength(t.path)-(d._.arrows.enddx*u||0)),d._.arrows[r+"Path"]&&q(s,{d:c.getSubpath(t.path,g,h)}),delete d._.arrows[r+"Path"],delete d._.arrows[r+"Marker"],delete d._.arrows[r+"dx"],delete d._.arrows[r+"Type"],delete d._.arrows[r+"String"];for(k in p)if(p[a](k)&&!p[k]){var F=c._g.doc.getElementById(k);F&&F.parentNode.removeChild(F)}}},u={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},v=function(a,c,d){if(c=u[b(c).toLowerCase()]){for(var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=c.length;h--;)g[h]=c[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}},w=function(d,f){var i=d.node,k=d.attrs,m=i.style.visibility;i.style.visibility="hidden";for(var o in f)if(f[a](o)){if(!c._availableAttrs[a](o))continue;var p=f[o];switch(k[o]=p,o){case"blur":d.blur(p);break;case"title":var u=i.getElementsByTagName("title");if(u.length&&(u=u[0]))u.firstChild.nodeValue=p;else{u=q("title");var w=c._g.doc.createTextNode(p);u.appendChild(w),i.appendChild(u)}break;case"href":case"target":var x=i.parentNode;if("a"!=x.tagName.toLowerCase()){var z=q("a");x.insertBefore(z,i),z.appendChild(i),x=z}"target"==o?x.setAttributeNS(n,"show","blank"==p?"new":p):x.setAttributeNS(n,o,p);break;case"cursor":i.style.cursor=p;break;case"transform":d.transform(p);break;case"arrow-start":t(d,p);break;case"arrow-end":t(d,p,1);break;case"clip-rect":var A=b(p).split(j);if(4==A.length){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var B=q("clipPath"),C=q("rect");B.id=c.createUUID(),q(C,{x:A[0],y:A[1],width:A[2],height:A[3]}),B.appendChild(C),d.paper.defs.appendChild(B),q(i,{"clip-path":"url(#"+B.id+")"}),d.clip=C}if(!p){var D=i.getAttribute("clip-path");if(D){var E=c._g.doc.getElementById(D.replace(/(^url\(#|\)$)/g,l));E&&E.parentNode.removeChild(E),q(i,{"clip-path":l}),delete d.clip}}break;case"path":"path"==d.type&&(q(i,{d:p?k.path=c._pathToAbsolute(p):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":if(i.setAttribute(o,p),d._.dirty=1,!k.fx)break;o="x",p=k.x;case"x":k.fx&&(p=-k.x-(k.width||0));case"rx":if("rx"==o&&"rect"==d.type)break;case"cx":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"height":if(i.setAttribute(o,p),d._.dirty=1,!k.fy)break;o="y",p=k.y;case"y":k.fy&&(p=-k.y-(k.height||0));case"ry":if("ry"==o&&"rect"==d.type)break;case"cy":i.setAttribute(o,p),d.pattern&&s(d),d._.dirty=1;break;case"r":"rect"==d.type?q(i,{rx:p,ry:p}):i.setAttribute(o,p),d._.dirty=1;break;case"src":"image"==d.type&&i.setAttributeNS(n,"href",p);break;case"stroke-width":(1!=d._.sx||1!=d._.sy)&&(p/=g(h(d._.sx),h(d._.sy))||1),i.setAttribute(o,p),k["stroke-dasharray"]&&v(d,k["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,p,f);break;case"fill":var F=b(p).match(c._ISURL);if(F){B=q("pattern");var G=q("image");B.id=c.createUUID(),q(B,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(G,{x:0,y:0,"xlink:href":F[1]}),B.appendChild(G),function(a){c._preload(F[1],function(){var b=this.offsetWidth,c=this.offsetHeight;q(a,{width:b,height:c}),q(G,{width:b,height:c}),d.paper.safari()})}(B),d.paper.defs.appendChild(B),q(i,{fill:"url(#"+B.id+")"}),d.pattern=B,d.pattern&&s(d);break}var H=c.getRGB(p);if(H.error){if(("circle"==d.type||"ellipse"==d.type||"r"!=b(p).charAt())&&r(d,p)){if("opacity"in k||"fill-opacity"in k){var I=c._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(I){var J=I.getElementsByTagName("stop");q(J[J.length-1],{"stop-opacity":("opacity"in k?k.opacity:1)*("fill-opacity"in k?k["fill-opacity"]:1)})}}k.gradient=p,k.fill="none";break}}else delete f.gradient,delete k.gradient,!c.is(k.opacity,"undefined")&&c.is(f.opacity,"undefined")&&q(i,{opacity:k.opacity}),!c.is(k["fill-opacity"],"undefined")&&c.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":k["fill-opacity"]});H[a]("opacity")&&q(i,{"fill-opacity":H.opacity>1?H.opacity/100:H.opacity});case"stroke":H=c.getRGB(p),i.setAttribute(o,H.hex),"stroke"==o&&H[a]("opacity")&&q(i,{"stroke-opacity":H.opacity>1?H.opacity/100:H.opacity}),"stroke"==o&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":("circle"==d.type||"ellipse"==d.type||"r"!=b(p).charAt())&&r(d,p);break; +case"opacity":k.gradient&&!k[a]("stroke-opacity")&&q(i,{"stroke-opacity":p>1?p/100:p});case"fill-opacity":if(k.gradient){I=c._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),I&&(J=I.getElementsByTagName("stop"),q(J[J.length-1],{"stop-opacity":p}));break}default:"font-size"==o&&(p=e(p,10)+"px");var K=o.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[K]=p,d._.dirty=1,i.setAttribute(o,p)}}y(d,f),i.style.visibility=m},x=1.2,y=function(d,f){if("text"==d.type&&(f[a]("text")||f[a]("font")||f[a]("font-size")||f[a]("x")||f[a]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(c._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[a]("text")){for(g.text=f.text;h.firstChild;)h.removeChild(h.firstChild);for(var j,k=b(f.text).split("\n"),m=[],n=0,o=k.length;o>n;n++)j=q("tspan"),n&&q(j,{dy:i*x,x:g.x}),j.appendChild(c._g.doc.createTextNode(k[n])),h.appendChild(j),m[n]=j}else for(m=h.getElementsByTagName("tspan"),n=0,o=m.length;o>n;n++)n?q(m[n],{dy:i*x,x:g.x}):q(m[0],{dy:0});q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&c.is(r,"finite")&&q(m[0],{dy:r})}},z=function(a){return a.parentNode&&"a"===a.parentNode.tagName.toLowerCase()?a.parentNode:a};Element=function(a,b){this[0]=this.node=a,a.raphael=!0,this.id=c._oid++,a.raphaelid=this.id,this.matrix=c.matrix(),this.realPath=null,this.paper=b,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!b.bottom&&(b.bottom=this),this.prev=b.top,b.top&&(b.top.next=this),b.top=this,this.next=null},$b=c.el,Element.prototype=$b,$b.constructor=Element,c._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new Element(c,b);return d.type="path",w(d,{fill:"none",stroke:"#000",path:a}),d},$b.rotate=function(a,c,e){if(this.removed)return this;if(a=b(a).split(j),a.length-1&&(c=d(a[1]),e=d(a[2])),a=d(a[0]),null==e&&(c=e),null==c||null==e){var f=this.getBBox(1);c=f.x+f.width/2,e=f.y+f.height/2}return this.transform(this._.transform.concat([["r",a,c,e]])),this},$b.scale=function(a,c,e,f){if(this.removed)return this;if(a=b(a).split(j),a.length-1&&(c=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),null==c&&(c=a),null==f&&(e=f),null==e||null==f)var g=this.getBBox(1);return e=null==e?g.x+g.width/2:e,f=null==f?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,c,e,f]])),this},$b.translate=function(a,c){return this.removed?this:(a=b(a).split(j),a.length-1&&(c=d(a[1])),a=d(a[0])||0,c=+c||0,this.transform(this._.transform.concat([["t",a,c]])),this)},$b.transform=function(b){var d=this._;if(null==b)return d.transform;if(c._extractTransform(this,b),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix}),1!=d.sx||1!=d.sy){var e=this.attrs[a]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},$b.hide=function(){return!this.removed&&this.paper.safari(this.node.style.display="none"),this},$b.show=function(){return!this.removed&&this.paper.safari(this.node.style.display=""),this},$b.remove=function(){var a=z(this.node);if(!this.removed&&a.parentNode){var b=this.paper;b.__set__&&b.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&b.defs.removeChild(this.gradient),c._tear(this,b),a.parentNode.removeChild(a),this.removeData();for(var d in this)this[d]="function"==typeof this[d]?c._removedFactory(d):null;this.removed=!0}},$b._getBBox=function(){if("none"==this.node.style.display){this.show();var a=!0}var b,c=!1;this.paper.canvas.parentElement?b=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(b=this.paper.canvas.parentNode.style),b&&"none"==b.display&&(c=!0,b.display="");var d={};try{d=this.node.getBBox()}catch(e){d={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{d=d||{},c&&(b.display="none")}return a&&this.hide(),d},$b.attr=function(b,d){if(this.removed)return this;if(null==b){var e={};for(var f in this.attrs)this.attrs[a](f)&&(e[f]=this.attrs[f]);return e.gradient&&"none"==e.fill&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform,e}if(null==d&&c.is(b,"string")){if("fill"==b&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;if("transform"==b)return this._.transform;for(var g=b.split(j),h={},i=0,l=g.length;l>i;i++)b=g[i],h[b]=b in this.attrs?this.attrs[b]:c.is(this.paper.customAttributes[b],"function")?this.paper.customAttributes[b].def:c._availableAttrs[b];return l-1?h:h[g[0]]}if(null==d&&c.is(b,"array")){for(h={},i=0,l=b.length;l>i;i++)h[b[i]]=this.attr(b[i]);return h}if(null!=d){var m={};m[b]=d}else null!=b&&c.is(b,"object")&&(m=b);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[a](n)&&m[a](n)&&c.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[a](p)&&(m[p]=o[p])}return w(this,m),this},$b.toFront=function(){if(this.removed)return this;var a=z(this.node);a.parentNode.appendChild(a);var b=this.paper;return b.top!=this&&c._tofront(this,b),this},$b.toBack=function(){if(this.removed)return this;var a=z(this.node),b=a.parentNode;b.insertBefore(a,b.firstChild),c._toback(this,this.paper);this.paper;return this},$b.insertAfter=function(a){if(this.removed||!a)return this;var b=z(this.node),d=z(a.node||a[a.length-1].node);return d.nextSibling?d.parentNode.insertBefore(b,d.nextSibling):d.parentNode.appendChild(b),c._insertafter(this,a,this.paper),this},$b.insertBefore=function(a){if(this.removed||!a)return this;var b=z(this.node),d=z(a.node||a[0].node);return d.parentNode.insertBefore(b,d),c._insertbefore(this,a,this.paper),this},$b.blur=function(a){var b=this;if(0!==+a){var d=q("filter"),e=q("feGaussianBlur");b.attrs.blur=a,d.id=c.createUUID(),q(e,{stdDeviation:+a||1.5}),d.appendChild(e),b.paper.defs.appendChild(d),b._blur=d,q(b.node,{filter:"url(#"+d.id+")"})}else b._blur&&(b._blur.parentNode.removeChild(b._blur),delete b._blur,delete b.attrs.blur),b.node.removeAttribute("filter");return b},c._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new Element(e,a);return f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs),f},c._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new Element(g,a);return h.attrs={x:b,y:c,width:d,height:e,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs),h},c._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new Element(f,a);return g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs),g},c._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new Element(g,a);return h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image",h},c._engine.text=function(a,b,d,e){var f=q("text");a.canvas&&a.canvas.appendChild(f);var g=new Element(f,a);return g.attrs={x:b,y:d,"text-anchor":"middle",text:e,"font-family":c._availableAttrs["font-family"],"font-size":c._availableAttrs["font-size"],stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs),g},c._engine.setSize=function(a,b){return this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},c._engine.create=function(){var a=c._getContainer.apply(0,arguments),b=a&&a.container,d=a.x,e=a.y,f=a.width,g=a.height;if(!b)throw new Error("SVG container not found.");var h,i=q("svg"),j="overflow:hidden;";return d=d||0,e=e||0,f=f||512,g=g||342,q(i,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),1==b?(i.style.cssText=j+"position:absolute;left:"+d+"px;top:"+e+"px",c._g.doc.body.appendChild(i),h=1):(i.style.cssText=j+"position:relative",b.firstChild?b.insertBefore(i,b.firstChild):b.appendChild(i)),b=new c._Paper,b.width=f,b.height=g,b.canvas=i,b.clear(),b._left=b._top=0,h&&(b.renderfix=function(){}),b.renderfix(),b},c._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);var f,h,i=this.getSize(),j=g(c/i.width,d/i.height),l=this.top,n=e?"xMidYMid meet":"xMinYMin";for(null==a?(this._vbSize&&(j=1),delete this._vbSize,f="0 0 "+this.width+m+this.height):(this._vbSize=j,f=a+m+b+m+c+m+d),q(this.canvas,{viewBox:f,preserveAspectRatio:n});j&&l;)h="stroke-width"in l.attrs?l.attrs["stroke-width"]:1,l.attr({"stroke-width":h}),l._.dirty=1,l._.dirtyT=1,l=l.prev;return this._viewBox=[a,b,c,d,!!e],this},c.prototype.renderfix=function(){var a,b=this.canvas,c=b.style;try{a=b.getScreenCTM()||b.createSVGMatrix()}catch(d){a=b.createSVGMatrix()}var e=-a.e%1,f=-a.f%1;(e||f)&&(e&&(this._left=(this._left+e)%1,c.left=this._left+"px"),f&&(this._top=(this._top+f)%1,c.top=this._top+"px"))},c.prototype.clear=function(){c.eve("raphael.clear",this);for(var a=this.canvas;a.firstChild;)a.removeChild(a.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(c._g.doc.createTextNode("Created with Raphaël "+c.version)),a.appendChild(this.desc),a.appendChild(this.defs=q("defs"))},c.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]="function"==typeof this[a]?c._removedFactory(a):null};var A=c.st;for(var B in $b)$b[a](B)&&!A[a](B)&&(A[B]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(B))}}(),function(){if(c.vml){var a="hasOwnProperty",b=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=c.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(a){var d=/[ahqstv]/gi,e=c._pathToAbsolute;if(b(a).match(d)&&(e=c._path2curve),d=/[clmz]/g,e==c._pathToAbsolute&&!b(a).match(d)){var g=b(a).replace(q,function(a,b,c){var d=[],e="m"==b.toLowerCase(),g=p[b];return c.replace(s,function(a){e&&2==d.length&&(g+=d+p["m"==b?"l":"L"],d=[]),d.push(f(a*u))}),g+d});return g}var h,i,j=e(a);g=[];for(var k=0,l=j.length;l>k;k++){h=j[k],i=j[k][0].toLowerCase(),"z"==i&&(i="x");for(var m=1,r=h.length;r>m;m++)i+=f(h[m]*u)+(m!=r-1?",":o);g.push(i)}return g.join(n)},y=function(a,b,d){var e=c.matrix();return e.rotate(-a,.5,.5),{dx:e.x(b,d),dy:e.y(b,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q=u/b,r=u/c;if(m.visibility="hidden",b&&c){if(l.coordsize=i(q)+n+i(r),m.rotation=f*(0>b*c?-1:1),f){var s=y(f,d,e);d=s.dx,e=s.dy}if(0>b&&(p+="x"),0>c&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-q+n+e*-r,k||g.fillsize){var t=l.getElementsByTagName(j);t=t&&t[0],l.removeChild(t),k&&(s=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),t.position=s.dx*o+n+s.dy*o),g.fillsize&&(t.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(t)}m.visibility="visible"}};c.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,c,d){for(var e=b(c).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";g--;)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),r=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),s=e;for(var t in i)i[a](t)&&(m[t]=i[t]);if(q&&(m.path=c._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur),(i.path&&"path"==e.type||q)&&(l.path=x(~b(m.path).toLowerCase().indexOf("r")?c._pathToAbsolute(m.path):m.path),e._.dirty=1,"image"==e.type&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0))),"transform"in i&&e.transform(i.transform),r){var y=+m.cx,B=+m.cy,D=+m.rx||+m.r||0,E=+m.ry||+m.r||0;l.path=c.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((y-D)*u),f((B-E)*u),f((y+D)*u),f((B+E)*u),f(y*u)),e._.dirty=1}if("clip-rect"in i){var G=b(i["clip-rect"]).split(k);if(4==G.length){G[2]=+G[2]+ +G[0],G[3]=+G[3]+ +G[1];var H=l.clipRect||c._g.doc.createElement("div"),I=H.style;I.clip=c.format("rect({1}px {2}px {3}px {0}px)",G),l.clipRect||(I.position="absolute",I.top=0,I.left=0,I.width=e.paper.width+"px",I.height=e.paper.height+"px",l.parentNode.insertBefore(H,l),H.appendChild(l),l.clipRect=H)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var J=e.textpath.style;i.font&&(J.font=i.font),i["font-family"]&&(J.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(J.fontSize=i["font-size"]),i["font-weight"]&&(J.fontWeight=i["font-weight"]),i["font-style"]&&(J.fontStyle=i["font-style"])}if("arrow-start"in i&&A(s,i["arrow-start"]),"arrow-end"in i&&A(s,i["arrow-end"],1),null!=i.opacity||null!=i["stroke-width"]||null!=i.fill||null!=i.src||null!=i.stroke||null!=i["stroke-width"]||null!=i["stroke-opacity"]||null!=i["fill-opacity"]||null!=i["stroke-dasharray"]||null!=i["stroke-miterlimit"]||null!=i["stroke-linejoin"]||null!=i["stroke-linecap"]){var K=l.getElementsByTagName(j),L=!1;if(K=K&&K[0],!K&&(L=K=F(j)),"image"==e.type&&i.src&&(K.src=i.src),i.fill&&(K.on=!0),(null==K.on||"none"==i.fill||null===i.fill)&&(K.on=!1),K.on&&i.fill){var M=b(i.fill).match(c._ISURL);if(M){K.parentNode==l&&l.removeChild(K),K.rotate=!0,K.src=M[1],K.type="tile";var N=e.getBBox(1);K.position=N.x+n+N.y,e._.fillpos=[N.x,N.y],c._preload(M[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else K.color=c.getRGB(i.fill).hex,K.src=o,K.type="solid",c.getRGB(i.fill).error&&(s.type in{circle:1,ellipse:1}||"r"!=b(i.fill).charAt())&&C(s,i.fill,K)&&(m.fill="none",m.gradient=i.fill,K.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var O=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+c.getRGB(i.fill).o+1||2)-1);O=h(g(O,0),1),K.opacity=O,K.src&&(K.color="none")}l.appendChild(K);var P=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],Q=!1;!P&&(Q=P=F("stroke")),(i.stroke&&"none"!=i.stroke||i["stroke-width"]||null!=i["stroke-opacity"]||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])&&(P.on=!0),("none"==i.stroke||null===i.stroke||null==P.on||0==i.stroke||0==i["stroke-width"])&&(P.on=!1);var R=c.getRGB(i.stroke);P.on&&i.stroke&&(P.color=R.hex),O=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+R.o+1||2)-1);var S=.75*(d(i["stroke-width"])||1);if(O=h(g(O,0),1),null==i["stroke-width"]&&(S=m["stroke-width"]),i["stroke-width"]&&(P.weight=S),S&&1>S&&(O*=S)&&(P.weight=1),P.opacity=O,i["stroke-linejoin"]&&(P.joinstyle=i["stroke-linejoin"]||"miter"),P.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(P.endcap="butt"==i["stroke-linecap"]?"flat":"square"==i["stroke-linecap"]?"square":"round"),"stroke-dasharray"in i){var T={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};P.dashstyle=T[a](i["stroke-dasharray"])?T[i["stroke-dasharray"]]:o}Q&&l.appendChild(P)}if("text"==s.type){s.paper.canvas.style.display=o;var U=s.paper.span,V=100,W=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=U.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),W=d(m["font-size"]||W&&W[0])||10,p.fontSize=W*V+"px",s.textpath.string&&(U.innerHTML=b(s.textpath.string).replace(/"));var X=U.getBoundingClientRect();s.W=m.w=(X.right-X.left)/V,s.H=m.h=(X.bottom-X.top)/V,s.X=m.x,s.Y=m.y+s.H/2,("x"in i||"y"in i)&&(s.path.v=c.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));for(var Y=["x","y","text","font","font-family","font-weight","font-style","font-size"],Z=0,$=Y.length;$>Z;Z++)if(Y[Z]in i){s._.dirty=1;break}switch(m["text-anchor"]){case"start":s.textpath.style["v-text-align"]="left",s.bbx=s.W/2;break;case"end":s.textpath.style["v-text-align"]="right",s.bbx=-s.W/2;break;default:s.textpath.style["v-text-align"]="center",s.bbx=0}s.textpath.style["v-text-kern"]=!0}},C=function(a,f,g){a.attrs=a.attrs||{};var h=(a.attrs,Math.pow),i="linear",j=".5 .5";if(a.attrs.gradient=f,f=b(f).replace(c._radial_gradient,function(a,b,c){return i="radial",b&&c&&(b=d(b),c=d(c),h(b-.5,2)+h(c-.5,2)>.25&&(c=e.sqrt(.25-h(b-.5,2))*(2*(c>.5)-1)+.5),j=b+n+c),o}),f=f.split(/\s*\-\s*/),"linear"==i){var k=f.shift();if(k=-d(k),isNaN(k))return null}var l=c._parseDots(f);if(!l)return null;if(a=a.shape||a.node,l.length){a.removeChild(g),g.on=!0,g.method="none",g.color=l[0].color,g.color2=l[l.length-1].color;for(var m=[],p=0,q=l.length;q>p;p++)l[p].offset&&m.push(l[p].offset+n+l[p].color);g.colors=m.length?m.join():"0% "+g.color,"radial"==i?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=j,g.angle=0):(g.type="gradient",g.angle=(270-k)%360),a.appendChild(g)}return 1},D=function(a,b){this[0]=this.node=a,a.raphael=!0,this.id=c._oid++,a.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=b,this.matrix=c.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!b.bottom&&(b.bottom=this),this.prev=b.top,b.top&&(b.top.next=this),b.top=this,this.next=null},E=c.el;D.prototype=E,E.constructor=D,E.transform=function(a){if(null==a)return this._.transform;var d,e=this.paper._viewBoxShift,f=e?"s"+[e.scale,e.scale]+"-1-1t"+[e.dx,e.dy]:o;e&&(d=a=b(a).replace(/\.{3}|\u2026/g,this._.transform||o)),c._extractTransform(this,f+a);var g,h=this.matrix.clone(),i=this.skew,j=this.node,k=~b(this.attrs.fill).indexOf("-"),l=!b(this.attrs.fill).indexOf("url(");if(h.translate(1,1),l||k||"image"==this.type)if(i.matrix="1 0 0 1",i.offset="0 0",g=h.split(),k&&g.noRotation||!g.isSimple){j.style.filter=h.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;j.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else j.style.filter=o,z(this,g.scalex,g.scaley,g.dx,g.dy,g.rotate);else j.style.filter=o,i.matrix=b(h),i.offset=h.offset();return null!==d&&(this._.transform=d,c._extractTransform(this,d)),this},E.rotate=function(a,c,e){if(this.removed)return this;if(null!=a){if(a=b(a).split(k),a.length-1&&(c=d(a[1]),e=d(a[2])),a=d(a[0]),null==e&&(c=e),null==c||null==e){var f=this.getBBox(1);c=f.x+f.width/2,e=f.y+f.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,c,e]])),this}},E.translate=function(a,c){return this.removed?this:(a=b(a).split(k),a.length-1&&(c=d(a[1])),a=d(a[0])||0,c=+c||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=c),this.transform(this._.transform.concat([["t",a,c]])),this)},E.scale=function(a,c,e,f){if(this.removed)return this;if(a=b(a).split(k),a.length-1&&(c=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),null==c&&(c=a),null==f&&(e=f),null==e||null==f)var g=this.getBBox(1);return e=null==e?g.x+g.width/2:e,f=null==f?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,c,e,f]])),this._.dirtyT=1,this},E.hide=function(){return!this.removed&&(this.node.style.display="none"),this},E.show=function(){return!this.removed&&(this.node.style.display=o),this},E.auxGetBBox=c.el.getBBox,E.getBBox=function(){var a=this.auxGetBBox();if(this.paper&&this.paper._viewBoxShift){var b={},c=1/this.paper._viewBoxShift.scale;return b.x=a.x-this.paper._viewBoxShift.dx,b.x*=c,b.y=a.y-this.paper._viewBoxShift.dy,b.y*=c,b.width=a.width*c,b.height=a.height*c,b.x2=b.x+b.width,b.y2=b.y+b.height,b}return a},E._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),c.eve.unbind("raphael.*.*."+this.id),c._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)this[a]="function"==typeof this[a]?c._removedFactory(a):null;this.removed=!0}},E.attr=function(b,d){if(this.removed)return this;if(null==b){var e={};for(var f in this.attrs)this.attrs[a](f)&&(e[f]=this.attrs[f]);return e.gradient&&"none"==e.fill&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform,e}if(null==d&&c.is(b,"string")){if(b==j&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;for(var g=b.split(k),h={},i=0,m=g.length;m>i;i++)b=g[i],h[b]=b in this.attrs?this.attrs[b]:c.is(this.paper.customAttributes[b],"function")?this.paper.customAttributes[b].def:c._availableAttrs[b];return m-1?h:h[g[0]]}if(this.attrs&&null==d&&c.is(b,"array")){for(h={},i=0,m=b.length;m>i;i++)h[b[i]]=this.attr(b[i]);return h}var n;null!=d&&(n={},n[b]=d),null==d&&c.is(b,"object")&&(n=b);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[a](o)&&n[a](o)&&c.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[a](q)&&(n[q]=p[q])}n.text&&"text"==this.type&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&c._tofront(this,this.paper),this},E.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),c._toback(this,this.paper)),this)},E.insertAfter=function(a){return this.removed?this:(a.constructor==c.st.constructor&&(a=a[a.length-1]),a.node.nextSibling?a.node.parentNode.insertBefore(this.node,a.node.nextSibling):a.node.parentNode.appendChild(this.node),c._insertafter(this,a,this.paper),this)},E.insertBefore=function(a){return this.removed?this:(a.constructor==c.st.constructor&&(a=a[0]),a.node.parentNode.insertBefore(this.node,a.node),c._insertbefore(this,a,this.paper),this)},E.blur=function(a){var b=this.node.runtimeStyle,d=b.filter;return d=d.replace(r,o),0!==+a?(this.attrs.blur=a,b.filter=d+n+m+".Blur(pixelradius="+(+a||1.5)+")",b.margin=c.format("-{0}px 0 0 -{0}px",f(+a||1.5))):(b.filter=d,b.margin=0,delete this.attrs.blur),this},c._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");return f.on=!0,c.appendChild(f),d.skew=f,d.transform(o),d},c._engine.rect=function(a,b,d,e,f,g){var h=c._rectPath(b,d,e,f,g),i=a.path(h),j=i.attrs;return i.X=j.x=b,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect",i},c._engine.ellipse=function(a,b,c,d,e){{var f=a.path();f.attrs}return f.X=b-d,f.Y=c-e,f.W=2*d,f.H=2*e,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e}),f},c._engine.circle=function(a,b,c,d){{var e=a.path();e.attrs}return e.X=b-d,e.Y=c-d,e.W=e.H=2*d,e.type="circle",B(e,{cx:b,cy:c,r:d}),e},c._engine.image=function(a,b,d,e,f,g){var h=c._rectPath(d,e,f,g),i=a.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];return k.src=b,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=b,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0),i},c._engine.text=function(a,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=c.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=b(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,a),l={fill:"#000",stroke:"none",font:c._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=b(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),a.canvas.appendChild(h);var m=F("skew");return m.on=!0,h.appendChild(m),k.skew=m,k.transform(o),k},c._engine.setSize=function(a,b){var d=this.canvas.style;return this.width=a,this.height=b,a==+a&&(a+="px"),b==+b&&(b+="px"),d.width=a,d.height=b,d.clip="rect(0 "+a+" "+b+" 0)",this._viewBox&&c._engine.setViewBox.apply(this,this._viewBox),this},c._engine.setViewBox=function(a,b,d,e,f){c.eve("raphael.setViewBox",this,this._viewBox,[a,b,d,e,f]);var g,h,i=this.getSize(),j=i.width,k=i.height;return f&&(g=k/e,h=j/d,j>d*g&&(a-=(j-d*g)/2/g),k>e*h&&(b-=(k-e*h)/2/h)),this._viewBox=[a,b,d,e,!!f],this._viewBoxShift={dx:-a,dy:-b,scale:size},this.forEach(function(a){a.transform("...")}),this};var F;c._engine.initWin=function(a){var b=a.document;b.styleSheets.length<31?b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):b.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},c._engine.initWin(c._g.win),c._engine.create=function(){var a=c._getContainer.apply(0,arguments),b=a.container,d=a.height,e=a.width,f=a.x,g=a.y;if(!b)throw new Error("VML container not found.");var h=new c._Paper,i=h.canvas=c._g.doc.createElement("div"),j=i.style;return f=f||0,g=g||0,e=e||512,d=d||342,h.width=e,h.height=d,e==+e&&(e+="px"),d==+d&&(d+="px"),h.coordsize=1e3*u+n+1e3*u,h.coordorigin="0 0",h.span=c._g.doc.createElement("span"),h.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",i.appendChild(h.span),j.cssText=c.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",e,d),1==b?(c._g.doc.body.appendChild(i),j.left=f+"px",j.top=g+"px",j.position="absolute"):b.firstChild?b.insertBefore(i,b.firstChild):b.appendChild(i),h.renderfix=function(){},h},c.prototype.clear=function(){c.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=c._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},c.prototype.remove=function(){c.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]="function"==typeof this[a]?c._removedFactory(a):null;return!0};var G=c.st;for(var H in E)E[a](H)&&!G[a](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}}(),B.was?A.win.Raphael=c:Raphael=c,"object"==typeof exports&&(module.exports=c),c}); \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/sequence-diagram.min.js b/src/main/resources/templates/editor/lib/sequence-diagram.min.js new file mode 100644 index 0000000000000000000000000000000000000000..521b782045eeb9bef7d9f9cf26d85d1678991ac8 --- /dev/null +++ b/src/main/resources/templates/editor/lib/sequence-diagram.min.js @@ -0,0 +1,7 @@ +/** js sequence diagrams 1.0.4 + * http://bramp.github.io/js-sequence-diagrams/ + * (c) 2012-2013 Andrew Brampton (bramp.net) + * @license Simplified BSD license. + */ +!function(){"use strict";function Diagram(){this.title=void 0,this.actors=[],this.signals=[]}function ParseError(message,hash){_.extend(this,hash),this.name="ParseError",this.message=message||""}Diagram.prototype.getActor=function(alias){var s=/^(.+) as (\S+)$/i.exec(alias.trim());s?(name=s[1].trim(),alias=s[2].trim()):name=alias.trim(),name=name.replace(/\\n/gm,"\n");var i,actors=this.actors;for(i in actors)if(actors[i].alias==alias)return actors[i];return i=actors.push(new Diagram.Actor(alias,name,actors.length)),actors[i-1]},Diagram.prototype.setTitle=function(title){this.title=title},Diagram.prototype.addSignal=function(signal){this.signals.push(signal)},Diagram.Actor=function(alias,name,index){this.alias=alias,this.name=name,this.index=index},Diagram.Signal=function(actorA,signaltype,actorB,message){this.type="Signal",this.actorA=actorA,this.actorB=actorB,this.linetype=3&signaltype,this.arrowtype=3&signaltype>>2,this.message=message},Diagram.Signal.prototype.isSelf=function(){return this.actorA.index==this.actorB.index},Diagram.Note=function(actor,placement,message){if(this.type="Note",this.actor=actor,this.placement=placement,this.message=message,this.hasManyActors()&&actor[0]==actor[1])throw new Error("Note should be over two different actors")},Diagram.Note.prototype.hasManyActors=function(){return _.isArray(this.actor)},Diagram.LINETYPE={SOLID:0,DOTTED:1},Diagram.ARROWTYPE={FILLED:0,OPEN:1},Diagram.PLACEMENT={LEFTOF:0,RIGHTOF:1,OVER:2};var grammar=function(){function Parser(){this.yy={}}var parser={trace:function(){},yy:{},symbols_:{error:2,start:3,document:4,EOF:5,line:6,statement:7,NL:8,participant:9,actor:10,signal:11,note_statement:12,title:13,message:14,note:15,placement:16,over:17,actor_pair:18,",":19,left_of:20,right_of:21,signaltype:22,ACTOR:23,linetype:24,arrowtype:25,LINE:26,DOTLINE:27,ARROW:28,OPENARROW:29,MESSAGE:30,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:"NL",9:"participant",13:"title",15:"note",17:"over",19:",",20:"left_of",21:"right_of",23:"ACTOR",26:"LINE",27:"DOTLINE",28:"ARROW",29:"OPENARROW",30:"MESSAGE"},productions_:[0,[3,2],[4,0],[4,2],[6,1],[6,1],[7,2],[7,1],[7,1],[7,2],[12,4],[12,4],[18,1],[18,3],[16,1],[16,1],[11,4],[10,1],[22,2],[22,1],[24,1],[24,1],[25,1],[25,1],[14,1]],performAction:function(yytext,yyleng,yylineno,yy,yystate,$$){var $0=$$.length-1;switch(yystate){case 1:return yy;case 4:break;case 6:$$[$0];break;case 7:yy.addSignal($$[$0]);break;case 8:yy.addSignal($$[$0]);break;case 9:yy.setTitle($$[$0]);break;case 10:this.$=new Diagram.Note($$[$0-1],$$[$0-2],$$[$0]);break;case 11:this.$=new Diagram.Note($$[$0-1],Diagram.PLACEMENT.OVER,$$[$0]);break;case 12:this.$=$$[$0];break;case 13:this.$=[$$[$0-2],$$[$0]];break;case 14:this.$=Diagram.PLACEMENT.LEFTOF;break;case 15:this.$=Diagram.PLACEMENT.RIGHTOF;break;case 16:this.$=new Diagram.Signal($$[$0-3],$$[$0-2],$$[$0-1],$$[$0]);break;case 17:this.$=yy.getActor($$[$0]);break;case 18:this.$=$$[$0-1]|$$[$0]<<2;break;case 19:this.$=$$[$0];break;case 20:this.$=Diagram.LINETYPE.SOLID;break;case 21:this.$=Diagram.LINETYPE.DOTTED;break;case 22:this.$=Diagram.ARROWTYPE.FILLED;break;case 23:this.$=Diagram.ARROWTYPE.OPEN;break;case 24:this.$=$$[$0].substring(1).trim().replace(/\\n/gm,"\n")}},table:[{3:1,4:2,5:[2,2],8:[2,2],9:[2,2],13:[2,2],15:[2,2],23:[2,2]},{1:[3]},{5:[1,3],6:4,7:5,8:[1,6],9:[1,7],10:11,11:8,12:9,13:[1,10],15:[1,12],23:[1,13]},{1:[2,1]},{5:[2,3],8:[2,3],9:[2,3],13:[2,3],15:[2,3],23:[2,3]},{5:[2,4],8:[2,4],9:[2,4],13:[2,4],15:[2,4],23:[2,4]},{5:[2,5],8:[2,5],9:[2,5],13:[2,5],15:[2,5],23:[2,5]},{10:14,23:[1,13]},{5:[2,7],8:[2,7],9:[2,7],13:[2,7],15:[2,7],23:[2,7]},{5:[2,8],8:[2,8],9:[2,8],13:[2,8],15:[2,8],23:[2,8]},{14:15,30:[1,16]},{22:17,24:18,26:[1,19],27:[1,20]},{16:21,17:[1,22],20:[1,23],21:[1,24]},{5:[2,17],8:[2,17],9:[2,17],13:[2,17],15:[2,17],19:[2,17],23:[2,17],26:[2,17],27:[2,17],30:[2,17]},{5:[2,6],8:[2,6],9:[2,6],13:[2,6],15:[2,6],23:[2,6]},{5:[2,9],8:[2,9],9:[2,9],13:[2,9],15:[2,9],23:[2,9]},{5:[2,24],8:[2,24],9:[2,24],13:[2,24],15:[2,24],23:[2,24]},{10:25,23:[1,13]},{23:[2,19],25:26,28:[1,27],29:[1,28]},{23:[2,20],28:[2,20],29:[2,20]},{23:[2,21],28:[2,21],29:[2,21]},{10:29,23:[1,13]},{10:31,18:30,23:[1,13]},{23:[2,14]},{23:[2,15]},{14:32,30:[1,16]},{23:[2,18]},{23:[2,22]},{23:[2,23]},{14:33,30:[1,16]},{14:34,30:[1,16]},{19:[1,35],30:[2,12]},{5:[2,16],8:[2,16],9:[2,16],13:[2,16],15:[2,16],23:[2,16]},{5:[2,10],8:[2,10],9:[2,10],13:[2,10],15:[2,10],23:[2,10]},{5:[2,11],8:[2,11],9:[2,11],13:[2,11],15:[2,11],23:[2,11]},{10:36,23:[1,13]},{30:[2,13]}],defaultActions:{3:[2,1],23:[2,14],24:[2,15],26:[2,18],27:[2,22],28:[2,23],36:[2,13]},parseError:function(str,hash){if(!hash.recoverable)throw new Error(str);this.trace(str)},parse:function(input){function lex(){var token;return token=self.lexer.lex()||EOF,"number"!=typeof token&&(token=self.symbols_[token]||token),token}var self=this,stack=[0],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;this.lexer.setInput(input),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var yyloc=this.lexer.yylloc;lstack.push(yyloc);var ranges=this.lexer.options&&this.lexer.options.ranges;this.parseError="function"==typeof this.yy.parseError?this.yy.parseError:Object.getPrototypeOf(this).parseError;for(var symbol,preErrorSymbol,state,action,r,p,len,newState,expected,yyval={};;){if(state=stack[stack.length-1],this.defaultActions[state]?action=this.defaultActions[state]:((null===symbol||"undefined"==typeof symbol)&&(symbol=lex()),action=table[state]&&table[state][symbol]),"undefined"==typeof action||!action.length||!action[0]){var errStr="";expected=[];for(p in table[state])this.terminals_[p]&&p>TERROR&&expected.push("'"+this.terminals_[p]+"'");errStr=this.lexer.showPosition?"Parse error on line "+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'":"Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==EOF?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'"),this.parseError(errStr,{text:this.lexer.match,token:this.terminals_[symbol]||symbol,line:this.lexer.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1)throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);switch(action[0]){case 1:stack.push(symbol),vstack.push(this.lexer.yytext),lstack.push(this.lexer.yylloc),stack.push(action[1]),symbol=null,preErrorSymbol?(symbol=preErrorSymbol,preErrorSymbol=null):(yyleng=this.lexer.yyleng,yytext=this.lexer.yytext,yylineno=this.lexer.yylineno,yyloc=this.lexer.yylloc,recovering>0&&recovering--);break;case 2:if(len=this.productions_[action[1]][1],yyval.$=vstack[vstack.length-len],yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column},ranges&&(yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]),r=this.performAction.call(yyval,yytext,yyleng,yylineno,this.yy,action[1],vstack,lstack),"undefined"!=typeof r)return r;len&&(stack=stack.slice(0,2*-1*len),vstack=vstack.slice(0,-1*len),lstack=lstack.slice(0,-1*len)),stack.push(this.productions_[action[1]][0]),vstack.push(yyval.$),lstack.push(yyval._$),newState=table[stack[stack.length-2]][stack[stack.length-1]],stack.push(newState);break;case 3:return!0}}return!0}},lexer=function(){var lexer={EOF:1,parseError:function(str,hash){if(!this.yy.parser)throw new Error(str);this.yy.parser.parseError(str,hash)},setInput:function(input){return this._input=input,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var ch=this._input[0];this.yytext+=ch,this.yyleng++,this.offset++,this.match+=ch,this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);return lines?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ch},unput:function(ch){var len=ch.length,lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-len-1),this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),lines.length-1&&(this.yylineno-=lines.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-len]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;return next.length<20&&(next+=this._input.substr(0,20-next.length)),(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput(),c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},test_match:function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer&&(backup={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(backup.yylloc.range=this.yylloc.range.slice(0))),lines=match[0].match(/(?:\r\n?|\n).*/g),lines&&(this.yylineno+=lines.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length},this.yytext+=match[0],this.match+=match[0],this.matches=match,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(match[0].length),this.matched+=match[0],token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),token)return token;if(this._backtrack){for(var k in backup)this[k]=backup[k];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var token,match,tempMatch,index;this._more||(this.yytext="",this.match="");for(var rules=this._currentRules(),i=0;imatch[0].length)){if(match=tempMatch,index=i,this.options.backtrack_lexer){if(token=this.test_match(tempMatch,rules[i]),token!==!1)return token;if(this._backtrack){match=!1;continue}return!1}if(!this.options.flex)break}return match?(token=this.test_match(match,rules[index]),token!==!1?token:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return r?r:this.lex()},begin:function(condition){this.conditionStack.push(condition)},popState:function(){var n=this.conditionStack.length-1;return n>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(n){return n=this.conditionStack.length-1-Math.abs(n||0),n>=0?this.conditionStack[n]:"INITIAL"},pushState:function(condition){this.begin(condition)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(yy,yy_,$avoiding_name_collisions,YY_START){switch($avoiding_name_collisions){case 0:return 8;case 1:break;case 2:break;case 3:return 9;case 4:return 20;case 5:return 21;case 6:return 17;case 7:return 15;case 8:return 13;case 9:return 19;case 10:return 23;case 11:return 27;case 12:return 26;case 13:return 29;case 14:return 28;case 15:return 30;case 16:return 5;case 17:return"INVALID"}},rules:[/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:participant\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:title\b)/i,/^(?:,)/i,/^(?:[^\->:\n,]+)/i,/^(?:--)/i,/^(?:-)/i,/^(?:>>)/i,/^(?:>)/i,/^(?:[^#\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],inclusive:!0}}};return lexer}();return parser.lexer=lexer,Parser.prototype=parser,parser.Parser=Parser,new Parser}();"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=grammar,exports.Parser=grammar.Parser,exports.parse=function(){return grammar.parse.apply(grammar,arguments)},exports.main=function(args){args[1]||(console.log("Usage: "+args[0]+" FILE"),process.exit(1));var source=require("fs").readFileSync(require("path").normalize(args[1]),"utf8");return exports.parser.parse(source)},"undefined"!=typeof module&&require.main===module&&exports.main(process.argv.slice(1))),ParseError.prototype=new Error,Diagram.ParseError=ParseError,grammar.parseError=function(message,hash){throw new ParseError(message,hash)},Diagram.parse=function(input){return grammar.yy=new Diagram,grammar.parse(input)},this.Diagram=Diagram}.call(this),"undefined"!=typeof jQuery&&function($){$.fn.sequenceDiagram=function(options){return this.each(function(){var $this=$(this),diagram=Diagram.parse($this.text());$this.html(""),diagram.drawSVG(this,options)})}}(jQuery),Raphael.registerFont({w:209,face:{"font-family":"daniel","font-weight":700,"font-stretch":"normal","units-per-em":"360","panose-1":"2 11 8 0 0 0 0 0 0 0",ascent:"288",descent:"-72","x-height":"7",bbox:"-92.0373 -310.134 632 184.967","underline-thickness":"3.51562","underline-position":"-21.6211","unicode-range":"U+0009-U+F002"},glyphs:{" ":{w:179}," ":{w:179},"!":{d:"66,-306v9,3,18,11,19,24v-18,73,-20,111,-37,194v0,10,2,34,-12,34v-12,0,-18,-9,-18,-28v0,-85,23,-136,38,-214v1,-7,4,-10,10,-10xm25,-30v15,-1,28,34,5,35v-11,-1,-38,-36,-5,-35",w:115},'"':{d:"91,-214v-32,3,-25,-40,-20,-68v3,-16,7,-25,12,-27v35,13,14,56,8,95xm8,-231v4,-31,1,-40,18,-75v37,7,11,51,11,79v-3,3,-4,8,-5,13v-17,4,-16,-10,-24,-17",w:117},"#":{d:"271,-64v-30,26,-96,-7,-102,51v-6,2,-13,2,-24,-2v-2,-11,10,-21,2,-28v-14,5,-48,0,-48,22v0,23,-11,14,-29,10v-7,-6,6,-19,-1,-24r-32,4v-19,-8,-15,-24,5,-28r33,-6v4,0,24,-23,11,-27v-26,0,-63,14,-74,-10v3,-1,9,-17,16,-10v15,-8,81,4,89,-30v8,-14,16,-34,24,-38v23,9,24,38,5,49v37,24,55,-38,72,-43v19,10,20,23,-1,45v2,8,23,1,29,4v3,3,6,6,10,11v-14,13,-20,12,-45,12v-17,0,-16,17,-19,29v18,-7,49,3,67,-2v4,0,8,4,12,11xm161,-104v-30,-1,-44,10,-44,37v14,1,24,0,40,-5v0,-1,3,-10,8,-26v0,-4,-1,-6,-4,-6",w:285},$:{d:"164,-257v29,4,1,42,-3,50v5,5,38,13,41,24v8,4,6,15,-2,21v-18,3,-36,-17,-49,-17v-17,1,-31,40,-28,48v5,4,8,8,9,10v13,1,35,37,28,44v-10,21,-36,20,-65,28v-10,10,-12,40,-17,51v-9,-3,-28,1,-18,-17v0,-13,5,-24,-1,-35v-18,1,-59,-10,-42,-29v21,0,56,16,55,-16v5,-4,9,-18,9,-26v-14,-15,-55,-41,-53,-65v2,-33,56,-19,98,-26v10,-14,31,-43,38,-45xm93,-152v11,-10,15,-15,14,-29v-17,-3,-37,1,-43,6v10,12,20,19,29,23xm111,-103v-8,1,-11,12,-10,22v10,0,28,2,27,-8v0,-4,-13,-15,-17,-14",w:225},"%":{d:"181,-96v24,-7,67,-13,104,1v14,18,21,19,22,44v-13,43,-99,61,-146,36v-9,-9,-22,-11,-32,-29v0,-27,24,-53,52,-52xm139,-185v-9,68,-138,73,-131,-5v0,-3,3,-9,9,-17v13,1,27,1,17,-16v5,-39,63,0,93,-6v36,1,80,-9,102,11v15,32,12,32,-8,56v-16,21,-103,78,-152,125r-14,28v-23,11,-25,-7,-29,-20v34,-71,133,-98,171,-162v-13,-12,-52,-5,-61,1v0,1,1,3,3,5xm38,-190v0,34,55,29,70,8v0,-14,-20,-11,-32,-14v-14,-3,-24,-9,-40,-10v1,0,5,11,2,16xm172,-53v12,27,90,18,102,-5v-18,-7,-32,-10,-40,-10v-29,3,-57,-4,-62,15",w:308},"&":{d:"145,-82v17,-8,47,-15,71,-26v13,2,25,12,9,23v-23,7,-40,16,-53,27r0,6v13,8,30,21,36,38v0,8,-4,12,-11,12v-19,0,-43,-39,-59,-44v-30,12,-65,29,-97,32v-32,3,-45,-41,-23,-63v21,-20,52,-26,70,-48v-4,-31,-12,-47,9,-73v13,-16,20,-29,23,-39v15,-15,32,-22,51,-22v30,9,62,64,32,96v-2,3,-47,42,-69,48v-15,8,-11,9,0,22v6,7,10,11,11,11xm114,-138v25,-13,62,-38,74,-62v0,-9,-10,-31,-20,-29v-28,7,-60,42,-60,75v0,10,2,15,6,16xm99,-91v-18,10,-54,18,-59,45v26,5,61,-12,77,-22v-1,-5,-13,-23,-18,-23",w:253},"'":{d:"36,-182v-36,7,-34,-61,-17,-80v15,1,21,19,21,20r-1,-1v0,0,-1,12,-5,35v1,5,3,17,2,26",w:63},"(":{d:"130,-306v13,2,23,43,-1,43v-49,43,-77,77,-90,148v5,49,27,67,64,101v4,14,5,6,2,19r-15,0v-35,-17,-79,-58,-79,-120v0,-58,66,-176,119,-191",w:120},")":{d:"108,-138v-2,73,-48,120,-98,153v-17,-5,-16,-20,-6,-31v52,-64,73,-62,74,-135v1,-42,-40,-98,-58,-128v0,-5,-1,-12,-2,-22v18,-18,25,0,42,27v25,39,50,66,48,136",w:120},"*":{d:"121,-271v15,-5,36,-8,40,9v-5,10,-31,19,-47,31v0,11,34,43,14,53v-18,8,-24,-24,-34,-20v-4,10,-4,19,-12,41v-25,7,-15,-30,-17,-47v-13,-1,-17,9,-46,30r-10,0v-20,-32,37,-43,54,-64v-10,-11,-36,-33,-16,-51v3,0,14,8,33,24v8,-10,26,-39,32,-42v14,7,15,23,9,36",w:177},"+":{d:"163,-64v-7,22,-65,2,-77,21v-2,10,-6,21,-11,35v-20,4,-21,-12,-19,-29v3,-23,-44,6,-39,-27v-8,-22,36,-8,49,-18v8,-13,6,-36,24,-40v19,-4,14,32,11,39v18,3,19,2,54,8v2,1,5,5,8,11",w:170},",":{d:"25,63v-26,21,-48,-2,-22,-24v14,-12,35,-40,35,-69v3,-2,3,-11,12,-9v35,17,5,88,-25,102",w:97},"-":{d:"57,-94v19,4,55,-5,54,17v-15,23,-54,20,-91,15v-4,2,-13,-10,-11,-16v-1,-22,28,-15,48,-16",w:124},".":{d:"40,-48v21,20,21,44,-4,44v-33,0,-26,-24,-10,-44r14,0",w:67},"/":{d:"21,20v-22,-45,21,-95,41,-126v38,-57,115,-158,193,-201v2,0,4,3,7,11v11,29,-15,34,-25,55v-81,56,-189,208,-197,261r-19,0",w:275},0:{d:"78,-237v70,-47,269,-41,270,59v0,34,-11,53,-29,76v-13,35,-30,32,-85,64v-6,2,-10,6,-7,8v-73,14,-98,38,-173,1v-7,-13,-52,-48,-46,-88v9,-57,27,-75,70,-120xm123,-38v100,0,202,-46,195,-153v-32,-55,-144,-73,-211,-35v-16,34,-68,54,-53,108v6,25,1,22,-3,39v6,24,41,41,72,41",w:353},1:{d:"39,-208v0,-14,6,-59,29,-39v3,4,6,13,10,24r-22,128r8,87v-4,6,-9,3,-16,2v-44,-38,-9,-137,-9,-202",w:93},2:{d:"88,-35v47,-10,119,-24,168,-9v0,12,-23,13,-35,16v1,1,3,1,5,1v-74,8,-118,23,-194,23v-14,0,-20,-13,-21,-28v55,-40,83,-61,123,-104v26,-13,65,-67,71,-102v-1,-9,-11,-16,-22,-16v-20,-1,-120,29,-156,49v-10,-2,-30,-20,-10,-28v50,-21,111,-51,178,-48v25,10,44,22,36,39v12,30,-19,64,-34,83v-39,48,-37,39,-115,109v0,5,-3,8,-8,11v4,3,8,4,14,4",w:265},3:{d:"188,-282v34,-10,74,25,47,51v-19,32,-55,50,-92,70v28,14,116,25,108,70v8,14,-49,40,-63,48v-29,9,-130,22,-168,42v-6,-5,-19,-7,-12,-22v56,-36,175,-21,210,-76v-9,-20,-88,-42,-97,-33v-20,-1,-41,2,-56,-7r5,-21v56,-25,103,-36,137,-78v1,-1,2,-5,4,-11v-15,-14,-56,7,-79,0v-10,9,-73,22,-92,31v-11,-4,-28,-23,-13,-30v50,-22,96,-26,154,-37v0,-1,8,3,7,3",w:260},4:{d:"79,-249v-7,17,-29,75,-33,96v0,6,3,8,8,8v43,-2,111,6,141,-6v17,-47,20,-100,63,-148v9,4,16,7,21,10v-17,31,-44,95,-51,141v7,4,24,-4,23,10v-1,16,-29,12,-31,23v-10,22,-9,69,-7,103v-3,2,-7,5,-10,9v-47,-11,-23,-74,-16,-114v0,-4,-2,-6,-7,-6v-65,2,-89,13,-162,4v-22,-22,-2,-53,5,-76v16,-15,17,-57,35,-70v6,-1,21,11,21,16",w:267},5:{d:"185,-272v30,7,45,-8,53,18v1,16,-17,18,-34,14v0,0,-95,-11,-129,1v-6,9,-24,33,-29,54v76,10,171,5,214,47v11,11,22,30,5,52v-14,12,-30,14,-34,27v-26,11,-141,63,-157,60v-16,-2,-25,-19,-4,-27v48,-18,128,-39,170,-86v4,-14,-65,-41,-85,-41r-92,0v-10,-4,-66,-1,-57,-23v0,-23,23,-51,35,-83v11,-28,133,-10,144,-13",w:284},6:{d:"70,-64v9,-51,63,-74,123,-71v43,2,109,3,111,41r-25,47v0,1,1,2,2,3v-5,0,-39,10,-41,20v-15,3,-22,4,-22,11v-39,1,-77,20,-119,13v-42,-7,-35,-9,-77,-46v-56,-118,94,-201,176,-229v7,0,21,8,20,15v-2,17,-23,15,-43,24v-69,31,-119,72,-134,145v-5,25,36,68,78,64v59,-6,128,-18,153,-61v-7,-14,-13,-9,-32,-21v-67,-15,-118,-5,-150,43r0,12v-13,4,-17,-3,-20,-10",w:310},7:{d:"37,-228v33,-14,173,-17,181,-19v28,-1,24,31,9,45v-17,15,-45,49,-59,69v-17,26,-55,67,-61,113v-10,13,-9,14,-14,20v-33,-13,-20,-25,-11,-53v16,-48,73,-115,109,-156v2,-7,5,-14,-10,-12v-26,4,-54,6,-76,13v-23,-5,-83,31,-94,-9v2,-8,18,-19,26,-11",w:245},8:{d:"57,-236v40,-50,166,-51,213,-10v22,28,10,63,-22,78r-35,17v8,5,54,24,53,44v-5,14,-4,33,-18,42v-13,13,-35,18,-44,34v-60,27,-190,49,-194,-42v7,-41,17,-54,59,-70r0,-4v-32,-9,-73,-62,-26,-85v4,0,8,-2,14,-4xm142,-160v24,-2,160,-31,99,-72v-28,-18,-108,-33,-146,-5v-16,12,-28,30,-33,59v24,12,37,20,80,18xm41,-62v30,65,189,6,199,-37v3,-14,-60,-30,-74,-30v-70,0,-118,10,-125,67",w:290},9:{d:"11,-192v15,-49,119,-61,161,-23v16,15,27,55,11,79v-20,62,-51,79,-96,118v-10,4,-45,27,-50,6v9,-15,66,-52,98,-99v-7,-7,-8,-3,-25,0v-49,-11,-96,-25,-99,-81xm145,-131v7,-5,13,-34,13,-41v-2,-51,-104,-38,-114,-6v-2,10,37,35,46,35v23,1,43,-1,55,12",w:198},":":{d:"39,-125v15,-8,40,-1,40,15v0,15,-6,22,-19,22v-13,0,-29,-21,-21,-37xm66,-17v-8,27,-51,19,-46,-8v-1,-6,8,-22,14,-20v29,0,30,6,32,28",w:95},";":{d:"56,-93v2,-30,37,-22,40,2v0,2,-1,7,-3,15v-13,8,-15,6,-27,4xm64,-44v11,-11,30,-4,32,14v-21,39,-63,71,-92,85v-5,0,-11,-2,-18,-8v11,-23,36,-36,50,-61v11,-7,19,-20,28,-30",w:107},"<":{d:"166,-202v12,0,29,15,24,29v0,4,-119,64,-120,73v15,21,89,64,91,86v2,29,-18,12,-30,15v-27,-29,-59,-54,-95,-75v-18,-10,-25,-13,-24,-41",w:176},"=":{d:"125,-121v18,7,55,-9,69,14v0,17,-45,26,-135,26v-18,0,-27,-7,-27,-21v-1,-37,60,-5,93,-19xm138,-71v20,0,48,-1,50,16v-13,24,-86,32,-131,29v-29,-2,-43,-10,-43,-24v-7,-23,36,-14,39,-17v27,6,57,-4,85,-4",w:196},">":{d:"4,-14v20,-48,77,-59,118,-94v-16,-19,-58,-52,-81,-75v-11,-7,-15,-38,-1,-40v33,16,83,71,121,105v26,23,-6,35,-41,53v-29,16,-56,28,-73,54v-21,15,-16,20,-34,15v-3,0,-9,-16,-9,-18",w:174},"?":{d:"105,-291v57,-13,107,-4,107,39v0,67,-136,85,-155,137v-1,6,10,23,-4,23v-23,1,-33,-35,-23,-57v31,-41,124,-60,149,-103v-8,-21,-72,-5,-88,-1v-23,6,-59,39,-71,8v0,0,-1,0,1,-17v10,-4,45,-20,84,-29xm80,-25v-6,4,-8,39,-24,22v-24,3,-22,-21,-13,-35v17,-7,29,5,37,13",w:216},"@":{d:"218,-207v23,8,42,14,47,37v44,68,-27,137,-87,85r1,0v0,2,-59,19,-61,17v-35,0,-42,-47,-17,-68r0,-4v-19,-1,-45,37,-49,40v-37,76,58,72,121,62v11,-2,34,-13,36,3v-14,31,-69,31,-114,33v-51,2,-99,-41,-80,-92v2,-30,22,-40,42,-63v35,-20,91,-53,161,-50xm217,-101v23,0,35,-19,35,-41v0,-43,-75,-41,-102,-19v36,3,55,16,62,41v-6,5,-6,19,5,19xm127,-110v8,5,51,-15,28,-16v-4,0,-25,4,-28,16",w:291},A:{d:"97,-81v-23,-10,-39,38,-52,60v-8,6,-8,6,-22,18v-22,-7,-23,-37,-4,-49v7,-8,11,-15,15,-23r-1,1v-14,-26,23,-29,31,-40v1,-1,15,-29,26,-36v17,-31,39,-58,54,-92v16,-20,20,-51,41,-66v29,5,34,62,45,92v9,64,21,103,49,155v-3,25,-44,11,-54,0v-34,-12,-97,-29,-128,-20xm107,-118v20,6,80,10,111,17v6,-7,-4,-15,-7,-24v-11,-28,-9,-92,-30,-117v-9,9,-19,44,-34,55v-9,23,-27,40,-40,69",w:294},B:{d:"256,-179v41,10,115,34,91,91v-6,3,-14,12,-19,20v-37,19,-50,34,-63,25v-9,10,-12,11,-34,13r3,-3v-4,-4,-12,-4,-18,0v0,0,2,2,5,4v-21,14,-26,6,-44,15v-4,0,-7,-2,-8,-5v-6,11,-20,-5,-18,11v-36,4,-91,35,-114,4v-7,-62,-10,-138,4,-199v-1,-19,-37,2,-37,-27v0,-8,2,-13,6,-15v68,-31,231,-92,311,-39v8,12,12,20,12,25v-8,42,-32,49,-77,80xm79,-160v72,-17,135,-39,184,-70v20,-13,31,-23,31,-27v1,-6,-30,-13,-38,-12v-54,0,-116,13,-186,41v11,21,1,48,9,68xm262,-43v0,-4,3,-6,-4,-5v0,1,1,2,4,5xm211,-140v-34,7,-94,24,-139,15v-6,20,-4,56,-4,82v0,29,43,1,56,2v48,-11,108,-25,154,-48v20,-10,32,-17,32,-25v0,-18,-33,-26,-99,-26xm195,-20v6,1,6,-2,5,-7v-3,2,-7,2,-5,7",w:364},C:{d:"51,-114v-12,75,96,76,166,71r145,-10v9,2,9,5,9,18v-37,18,-85,28,-109,22v-18,10,-47,10,-71,10v-29,0,-68,1,-105,-11v-6,-1,-10,-3,-10,-8v-33,-13,-48,-33,-66,-59v-19,-114,146,-150,224,-177v35,0,88,-31,99,7v-1,29,-49,14,-76,28v-55,8,-115,35,-175,71v-13,8,-23,21,-31,38",w:376},D:{d:"312,-78v-2,1,-3,7,-10,5v6,-3,10,-4,10,-5xm4,-252v2,-27,83,-38,106,-39v130,-7,267,1,291,109v0,0,-2,8,-3,25v-5,9,-4,28,-23,34v-4,4,-2,5,-7,0v-3,3,-15,7,-5,10v0,0,-10,14,-13,2v-11,1,-8,5,-20,14v1,2,7,3,9,1v-4,13,-22,13,-11,4v0,-3,1,-6,-3,-5v-40,29,-103,38,-141,65v10,6,22,-7,34,-3v-41,20,-127,44,-171,46v-21,1,-47,-33,-11,-39v15,-2,43,-6,56,-11v-16,-101,-5,-130,9,-207v2,0,4,-1,6,-3v-16,-17,-91,38,-103,-3xm297,-69v-7,3,-17,8,-25,7v1,1,3,2,5,2v-4,2,-11,5,-23,9v4,-11,30,-21,43,-18xm240,-51v10,0,12,2,0,6r0,-6xm220,-36v-1,-3,4,-6,6,-3v0,1,-2,1,-6,3xm125,-48v16,6,137,-46,155,-53v29,-18,101,-44,82,-93v-21,-53,-84,-61,-168,-67v-20,7,-50,3,-77,8v33,54,-12,132,8,205xm159,-22v-4,-1,-15,-5,-15,2v7,-1,12,-2,15,-2",w:381},E:{d:"45,-219v-19,-36,34,-41,63,-36v44,-10,133,-8,194,-15v3,2,38,11,52,15v-73,19,-171,21,-246,38v-9,11,-16,32,-20,61v35,11,133,-6,183,3v1,6,2,7,3,14v-46,24,-118,16,-193,27v-15,13,-22,52,-22,66v60,1,121,-20,188,-20v22,10,53,-7,74,5v16,29,-23,26,-43,32v-73,4,-139,13,-216,27r-52,-10v-4,-22,23,-69,26,-98v-3,0,-10,-15,-12,-24v20,-12,34,-23,35,-67v2,-1,5,-5,5,-7v0,-4,-14,-11,-19,-11",w:353},F:{d:"270,-258v13,2,59,6,48,34v-78,-3,-143,1,-212,22v-10,16,-21,43,-24,69r145,-9v8,3,29,-3,16,21v-14,-1,-59,13,-60,7v-12,13,-67,18,-108,21v-2,1,-4,3,-7,6v-2,23,-8,43,-7,69v1,28,-30,11,-40,5r10,-80r-26,-14v5,-10,10,-33,28,-25v21,-3,15,-46,26,-59v-1,-3,-32,-13,-28,-24v2,-22,45,-16,59,-30v47,4,99,-14,151,-9v5,-3,25,-3,29,-4",w:236},G:{d:"311,-168v53,0,94,57,74,110v-31,37,-71,34,-136,52v-13,-7,-41,10,-57,7v-73,-1,-122,-17,-162,-59v-49,-51,-24,-80,5,-130v35,-61,138,-93,214,-106v16,4,42,-1,40,21v-5,40,-39,2,-73,21v-76,19,-162,65,-177,142v28,103,237,76,312,29v2,-3,3,-7,3,-13v-10,-35,-37,-43,-87,-45v-16,-13,-53,-9,-78,1v-4,-3,-5,-7,-5,-11v17,-29,73,-17,108,-24v12,4,18,5,19,5",w:391},H:{d:"300,-268v18,12,19,32,4,51v-35,44,-34,140,-46,217v-1,5,-5,13,-11,12v-6,1,-19,-14,-18,-27r7,-106v-28,7,-76,22,-116,14v-18,2,-36,6,-55,3v-43,-8,-14,53,-33,75v-29,1,-26,-67,-21,-97v5,-31,28,-73,43,-98v2,2,7,3,14,3v13,33,-11,48,-13,78v61,4,118,2,176,2v8,0,13,-6,15,-20v4,-47,21,-87,54,-107",w:288},I:{d:"63,-266v34,10,-4,105,-8,128r-24,126v-2,2,-3,1,-9,6v-12,-10,-12,-15,-12,-47v0,-93,9,-156,28,-188v10,-17,19,-25,25,-25",w:79},J:{d:"235,-291v26,11,31,104,31,142v0,37,-2,95,-32,126v-33,34,-121,26,-167,1v-18,-11,-54,-29,-59,-59v0,-3,5,-15,16,-14v31,36,90,57,162,51v63,-30,56,-148,32,-226v-1,-16,11,-13,17,-21",w:282},K:{d:"212,-219v17,-5,80,-60,80,-19v0,9,-2,14,-5,16r-132,78v-34,23,-54,32,-21,50v39,21,74,23,124,41v5,2,7,5,7,9v-4,24,-55,15,-79,8v-67,-19,-98,-36,-116,-83v9,-24,38,-35,66,-61v7,-4,49,-30,76,-39xm47,-194v11,-20,11,-45,31,-55v2,2,4,3,6,0v29,39,-21,96,-18,128v-17,24,-15,62,-29,113v-4,3,-10,7,-19,11v-12,-13,-10,-28,-8,-53v3,-31,17,-79,37,-144",w:270},L:{d:"84,-43v58,0,179,-27,242,-4v3,17,-29,24,-40,26v-85,-4,-202,46,-268,3v-24,-16,-2,-33,-4,-57v26,-76,38,-108,86,-191v14,-7,26,-50,45,-32v6,22,5,31,-12,46v-20,39,-50,82,-67,142v-7,6,-19,46,-19,54v0,9,12,13,37,13",w:331},M:{d:"174,-236v-1,52,-11,92,-7,143v10,5,15,-12,22,-18v42,-55,90,-130,136,-174r15,-18v42,2,32,53,11,80v-12,58,-54,143,-34,210v0,3,-3,12,-9,10v-31,-5,-32,-57,-27,-92v4,-27,12,-58,25,-93v-5,-10,5,-19,6,-30v-46,44,-66,110,-129,172v-11,10,-18,15,-22,15v-34,6,-28,-103,-28,-152v-28,22,-65,119,-96,170v-9,15,-34,3,-31,-19v30,-64,91,-177,139,-229v12,-1,29,13,29,25",w:343},N:{d:"248,-20v-3,17,-37,18,-43,3v-24,-35,-53,-145,-80,-203v-32,40,-55,120,-92,174v-13,3,-26,-13,-27,-22r87,-171v4,-13,20,-57,42,-32v42,48,46,139,82,198v29,-45,46,-88,65,-153v12,-19,23,-42,38,-60v27,-1,14,18,4,44v-6,46,-32,68,-37,121v-15,29,-33,69,-39,101",w:307},O:{d:"240,-268v85,1,163,29,150,125v13,7,-12,18,-5,26v-23,63,-133,112,-228,124v-80,-16,-171,-56,-148,-153v11,-47,20,-43,53,-83v17,-9,39,-22,73,-29v45,-10,81,-10,105,-10xm363,-156v16,-51,-62,-85,-111,-79v-25,-11,-50,8,-81,0v-15,10,-70,16,-85,31v6,20,-27,24,-39,45v-42,75,40,128,115,128v56,0,209,-71,201,-125",w:383},P:{d:"70,-225v-7,-12,-36,16,-49,19v-4,0,-9,-5,-14,-17v21,-47,114,-55,172,-59v41,-3,132,33,99,87v-21,34,-72,59,-144,80v-2,16,-79,3,-74,46v3,25,-5,47,-10,68v-22,-1,-23,-29,-22,-56v2,-25,-20,-32,-8,-50v21,-5,10,-35,25,-57v6,-28,14,-48,25,-61xm71,-229v47,14,-2,50,-1,99v41,-3,113,-37,173,-76v5,-9,8,-14,8,-15v-28,-47,-125,-29,-180,-8",w:252},Q:{d:"374,-217v20,59,-11,127,-48,156r30,38v-1,6,-8,16,-14,9v-3,0,-19,-9,-47,-26v-72,35,-173,75,-236,12v-70,-40,-67,-213,26,-217r8,5v24,-20,72,-48,112,-38v21,-4,22,-1,50,-2v66,-2,94,20,119,63xm296,-88v13,5,61,-49,63,-84v4,-62,-54,-78,-119,-76v-14,-6,-49,5,-71,3v-42,16,-89,41,-93,94v-9,11,1,25,-7,38v-12,-19,-7,-67,-1,-88v-56,30,-37,137,19,155v27,17,92,19,119,0v12,-2,29,-9,52,-20v2,-2,3,-3,3,-6v-11,-12,-46,-27,-54,-56v0,-13,3,-19,9,-19v18,1,60,52,80,59",w:379},R:{d:"100,-275v96,-23,196,-10,208,78v-3,18,-17,52,-49,62v-14,20,-54,23,-79,40v-2,0,-14,2,-36,6v-40,8,-30,14,-3,33v37,27,52,30,118,55v16,6,31,23,12,27v-58,-2,-104,-29,-143,-61v-14,-3,-16,-15,-39,-27v-23,-19,-28,-12,-15,-38v63,-19,111,-15,163,-53v27,-20,43,-36,43,-49v0,-64,-120,-62,-173,-38v-9,4,-38,9,-40,18v-10,32,-16,70,-13,116v-10,21,-8,47,-6,75v2,31,-9,29,-27,22v-9,-55,5,-140,15,-190v-8,-6,-24,10,-24,-11v0,-34,16,-34,42,-55v2,-1,17,-4,46,-10",w:297},S:{d:"13,-3v-7,-3,-22,-18,-5,-22v68,-15,119,-32,154,-45v51,-19,39,-34,3,-53v-46,-25,-82,-30,-121,-64v-33,-29,-50,-35,-25,-58v37,-20,119,-29,181,-29v29,0,44,6,44,18v-9,26,-62,6,-104,14v-17,2,-72,6,-92,16v37,53,132,58,180,111v8,9,11,20,11,30v-4,17,-23,35,-42,34v-21,16,-17,1,-49,17v-14,7,-41,9,-56,20v-25,-3,-49,10,-79,11",w:234},T:{d:"141,-3v-36,-6,1,-49,-3,-79v10,-19,6,-35,15,-64r26,-85v-51,-9,-100,10,-141,14v-16,2,-30,-26,-11,-32v26,-8,143,-8,179,-19r12,6v67,-2,142,-1,200,-1v8,0,14,3,19,10v-18,16,-74,3,-103,14v-48,-4,-60,4,-113,7v-42,22,-36,130,-58,187v1,12,-9,44,-22,42",w:277},U:{d:"365,-262v13,56,-22,104,-36,141v-19,22,-30,38,-57,56v-4,18,-60,35,-78,50v-53,28,-142,0,-161,-34v-31,-56,-37,-108,-11,-164v17,-33,29,-50,48,-29v-2,2,-3,7,-4,13v-44,36,-38,149,7,174v30,26,55,19,102,4v56,-17,66,-34,120,-76v12,-24,56,-68,46,-122r0,-16v0,1,-1,3,-1,6v4,-13,11,-10,25,-3",w:368},V:{d:"246,-258v21,-22,31,-26,44,-8v1,1,-12,22,-28,35v-15,25,-41,38,-56,69v-13,15,-20,31,-28,57v-15,13,-11,29,-27,72v3,21,-5,24,-27,27v-33,-45,-54,-118,-84,-167v-5,-26,-18,-50,-25,-76v-3,-12,24,-8,29,-5v8,13,18,52,26,70r52,115v9,-2,4,-9,10,-21r25,-47v25,-44,46,-76,89,-121",w:234},W:{d:"31,-213v16,46,17,106,41,151v31,-35,49,-89,76,-127v30,-15,39,27,52,56v10,22,21,48,35,67v2,0,4,-1,5,-3v16,-28,50,-76,79,-121v14,-21,40,-63,64,-83r5,8v-30,58,-76,110,-97,173v-18,28,-25,37,-33,63v-11,1,-16,25,-30,15v-21,-31,-44,-89,-62,-131v0,-2,-1,-3,-5,-5v-17,11,-16,36,-31,50v-20,33,-20,84,-68,94v-24,-19,-23,-81,-39,-111v-1,-15,-29,-94,-10,-108v9,2,12,5,18,12",w:331},X:{d:"143,-183v43,-25,69,-36,126,-62v22,-10,86,-10,56,21v-51,3,-158,61,-154,64v10,15,41,30,50,52v27,17,46,60,70,82v9,14,-6,30,-24,20v-35,-43,-75,-100,-116,-132v-48,13,-100,47,-118,94v-1,49,-26,34,-27,4v-1,-26,13,-27,17,-48v22,-27,68,-55,90,-77v-9,-12,-60,-39,-79,-57v-6,-10,-6,-25,12,-25",w:312},Y:{d:"216,-240v19,-14,42,10,22,26v-54,66,-121,109,-156,197v-8,21,-11,15,-30,4v3,-37,27,-61,33,-76v12,-12,15,-19,32,-42v-8,-6,-40,5,-45,5v-48,-6,-69,-65,-56,-113v14,0,13,-1,24,7v2,33,12,75,42,73v36,-2,102,-57,134,-81",w:189},Z:{d:"60,-255v66,12,200,-34,240,21v-13,42,-63,62,-98,89v-19,15,-47,33,-82,55v-25,16,-47,32,-66,47v58,24,129,-6,208,-6v23,0,36,12,13,19v-33,2,-53,5,-86,10v-32,18,-88,15,-135,15v-9,-1,-55,-1,-48,-29v1,-24,30,-24,40,-41v64,-50,151,-86,208,-147v-38,-17,-155,12,-198,-4v0,0,-11,-33,4,-29",w:310},"[":{d:"72,-258r-15,250v30,4,55,-3,80,-6v7,-1,8,17,9,23v-28,15,-73,23,-121,21v-7,0,-10,-6,-10,-17v0,-60,25,-193,22,-288v0,-16,13,-20,33,-19v9,-3,34,-12,51,-12v16,0,15,16,19,29v-16,7,-48,10,-68,19",w:151},"\\":{d:"21,38v-20,-21,9,-72,13,-90v44,-78,113,-189,200,-253v2,0,5,4,7,12v11,31,-13,36,-24,58v-74,61,-174,219,-180,273r-16,0",w:257},"]":{d:"133,-258v-23,-13,-84,6,-85,-32v0,-10,5,-15,14,-15v0,0,30,2,90,7v10,1,15,13,15,36v2,7,-8,59,-13,112r-11,125v-9,48,9,90,-59,71v-20,-4,-39,-1,-59,-4v-5,-10,-25,-12,-14,-30v8,-3,61,-13,78,-8v14,1,8,-7,10,-17v15,-69,21,-166,34,-245",w:171},"^":{d:"68,-306v20,15,47,36,58,60v-1,4,0,7,-9,7v-26,0,-47,-38,-49,-32v-15,9,-41,50,-54,30v-2,-31,17,-23,33,-51v8,-9,15,-14,21,-14",w:135},_:{d:"11,15v-8,33,18,45,50,34r205,2r197,-5v11,-5,14,-9,7,-28v-95,-21,-258,-10,-376,-10v-25,0,-72,-3,-83,7",w:485},"`":{d:"75,-264v16,8,56,14,39,43v-30,-8,-65,-23,-105,-44v-1,-3,-3,-28,5,-25v16,5,44,17,61,26",w:129},a:{d:"124,-56v10,4,59,41,65,50v1,7,-6,17,-12,17r-60,-30v-22,2,-42,21,-65,19v-33,4,-68,-67,-15,-81v41,-27,96,-39,110,9v0,6,-4,12,-11,16v-33,-25,-67,-5,-88,12v10,16,61,-18,76,-12",w:196},b:{d:"80,-140v69,1,123,0,134,52v5,26,-71,71,-97,70v-11,11,-88,22,-94,22v-11,-3,-26,-18,-6,-24v19,-5,-2,-19,-1,-35v1,-18,11,-36,-5,-47v-6,-17,-6,-21,14,-32v6,-45,18,-89,28,-124v2,-7,8,-12,17,-15v5,3,10,11,16,28v-12,27,-13,63,-23,96v0,6,6,9,17,9xm87,-107v-40,-9,-31,31,-39,54v8,15,0,25,12,22v30,-8,60,-18,88,-32v39,-18,49,-33,-1,-42v-20,-4,-45,-7,-60,-2",w:217},c:{d:"128,-123v29,-7,37,29,12,33v-27,-4,-40,6,-79,25v-8,4,-13,11,-16,22v30,32,91,3,134,11v5,13,-8,26,-22,19v-51,25,-139,28,-150,-30v6,-50,69,-82,121,-80",w:194},d:{d:"224,-201v0,-35,-17,-111,24,-94v7,86,-2,119,0,197v-4,2,-8,21,-18,16v-62,-7,-154,-8,-185,29v6,17,28,26,51,26v16,0,100,-15,132,-18v7,5,-6,20,-10,22v-24,8,-122,42,-163,25v-32,-5,-62,-53,-36,-80v35,-37,118,-46,198,-43v1,-22,7,-49,7,-80",w:265},e:{d:"4,-57v0,-58,51,-71,110,-74v33,-1,45,16,59,35v1,14,2,39,-7,42v-24,-2,-73,13,-99,11v-2,2,-2,3,-2,3v0,3,12,8,37,15v21,0,69,9,31,22v-9,14,-34,6,-56,6v-27,-5,-73,-28,-73,-60xm123,-102v-22,2,-68,5,-65,26v24,-2,66,5,79,-6v-5,-13,-1,-13,-14,-20",w:182},f:{d:"6,-59v6,-29,53,-4,53,-43v0,-64,29,-118,84,-150v45,-25,167,-24,155,51v-1,2,-7,6,0,6r-10,2v-45,-58,-165,-39,-186,39v-7,26,-11,42,-9,62v44,8,95,-21,135,-7v-12,25,-39,21,-76,30v-19,5,-18,7,-54,19v-2,8,15,32,17,35v-6,25,-26,26,-40,-5r-15,-24v-41,10,-44,12,-54,-15",w:234},g:{d:"132,-97v30,27,21,75,30,117v-12,31,-11,66,-36,103v-32,46,-105,83,-167,39v-31,-21,-49,-29,-51,-75v-2,-37,77,-50,121,-57v37,-6,68,-10,95,-11v7,-6,3,-32,4,-46v0,0,-1,1,-1,2v0,-18,-5,-31,-14,-45v-44,5,-79,20,-94,-18v3,-54,73,-54,125,-50v12,7,12,13,4,25v-30,-11,-76,8,-90,20v23,3,50,-16,74,-4xm-34,121v60,53,168,1,159,-86v-47,-7,-93,24,-142,30v-12,7,-45,19,-42,29v0,10,8,19,25,27",w:188},h:{d:"100,-310v11,-2,10,19,11,20v-11,52,-40,133,-53,189v-6,30,-9,37,-9,47v27,0,113,-34,143,-34v42,0,31,47,39,79v0,4,-5,17,-16,16v4,2,11,3,4,6v-24,-1,-28,-34,-25,-64v-1,-1,-2,-3,-5,-5v-51,0,-110,38,-162,51v-9,1,-15,-15,-16,-23v17,-89,39,-141,71,-264v0,-9,6,-19,18,-18",w:251},i:{d:"62,-209v7,18,9,23,-5,38v-23,-6,-21,-18,-11,-36v2,0,8,-1,16,-2xm34,-7v-18,-21,-8,-73,-1,-106v7,-10,20,-8,23,6v-1,36,7,72,-2,104v-8,2,-8,0,-20,-4",w:80},j:{d:"88,-191v5,28,-18,40,-28,21v0,-20,12,-29,28,-21xm82,-99v28,-1,16,35,16,61v0,60,-19,150,-35,202v-12,8,-19,31,-35,16v-32,-7,-43,-19,-56,-44r2,-17v11,4,49,45,61,18v10,-55,27,-107,30,-171v0,-16,0,-59,17,-65",w:120},k:{d:"59,-66v33,26,114,37,155,62v8,-4,22,-2,19,-17v0,-4,-12,-11,-30,-24v-36,-25,-54,-22,-99,-33v14,-21,119,-13,103,-63r-16,-7r-123,47r25,-93v-3,-15,16,-49,18,-81v1,-15,-21,-14,-25,-3v-31,82,-49,168,-75,257v2,2,22,30,27,10v2,-5,4,-9,9,-11v4,-16,4,-15,12,-44",w:236},l:{d:"66,-300v21,-6,37,23,30,55v-10,51,-28,135,-28,208v0,11,6,36,-13,37v-29,-5,-30,-48,-25,-83r28,-177v-6,-17,1,-29,8,-40",w:102},m:{d:"348,-59v-2,21,0,57,3,73v-17,3,-30,-1,-32,-16v-8,-7,-5,-44,-13,-70v-35,3,-82,49,-111,70v-12,8,-40,4,-39,-15r2,-56v-1,-13,4,-28,-8,-29v-35,8,-79,72,-115,87v-6,2,-20,-18,-21,-22v1,-20,14,-105,39,-64r8,15v17,-14,72,-56,93,-54v27,3,49,40,43,80v24,-2,66,-55,124,-53v11,14,28,23,27,54",w:368},n:{d:"121,-136v37,6,62,54,62,111v0,32,-16,25,-31,17v-18,-30,-5,-45,-22,-85v-37,-13,-71,55,-92,65v-20,-3,-39,-39,-21,-62v2,-12,3,-15,11,-30v12,-8,20,11,29,12",w:194},o:{d:"108,-139v52,-24,104,18,104,63v0,59,-66,67,-114,83v-52,-2,-115,-50,-80,-105v23,-18,52,-35,90,-41xm45,-60v16,54,125,16,131,-23v-12,-59,-129,-8,-131,23",w:217},p:{d:"82,14v-10,12,-8,117,-24,142v-15,2,-19,0,-29,-13v0,-76,9,-113,22,-192v14,-27,35,-6,37,13v0,8,-3,21,-7,38v2,2,3,2,4,2v26,-9,116,-33,126,-72v-7,-17,-24,-33,-49,-31v-40,3,-116,13,-116,47v-5,7,-2,17,-16,20v-17,-12,-18,-20,-12,-38v8,-25,74,-61,110,-59v55,-15,113,15,118,70v-15,52,-84,79,-146,83v-5,0,-11,-4,-18,-10",w:251},q:{d:"144,-147v27,-8,89,-3,97,31v-9,29,-42,-4,-73,1v-32,6,-118,20,-111,49v0,7,13,13,21,13v21,0,78,-24,104,-34v2,0,9,8,22,21v1,1,1,2,1,5v-27,90,-22,70,-43,203v11,15,-15,54,-33,33v-6,-8,-10,-20,-3,-28v1,-72,5,-114,15,-172v-35,3,-35,10,-59,8v-41,-4,-98,-41,-56,-85v33,-34,59,-27,118,-45",w:248},r:{d:"242,-117v2,22,5,10,-14,23v-73,-7,-166,-23,-174,56v-8,6,-3,20,-8,36v-29,10,-40,-9,-33,-46v6,-31,7,-69,32,-55v58,-37,66,-42,175,-19v3,5,15,4,22,5",w:229},s:{d:"154,-151v19,1,27,24,13,32v-4,1,-22,4,-53,7v-16,8,-22,-2,-39,9v23,21,89,16,96,62v-13,24,-85,35,-124,42v-9,-3,-18,-3,-27,0v-6,-4,-21,-16,-8,-25v30,-6,83,-13,102,-24v-17,-16,-80,-33,-97,-48v-3,-2,-4,-7,-4,-15v-6,-6,3,-13,15,-18v22,-9,94,-23,126,-22",w:188},t:{d:"85,-150v10,-41,35,-126,65,-134v4,1,24,19,11,36v-17,22,-29,57,-36,104v26,8,50,-7,73,5v14,0,22,3,22,9v-1,19,-44,18,-57,23v-10,1,-46,0,-54,10v-10,24,-4,67,-20,98v-21,-3,-26,1,-26,-20v0,-9,2,-36,8,-81v-15,-13,-81,9,-77,-27v4,-38,71,6,91,-23",w:194},u:{d:"207,-136v-1,-2,11,-14,14,-13v6,0,10,7,10,22v-3,40,-23,56,-40,82v-13,19,-62,43,-93,43v-67,-2,-111,-75,-71,-133v26,-3,21,29,19,49v-1,27,26,44,57,42v41,-2,93,-55,104,-92",w:242},v:{d:"24,-127r52,71v42,-16,70,-54,124,-65v5,4,8,7,8,11v-8,19,-4,8,-33,32v0,1,-1,3,-1,5v-61,45,-93,68,-97,68v-40,-15,-50,-72,-68,-100v6,-14,10,-22,15,-22",w:214},w:{d:"15,-139v38,-2,27,57,45,86v30,2,67,-66,101,-78v26,6,36,69,60,78v47,-35,51,-54,119,-104v3,0,7,-2,15,-4v19,23,-9,28,-21,49v-33,28,-68,90,-107,109v-10,6,-52,-47,-72,-71v-20,17,-85,74,-97,73v-38,7,-41,-98,-52,-122v0,-1,3,-7,9,-16",w:325},x:{d:"95,-124v22,-13,78,-32,99,-31v16,0,23,6,23,18v0,22,-17,11,-49,21v-3,0,-45,20,-42,24v0,1,2,4,8,10v20,24,49,41,44,80v-35,3,-27,-9,-60,-44v-40,-43,-37,-26,-79,9v-1,1,-2,3,-3,8v-12,8,-28,10,-27,-11v-6,-8,45,-65,48,-65v-17,-21,-61,-52,-24,-68v9,0,48,37,62,49",w:223},y:{d:"44,-65v22,33,70,4,99,-8v5,-4,28,-15,41,-31r17,0v25,47,-26,70,-40,114v-5,4,-9,8,-10,21v-16,12,-11,33,-27,51v-5,18,-12,43,-23,71v-1,-1,-2,34,-18,29v-12,1,-22,-12,-22,-23v20,-70,24,-65,68,-177v-47,16,-111,8,-116,-39v-11,-13,-7,-62,8,-62v18,0,22,26,23,54",w:216},z:{d:"189,-43v9,-1,46,-6,41,12v0,7,-5,13,-15,14v-45,6,-148,24,-181,13v0,-3,-5,-8,-14,-15v5,-44,66,-46,90,-85v-15,-18,-84,21,-84,-14v0,-10,5,-17,14,-18v33,-3,79,-13,109,-3v4,-2,14,11,12,15v0,23,-26,51,-78,84v28,10,73,-3,106,-3",w:244},"{":{d:"94,-303v27,-9,90,-14,79,26v-20,17,-55,-5,-87,13v-4,1,-6,4,-6,8v33,42,31,44,7,85v-6,10,-13,16,-13,13v5,6,17,17,15,31r-33,78v7,35,28,49,57,63r49,0v7,42,-51,41,-86,20v-43,-13,-51,-51,-56,-89v-2,-25,25,-54,27,-71v-3,-4,-46,-5,-41,-21v2,-10,-3,-29,11,-25v2,0,51,-17,52,-38v4,-3,-25,-23,-25,-49v0,-41,8,-30,50,-44",w:179},"|":{d:"30,-308v26,5,14,50,15,80v5,78,-8,153,-3,225v-2,15,-1,31,-11,36v-8,-3,-25,-22,-25,-32r9,-183v0,-40,0,-78,1,-112v0,-4,9,-15,14,-14",w:63},"}":{d:"47,-298v34,-17,118,-18,112,36v6,25,-76,98,-69,103v4,16,39,7,44,28v7,34,-34,17,-37,39v8,29,49,83,23,123v-15,23,-43,26,-73,46v-34,8,-43,11,-49,-17v1,-15,30,-15,33,-20v24,-12,70,-27,55,-61v-14,-33,-37,-68,-19,-103v-46,-50,46,-100,60,-141v-10,-16,-68,6,-77,-12",w:143},"~":{d:"7,-254v2,-6,59,-50,67,-46v11,-1,35,19,46,26v5,0,27,-10,66,-31v21,8,-1,25,-7,38v-27,21,-48,31,-65,31v-24,-11,-37,-39,-65,-9v-7,7,-26,36,-42,11v3,-5,-3,-17,0,-20",w:199},"Ä":{d:"161,-217v20,53,23,124,54,170v-2,20,-34,9,-42,0v-27,-12,-78,-18,-101,-18v-26,6,-29,51,-54,63v-18,-4,-19,-30,-3,-38v5,-9,15,-16,8,-29v1,-12,23,-9,26,-19v6,-10,11,-20,20,-27r70,-121v12,-4,16,4,22,19xm82,-91v17,3,62,7,86,13v-13,-33,-13,-80,-29,-109v-15,30,-38,63,-57,96xm187,-259v0,8,-4,13,-12,13v-18,0,-21,-20,-16,-34v18,-1,28,2,28,21xm90,-284v7,3,28,11,28,18v0,9,-9,18,-18,17v-17,0,-25,-24,-10,-35"},"Å":{d:"161,-217v20,53,23,124,54,170v-2,20,-34,9,-42,0v-27,-12,-78,-18,-101,-18v-26,6,-29,51,-54,63v-18,-4,-19,-30,-3,-38v5,-9,15,-16,8,-29v1,-12,23,-9,26,-19v6,-10,11,-20,20,-27r70,-121v12,-4,16,4,22,19xm82,-91v17,3,62,7,86,13v-13,-33,-13,-80,-29,-109v-15,30,-38,63,-57,96xm112,-239v-31,-17,-9,-61,29,-56v12,2,22,3,33,12v24,39,-30,62,-62,44xm119,-262v2,14,41,8,41,-4v0,-4,-8,-6,-24,-9v-10,-2,-17,10,-17,13"},"Ç":{d:"48,-108v-12,70,90,71,159,67r138,-9v9,-1,7,9,7,17v-37,16,-80,27,-103,21v-14,9,-40,3,-67,9v-30,0,-64,1,-100,-10v-6,-1,-10,-4,-10,-8v-32,-12,-46,-31,-63,-56v-16,-61,47,-103,83,-121v82,-42,118,-45,200,-60v21,-4,36,34,11,37v-90,11,-148,31,-225,77v-12,8,-23,20,-30,36xm172,18v29,4,47,14,53,35v-2,7,-14,31,-27,31v-28,7,-55,9,-84,14v-18,-5,-13,-32,7,-32v21,0,55,-5,69,-13v-16,-14,-63,10,-50,-35v9,-10,1,-27,23,-29v7,8,11,16,9,29",w:331},"É":{d:"49,-160v1,-4,-10,-9,-15,-8v-15,-35,32,-30,57,-31r142,-8v2,1,30,7,40,10v-52,16,-133,17,-190,30v-7,9,-12,24,-15,47v26,10,102,-6,141,3v1,3,1,6,2,10v-36,18,-92,12,-149,21v-11,9,-16,41,-16,51v55,-1,111,-21,168,-13v15,-8,48,1,31,18v-53,16,-130,13,-198,29r-39,-8v-4,-19,17,-53,20,-76v-1,0,-7,-11,-9,-18v18,-7,22,-28,30,-57xm133,-248v27,-11,48,-32,59,-14v3,11,-79,52,-88,53v-14,1,-16,-11,-12,-21v10,-4,23,-11,41,-18",w:252},"Ñ":{d:"224,-182v1,-17,15,-24,22,-38v20,0,13,10,3,33v-3,36,-25,52,-28,94v-10,24,-30,55,-29,82r-19,7v-32,-8,-36,-70,-58,-111v-2,-23,-7,-27,-19,-54v-28,36,-41,93,-71,133v-9,5,-20,-9,-20,-17r73,-149v9,-24,31,-5,36,7v19,41,31,98,53,139v22,-35,34,-69,50,-118v2,-3,3,-3,7,-8xm203,-257v22,-8,41,-24,65,-26v3,11,-8,9,-7,21v-26,20,-46,31,-59,31v-2,3,-49,-27,-49,-29v-11,0,-32,31,-46,32v-11,-2,-12,-21,-4,-23v4,-6,28,-30,48,-34v17,-4,43,28,52,28",w:219},"Ö":{d:"62,-184v78,-31,249,-50,238,74v-6,65,-102,105,-179,115v-77,-7,-152,-71,-101,-149v2,-5,24,-33,42,-40xm279,-120v14,-38,-47,-64,-85,-61v-20,-9,-41,7,-62,0v-11,7,-54,12,-66,24v0,20,-51,35,-38,66v-1,43,50,67,96,67v44,0,162,-55,155,-96xm197,-229v0,8,-4,13,-12,13v-17,0,-19,-19,-16,-34v18,-1,29,1,28,21xm101,-254v7,3,28,9,27,18v1,8,-8,17,-17,17v-18,0,-26,-24,-10,-35",w:273},"Ü":{d:"281,-202v6,67,-30,121,-71,152v-3,14,-47,26,-60,39v-41,20,-110,1,-125,-26v-24,-44,-28,-84,-8,-127v12,-26,23,-38,37,-22v-2,2,-3,5,-3,10v-34,26,-29,116,5,134v22,32,86,-1,109,-8v38,-28,104,-64,97,-149v2,-10,7,-8,19,-3xm197,-227v0,8,-4,13,-12,13v-18,0,-21,-20,-16,-34v18,-1,28,2,28,21xm101,-252v7,3,27,10,27,18v0,8,-9,18,-18,17v-18,-1,-24,-25,-9,-35",w:262},"á":{d:"118,-53v10,4,55,41,62,47v0,7,-5,16,-12,16r-57,-28v-20,3,-40,19,-61,18v-10,2,-43,-17,-42,-36v0,-14,7,-40,27,-41v39,-26,92,-36,104,9v0,6,-2,11,-9,15v-32,-24,-64,-6,-84,11v8,15,58,-17,72,-11xm32,-117v24,-3,85,-55,101,-32v3,11,-80,53,-89,53v-13,2,-14,-10,-12,-21",w:173},"à":{d:"118,-53v10,4,55,41,62,47v0,7,-5,16,-12,16r-57,-28v-20,3,-40,19,-61,18v-10,2,-43,-17,-42,-36v0,-14,7,-40,27,-41v39,-26,92,-36,104,9v0,6,-2,11,-9,15v-32,-24,-64,-6,-84,11v8,15,58,-17,72,-11xm99,-137v7,6,56,14,37,40v-28,-7,-62,-21,-100,-41v-2,-3,-2,-26,5,-23v16,4,42,17,58,24",w:173},"â":{d:"118,-53v10,4,55,41,62,47v0,7,-5,16,-12,16r-57,-28v-20,3,-40,19,-61,18v-10,2,-43,-17,-42,-36v0,-14,7,-40,27,-41v39,-26,92,-36,104,9v0,6,-2,11,-9,15v-32,-24,-64,-6,-84,11v8,15,58,-17,72,-11xm147,-97v-27,-6,-39,-26,-60,-37v-21,7,-38,46,-65,23v-2,-5,-3,-10,-4,-14v18,-4,43,-31,61,-42v28,5,40,21,62,36v12,8,18,17,18,25v0,6,-4,9,-12,9",w:173},"ä":{d:"118,-53v10,4,55,41,62,47v0,7,-5,16,-12,16r-57,-28v-20,3,-40,19,-61,18v-32,5,-66,-64,-15,-77v39,-26,92,-36,104,9v0,6,-3,11,-9,15v-32,-24,-64,-6,-84,11v8,15,58,-17,72,-11xm142,-119v0,8,-4,13,-12,13v-18,0,-21,-20,-16,-34v18,-1,28,2,28,21xm46,-144v7,3,28,9,27,18v1,8,-9,18,-18,17v-18,-1,-25,-25,-9,-35",w:173},"ã":{d:"118,-53v10,4,55,41,62,47v0,7,-5,16,-12,16r-57,-28v-20,3,-40,19,-61,18v-10,2,-43,-17,-42,-36v0,-14,7,-40,27,-41v39,-26,92,-36,104,9v0,6,-2,11,-9,15v-32,-24,-64,-6,-84,11v8,15,58,-17,72,-11xm114,-136v22,-8,41,-24,64,-26v3,11,-7,10,-7,21v-26,20,-45,30,-58,30v-3,3,-49,-26,-49,-28v-10,-1,-32,35,-51,31v-12,-32,8,-29,32,-51v24,-21,54,20,69,23",w:173},"å":{d:"118,-53v10,4,55,41,62,47v0,7,-5,16,-12,16r-57,-28v-20,3,-40,19,-61,18v-10,2,-43,-17,-42,-36v0,-14,7,-40,27,-41v39,-26,92,-36,104,9v0,6,-2,11,-9,15v-32,-24,-64,-6,-84,11v8,15,58,-17,72,-11xm54,-101v-37,-20,-9,-71,34,-65v13,1,25,3,38,13v27,45,-34,73,-72,52xm61,-128v4,20,48,7,49,-5v0,-5,-9,-7,-28,-10v-12,-2,-21,11,-21,15",w:173},"ç":{d:"108,-118v30,-6,56,21,25,33v-24,-6,-39,5,-75,23v-7,4,-12,12,-15,22v31,28,86,3,128,9v3,28,-29,16,-44,28v-53,15,-106,10,-120,-37v0,-48,62,-70,101,-78xm92,18v23,4,45,12,48,32v-2,6,-12,28,-25,28v-24,6,-50,10,-77,13v-16,-4,-11,-28,7,-29v17,-1,51,-4,63,-12v-14,-15,-57,10,-46,-32v9,-8,0,-25,21,-26v6,6,12,14,9,26",w:171},"é":{d:"108,-124v42,-3,70,39,50,73v-22,-1,-70,12,-94,10v-1,1,-2,3,-2,3v0,3,12,7,35,14v18,0,64,7,30,21v-10,14,-31,6,-53,6v-26,-7,-70,-26,-70,-58v0,-54,48,-65,104,-69xm130,-78v-2,-35,-66,-13,-77,3v16,6,62,6,77,-3xm76,-169v26,-11,48,-32,59,-14v3,10,-80,53,-89,53v-14,1,-14,-10,-12,-21v15,-7,16,-7,42,-18",w:161},"è":{d:"108,-124v42,-3,70,39,50,73v-22,-1,-70,12,-94,10v-1,1,-2,3,-2,3v0,3,12,7,35,14v18,0,64,7,30,21v-10,14,-31,6,-53,6v-26,-7,-70,-26,-70,-58v0,-54,48,-65,104,-69xm130,-78v-2,-35,-66,-13,-77,3v16,6,62,6,77,-3xm95,-166v7,6,54,14,37,40v-28,-7,-62,-21,-100,-41v-3,-3,-3,-26,5,-24v16,5,42,18,58,25",w:161},"ê":{d:"108,-124v42,-3,70,39,50,73v-22,-1,-70,12,-94,10v-1,1,-2,3,-2,3v0,3,12,7,35,14v18,0,64,7,30,21v-10,14,-31,6,-53,6v-26,-7,-70,-26,-70,-58v0,-54,48,-65,104,-69xm130,-78v-2,-35,-66,-13,-77,3v16,6,62,6,77,-3xm145,-129v-27,-6,-39,-26,-60,-37v-8,0,-10,4,-14,10v-11,15,-51,34,-56,0v17,-4,44,-32,61,-43v28,5,41,21,63,36v12,8,17,17,17,25v0,6,-3,9,-11,9",w:161},"ë":{d:"108,-124v42,-3,70,39,50,73v-22,-1,-70,12,-94,10r-3,3v0,3,12,7,36,14v18,0,64,7,30,21v-10,14,-31,6,-53,6v-26,-7,-67,-27,-71,-58v7,-52,48,-65,105,-69xm130,-78v-2,-35,-66,-13,-77,3v16,6,62,6,77,-3xm140,-144v0,8,-4,12,-12,12v-18,0,-19,-19,-16,-33v18,-1,29,1,28,21xm44,-169v7,3,28,9,28,17v0,9,-9,18,-18,18v-18,0,-25,-24,-10,-35",w:161},"í":{d:"59,-98v20,4,15,53,10,95v-6,1,-11,2,-19,-4v1,-7,-12,-18,-10,-24v4,-22,-4,-65,19,-67xm50,-139v27,-11,49,-32,59,-14v3,11,-80,53,-89,53v-14,1,-14,-12,-11,-22v15,-7,14,-6,41,-17",w:105},"ì":{d:"57,-98v22,5,13,50,11,95v-7,1,-11,2,-20,-4v1,-7,-12,-18,-10,-24v4,-22,-2,-64,19,-67xm70,-139v14,10,54,14,37,41v-28,-7,-61,-22,-99,-42v-3,-2,-3,-25,5,-23v15,5,41,17,57,24",w:109},"î":{d:"72,-98v20,5,12,51,10,95v-6,2,-13,1,-20,-4v1,-8,-12,-18,-10,-24v4,-22,-3,-65,20,-67xm134,-94v-26,-7,-39,-25,-60,-37v-7,0,-9,4,-13,10v-14,15,-51,34,-56,-1v18,-4,45,-33,61,-43v27,6,40,22,62,37v12,8,18,17,18,25v0,6,-4,9,-12,9",w:143},"ï":{d:"55,-97v19,5,15,53,10,95v-17,5,-26,-14,-30,-28v6,-20,-3,-65,20,-67xm110,-118v0,8,-4,13,-12,13v-17,0,-19,-19,-16,-34v18,-1,29,1,28,21xm14,-143v6,3,28,8,28,17v0,9,-9,18,-18,18v-18,0,-25,-24,-10,-35",w:107},"ñ":{d:"115,-129v34,6,59,50,59,105v0,31,-15,24,-30,17v-15,-29,-5,-42,-20,-81v-35,-13,-68,52,-88,61v-20,-4,-38,-36,-19,-59v0,-12,3,-14,10,-28v11,-8,18,11,27,12xm117,-166v22,-7,41,-23,64,-26v3,11,-7,10,-7,21v-26,20,-45,30,-58,30v-3,3,-49,-26,-49,-28v-10,-1,-32,35,-51,31v-5,-12,-8,-16,0,-23v4,-6,28,-29,48,-33v17,-3,43,28,53,28",w:171},"ó":{d:"102,-132v50,-20,99,16,99,60v0,54,-60,64,-108,79v-50,-2,-110,-48,-76,-100v22,-17,49,-33,85,-39xm136,-104v-34,0,-91,27,-94,47v16,51,125,16,125,-22v0,-17,-10,-25,-31,-25xm49,-154v24,-3,85,-55,101,-32v3,11,-80,53,-89,53v-14,0,-13,-8,-12,-21",w:191},"ò":{d:"102,-132v50,-20,99,16,99,60v0,54,-60,64,-108,79v-50,-2,-110,-48,-76,-100v22,-17,49,-33,85,-39xm136,-104v-34,0,-91,27,-94,47v16,51,125,16,125,-22v0,-17,-10,-25,-31,-25xm115,-181v14,10,51,13,37,40v-28,-7,-62,-21,-100,-41v-3,-2,-3,-26,5,-23v16,5,42,17,58,24",w:191},"ô":{d:"102,-132v50,-20,99,16,99,60v0,54,-60,64,-108,79v-50,-2,-110,-48,-76,-100v22,-17,49,-33,85,-39xm136,-104v-34,0,-91,27,-94,47v16,51,125,16,125,-22v0,-17,-10,-25,-31,-25xm110,-177v-22,6,-38,45,-65,22v-2,-4,-3,-9,-4,-13v18,-4,43,-32,61,-43v27,6,40,21,62,36v12,9,18,17,18,25v1,11,-15,10,-23,7",w:191},"ö":{d:"102,-132v50,-20,99,16,99,60v0,54,-60,64,-108,79v-50,-2,-110,-48,-76,-100v22,-17,49,-33,85,-39xm136,-104v-34,0,-91,27,-94,47v16,51,125,16,125,-22v0,-17,-10,-25,-31,-25xm161,-160v0,8,-4,13,-12,13v-17,0,-19,-19,-16,-34v18,-1,29,1,28,21xm65,-185v7,3,28,9,28,18v0,7,-9,18,-18,17v-18,1,-25,-24,-10,-35",w:191},"õ":{d:"102,-132v50,-20,99,16,99,60v0,54,-60,64,-108,79v-50,-2,-110,-48,-76,-100v22,-17,49,-33,85,-39xm136,-104v-34,0,-91,27,-94,47v16,51,125,16,125,-22v0,-17,-10,-25,-31,-25xm58,-199v26,-21,54,18,69,22v4,0,15,-5,34,-13v22,-9,21,-16,31,-13v3,11,-9,9,-7,22v-26,20,-46,30,-59,30v-2,4,-49,-28,-49,-29v-11,0,-32,31,-46,32v-12,-3,-13,-21,-4,-23v4,-6,14,-15,31,-28",w:191},"ú":{d:"196,-129v-1,-4,12,-13,15,-13v6,0,8,7,8,21v0,24,-7,25,-13,45v-7,7,-14,21,-24,29v-9,24,-61,45,-89,45v-63,0,-105,-72,-67,-126v24,-3,19,27,18,46v-1,26,23,42,54,40v38,-3,88,-51,98,-87xm106,-174v26,-11,48,-32,59,-14v3,11,-81,53,-89,54v-13,1,-15,-12,-11,-22v15,-7,14,-7,41,-18",w:213},"ù":{d:"196,-129v-1,-4,12,-13,15,-13v6,0,8,7,8,21v0,24,-7,25,-13,45v-7,7,-14,21,-24,29v-9,24,-61,45,-89,45v-63,0,-105,-72,-67,-126v24,-3,19,27,18,46v-1,26,23,42,54,40v38,-3,88,-51,98,-87xm126,-166v7,6,56,14,37,40v-28,-7,-62,-22,-100,-42v-2,-3,-2,-26,5,-23v16,4,42,18,58,25",w:213},"û":{d:"196,-129v-1,-4,12,-13,15,-13v6,0,8,7,8,21v0,24,-7,25,-13,45v-7,7,-14,21,-24,29v-9,24,-61,45,-89,45v-63,0,-105,-72,-67,-126v24,-3,19,27,18,46v-1,26,23,42,54,40v38,-3,88,-51,98,-87xm172,-143v-27,-6,-39,-26,-60,-37v-8,0,-10,4,-14,10v-11,15,-49,35,-56,0v17,-4,44,-32,61,-43v27,6,41,21,63,36v12,9,17,17,17,25v0,6,-3,9,-11,9",w:213},"ü":{d:"196,-129v-1,-4,12,-13,15,-13v6,0,8,7,8,21v0,24,-7,25,-13,45v-7,7,-14,21,-24,29v-9,24,-61,45,-89,45v-63,0,-105,-72,-67,-126v24,-3,19,27,18,46v-1,26,23,42,54,40v38,-3,88,-51,98,-87xm168,-161v0,8,-3,13,-11,13v-17,0,-20,-19,-17,-34v18,-1,29,1,28,21xm72,-186v7,3,29,9,28,18v0,7,-9,18,-18,17v-18,1,-25,-24,-10,-35",w:213},"†":{d:"22,-286v15,6,5,-20,19,-19v9,-3,15,21,17,22v6,1,12,3,20,6v3,10,5,16,-9,16v-34,-10,-6,51,-34,52v-20,-7,11,-47,-15,-49v-14,3,-25,-5,-17,-24v7,-2,14,-4,19,-4",w:77},"°":{d:"106,-268v0,36,-35,38,-51,46v-48,5,-60,-58,-25,-78v33,-11,76,-9,76,32xm38,-257v16,7,39,2,38,-17v-13,-9,-28,-1,-32,11v-5,3,-7,0,-6,6",w:114},"¢":{d:"105,-188v13,-12,14,-18,26,-15v7,23,7,15,-3,49v6,0,18,14,17,20v-3,5,-12,19,-26,13v-14,1,-14,5,-16,21v10,10,46,-13,38,18v-9,17,-23,16,-54,20v-17,16,-4,55,-29,60v-37,-10,19,-64,-24,-71v-20,-10,-37,-47,-6,-62v23,-20,73,-4,77,-53xm65,-101v4,-9,7,-8,3,-13v-14,4,-22,10,-3,13",w:154},"£":{d:"153,-170v3,22,62,0,49,39v-18,6,-31,12,-58,9v-12,-1,-17,30,-23,39v19,26,50,56,91,35v9,-2,27,-13,27,4v0,27,-27,39,-58,42v-32,-5,-59,-19,-78,-39v-6,1,-35,44,-57,39v-25,0,-37,-15,-37,-46v0,-41,43,-53,73,-50v4,1,12,-18,12,-21v-7,-15,-49,0,-44,-30v-2,-31,31,-16,60,-19v16,-30,25,-119,93,-113v16,2,75,16,50,44v-4,5,-7,7,-12,8v-18,-12,-32,-18,-41,-18v-35,-1,-38,52,-47,77xm43,-45v4,5,12,-2,11,-9v-1,2,-12,1,-11,9",w:242},"§":{d:"141,-115v12,10,29,36,28,56v-4,68,-129,69,-152,16v-1,-12,-10,-22,8,-23v17,3,47,21,67,23v16,1,40,-8,38,-21v-8,-49,-119,-30,-117,-85v1,-28,15,-45,-3,-64v-1,-53,55,-61,103,-62v15,-5,6,-5,20,-2v16,17,23,27,23,30v-1,26,-29,7,-45,7v-21,0,-51,2,-62,17v19,14,87,8,97,43v18,14,16,57,-5,65xm64,-147r57,17v10,-28,-22,-43,-47,-44v-25,-1,-35,19,-10,27",w:174},"•":{d:"130,-114v0,47,-124,54,-120,-8r6,-31v44,-28,64,-34,104,0v8,6,10,20,10,39",w:139},"¶":{d:"121,-237v21,-9,44,-13,63,-1v-1,7,5,6,7,11r-4,190v-2,33,4,39,-15,40v-16,1,-10,-20,-10,-33r4,-161v0,-17,-1,-34,-16,-25v2,10,1,23,1,35v-9,46,-6,75,-15,156v-3,4,-7,5,-12,5v-17,-10,-3,-89,-10,-115v-43,14,-98,10,-101,-29v-4,-53,59,-63,104,-75v3,1,4,2,4,2xm95,-204v2,9,-30,50,1,50v35,0,23,-13,29,-43v0,-1,-2,-7,-4,-15v-12,-1,-14,2,-26,8",w:206},"ß":{d:"33,10v-29,4,-28,-32,-16,-70v18,-58,17,-137,56,-176v12,-24,46,-58,82,-43v20,8,47,24,47,54v0,30,-62,59,-67,90v33,23,56,33,63,63v-18,21,-22,36,-48,54v-24,17,-27,41,-53,16v-2,-19,7,-35,24,-42v15,-13,26,-22,34,-40v-13,-17,-78,-29,-56,-70v-3,-27,64,-54,66,-86v-8,-25,-41,-4,-52,8v-29,30,-47,83,-51,141v-17,25,-8,71,-29,101"},"®":{d:"75,-194v78,-29,116,9,130,84v-2,42,-22,47,-57,67v-74,20,-161,-19,-129,-110v6,-18,29,-34,57,-40xm46,-86v51,36,84,21,129,-15v7,-15,0,-39,-10,-49v-13,-37,-49,-26,-86,-18v-28,7,-49,46,-33,82xm72,-123v-5,-43,68,-57,75,-14v-17,26,-18,17,3,32v2,25,-25,18,-45,7r-4,-4v-1,8,-3,20,-12,24v-10,-3,-21,-34,-17,-45xm112,-135v-10,-1,-20,13,-9,14v6,-6,9,-11,9,-14",w:217},"©":{d:"102,-29v-74,5,-124,-84,-70,-140v22,-22,53,-35,97,-38v46,-4,88,49,74,100v0,44,-51,75,-101,78xm96,-66v42,-3,75,-23,75,-69v0,-23,-4,-38,-44,-38v-16,0,-33,6,-49,20v36,-4,55,-12,62,20v-5,16,-49,1,-50,21v10,15,53,-14,54,11v0,18,-14,27,-42,27v-22,1,-46,-11,-46,-31v0,-25,7,-39,20,-44v-1,-1,-2,-2,-3,-2v-51,22,-32,89,23,85",w:217},"™":{d:"213,-307v28,9,11,49,7,75v-1,4,-4,6,-11,6v-7,1,-11,-14,-11,-34v-14,-6,-34,34,-46,28v-2,0,-10,-9,-24,-27v-10,7,-3,36,-27,31v-15,-24,-3,-27,1,-48v-6,-7,-27,-1,-31,3v-3,14,-7,30,-11,51v-5,10,-29,9,-24,-12v-5,-8,1,-18,3,-35v-13,6,-33,2,-29,-18v20,-17,64,-17,100,-19v28,-1,29,30,45,39v11,-6,35,-32,58,-40",w:239},"´":{d:"52,-284v29,-11,50,-34,62,-14v3,12,-86,54,-94,56v-14,0,-16,-12,-12,-23v11,-5,25,-11,44,-19",w:120},"¨":{d:"124,-259v0,9,-4,13,-12,13v-18,0,-22,-21,-17,-35v19,-1,30,1,29,22xm23,-285v7,2,30,9,29,18v1,10,-9,19,-18,19v-19,0,-28,-26,-11,-37",w:136},"≠":{d:"48,-130v29,11,49,-57,60,-50v25,6,7,27,-1,46v22,5,29,7,21,22v-18,2,-48,-1,-50,15v9,8,53,-7,54,10v-4,22,-46,20,-72,24v-7,13,-18,32,-34,57v-8,6,-15,-3,-13,-14v-1,-9,15,-39,14,-45v-30,5,-24,-17,-13,-25v12,-1,36,4,29,-13v-14,0,-47,6,-36,-12v0,-18,27,-13,41,-15",w:140},"Æ":{d:"335,-259v0,30,-102,12,-122,34v10,21,2,79,16,100v24,-6,59,-13,86,-16v23,-2,32,21,13,26r-103,29v-3,22,-4,38,8,43v28,-5,60,-6,86,-14v5,-1,14,7,14,11v6,16,-90,40,-107,40v-29,0,-39,-19,-32,-46v-2,-4,0,-26,-9,-28v-29,2,-58,6,-88,6v-31,0,-40,74,-82,73v-18,-23,4,-37,12,-50v40,-65,112,-126,165,-207v20,-17,69,-11,112,-13v21,0,31,4,31,12xm123,-111v28,1,44,-2,67,-10v-4,-22,5,-49,-7,-65v-3,6,-65,61,-60,75",w:348},"Ø":{d:"76,-211v41,-13,100,-22,140,-3v26,-19,40,-29,44,-29v10,0,15,7,15,20v0,15,-23,23,-30,35v23,39,29,114,-21,139v-36,19,-102,35,-147,18v-14,-5,-29,29,-46,35v-25,-13,-19,-24,3,-56v-9,-17,-28,-27,-28,-60v0,-38,23,-72,70,-99xm107,-66v55,15,125,-12,123,-70v0,-16,-5,-25,-13,-29r-110,95r0,4xm39,-108v-1,3,17,31,22,27v8,-6,109,-90,123,-106v-15,-11,-43,1,-63,2v-33,10,-80,35,-82,77",w:270},"∞":{d:"322,-72v-4,22,-54,41,-76,41v-43,0,-83,-17,-114,-35v-46,19,-125,53,-128,-18v-1,-14,10,-22,13,-35v29,-10,62,-31,97,-4v37,28,47,5,75,-8v40,-19,73,-10,114,1v13,1,18,55,19,58xm228,-69v15,0,62,-12,61,-25v-19,-23,-89,-10,-105,11v0,2,1,4,2,4v28,6,42,10,42,10xm75,-102v-13,2,-41,4,-44,19v0,4,3,7,10,7v21,0,40,-6,54,-17v-9,-6,-16,-9,-20,-9",w:330},"±":{d:"93,-163v-7,46,76,-4,46,47v-14,6,-27,13,-38,8v-24,2,-14,28,-28,44r-14,0v-7,-12,-5,-15,-7,-33v-12,-7,-41,-1,-37,-24v2,-11,23,-17,36,-14r28,-38v4,0,9,4,14,10xm113,-27v-12,18,-58,27,-85,24v-16,2,-22,-23,-13,-36v28,-7,85,-11,98,12",w:151},"≤":{d:"73,-109v10,15,87,16,87,42v0,11,-5,16,-13,16v-36,-11,-69,-24,-109,-31v-18,-8,-18,-13,-9,-36v59,-56,93,-83,101,-83v16,0,18,17,14,28v-27,24,-42,35,-71,64xm10,-29v35,-12,117,-26,148,-3v1,2,-5,19,-8,18r-124,15v-16,2,-26,-18,-16,-30",w:168},"≥":{d:"115,-174v20,7,53,36,20,57v-19,11,-91,68,-82,59v-18,3,-25,-22,-13,-31v15,-10,14,-10,70,-51r-50,-37v-5,-4,-5,-27,4,-28v16,7,40,17,51,31xm14,-32v33,-10,86,-14,127,-10v12,12,5,23,-11,27v-49,9,-82,13,-99,13v-22,0,-24,-16,-17,-30",w:163},"¥":{d:"31,-248v30,-3,64,64,74,59v37,-22,77,-65,107,-82v20,-11,34,18,21,32v-28,19,-52,38,-70,57v-18,8,-40,21,-35,60v2,19,39,7,64,7v25,0,16,21,2,27v-36,16,-46,8,-68,18v6,11,101,-20,66,24v-21,11,-42,12,-75,20v-2,1,-5,6,-10,18v-8,3,-11,10,-24,8v-7,-17,-2,-18,-9,-26v-13,5,-39,3,-53,-2v-10,-17,-7,-27,0,-34v23,-1,45,1,64,-5v-11,-7,-28,-4,-64,-6v-13,-8,-15,-24,-6,-35v33,-2,102,9,76,-37v-14,-14,-33,-38,-60,-66v-10,-10,-8,-28,0,-37",w:219},"µ":{d:"123,-114v41,0,54,-9,127,-17v12,-2,20,-6,25,-12v5,-78,43,-127,119,-138v38,-5,46,23,55,48v-5,5,2,4,2,12v-2,47,-72,81,-129,95v-17,4,-12,32,-2,39v30,-5,24,0,99,4v14,9,14,20,-1,23v-17,3,-71,-1,-85,13v1,19,18,35,-3,47v-1,-6,-10,-7,-16,-5v-3,-3,-20,-37,-29,-41v-15,8,-50,22,-49,-9v1,-19,2,-27,28,-26v24,1,13,-12,8,-30v-22,1,-64,16,-111,23v-50,7,-17,47,-17,57v0,10,-5,15,-13,15v-20,-9,-27,-30,-33,-55v-20,-17,-52,8,-85,-6v-2,-10,-13,-26,4,-29v32,-6,41,-1,65,-7v-17,-74,-4,-173,69,-180v55,-20,130,8,131,65v-11,9,-10,2,-29,-11v-33,-23,-37,-26,-76,-25v-41,13,-69,38,-67,100v0,34,4,50,13,50xm317,-152v29,-6,106,-43,106,-71v0,-23,-24,-25,-42,-17v-31,1,-74,48,-64,88",w:462},"∂":{d:"456,-113v55,-37,119,-8,176,5v-19,37,-104,-5,-144,18v-5,64,-45,87,-130,87v-43,0,-70,-8,-96,-21v-54,15,-146,29,-209,10v-18,-11,-43,-26,-46,-53v-1,-9,28,-48,51,-46v55,-10,55,-8,101,-8v29,0,17,-26,23,-56v4,-19,4,-74,34,-49v4,42,-7,83,-10,124v0,4,-11,10,-34,17v-29,-1,-45,-4,-74,1v-10,2,-57,3,-52,18v30,43,132,30,190,18v2,-10,-7,-19,-5,-28v5,-36,31,-59,74,-56v27,2,71,4,70,35v-1,30,-37,41,-58,57v35,13,131,15,135,-23v2,-19,-5,-36,4,-50xm262,-85v0,3,13,28,19,25v7,0,48,-13,61,-29v-10,-17,-71,-17,-80,4",w:640},"∑":{d:"235,-95v-3,-59,120,-41,160,-28v3,-2,15,-3,14,4v1,3,-16,19,-21,18r-97,4v-25,5,-18,18,-23,56v-16,14,-25,24,-36,18v-83,32,-154,29,-212,-17v-45,-68,41,-114,107,-119v50,-4,59,66,22,85v-16,8,-61,10,-79,15v36,27,185,24,165,-36xm128,-119v-23,-3,-43,4,-53,15v13,5,46,-4,53,-15",w:414},"∏":{d:"243,-190v7,-18,27,-19,38,6v0,2,-5,8,-14,16v-8,-9,-27,-4,-24,-22xm221,-111v55,-7,60,22,45,64v5,23,17,47,-22,47v-35,0,-18,-40,-15,-70v-2,-19,-35,-13,-52,-18v-2,0,-13,1,-34,3v-4,0,-10,11,-13,31v-3,20,1,43,-11,54v-12,-4,-13,-5,-21,-3v-13,-13,-3,-25,-12,-41v7,-6,12,-22,10,-39v-23,-8,-79,15,-87,-21v12,-28,78,-4,101,-20r36,-96v8,-19,17,-28,27,-28v10,0,15,6,15,18v-6,32,-31,62,-38,109v25,10,47,-1,71,10",w:282},"π":{d:"247,-240v-3,5,-14,12,-21,6v-41,5,-71,-4,-85,37v-6,7,-21,42,-25,61v28,12,104,-16,129,24v8,11,12,24,12,38v-7,17,-2,99,-40,68v-9,-23,-5,-47,-1,-73v3,-24,-40,-24,-50,-19v-4,0,-18,2,-44,6v-30,-6,-16,49,-33,58v-19,-11,-14,2,-29,-10v8,-71,20,-114,43,-170v-24,-2,-49,4,-73,7v-30,3,-32,-33,-7,-36r184,-22v17,-1,40,13,40,25",w:265},"∫":{d:"62,-151v-7,-70,20,-130,63,-150v28,1,39,10,70,23v20,8,6,33,-6,35v-29,-13,-45,-20,-49,-20v-20,-4,-45,51,-43,70v8,60,5,129,5,189v0,62,-27,93,-79,93v-37,-1,-71,-14,-63,-57v21,0,79,34,91,-2v16,-3,14,-64,21,-85v-2,-31,-1,-74,-10,-96",w:156},"ª":{d:"6,-265v1,-31,58,-53,80,-22v-11,14,25,28,25,36v-2,8,-15,12,-27,10v-22,-29,-68,19,-78,-24xm52,-281v-8,1,-24,10,-9,13v11,1,24,-10,9,-13",w:117},"º":{d:"13,-273v1,-31,56,-41,83,-18v36,8,14,48,-9,52v-35,6,-64,-5,-74,-34xm81,-269v-7,-7,-20,-11,-29,-6v5,13,13,11,29,6",w:128},"Ω":{d:"121,-111v9,16,43,-5,54,5v28,-4,62,8,81,-5v48,-33,166,-28,160,44v15,34,-51,53,-88,53v-34,0,-53,-21,-71,-37v-15,7,-32,-4,-28,-22v-26,-4,-93,-6,-108,8v8,17,5,37,12,54v-1,15,-18,15,-31,10v-9,-15,-20,-39,-19,-63v-20,-9,-73,15,-79,-18v4,-28,50,-11,77,-24v12,-99,36,-168,137,-178v35,5,64,20,67,57v0,13,-14,18,-20,5v-15,-35,-83,-31,-104,4v-26,20,-39,82,-40,107xm334,-45v15,2,51,-14,53,-22v-7,-20,-36,-31,-69,-29v-8,-1,-39,6,-37,14v-3,10,44,38,53,37",w:424},"æ":{d:"145,-44r33,7v2,42,-59,29,-85,16v-6,7,-35,24,-48,15v-19,2,-35,-21,-33,-37v2,-24,5,-19,28,-36v-6,-8,-45,3,-33,-21v21,-22,58,-12,85,-1v6,-5,35,-28,45,-15v20,-4,36,17,36,35v0,23,-4,21,-28,37xm111,-72v12,3,49,-16,19,-17v-5,0,-20,12,-19,17xm74,-50v-14,-4,-48,16,-19,17v4,1,19,-14,19,-17",w:184},"ø":{d:"76,-136v17,7,33,-8,51,0v9,-6,21,-13,36,-21v23,22,-13,31,3,50v11,13,4,21,14,35v-4,5,-1,14,-4,23v-14,23,-45,41,-84,39v-12,2,-29,28,-41,38v-2,-11,-34,-10,-15,-30v3,-7,5,-11,5,-11v-15,-24,-60,-54,-22,-89v23,-21,25,-32,57,-34xm102,-54v18,1,50,-19,30,-32v-12,7,-22,18,-30,32xm85,-92v-14,3,-26,8,-38,17v2,20,17,13,26,0v6,-8,12,-13,12,-17",w:188},"¿":{d:"181,-247v3,1,31,2,29,15v-4,22,-37,27,-41,4v1,-5,7,-20,12,-19xm161,-34v-45,-1,-105,19,-124,51v0,11,18,17,54,17v39,0,82,-13,112,4v-10,35,-58,31,-100,31v-47,0,-80,-10,-99,-31v-10,-56,22,-73,64,-90v8,-3,32,-9,74,-18v21,-15,7,-62,22,-92v-1,-5,-1,-11,4,-12v16,0,24,7,24,22v-8,30,-8,73,-17,111v-3,5,-7,7,-14,7",w:213},"¡":{d:"86,-197v8,16,-7,41,-24,25v-11,-11,-4,-16,-3,-29v13,0,15,-2,27,4xm46,-107v4,-8,11,-16,23,-7v19,26,-5,57,-6,87v-7,0,-5,18,-9,28v0,14,-17,52,-11,70v-2,7,-15,28,-25,12v-4,-6,-15,-7,-6,-16v2,-39,14,-96,34,-174",w:95},"¬":{d:"141,-99v47,7,103,-3,149,6v14,24,18,15,10,39v-10,34,-7,31,-26,76v-4,6,-15,8,-16,21v-4,2,-4,1,-13,5v-22,-33,-4,-33,16,-104v-5,-9,-28,-4,-38,-6r-183,4v-14,0,-41,-29,-17,-36v31,-9,82,5,118,-5",w:315},"√":{d:"364,-218v43,-21,80,-51,104,-32v-3,19,-24,21,-44,40v-41,15,-78,53,-136,78r-137,98v-20,16,-79,66,-91,68v-3,1,-25,-11,-24,-13v-4,-28,-43,-61,-30,-85v26,-15,42,19,58,32r295,-188v0,1,2,2,5,2",w:474},"ƒ":{d:"115,-262v-23,6,-39,63,-38,96v1,3,57,2,54,16v1,22,-45,15,-51,30v3,34,12,68,10,103v14,17,-18,53,-28,63v-48,8,-89,5,-95,-37v20,-5,77,21,83,-18v17,-29,-4,-61,0,-98v0,-5,-3,-10,-7,-17v-33,4,-43,-17,-25,-37v10,-4,27,5,27,-10v0,-43,15,-77,32,-109v12,-7,16,-22,38,-20v11,1,51,35,25,55v-9,1,-16,-17,-25,-17",w:145},"≈":{d:"133,-112v21,15,48,-30,78,-17v3,3,5,7,5,9v-8,30,-47,45,-76,45v-19,0,-64,-48,-90,-21r-29,20v-6,-1,-17,-16,-15,-32v24,-17,70,-42,107,-21v4,4,10,9,20,17xm138,-57v28,2,48,-25,76,-26v13,30,-21,42,-40,53v-41,24,-77,-15,-114,-23v-15,14,-46,32,-49,-1v-3,-9,27,-28,54,-30",w:223},"∆":{d:"18,-1v-24,-30,8,-48,25,-71v14,-19,34,-28,40,-56v20,-35,29,-14,57,4v9,39,43,62,57,102v0,16,-34,17,-50,14v-28,2,-72,4,-129,7xm139,-47r-22,-52v-12,-5,-12,15,-24,27v-7,6,-14,16,-23,28v23,1,36,-1,69,-3",w:199},"«":{d:"191,-64v16,6,87,37,53,63v-39,-9,-71,-28,-107,-40v-14,-13,-13,-34,10,-47v27,-15,48,-55,84,-62v9,-2,21,10,21,18r-13,21v-16,5,-44,22,-51,41v0,4,1,6,3,6xm71,-65v17,6,87,35,55,62v-39,-8,-66,-27,-108,-40v-14,-13,-13,-36,10,-46v23,-18,50,-56,84,-63v9,-2,21,10,21,18r-13,22v-20,6,-32,17,-51,37v0,3,-1,11,2,10",w:265},"»":{d:"120,-129v9,-33,48,-10,64,5v9,20,86,52,50,86v-36,11,-66,31,-107,40v-6,-7,-9,-13,-9,-17v-2,-13,50,-46,63,-46v11,-18,-33,-42,-48,-47xm1,-128v10,-33,46,-8,64,6v8,19,86,50,51,85v-40,13,-69,30,-108,40v-6,-7,-8,-12,-8,-16v-2,-14,50,-46,63,-47v7,-13,-9,-20,-19,-30v-10,-9,-20,-15,-30,-17",w:252},"…":{d:"244,-24v-1,21,-38,32,-41,3v-2,-19,23,-22,34,-17v0,7,0,15,7,14xm113,-24v0,-22,28,-21,38,-8v5,34,-39,40,-38,8xm35,-2v-10,-2,-36,-17,-18,-29v-1,-15,17,-17,31,-6v7,17,6,33,-13,35",w:258}," ":{w:179},"À":{d:"161,-217v20,53,23,124,54,170v-2,20,-34,9,-42,0v-27,-12,-78,-18,-101,-18v-26,6,-29,51,-54,63v-18,-4,-19,-30,-3,-38v5,-9,15,-16,8,-29v1,-12,23,-9,26,-19v6,-10,11,-20,20,-27r70,-121v12,-4,16,4,22,19xm82,-91v17,3,62,7,86,13v-13,-33,-13,-80,-29,-109v-15,30,-38,63,-57,96xm150,-268v14,10,54,14,37,41v-28,-7,-62,-22,-100,-42v-2,-3,-2,-26,5,-23v16,4,42,17,58,24"},"Ã":{d:"161,-217v20,53,23,124,54,170v-2,20,-34,9,-42,0v-27,-12,-78,-18,-101,-18v-26,6,-29,51,-54,63v-18,-4,-19,-30,-3,-38v5,-9,15,-16,8,-29v1,-12,23,-9,26,-19v6,-10,11,-20,20,-27r70,-121v12,-4,16,4,22,19xm82,-91v17,3,62,7,86,13v-13,-33,-13,-80,-29,-109v-15,30,-38,63,-57,96xm100,-285v26,-19,54,19,69,22v4,0,15,-5,34,-13v23,-9,22,-17,31,-12v3,11,-9,9,-7,21v-26,20,-46,30,-59,30v-3,3,-50,-26,-49,-29v-12,1,-31,35,-51,32v-3,-8,-5,-14,-5,-18v10,-9,16,-17,37,-33"},"Õ":{d:"62,-184v78,-31,249,-50,238,74v-6,65,-102,105,-179,115v-77,-7,-152,-71,-101,-149v2,-5,24,-33,42,-40xm279,-120v14,-38,-47,-64,-85,-61v-20,-9,-41,7,-62,0v-11,7,-54,12,-66,24v0,20,-51,35,-38,66v-1,43,50,67,96,67v44,0,162,-55,155,-96xm116,-270v26,-19,54,19,69,22v4,0,15,-5,34,-13v23,-10,22,-16,31,-12v3,11,-8,9,-7,21v-45,28,-47,42,-88,16v-29,-19,-12,-20,-43,2v-8,5,-12,18,-23,15v-13,-3,-12,-20,-4,-23v4,-6,14,-15,31,-28",w:273},"Œ":{d:"247,-243v71,4,161,-7,245,-8v17,0,27,6,27,17v-8,27,-70,14,-104,23v-3,1,-52,0,-65,7r0,4v16,16,17,29,17,65v32,10,74,-14,99,16v-14,25,-76,17,-127,24v-17,18,-55,32,-75,51v85,0,128,-3,204,-11v15,-2,21,11,20,29v-78,24,-177,12,-270,24v-24,3,-24,-29,-48,-15v-46,7,-70,4,-105,-4v-19,-18,-42,-22,-52,-55v-10,-34,0,-47,12,-78v-18,-59,48,-78,105,-84v17,-18,103,-13,117,-5xm125,-45v76,-9,186,-43,209,-105v-26,-67,-137,-83,-217,-54v3,34,-45,25,-60,58v-41,48,5,108,68,101",w:492},"œ":{d:"185,-54v25,28,107,-17,104,33v-12,12,-60,14,-87,14v0,0,1,1,2,1v-11,1,-39,-9,-50,-17v-28,17,-75,32,-114,7v-22,-14,-34,-11,-34,-41v0,-36,33,-49,48,-75v29,-16,72,-3,95,11v12,-9,48,-27,59,-26v30,0,64,15,65,40v0,7,-6,20,-20,37v-29,1,-44,11,-68,16xm226,-106v-21,-7,-41,-2,-48,13v14,1,42,-7,48,-13xm132,-87v-21,-35,-94,11,-92,24v-2,14,43,21,61,21v25,0,36,-20,31,-45",w:295},"–":{d:"6,-66v-8,-72,79,-21,146,-39v37,-10,79,7,111,0v9,8,14,13,14,17v2,26,-72,13,-99,21v-83,4,-124,21,-172,1",w:282},"—":{d:"175,-106v86,-9,201,1,286,-1v11,6,13,11,6,30v-118,15,-246,10,-377,10v-25,0,-73,3,-82,-8r-2,-26v11,-13,32,-9,52,-7v38,3,84,-5,117,2",w:485},"“":{d:"66,-261v-21,5,-37,51,-22,77v0,4,-2,6,-7,6v-31,-9,-38,-62,-12,-94v12,-15,21,-28,31,-34v16,-1,19,24,22,34v10,-11,22,-32,43,-23v-2,8,4,16,5,19v-6,11,-51,53,-29,74v-12,21,-30,5,-33,-17v-6,-13,9,-28,2,-42",w:118},"”":{d:"120,-294v12,3,30,26,19,34v2,15,-40,70,-55,66v-40,-10,10,-51,14,-64v3,-3,8,-31,22,-36xm70,-306v14,3,26,34,16,49v-19,30,-31,45,-58,59v-12,-11,-33,-17,-7,-36v13,-19,36,-27,36,-59v0,-5,9,-13,13,-13",w:148},"‘":{d:"73,-262v-10,7,-41,39,-38,69v-15,13,-27,-16,-28,-28v-2,-20,51,-83,66,-83v20,0,25,41,0,42",w:95},"’":{d:"74,-300v13,31,-1,99,-44,101v-13,0,-19,-5,-19,-15v6,-10,31,-34,35,-59v2,-11,1,-32,11,-32v6,0,11,2,17,5",w:90},"÷":{d:"167,-158v-4,3,-7,9,-10,20v-23,4,-34,-8,-29,-31v14,-6,18,1,39,11xm78,-72v-53,11,-53,12,-69,-15v-1,-12,11,-17,22,-14v71,-13,151,-18,230,-24v11,1,21,16,23,28v-28,20,-90,11,-126,16v-36,5,-62,5,-80,9xm123,-40v19,-17,41,-1,41,17v0,13,-6,19,-17,19v-15,0,-29,-14,-24,-36",w:293},"◊":{d:"76,-158v48,-8,64,11,100,36v28,19,-5,39,-22,54v-15,13,-40,32,-48,49v-17,5,-12,0,-27,-16v-6,-6,-86,-31,-68,-53r2,-9v27,-23,48,-44,63,-61xm93,-65v12,-2,35,-31,41,-38v-5,-10,-16,-14,-34,-24v-12,12,-36,29,-40,44v19,11,30,18,33,18",w:199},"ÿ":{d:"118,85v-11,11,-11,38,-22,61v-2,-1,-2,31,-17,27v-11,0,-21,-10,-21,-22v20,-66,23,-61,64,-168v-22,1,-38,16,-58,4v-22,4,-51,-16,-51,-42v-11,-13,-7,-59,7,-58v16,1,21,24,22,51v21,33,66,5,94,-7v4,-3,26,-14,38,-29r17,0v23,44,-23,59,-34,102v-6,9,-13,9,-13,26v-15,6,-12,33,-27,48v0,2,1,4,1,7xm158,-136v0,8,-4,13,-12,13v-18,0,-21,-20,-16,-34v18,-1,29,1,28,21xm62,-161v7,3,28,9,27,18v1,8,-8,17,-17,17v-18,0,-26,-24,-10,-35",w:190},"Ÿ":{d:"176,-189v35,20,-25,54,-39,72v-26,34,-57,57,-74,104v-10,15,-4,14,-23,3r0,-10v19,-44,27,-46,50,-81v-9,-5,-24,4,-34,4v-38,0,-54,-50,-44,-87v21,-5,18,19,22,35v4,18,15,27,29,27v41,0,60,-39,113,-67xm153,-222v0,8,-3,12,-11,12v-18,0,-21,-19,-16,-33v18,-1,28,2,27,21xm57,-247v8,2,29,9,28,17v0,21,-37,24,-36,1v0,-7,2,-13,8,-18",w:135},"⁄":{d:"193,-305v7,6,17,31,3,41v-10,7,-12,13,-21,25v-79,56,-190,209,-197,260r-18,0v-23,-19,9,-70,15,-85v52,-83,121,-179,218,-241",w:120},"¤":{d:"308,-133r-200,16v-2,1,-6,4,-10,10v70,-2,144,-14,211,-8v3,0,8,4,13,8v-1,4,-3,9,-9,17v-57,11,-164,6,-219,25v26,32,112,25,173,25v9,0,35,2,35,19v0,9,-4,13,-12,14v-115,12,-146,23,-211,-19v-12,-4,-22,-9,-25,-27v-6,-29,-61,3,-43,-49v17,-1,36,7,42,-12v-32,7,-36,-39,-11,-40v29,14,63,-25,73,-30v52,-25,72,-44,142,-44v23,0,21,41,-1,39v-35,-3,-61,9,-102,31v2,2,5,4,8,4v18,-6,101,-9,115,-9v7,0,55,13,31,30",w:312},"€":{d:"308,-133r-200,16v-2,1,-6,4,-10,10v70,-2,144,-14,211,-8v3,0,8,4,13,8v-1,4,-3,9,-9,17v-57,11,-164,6,-219,25v26,32,112,25,173,25v9,0,35,2,35,19v0,9,-4,13,-12,14v-115,12,-146,23,-211,-19v-12,-4,-22,-9,-25,-27v-6,-29,-61,3,-43,-49v17,-1,36,7,42,-12v-32,7,-36,-39,-11,-40v29,14,63,-25,73,-30v52,-25,72,-44,142,-44v23,0,21,41,-1,39v-35,-3,-61,9,-102,31v2,2,5,4,8,4v18,-6,101,-9,115,-9v7,0,55,13,31,30",w:312},"‹":{d:"64,-107v9,17,86,17,87,43v0,11,-4,16,-13,16v-36,-11,-70,-22,-109,-31v-19,-4,-18,-14,-9,-36v59,-56,93,-84,101,-84v17,0,19,20,13,29",w:159},"›":{d:"41,-181v26,27,112,44,70,91r-82,60v-20,3,-25,-23,-13,-32r70,-51r-66,-46v-5,-6,-4,-28,5,-29v4,2,9,4,16,7",w:137},"":{d:"74,-74v-6,-24,-70,8,-68,-27v0,-6,6,-20,20,-18v44,6,45,-9,42,-49v7,-40,26,-114,90,-104v48,-2,63,-1,90,30v11,25,4,14,2,44v-7,17,-54,9,-49,-7r8,-21v-5,-13,-22,-9,-43,-11v-56,-6,-63,45,-67,92v-2,21,5,23,22,22v37,-1,80,-9,113,-1v13,31,-9,82,-22,106v-13,10,-26,-6,-22,-25r11,-46v0,-3,-2,-6,-6,-6v-19,0,-47,3,-83,9v-6,1,-9,4,-8,11r12,59v-1,9,-11,30,-23,18v-18,-18,-15,-59,-19,-76",w:272},"":{d:"43,-61v-21,4,-36,2,-39,-15v-4,-35,41,-8,34,-47v4,-59,12,-99,46,-124v11,-42,157,-47,149,13v1,7,-7,15,-13,15v-18,-7,-19,-26,-47,-23v-34,3,-65,6,-79,37v-12,27,-22,52,-21,91v13,9,31,-11,45,-4v32,-15,50,-6,94,-13v12,-30,19,-79,36,-133v1,-5,5,-8,12,-8v44,18,-18,106,-12,144v-9,22,-1,73,-16,104v2,28,-23,28,-37,16v1,-26,9,-48,11,-75v0,-6,-3,-9,-9,-9v-43,0,-83,8,-119,24v8,40,17,33,-7,56v-20,-9,-21,-19,-28,-49",w:283},"‡":{d:"102,-284v16,2,42,-2,33,18v-7,15,-42,1,-38,30v3,3,31,1,30,11v4,15,-29,19,-36,24v-2,18,-4,24,-16,29r-25,-26v-25,7,-53,3,-42,-25v4,-10,70,0,51,-22v-17,4,-41,12,-39,-15v-5,-16,39,-18,44,-20v4,-2,7,-10,10,-24v19,-3,23,6,28,20",w:145},"∙":{d:"57,-77v6,18,-7,21,-19,23v-34,6,-25,-40,-9,-43v18,-3,29,8,28,20",w:67},"‚":{d:"25,63v-26,21,-48,-2,-22,-24v14,-12,35,-40,35,-69v3,-2,3,-11,12,-9v35,17,5,88,-25,102",w:97},"„":{d:"25,63v-26,21,-48,-2,-22,-24v11,-9,36,-41,35,-69v3,-2,4,-12,12,-9v36,14,5,89,-25,102xm84,64v-24,20,-45,-1,-21,-24v21,-20,32,-35,35,-69v3,-2,3,-11,12,-9v36,17,9,86,-26,102",w:135},"‰":{d:"398,-131v58,-1,87,13,72,65v-1,30,-66,63,-99,65v-56,3,-99,-58,-62,-102v2,2,5,2,8,2v20,-16,51,-17,81,-30xm202,-279v33,0,94,-24,95,18v-7,31,-33,27,-54,55v-36,32,-71,74,-112,99v-18,18,-40,34,-51,58v-19,14,-25,37,-56,40v-17,2,-25,-29,-10,-40v15,-11,40,-37,52,-52r87,-72v-51,13,-100,6,-116,-27v1,-5,-6,-30,-9,-36v-3,-5,22,-41,27,-39v29,2,16,34,5,49v0,15,14,23,42,23v42,0,59,-31,28,-38v-17,-4,-53,3,-50,-23v0,-7,1,-12,4,-16v16,-9,36,4,49,5v0,0,23,-4,69,-4xm222,-118v33,-2,55,18,50,57v-29,36,-48,45,-96,50v-27,-5,-56,-17,-58,-51v13,-37,64,-43,104,-56xm335,-61v13,44,101,7,108,-31v-11,-3,-20,-4,-30,-4v-18,-1,-82,18,-78,35xm225,-244v-18,0,-29,-1,-46,3v7,15,6,28,0,43v15,-14,34,-30,46,-46xm164,-53v26,5,59,-10,76,-26v-17,-16,-49,2,-67,14v1,8,-8,6,-9,12",w:485},"Â":{d:"161,-217v20,53,23,124,54,170v-2,20,-34,9,-42,0v-27,-12,-78,-18,-101,-18v-26,6,-29,51,-54,63v-18,-4,-19,-30,-3,-38v5,-9,15,-16,8,-29v1,-12,23,-9,26,-19v6,-10,11,-20,20,-27r70,-121v12,-4,16,4,22,19xm82,-91v17,3,62,7,86,13v-13,-33,-13,-80,-29,-109v-15,30,-38,63,-57,96xm202,-219v-27,-6,-40,-26,-61,-37v-21,7,-39,46,-65,23v-2,-4,-3,-10,-4,-14v19,-4,43,-32,61,-43v27,6,40,22,62,37v12,8,18,17,18,25v0,6,-3,9,-11,9"},"Ê":{d:"49,-160v1,-4,-10,-9,-15,-8v-15,-35,32,-30,57,-31r142,-8v2,1,30,7,40,10v-52,16,-133,17,-190,30v-7,9,-12,24,-15,47v26,10,102,-6,141,3v1,3,1,6,2,10v-36,18,-92,12,-149,21v-11,9,-16,41,-16,51v55,-1,111,-21,168,-13v15,-8,48,1,31,18v-53,16,-130,13,-198,29r-39,-8v-4,-19,17,-53,20,-76v-1,0,-7,-11,-9,-18v18,-7,22,-28,30,-57xm199,-211v-27,-6,-39,-26,-60,-37v-21,7,-40,47,-65,22v-2,-7,-2,-7,-4,-13v18,-5,44,-31,61,-43v27,6,41,22,62,37v12,9,18,17,18,25v0,6,-4,9,-12,9",w:252},"Á":{d:"161,-217v20,53,23,124,54,170v-2,20,-34,9,-42,0v-27,-12,-78,-18,-101,-18v-26,6,-29,51,-54,63v-18,-4,-19,-30,-3,-38v5,-9,15,-16,8,-29v1,-12,23,-9,26,-19v6,-10,11,-20,20,-27r70,-121v12,-4,16,4,22,19xm82,-91v17,3,62,7,86,13v-13,-33,-13,-80,-29,-109v-15,30,-38,63,-57,96xm84,-250v31,-5,83,-53,100,-31v0,5,-11,15,-35,28v-16,5,-51,28,-53,25v-14,1,-16,-11,-12,-22"},"Ë":{d:"49,-160v1,-4,-10,-9,-15,-8v-15,-35,32,-30,57,-31r142,-8v2,1,30,7,40,10v-52,16,-133,17,-190,30v-7,9,-12,24,-15,47v26,10,102,-6,141,3v1,3,1,6,2,10v-36,18,-92,12,-149,21v-11,9,-17,41,-17,51v55,0,112,-21,169,-13v15,-8,48,1,31,18v-53,16,-130,13,-198,29r-39,-8v-3,-21,17,-53,20,-76v-1,0,-7,-11,-9,-18v18,-7,22,-28,30,-57xm191,-236v0,8,-4,13,-12,13v-17,0,-19,-19,-16,-34v18,-1,29,1,28,21xm95,-261v7,3,29,9,28,18v0,7,-9,17,-18,17v-18,0,-26,-25,-10,-35",w:252},"È":{d:"49,-160v1,-4,-10,-9,-15,-8v-15,-35,32,-30,57,-31r142,-8v2,1,30,7,40,10v-52,16,-133,17,-190,30v-7,9,-12,24,-15,47v26,10,102,-6,141,3v1,3,1,6,2,10v-36,18,-92,12,-149,21v-11,9,-16,41,-16,51v55,-1,111,-21,168,-13v15,-8,48,1,31,18v-53,16,-130,13,-198,29r-39,-8v-4,-19,17,-53,20,-76v-1,0,-7,-11,-9,-18v18,-7,22,-28,30,-57xm184,-236v6,9,5,13,0,23v-28,-7,-62,-21,-100,-41v-3,-2,-3,-27,5,-23v34,11,60,25,95,41",w:252},"Í":{d:"26,-5v-9,-6,-9,-12,-9,-36v0,-71,7,-119,21,-144v8,-13,14,-20,19,-20v28,19,-7,89,-10,120v-2,21,-8,47,-14,76v-2,1,-2,0,-7,4xm6,-233v31,-6,83,-53,101,-31v2,11,-80,53,-89,53v-14,1,-14,-11,-12,-22",w:104},"Î":{d:"53,-9v-15,7,-16,-3,-16,-32v0,-71,7,-119,21,-144v8,-13,14,-20,19,-20v28,19,-7,89,-10,120v-2,21,-8,47,-14,76xm137,-209v-27,-6,-40,-26,-61,-37v-8,0,-9,4,-13,10v-11,13,-50,37,-56,0v18,-5,43,-32,61,-43v28,5,40,21,62,36v12,9,18,17,18,25v0,6,-4,9,-11,9",w:144},"Ï":{d:"33,-5v-9,-6,-9,-12,-9,-36v0,-71,8,-119,22,-144v8,-13,14,-20,19,-20v27,20,-11,87,-10,120r-15,76v-1,1,-4,2,-7,4xm111,-222v0,8,-4,12,-12,12v-18,0,-19,-19,-16,-33v18,-1,29,1,28,21xm15,-247v8,2,29,9,28,17v0,21,-37,24,-36,1v0,-7,2,-13,8,-18",w:110},"Ì":{d:"33,-5v-9,-6,-9,-12,-9,-36v0,-71,8,-119,22,-144v8,-13,14,-20,19,-20v27,20,-11,87,-10,120r-15,76v-1,1,-4,2,-7,4xm72,-247v7,6,55,15,36,40v-28,-7,-61,-21,-99,-41v-3,-2,-3,-27,5,-23v18,3,41,17,58,24",w:111},"Ó":{d:"62,-184v78,-31,249,-50,238,74v-6,65,-102,105,-179,115v-77,-7,-152,-71,-101,-149v2,-5,24,-33,42,-40xm279,-120v14,-38,-47,-64,-85,-61v-20,-9,-41,7,-62,0v-11,7,-54,12,-66,24v0,20,-51,35,-38,66v-1,43,50,67,96,67v44,0,162,-55,155,-96xm142,-250v27,-11,47,-32,59,-14v2,11,-80,53,-89,53v-13,1,-15,-11,-12,-21v10,-5,24,-11,42,-18",w:273},"Ô":{d:"62,-184v78,-31,249,-50,238,74v-6,65,-102,105,-179,115v-77,-7,-152,-71,-101,-149v2,-5,24,-33,42,-40xm279,-120v14,-38,-47,-64,-85,-61v-20,-9,-41,7,-62,0v-11,7,-54,12,-66,24v0,20,-51,35,-38,66v-1,43,50,67,96,67v44,0,162,-55,155,-96xm157,-282v17,18,52,34,54,63v-24,12,-52,-36,-53,-29r-42,34v-23,-4,-6,-31,5,-34v1,1,27,-37,36,-34",w:273},"":{d:"231,-188v31,-74,91,-99,188,-116v28,1,6,39,1,51v-20,52,-100,91,-148,126v2,4,6,7,12,10v42,-42,181,-41,166,46v-1,8,-19,8,-28,5v-43,1,-168,42,-106,86v15,16,33,28,61,39v0,10,0,17,-6,22v-8,8,-35,26,-78,51v-52,7,-128,22,-154,-17v-23,-35,-99,-35,-117,-77v-29,-68,25,-149,75,-175v44,-23,89,5,135,13v14,-26,2,-39,-1,-64",w:461},"Ò":{d:"62,-184v78,-31,249,-50,238,74v-6,65,-102,105,-179,115v-77,-7,-152,-71,-101,-149v2,-5,24,-33,42,-40xm279,-120v14,-38,-47,-64,-85,-61v-20,-9,-41,7,-62,0v-11,7,-54,12,-66,24v0,20,-51,35,-38,66v-1,43,50,67,96,67v44,0,162,-55,155,-96xm161,-262v14,10,52,13,37,41v-28,-7,-62,-21,-100,-41v-3,-3,-3,-26,5,-24v16,5,42,17,58,24",w:273},"Ú":{d:"281,-202v6,67,-30,121,-71,152v-3,14,-47,26,-60,39v-41,20,-110,1,-125,-26v-24,-44,-28,-84,-8,-127v12,-26,23,-38,37,-22v-2,2,-3,5,-3,10v-34,26,-30,116,5,134v22,32,86,-1,109,-8v38,-28,104,-64,97,-149v2,-10,7,-8,19,-3xm194,-265v3,-1,11,4,11,6v3,12,-81,52,-89,54v-14,0,-13,-9,-12,-22",w:262},"Û":{d:"281,-202v6,67,-30,121,-71,152v-3,14,-47,26,-60,39v-41,20,-110,1,-125,-26v-24,-44,-28,-84,-8,-127v12,-26,23,-38,37,-22v-2,2,-3,5,-3,10v-34,26,-30,116,5,134v22,32,86,-1,109,-8v38,-28,104,-64,97,-149v2,-10,7,-8,19,-3xm150,-266v24,11,58,27,73,46v0,5,-3,6,-10,6v-28,2,-61,-30,-63,-25v-10,0,-57,40,-69,23v3,-10,-8,-15,8,-19v17,-1,34,-29,61,-31",w:262},"Ù":{d:"281,-202v6,67,-30,121,-71,152v-3,14,-47,26,-60,39v-41,20,-110,1,-125,-26v-24,-44,-28,-84,-8,-127v12,-26,23,-38,37,-22v-2,2,-3,5,-3,10v-34,26,-30,116,5,134v22,32,86,-1,109,-8v38,-28,104,-64,97,-149v2,-10,7,-8,19,-3xm151,-243v14,10,54,14,37,41v-28,-7,-61,-22,-99,-42v-3,-2,-4,-25,4,-23v16,5,42,17,58,24",w:262},"ı":{d:"43,-103v21,4,16,56,11,100v-7,2,-11,1,-20,-5v0,-7,-13,-18,-11,-25v4,-23,-3,-68,20,-70",w:80},"ˆ":{d:"144,-220v-29,0,-41,-27,-63,-39v-8,0,-11,5,-15,11v-17,12,-32,31,-54,13v-2,-5,-3,-9,-4,-14v20,-5,45,-33,64,-45v28,6,43,23,65,38v12,9,19,19,19,27v0,6,-4,9,-12,9",w:165},"˜":{d:"47,-300v26,-21,57,19,72,23v4,0,16,-5,36,-14v24,-10,22,-16,32,-13v3,12,-7,11,-7,23v-27,21,-48,32,-62,32v-3,2,-52,-27,-51,-31v-12,-2,-34,40,-54,33v-4,-13,-8,-18,1,-24v5,-7,16,-15,33,-29",w:186},"¯":{d:"63,-295v28,-7,73,10,105,7v11,1,6,8,5,19v-37,21,-72,11,-136,11v-23,0,-31,-14,-27,-36v12,-15,40,0,53,-1",w:183},"˘":{d:"65,-269v20,-11,45,-31,74,-36v20,30,-42,40,-59,66v-5,6,-11,8,-18,8v-8,-3,-45,-32,-51,-54v5,-24,14,-13,34,1",w:158},"˙":{d:"23,-302v15,-13,32,1,32,18v1,22,-36,29,-39,4v0,0,3,-7,7,-22",w:70},"˚":{d:"23,-225v-43,-24,-11,-85,41,-78v16,2,31,4,46,17v32,54,-41,86,-87,61xm33,-257v2,20,57,11,57,-6v0,-6,-11,-9,-33,-12v-14,-2,-24,13,-24,18",w:123},"¸":{d:"74,16v32,2,49,14,55,36v-3,7,-14,31,-29,33v-28,4,-57,11,-88,14v-19,-6,-13,-31,8,-33v20,-1,59,-5,73,-14v-17,-14,-68,8,-53,-37v9,-10,2,-28,24,-30v8,8,13,17,10,31",w:129},"˝":{d:"91,-249v15,-11,38,-53,57,-29v0,9,0,14,-3,23v-2,3,-20,22,-54,55v-5,5,-10,8,-16,8v-17,2,-6,-22,-7,-31v-1,0,-2,0,-4,1v-17,21,-29,31,-50,27v-5,-18,-3,-15,3,-27v23,-27,40,-46,48,-59v7,-12,31,3,29,9v-1,14,-3,24,-13,31v4,4,9,-1,10,-8",w:151},"˛":{d:"82,-5v-8,12,-16,55,-21,75v0,4,2,7,7,7v6,0,22,-7,50,-20v8,0,12,7,12,20v-2,22,-6,14,-27,30v-15,12,-26,16,-30,16v-47,-8,-59,-14,-56,-75v8,-27,12,-54,25,-77v19,-21,35,15,40,24",w:138},"ˇ":{d:"39,-286v33,46,63,-4,96,-16v6,0,9,6,9,19v0,24,-49,46,-77,46v-32,0,-52,-28,-59,-48v0,-25,23,-17,31,-1",w:153},"\r":{w:179}}}),function(){"use strict"; +function AssertException(message){this.message=message}function assert(exp,message){if(!exp)throw new AssertException(message)}function getCenterX(box){return box.x+box.width/2}function getCenterY(box){return box.y+box.height/2}var DIAGRAM_MARGIN=10,ACTOR_MARGIN=10,ACTOR_PADDING=10,SIGNAL_MARGIN=5,SIGNAL_PADDING=5,NOTE_MARGIN=10,NOTE_PADDING=5,NOTE_OVERLAP=15,TITLE_MARGIN=0,TITLE_PADDING=5,SELF_SIGNAL_WIDTH=20,PLACEMENT=Diagram.PLACEMENT,LINETYPE=Diagram.LINETYPE,ARROWTYPE=Diagram.ARROWTYPE,LINE={stroke:"#000","stroke-width":2},RECT={fill:"#fff"};AssertException.prototype.toString=function(){return"AssertException: "+this.message},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),Raphael.fn.line=function(x1,y1,x2,y2){return assert(_.all([x1,x2,y1,y2],_.isFinite),"x1,x2,y1,y2 must be numeric"),this.path("M{0},{1} L{2},{3}",x1,y1,x2,y2)},Raphael.fn.wobble=function(x1,y1,x2,y2){assert(_.all([x1,x2,y1,y2],_.isFinite),"x1,x2,y1,y2 must be numeric");var wobble=Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/25,r1=Math.random(),r2=Math.random(),xfactor=Math.random()>.5?wobble:-wobble,yfactor=Math.random()>.5?wobble:-wobble,p1={x:(x2-x1)*r1+x1+xfactor,y:(y2-y1)*r1+y1+yfactor},p2={x:(x2-x1)*r2+x1-xfactor,y:(y2-y1)*r2+y1-yfactor};return"C"+p1.x+","+p1.y+" "+p2.x+","+p2.y+" "+x2+","+y2},Raphael.fn.text_bbox=function(text,font){var p;font._obj?p=this.print_center(0,0,text,font._obj,font["font-size"]):(p=this.text(0,0,text),p.attr(font));var bb=p.getBBox();return p.remove(),bb},Raphael.fn.handRect=function(x,y,w,h){return assert(_.all([x,y,w,h],_.isFinite),"x, y, w, h must be numeric"),this.path("M"+x+","+y+this.wobble(x,y,x+w,y)+this.wobble(x+w,y,x+w,y+h)+this.wobble(x+w,y+h,x,y+h)+this.wobble(x,y+h,x,y)).attr(RECT)},Raphael.fn.handLine=function(x1,y1,x2,y2){return assert(_.all([x1,x2,y1,y2],_.isFinite),"x1,x2,y1,y2 must be numeric"),this.path("M"+x1+","+y1+this.wobble(x1,y1,x2,y2))},Raphael.fn.print_center=function(x,y,string,font,size,letter_spacing){var path=this.print(x,y,string,font,size,"baseline",letter_spacing),bb=path.getBBox(),dx=x-bb.x-bb.width/2,dy=y-bb.y-bb.height/2,m=new Raphael.matrix;return m.translate(dx,dy),path.attr("path",Raphael.mapPath(path.attr("path"),m))};var BaseTheme=function(diagram){this.init(diagram)};_.extend(BaseTheme.prototype,{init:function(diagram){this.diagram=diagram,this._paper=void 0,this._font=void 0,this._title=void 0,this._actors_height=0,this._signals_height=0;var a=this.arrow_types={};a[ARROWTYPE.FILLED]="block",a[ARROWTYPE.OPEN]="open";var l=this.line_types={};l[LINETYPE.SOLID]="",l[LINETYPE.DOTTED]="-"},init_paper:function(container){this._paper=new Raphael(container,320,200)},init_font:function(){},draw_line:function(x1,y1,x2,y2){return this._paper.line(x1,y1,x2,y2)},draw_rect:function(x,y,w,h){return this._paper.rect(x,y,w,h)},draw:function(container){var diagram=this.diagram;this.init_paper(container),this.init_font(),this.layout();var title_height=this._title?this._title.height:0;this._paper.setStart(),this._paper.setSize(diagram.width,diagram.height);var y=DIAGRAM_MARGIN+title_height;this.draw_title(),this.draw_actors(y),this.draw_signals(y+this._actors_height),this._paper.setFinish()},layout:function(){function actor_ensure_distance(a,b,d){assert(b>a,"a must be less than or equal to b"),0>a?(b=actors[b],b.x=Math.max(d-b.width/2,b.x)):b>=actors.length?(a=actors[a],a.padding_right=Math.max(d,a.padding_right)):(a=actors[a],a.distances[b]=Math.max(d,a.distances[b]?a.distances[b]:0))}var diagram=this.diagram,paper=this._paper,font=this._font,actors=diagram.actors,signals=diagram.signals;if(diagram.width=0,diagram.height=0,diagram.title){var title=this._title={},bb=paper.text_bbox(diagram.title,font);title.text_bb=bb,title.message=diagram.title,title.width=bb.width+2*(TITLE_PADDING+TITLE_MARGIN),title.height=bb.height+2*(TITLE_PADDING+TITLE_MARGIN),title.x=DIAGRAM_MARGIN,title.y=DIAGRAM_MARGIN,diagram.width+=title.width,diagram.height+=title.height}_.each(actors,function(a){var bb=paper.text_bbox(a.name,font);a.text_bb=bb,a.x=0,a.y=0,a.width=bb.width+2*(ACTOR_PADDING+ACTOR_MARGIN),a.height=bb.height+2*(ACTOR_PADDING+ACTOR_MARGIN),a.distances=[],a.padding_right=0,this._actors_height=Math.max(a.height,this._actors_height)},this),_.each(signals,function(s){var a,b,bb=paper.text_bbox(s.message,font);s.text_bb=bb,s.width=bb.width,s.height=bb.height;var extra_width=0;if("Signal"==s.type)s.width+=2*(SIGNAL_MARGIN+SIGNAL_PADDING),s.height+=2*(SIGNAL_MARGIN+SIGNAL_PADDING),s.isSelf()?(a=s.actorA.index,b=a+1,s.width+=SELF_SIGNAL_WIDTH):(a=Math.min(s.actorA.index,s.actorB.index),b=Math.max(s.actorA.index,s.actorB.index));else{if("Note"!=s.type)throw new Error("Unhandled signal type:"+s.type);if(s.width+=2*(NOTE_MARGIN+NOTE_PADDING),s.height+=2*(NOTE_MARGIN+NOTE_PADDING),extra_width=2*ACTOR_MARGIN,s.placement==PLACEMENT.LEFTOF)b=s.actor.index,a=b-1;else if(s.placement==PLACEMENT.RIGHTOF)a=s.actor.index,b=a+1;else if(s.placement==PLACEMENT.OVER&&s.hasManyActors())a=Math.min(s.actor[0].index,s.actor[1].index),b=Math.max(s.actor[0].index,s.actor[1].index),extra_width=-(2*NOTE_PADDING+2*NOTE_OVERLAP);else if(s.placement==PLACEMENT.OVER)return a=s.actor.index,actor_ensure_distance(a-1,a,s.width/2),actor_ensure_distance(a,a+1,s.width/2),this._signals_height+=s.height,void 0}actor_ensure_distance(a,b,s.width+extra_width),this._signals_height+=s.height},this);var actors_x=0;return _.each(actors,function(a){a.x=Math.max(actors_x,a.x),_.each(a.distances,function(distance,b){"undefined"!=typeof distance&&(b=actors[b],distance=Math.max(distance,a.width/2,b.width/2),b.x=Math.max(b.x,a.x+a.width/2+distance-b.width/2))}),actors_x=a.x+a.width+a.padding_right},this),diagram.width=Math.max(actors_x,diagram.width),diagram.width+=2*DIAGRAM_MARGIN,diagram.height+=2*DIAGRAM_MARGIN+2*this._actors_height+this._signals_height,this},draw_title:function(){var title=this._title;title&&this.draw_text_box(title,title.message,TITLE_MARGIN,TITLE_PADDING,this._font)},draw_actors:function(offsetY){var y=offsetY;_.each(this.diagram.actors,function(a){this.draw_actor(a,y,this._actors_height),this.draw_actor(a,y+this._actors_height+this._signals_height,this._actors_height);var aX=getCenterX(a),line=this.draw_line(aX,y+this._actors_height-ACTOR_MARGIN,aX,y+this._actors_height+ACTOR_MARGIN+this._signals_height);line.attr(LINE)},this)},draw_actor:function(actor,offsetY,height){actor.y=offsetY,actor.height=height,this.draw_text_box(actor,actor.name,ACTOR_MARGIN,ACTOR_PADDING,this._font)},draw_signals:function(offsetY){var y=offsetY;_.each(this.diagram.signals,function(s){"Signal"==s.type?s.isSelf()?this.draw_self_signal(s,y):this.draw_signal(s,y):"Note"==s.type&&this.draw_note(s,y),y+=s.height},this)},draw_self_signal:function(signal,offsetY){assert(signal.isSelf(),"signal must be a self signal");var text_bb=signal.text_bb,aX=getCenterX(signal.actorA),x=aX+SELF_SIGNAL_WIDTH+SIGNAL_PADDING-text_bb.x,y=offsetY+signal.height/2;this.draw_text(x,y,signal.message,this._font);var line,attr=_.extend({},LINE,{"stroke-dasharray":this.line_types[signal.linetype]}),y1=offsetY+SIGNAL_MARGIN,y2=y1+signal.height-SIGNAL_MARGIN;line=this.draw_line(aX,y1,aX+SELF_SIGNAL_WIDTH,y1),line.attr(attr),line=this.draw_line(aX+SELF_SIGNAL_WIDTH,y1,aX+SELF_SIGNAL_WIDTH,y2),line.attr(attr),line=this.draw_line(aX+SELF_SIGNAL_WIDTH,y2,aX,y2),attr["arrow-end"]=this.arrow_types[signal.arrowtype]+"-wide-long",line.attr(attr)},draw_signal:function(signal,offsetY){var aX=getCenterX(signal.actorA),bX=getCenterX(signal.actorB),x=(bX-aX)/2+aX,y=offsetY+SIGNAL_MARGIN+2*SIGNAL_PADDING;this.draw_text(x,y,signal.message,this._font),y=offsetY+signal.height-SIGNAL_MARGIN-SIGNAL_PADDING;var line=this.draw_line(aX,y,bX,y);line.attr(LINE),line.attr({"arrow-end":this.arrow_types[signal.arrowtype]+"-wide-long","stroke-dasharray":this.line_types[signal.linetype]})},draw_note:function(note,offsetY){note.y=offsetY;var actorA=note.hasManyActors()?note.actor[0]:note.actor,aX=getCenterX(actorA);switch(note.placement){case PLACEMENT.RIGHTOF:note.x=aX+ACTOR_MARGIN;break;case PLACEMENT.LEFTOF:note.x=aX-ACTOR_MARGIN-note.width;break;case PLACEMENT.OVER:if(note.hasManyActors()){var bX=getCenterX(note.actor[1]),overlap=NOTE_OVERLAP+NOTE_PADDING;note.x=aX-overlap,note.width=bX+overlap-note.x}else note.x=aX-note.width/2;break;default:throw new Error("Unhandled note placement:"+note.placement)}this.draw_text_box(note,note.message,NOTE_MARGIN,NOTE_PADDING,this._font)},draw_text:function(x,y,text,font){var t,paper=this._paper,f=font||{};f._obj?t=paper.print_center(x,y,text,f._obj,f["font-size"]):(t=paper.text(x,y,text),t.attr(f));var bb=t.getBBox(),r=paper.rect(bb.x,bb.y,bb.width,bb.height);r.attr({fill:"#fff",stroke:"none"}),t.toFront()},draw_text_box:function(box,text,margin,padding,font){var x=box.x+margin,y=box.y+margin,w=box.width-2*margin,h=box.height-2*margin,rect=this.draw_rect(x,y,w,h);rect.attr(LINE),x=getCenterX(box),y=getCenterY(box),this.draw_text(x,y,text,font)}});var RaphaëlTheme=function(diagram){this.init(diagram)};_.extend(RaphaëlTheme.prototype,BaseTheme.prototype,{init_font:function(){this._font={"font-size":16,"font-family":"Andale Mono, monospace"}}});var HandRaphaëlTheme=function(diagram){this.init(diagram)};_.extend(HandRaphaëlTheme.prototype,BaseTheme.prototype,{init_font:function(){this._font={"font-size":16,"font-family":"daniel"},this._font._obj=this._paper.getFont("daniel")},draw_line:function(x1,y1,x2,y2){return this._paper.handLine(x1,y1,x2,y2)},draw_rect:function(x,y,w,h){return this._paper.handRect(x,y,w,h)}});var themes={simple:RaphaëlTheme,hand:HandRaphaëlTheme};Diagram.prototype.drawSVG=function(container,options){var default_options={theme:"hand"};if(options=_.defaults(options||{},default_options),!(options.theme in themes))throw new Error("Unsupported theme: "+options.theme);var drawing=new themes[options.theme](this);drawing.draw(container)}}(); \ No newline at end of file diff --git a/src/main/resources/templates/editor/lib/underscore.min.js b/src/main/resources/templates/editor/lib/underscore.min.js new file mode 100644 index 0000000000000000000000000000000000000000..447e19b7c2e1e613fc150bf3cd7e292547a653af --- /dev/null +++ b/src/main/resources/templates/editor/lib/underscore.min.js @@ -0,0 +1,5 @@ +// Underscore.js 1.8.2 +// http://underscorejs.org +// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors +// Underscore may be freely distributed under the MIT license. +(function(){function n(n){function t(t,r,e,u,i,o){for(;i>=0&&o>i;i+=n){var a=u?u[i]:i;e=r(e,t[a],a,t)}return e}return function(r,e,u,i){e=d(e,i,4);var o=!w(r)&&m.keys(r),a=(o||r).length,c=n>0?0:a-1;return arguments.length<3&&(u=r[o?o[c]:c],c+=n),t(r,e,u,o,c,a)}}function t(n){return function(t,r,e){r=b(r,e);for(var u=null!=t&&t.length,i=n>0?0:u-1;i>=0&&u>i;i+=n)if(r(t[i],i,t))return i;return-1}}function r(n,t){var r=S.length,e=n.constructor,u=m.isFunction(e)&&e.prototype||o,i="constructor";for(m.has(n,i)&&!m.contains(t,i)&&t.push(i);r--;)i=S[r],i in n&&n[i]!==u[i]&&!m.contains(t,i)&&t.push(i)}var e=this,u=e._,i=Array.prototype,o=Object.prototype,a=Function.prototype,c=i.push,l=i.slice,f=o.toString,s=o.hasOwnProperty,p=Array.isArray,h=Object.keys,v=a.bind,g=Object.create,y=function(){},m=function(n){return n instanceof m?n:this instanceof m?void(this._wrapped=n):new m(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=m),exports._=m):e._=m,m.VERSION="1.8.2";var d=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}},b=function(n,t,r){return null==n?m.identity:m.isFunction(n)?d(n,t,r):m.isObject(n)?m.matcher(n):m.property(n)};m.iteratee=function(n,t){return b(n,t,1/0)};var x=function(n,t){return function(r){var e=arguments.length;if(2>e||null==r)return r;for(var u=1;e>u;u++)for(var i=arguments[u],o=n(i),a=o.length,c=0;a>c;c++){var l=o[c];t&&r[l]!==void 0||(r[l]=i[l])}return r}},_=function(n){if(!m.isObject(n))return{};if(g)return g(n);y.prototype=n;var t=new y;return y.prototype=null,t},j=Math.pow(2,53)-1,w=function(n){var t=n&&n.length;return"number"==typeof t&&t>=0&&j>=t};m.each=m.forEach=function(n,t,r){t=d(t,r);var e,u;if(w(n))for(e=0,u=n.length;u>e;e++)t(n[e],e,n);else{var i=m.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},m.map=m.collect=function(n,t,r){t=b(t,r);for(var e=!w(n)&&m.keys(n),u=(e||n).length,i=Array(u),o=0;u>o;o++){var a=e?e[o]:o;i[o]=t(n[a],a,n)}return i},m.reduce=m.foldl=m.inject=n(1),m.reduceRight=m.foldr=n(-1),m.find=m.detect=function(n,t,r){var e;return e=w(n)?m.findIndex(n,t,r):m.findKey(n,t,r),e!==void 0&&e!==-1?n[e]:void 0},m.filter=m.select=function(n,t,r){var e=[];return t=b(t,r),m.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e},m.reject=function(n,t,r){return m.filter(n,m.negate(b(t)),r)},m.every=m.all=function(n,t,r){t=b(t,r);for(var e=!w(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(!t(n[o],o,n))return!1}return!0},m.some=m.any=function(n,t,r){t=b(t,r);for(var e=!w(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(t(n[o],o,n))return!0}return!1},m.contains=m.includes=m.include=function(n,t,r){return w(n)||(n=m.values(n)),m.indexOf(n,t,"number"==typeof r&&r)>=0},m.invoke=function(n,t){var r=l.call(arguments,2),e=m.isFunction(t);return m.map(n,function(n){var u=e?t:n[t];return null==u?u:u.apply(n,r)})},m.pluck=function(n,t){return m.map(n,m.property(t))},m.where=function(n,t){return m.filter(n,m.matcher(t))},m.findWhere=function(n,t){return m.find(n,m.matcher(t))},m.max=function(n,t,r){var e,u,i=-1/0,o=-1/0;if(null==t&&null!=n){n=w(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],e>i&&(i=e)}else t=b(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(u>o||u===-1/0&&i===-1/0)&&(i=n,o=u)});return i},m.min=function(n,t,r){var e,u,i=1/0,o=1/0;if(null==t&&null!=n){n=w(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],i>e&&(i=e)}else t=b(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(o>u||1/0===u&&1/0===i)&&(i=n,o=u)});return i},m.shuffle=function(n){for(var t,r=w(n)?n:m.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=m.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},m.sample=function(n,t,r){return null==t||r?(w(n)||(n=m.values(n)),n[m.random(n.length-1)]):m.shuffle(n).slice(0,Math.max(0,t))},m.sortBy=function(n,t,r){return t=b(t,r),m.pluck(m.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var A=function(n){return function(t,r,e){var u={};return r=b(r,e),m.each(t,function(e,i){var o=r(e,i,t);n(u,e,o)}),u}};m.groupBy=A(function(n,t,r){m.has(n,r)?n[r].push(t):n[r]=[t]}),m.indexBy=A(function(n,t,r){n[r]=t}),m.countBy=A(function(n,t,r){m.has(n,r)?n[r]++:n[r]=1}),m.toArray=function(n){return n?m.isArray(n)?l.call(n):w(n)?m.map(n,m.identity):m.values(n):[]},m.size=function(n){return null==n?0:w(n)?n.length:m.keys(n).length},m.partition=function(n,t,r){t=b(t,r);var e=[],u=[];return m.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},m.first=m.head=m.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:m.initial(n,n.length-t)},m.initial=function(n,t,r){return l.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},m.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:m.rest(n,Math.max(0,n.length-t))},m.rest=m.tail=m.drop=function(n,t,r){return l.call(n,null==t||r?1:t)},m.compact=function(n){return m.filter(n,m.identity)};var k=function(n,t,r,e){for(var u=[],i=0,o=e||0,a=n&&n.length;a>o;o++){var c=n[o];if(w(c)&&(m.isArray(c)||m.isArguments(c))){t||(c=k(c,t,r));var l=0,f=c.length;for(u.length+=f;f>l;)u[i++]=c[l++]}else r||(u[i++]=c)}return u};m.flatten=function(n,t){return k(n,t,!1)},m.without=function(n){return m.difference(n,l.call(arguments,1))},m.uniq=m.unique=function(n,t,r,e){if(null==n)return[];m.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=b(r,e));for(var u=[],i=[],o=0,a=n.length;a>o;o++){var c=n[o],l=r?r(c,o,n):c;t?(o&&i===l||u.push(c),i=l):r?m.contains(i,l)||(i.push(l),u.push(c)):m.contains(u,c)||u.push(c)}return u},m.union=function(){return m.uniq(k(arguments,!0,!0))},m.intersection=function(n){if(null==n)return[];for(var t=[],r=arguments.length,e=0,u=n.length;u>e;e++){var i=n[e];if(!m.contains(t,i)){for(var o=1;r>o&&m.contains(arguments[o],i);o++);o===r&&t.push(i)}}return t},m.difference=function(n){var t=k(arguments,!0,!0,1);return m.filter(n,function(n){return!m.contains(t,n)})},m.zip=function(){return m.unzip(arguments)},m.unzip=function(n){for(var t=n&&m.max(n,"length").length||0,r=Array(t),e=0;t>e;e++)r[e]=m.pluck(n,e);return r},m.object=function(n,t){for(var r={},e=0,u=n&&n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},m.indexOf=function(n,t,r){var e=0,u=n&&n.length;if("number"==typeof r)e=0>r?Math.max(0,u+r):r;else if(r&&u)return e=m.sortedIndex(n,t),n[e]===t?e:-1;if(t!==t)return m.findIndex(l.call(n,e),m.isNaN);for(;u>e;e++)if(n[e]===t)return e;return-1},m.lastIndexOf=function(n,t,r){var e=n?n.length:0;if("number"==typeof r&&(e=0>r?e+r+1:Math.min(e,r+1)),t!==t)return m.findLastIndex(l.call(n,0,e),m.isNaN);for(;--e>=0;)if(n[e]===t)return e;return-1},m.findIndex=t(1),m.findLastIndex=t(-1),m.sortedIndex=function(n,t,r,e){r=b(r,e,1);for(var u=r(t),i=0,o=n.length;o>i;){var a=Math.floor((i+o)/2);r(n[a])i;i++,n+=r)u[i]=n;return u};var O=function(n,t,r,e,u){if(!(e instanceof t))return n.apply(r,u);var i=_(n.prototype),o=n.apply(i,u);return m.isObject(o)?o:i};m.bind=function(n,t){if(v&&n.bind===v)return v.apply(n,l.call(arguments,1));if(!m.isFunction(n))throw new TypeError("Bind must be called on a function");var r=l.call(arguments,2),e=function(){return O(n,e,t,this,r.concat(l.call(arguments)))};return e},m.partial=function(n){var t=l.call(arguments,1),r=function(){for(var e=0,u=t.length,i=Array(u),o=0;u>o;o++)i[o]=t[o]===m?arguments[e++]:t[o];for(;e=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=m.bind(n[r],n);return n},m.memoize=function(n,t){var r=function(e){var u=r.cache,i=""+(t?t.apply(this,arguments):e);return m.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},m.delay=function(n,t){var r=l.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},m.defer=m.partial(m.delay,m,1),m.throttle=function(n,t,r){var e,u,i,o=null,a=0;r||(r={});var c=function(){a=r.leading===!1?0:m.now(),o=null,i=n.apply(e,u),o||(e=u=null)};return function(){var l=m.now();a||r.leading!==!1||(a=l);var f=t-(l-a);return e=this,u=arguments,0>=f||f>t?(o&&(clearTimeout(o),o=null),a=l,i=n.apply(e,u),o||(e=u=null)):o||r.trailing===!1||(o=setTimeout(c,f)),i}},m.debounce=function(n,t,r){var e,u,i,o,a,c=function(){var l=m.now()-o;t>l&&l>=0?e=setTimeout(c,t-l):(e=null,r||(a=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,o=m.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(a=n.apply(i,u),i=u=null),a}},m.wrap=function(n,t){return m.partial(t,n)},m.negate=function(n){return function(){return!n.apply(this,arguments)}},m.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},m.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},m.before=function(n,t){var r;return function(){return--n>0&&(r=t.apply(this,arguments)),1>=n&&(t=null),r}},m.once=m.partial(m.before,2);var F=!{toString:null}.propertyIsEnumerable("toString"),S=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];m.keys=function(n){if(!m.isObject(n))return[];if(h)return h(n);var t=[];for(var e in n)m.has(n,e)&&t.push(e);return F&&r(n,t),t},m.allKeys=function(n){if(!m.isObject(n))return[];var t=[];for(var e in n)t.push(e);return F&&r(n,t),t},m.values=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},m.mapObject=function(n,t,r){t=b(t,r);for(var e,u=m.keys(n),i=u.length,o={},a=0;i>a;a++)e=u[a],o[e]=t(n[e],e,n);return o},m.pairs=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},m.invert=function(n){for(var t={},r=m.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},m.functions=m.methods=function(n){var t=[];for(var r in n)m.isFunction(n[r])&&t.push(r);return t.sort()},m.extend=x(m.allKeys),m.extendOwn=m.assign=x(m.keys),m.findKey=function(n,t,r){t=b(t,r);for(var e,u=m.keys(n),i=0,o=u.length;o>i;i++)if(e=u[i],t(n[e],e,n))return e},m.pick=function(n,t,r){var e,u,i={},o=n;if(null==o)return i;m.isFunction(t)?(u=m.allKeys(o),e=d(t,r)):(u=k(arguments,!1,!1,1),e=function(n,t,r){return t in r},o=Object(o));for(var a=0,c=u.length;c>a;a++){var l=u[a],f=o[l];e(f,l,o)&&(i[l]=f)}return i},m.omit=function(n,t,r){if(m.isFunction(t))t=m.negate(t);else{var e=m.map(k(arguments,!1,!1,1),String);t=function(n,t){return!m.contains(e,t)}}return m.pick(n,t,r)},m.defaults=x(m.allKeys,!0),m.clone=function(n){return m.isObject(n)?m.isArray(n)?n.slice():m.extend({},n):n},m.tap=function(n,t){return t(n),n},m.isMatch=function(n,t){var r=m.keys(t),e=r.length;if(null==n)return!e;for(var u=Object(n),i=0;e>i;i++){var o=r[i];if(t[o]!==u[o]||!(o in u))return!1}return!0};var E=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof m&&(n=n._wrapped),t instanceof m&&(t=t._wrapped);var u=f.call(n);if(u!==f.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}var i="[object Array]"===u;if(!i){if("object"!=typeof n||"object"!=typeof t)return!1;var o=n.constructor,a=t.constructor;if(o!==a&&!(m.isFunction(o)&&o instanceof o&&m.isFunction(a)&&a instanceof a)&&"constructor"in n&&"constructor"in t)return!1}r=r||[],e=e||[];for(var c=r.length;c--;)if(r[c]===n)return e[c]===t;if(r.push(n),e.push(t),i){if(c=n.length,c!==t.length)return!1;for(;c--;)if(!E(n[c],t[c],r,e))return!1}else{var l,s=m.keys(n);if(c=s.length,m.keys(t).length!==c)return!1;for(;c--;)if(l=s[c],!m.has(t,l)||!E(n[l],t[l],r,e))return!1}return r.pop(),e.pop(),!0};m.isEqual=function(n,t){return E(n,t)},m.isEmpty=function(n){return null==n?!0:w(n)&&(m.isArray(n)||m.isString(n)||m.isArguments(n))?0===n.length:0===m.keys(n).length},m.isElement=function(n){return!(!n||1!==n.nodeType)},m.isArray=p||function(n){return"[object Array]"===f.call(n)},m.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},m.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(n){m["is"+n]=function(t){return f.call(t)==="[object "+n+"]"}}),m.isArguments(arguments)||(m.isArguments=function(n){return m.has(n,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(m.isFunction=function(n){return"function"==typeof n||!1}),m.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},m.isNaN=function(n){return m.isNumber(n)&&n!==+n},m.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===f.call(n)},m.isNull=function(n){return null===n},m.isUndefined=function(n){return n===void 0},m.has=function(n,t){return null!=n&&s.call(n,t)},m.noConflict=function(){return e._=u,this},m.identity=function(n){return n},m.constant=function(n){return function(){return n}},m.noop=function(){},m.property=function(n){return function(t){return null==t?void 0:t[n]}},m.propertyOf=function(n){return null==n?function(){}:function(t){return n[t]}},m.matcher=m.matches=function(n){return n=m.extendOwn({},n),function(t){return m.isMatch(t,n)}},m.times=function(n,t,r){var e=Array(Math.max(0,n));t=d(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},m.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},m.now=Date.now||function(){return(new Date).getTime()};var M={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},N=m.invert(M),I=function(n){var t=function(t){return n[t]},r="(?:"+m.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};m.escape=I(M),m.unescape=I(N),m.result=function(n,t,r){var e=null==n?void 0:n[t];return e===void 0&&(e=r),m.isFunction(e)?e.call(n):e};var B=0;m.uniqueId=function(n){var t=++B+"";return n?n+t:t},m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var T=/(.)^/,R={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},q=/\\|'|\r|\n|\u2028|\u2029/g,K=function(n){return"\\"+R[n]};m.template=function(n,t,r){!t&&r&&(t=r),t=m.defaults({},t,m.templateSettings);var e=RegExp([(t.escape||T).source,(t.interpolate||T).source,(t.evaluate||T).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,o,a){return i+=n.slice(u,a).replace(q,K),u=a+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":o&&(i+="';\n"+o+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var o=new Function(t.variable||"obj","_",i)}catch(a){throw a.source=i,a}var c=function(n){return o.call(this,n,m)},l=t.variable||"obj";return c.source="function("+l+"){\n"+i+"}",c},m.chain=function(n){var t=m(n);return t._chain=!0,t};var z=function(n,t){return n._chain?m(t).chain():t};m.mixin=function(n){m.each(m.functions(n),function(t){var r=m[t]=n[t];m.prototype[t]=function(){var n=[this._wrapped];return c.apply(n,arguments),z(this,r.apply(m,n))}})},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=i[n];m.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],z(this,r)}}),m.each(["concat","join","slice"],function(n){var t=i[n];m.prototype[n]=function(){return z(this,t.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return m})}).call(this); \ No newline at end of file diff --git a/src/main/resources/templates/editor/plugins/code-block-dialog/code-block-dialog.js b/src/main/resources/templates/editor/plugins/code-block-dialog/code-block-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..b4b0d8cbbf914cbe66c4f241b3c18ddeda8895d6 --- /dev/null +++ b/src/main/resources/templates/editor/plugins/code-block-dialog/code-block-dialog.js @@ -0,0 +1,237 @@ +/*! + * Code block dialog plugin for Editor.md + * + * @file code-block-dialog.js + * @author pandao + * @version 1.2.0 + * @updateTime 2015-03-07 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + var cmEditor; + var pluginName = "code-block-dialog"; + + // for CodeBlock dialog select + var codeLanguages = exports.codeLanguages = { + asp : ["ASP", "vbscript"], + actionscript : ["ActionScript(3.0)/Flash/Flex", "clike"], + bash : ["Bash/Bat", "shell"], + css : ["CSS", "css"], + c : ["C", "clike"], + cpp : ["C++", "clike"], + csharp : ["C#", "clike"], + coffeescript : ["CoffeeScript", "coffeescript"], + d : ["D", "d"], + dart : ["Dart", "dart"], + delphi : ["Delphi/Pascal", "pascal"], + erlang : ["Erlang", "erlang"], + go : ["Golang", "go"], + groovy : ["Groovy", "groovy"], + html : ["HTML", "text/html"], + java : ["Java", "clike"], + json : ["JSON", "text/json"], + javascript : ["Javascript", "javascript"], + lua : ["Lua", "lua"], + less : ["LESS", "css"], + markdown : ["Markdown", "gfm"], + "objective-c" : ["Objective-C", "clike"], + php : ["PHP", "php"], + perl : ["Perl", "perl"], + python : ["Python", "python"], + r : ["R", "r"], + rst : ["reStructedText", "rst"], + ruby : ["Ruby", "ruby"], + sql : ["SQL", "sql"], + sass : ["SASS/SCSS", "sass"], + shell : ["Shell", "shell"], + scala : ["Scala", "clike"], + swift : ["Swift", "clike"], + vb : ["VB/VBScript", "vb"], + xml : ["XML", "text/xml"], + yaml : ["YAML", "yaml"] + }; + + exports.fn.codeBlockDialog = function() { + + var _this = this; + var cm = this.cm; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = this.classPrefix; + var dialogName = classPrefix + pluginName, dialog; + var dialogLang = lang.dialog.codeBlock; + + cm.focus(); + + if (editor.find("." + dialogName).length > 0) + { + dialog = editor.find("." + dialogName); + dialog.find("option:first").attr("selected", "selected"); + dialog.find("textarea").val(selection); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + } + else + { + var dialogHTML = "
        " + + dialogLang.selectLabel + "" + + "
        " + + ""; + + dialog = this.createDialog({ + name : dialogName, + title : dialogLang.title, + width : 780, + height : 565, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + content : dialogHTML, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + enter : [lang.buttons.enter, function() { + var codeTexts = this.find("textarea").val(); + var langName = this.find("select").val(); + + if (langName === "") + { + alert(lang.dialog.codeBlock.unselectedLanguageAlert); + return false; + } + + if (codeTexts === "") + { + alert(lang.dialog.codeBlock.codeEmptyAlert); + return false; + } + + langName = (langName === "other") ? "" : langName; + + cm.replaceSelection(["```" + langName, codeTexts, "```"].join("\n")); + + if (langName === "") { + cm.setCursor(cursor.line, cursor.ch + 3); + } + + this.hide().lockScreen(false).hideMask(); + + return false; + }], + cancel : [lang.buttons.cancel, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + var langSelect = dialog.find("select"); + + if (langSelect.find("option").length === 1) + { + for (var key in codeLanguages) + { + var codeLang = codeLanguages[key]; + langSelect.append(""); + } + + langSelect.append(""); + } + + var mode = langSelect.find("option:selected").attr("mode"); + + var cmConfig = { + mode : (mode) ? mode : "text/html", + theme : settings.theme, + tabSize : 4, + autofocus : true, + autoCloseTags : true, + indentUnit : 4, + lineNumbers : true, + lineWrapping : true, + extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }}, + foldGutter : true, + gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], + matchBrackets : true, + indentWithTabs : true, + styleActiveLine : true, + styleSelectedText : true, + autoCloseBrackets : true, + showTrailingSpace : true, + highlightSelectionMatches : true + }; + + var textarea = dialog.find("textarea"); + var cmObj = dialog.find(".CodeMirror"); + + if (dialog.find(".CodeMirror").length < 1) + { + cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig); + cmObj = dialog.find(".CodeMirror"); + + cmObj.css({ + "float" : "none", + margin : "8px 0", + border : "1px solid #ddd", + fontSize : settings.fontSize, + width : "100%", + height : "390px" + }); + + cmEditor.on("change", function(cm) { + textarea.val(cm.getValue()); + }); + } + else + { + + cmEditor.setValue(cm.getSelection()); + } + + langSelect.change(function(){ + var _mode = $(this).find("option:selected").attr("mode"); + cmEditor.setOption("mode", _mode); + }); + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/emoji-dialog/emoji-dialog.js b/src/main/resources/templates/editor/plugins/emoji-dialog/emoji-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..d43ef20e7195989d2c37222ef14a3ca9e2e34220 --- /dev/null +++ b/src/main/resources/templates/editor/plugins/emoji-dialog/emoji-dialog.js @@ -0,0 +1,327 @@ +/*! + * Emoji dialog plugin for Editor.md + * + * @file emoji-dialog.js + * @author pandao + * @version 1.2.0 + * @updateTime 2015-03-08 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "emoji-dialog"; + var emojiTabIndex = 0; + var emojiData = []; + var selecteds = []; + + var logoPrefix = "editormd-logo"; + var logos = [ + logoPrefix, + logoPrefix + "-1x", + logoPrefix + "-2x", + logoPrefix + "-3x", + logoPrefix + "-4x", + logoPrefix + "-5x", + logoPrefix + "-6x", + logoPrefix + "-7x", + logoPrefix + "-8x" + ]; + + var langs = { + "zh-cn" : { + toolbar : { + emoji : "Emoji 表情" + }, + dialog : { + emoji : { + title : "Emoji 表情" + } + } + }, + "zh-tw" : { + toolbar : { + emoji : "Emoji 表情" + }, + dialog : { + emoji : { + title : "Emoji 表情" + } + } + }, + "en" : { + toolbar : { + emoji : "Emoji" + }, + dialog : { + emoji : { + title : "Emoji" + } + } + } + }; + + exports.fn.emojiDialog = function() { + var _this = this; + var cm = this.cm; + var settings = _this.settings; + + if (!settings.emoji) + { + alert("settings.emoji == false"); + return ; + } + + var path = settings.pluginPath + pluginName + "/"; + var editor = this.editor; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = this.classPrefix; + + $.extend(true, this.lang, langs[this.lang.name]); + this.setToolbar(); + + var lang = this.lang; + var dialogName = classPrefix + pluginName, dialog; + var dialogLang = lang.dialog.emoji; + + var dialogContent = [ + "
        ", + "
        ", + "
        ", + ].join("\n"); + + cm.focus(); + + if (editor.find("." + dialogName).length > 0) + { + dialog = editor.find("." + dialogName); + + selecteds = []; + dialog.find("a").removeClass("selected"); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + } + else + { + dialog = this.createDialog({ + name : dialogName, + title : dialogLang.title, + width : 800, + height : 475, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + content : dialogContent, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + enter : [lang.buttons.enter, function() { + cm.replaceSelection(selecteds.join(" ")); + this.hide().lockScreen(false).hideMask(); + + return false; + }], + cancel : [lang.buttons.cancel, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + var category = ["Github emoji", "Twemoji", "Font awesome", "Editor.md logo"]; + var tab = dialog.find("." + classPrefix + "tab"); + + if (tab.html() === "") + { + var head = "
        "; + + tab.append(head); + + var container = "
        "; + + for (var x = 0; x < 4; x++) + { + var display = (x === 0) ? "" : "display:none;"; + container += "
        "; + } + + container += "
        "; + + tab.append(container); + } + + var tabBoxs = tab.find("." + classPrefix + "tab-box"); + var emojiCategories = ["github-emoji", "twemoji", "font-awesome", logoPrefix]; + + var drawTable = function() { + var cname = emojiCategories[emojiTabIndex]; + var $data = emojiData[cname]; + var $tab = tabBoxs.eq(emojiTabIndex); + + if ($tab.html() !== "") { + //console.log("break =>", cname); + return ; + } + + var pagination = function(data, type) { + var rowNumber = (type === "editormd-logo") ? "5" : 20; + var pageTotal = Math.ceil(data.length / rowNumber); + var table = "
        "; + + for (var i = 0; i < pageTotal; i++) + { + var row = "
        "; + + for (var x = 0; x < rowNumber; x++) + { + var emoji = $.trim(data[(i * rowNumber) + x]); + + if (typeof emoji !== "undefined" && emoji !== "") + { + var img = "", icon = ""; + + if (type === "github-emoji") + { + var src = (emoji === "+1") ? "plus1" : emoji; + src = (src === "black_large_square") ? "black_square" : src; + src = (src === "moon") ? "waxing_gibbous_moon" : src; + + src = exports.emoji.path + src + exports.emoji.ext; + img = "\":""; + row += "" + img + ""; + } + else if (type === "twemoji") + { + var twemojiSrc = exports.twemoji.path + emoji + exports.twemoji.ext; + img = "\"twemoji-""; + row += "" + img + ""; + } + else if (type === "font-awesome") + { + icon = ""; + row += "" + icon + ""; + } + else if (type === "editormd-logo") + { + icon = ""; + row += "" + icon + ""; + } + } + else + { + row += ""; + } + } + + row += "
        "; + + table += row; + } + + table += "
        "; + + return table; + }; + + if (emojiTabIndex === 0) + { + for (var i = 0, len = $data.length; i < len; i++) + { + var h4Style = (i === 0) ? " style=\"margin: 0 0 10px;\"" : " style=\"margin: 10px 0;\""; + $tab.append("" + $data[i].category + ""); + $tab.append(pagination($data[i].list, cname)); + } + } + else + { + $tab.append(pagination($data, cname)); + } + + $tab.find("." + classPrefix + "emoji-btn").bind(exports.mouseOrTouch("click", "touchend"), function() { + $(this).toggleClass("selected"); + + if ($(this).hasClass("selected")) + { + selecteds.push($(this).attr("value")); + } + }); + }; + + if (emojiData.length < 1) + { + if (typeof dialog.loading === "function") { + dialog.loading(true); + } + + $.getJSON(path + "emoji.json?temp=" + Math.random(), function(json) { + + if (typeof dialog.loading === "function") { + dialog.loading(false); + } + + emojiData = json; + emojiData[logoPrefix] = logos; + drawTable(); + }); + } + else + { + drawTable(); + } + + tab.find("li").bind(exports.mouseOrTouch("click", "touchend"), function() { + var $this = $(this); + emojiTabIndex = $this.index(); + + $this.addClass("active").siblings().removeClass("active"); + tabBoxs.eq(emojiTabIndex).show().siblings().hide(); + drawTable(); + }); + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/emoji-dialog/emoji.json b/src/main/resources/templates/editor/plugins/emoji-dialog/emoji.json new file mode 100644 index 0000000000000000000000000000000000000000..46d84733dd9321a2a87479acafdbc7e7b2688dc0 --- /dev/null +++ b/src/main/resources/templates/editor/plugins/emoji-dialog/emoji.json @@ -0,0 +1,28 @@ +{ + "github-emoji" : [ + { + "category" :"People", + "list" : ["bowtie","smile","laughing","blush","smiley","relaxed","smirk","heart_eyes","kissing_heart","kissing_closed_eyes","flushed","relieved","satisfied","grin","wink","stuck_out_tongue_winking_eye","stuck_out_tongue_closed_eyes","grinning","kissing","kissing_smiling_eyes","stuck_out_tongue","sleeping","worried","frowning","anguished","open_mouth","grimacing","confused","hushed","expressionless","unamused","sweat_smile","sweat","disappointed_relieved","weary","pensive","disappointed","confounded","fearful","cold_sweat","persevere","cry","sob","joy","astonished","scream","neckbeard","tired_face","angry","rage","triumph","sleepy","yum","mask","sunglasses","dizzy_face","imp","smiling_imp","neutral_face","no_mouth","innocent","alien","yellow_heart","blue_heart","purple_heart","heart","green_heart","broken_heart","heartbeat","heartpulse","two_hearts","revolving_hearts","cupid","sparkling_heart","sparkles","star","star2","dizzy","boom","collision","anger","exclamation","question","grey_exclamation","grey_question","zzz","dash","sweat_drops","notes","musical_note","fire","hankey","poop","shit","+1","thumbsup","-1","thumbsdown","ok_hand","punch","facepunch","fist","v","wave","hand","raised_hand","open_hands","point_up","point_down","point_left","point_right","raised_hands","pray","point_up_2","clap","muscle","metal","fu","walking","runner","running","couple","family","two_men_holding_hands","two_women_holding_hands","dancer","dancers","ok_woman","no_good","information_desk_person","raising_hand","bride_with_veil","person_with_pouting_face","person_frowning","bow","couplekiss","couple_with_heart","massage","haircut","nail_care","boy","girl","woman","man","baby","older_woman","older_man","person_with_blond_hair","man_with_gua_pi_mao","man_with_turban","construction_worker","cop","angel","princess","smiley_cat","smile_cat","heart_eyes_cat","kissing_cat","smirk_cat","scream_cat","crying_cat_face","joy_cat","pouting_cat","japanese_ogre","japanese_goblin","see_no_evil","hear_no_evil","speak_no_evil","guardsman","skull","feet","lips","kiss","droplet","ear","eyes","nose","tongue","love_letter","bust_in_silhouette","busts_in_silhouette","speech_balloon","thought_balloon","feelsgood","finnadie","goberserk","godmode","hurtrealbad","rage1","rage2","rage3","rage4","suspect","trollface"] + }, + { + "category" :"Nature", + "list" : ["sunny","umbrella","cloud","snowflake","snowman","zap","cyclone","foggy","ocean","cat","dog","mouse","hamster","rabbit","wolf","frog","tiger","koala","bear","pig","pig_nose","cow","boar","monkey_face","monkey","horse","racehorse","camel","sheep","elephant","panda_face","snake","bird","baby_chick","hatched_chick","hatching_chick","chicken","penguin","turtle","bug","honeybee","ant","beetle","snail","octopus","tropical_fish","fish","whale","whale2","dolphin","cow2","ram","rat","water_buffalo","tiger2","rabbit2","dragon","goat","rooster","dog2","pig2","mouse2","ox","dragon_face","blowfish","crocodile","dromedary_camel","leopard","cat2","poodle","paw_prints","bouquet","cherry_blossom","tulip","four_leaf_clover","rose","sunflower","hibiscus","maple_leaf","leaves","fallen_leaf","herb","mushroom","cactus","palm_tree","evergreen_tree","deciduous_tree","chestnut","seedling","blossom","ear_of_rice","shell","globe_with_meridians","sun_with_face","full_moon_with_face","new_moon_with_face","new_moon","waxing_crescent_moon","first_quarter_moon","waxing_gibbous_moon","full_moon","waning_gibbous_moon","last_quarter_moon","waning_crescent_moon","last_quarter_moon_with_face","first_quarter_moon_with_face","moon","earth_africa","earth_americas","earth_asia","volcano","milky_way","partly_sunny","octocat","squirrel"] + }, + { + "category" :"Objects", + "list" : ["bamboo","gift_heart","dolls","school_satchel","mortar_board","flags","fireworks","sparkler","wind_chime","rice_scene","jack_o_lantern","ghost","santa","christmas_tree","gift","bell","no_bell","tanabata_tree","tada","confetti_ball","balloon","crystal_ball","cd","dvd","floppy_disk","camera","video_camera","movie_camera","computer","tv","iphone","phone","telephone","telephone_receiver","pager","fax","minidisc","vhs","sound","speaker","mute","loudspeaker","mega","hourglass","hourglass_flowing_sand","alarm_clock","watch","radio","satellite","loop","mag","mag_right","unlock","lock","lock_with_ink_pen","closed_lock_with_key","key","bulb","flashlight","high_brightness","low_brightness","electric_plug","battery","calling","email","mailbox","postbox","bath","bathtub","shower","toilet","wrench","nut_and_bolt","hammer","seat","moneybag","yen","dollar","pound","euro","credit_card","money_with_wings","e-mail","inbox_tray","outbox_tray","envelope","incoming_envelope","postal_horn","mailbox_closed","mailbox_with_mail","mailbox_with_no_mail","package","door","smoking","bomb","gun","hocho","pill","syringe","page_facing_up","page_with_curl","bookmark_tabs","bar_chart","chart_with_upwards_trend","chart_with_downwards_trend","scroll","clipboard","calendar","date","card_index","file_folder","open_file_folder","scissors","pushpin","paperclip","black_nib","pencil2","straight_ruler","triangular_ruler","closed_book","green_book","blue_book","orange_book","notebook","notebook_with_decorative_cover","ledger","books","bookmark","name_badge","microscope","telescope","newspaper","football","basketball","soccer","baseball","tennis","8ball","rugby_football","bowling","golf","mountain_bicyclist","bicyclist","horse_racing","snowboarder","swimmer","surfer","ski","spades","hearts","clubs","diamonds","gem","ring","trophy","musical_score","musical_keyboard","violin","space_invader","video_game","black_joker","flower_playing_cards","game_die","dart","mahjong","clapper","memo","pencil","book","art","microphone","headphones","trumpet","saxophone","guitar","shoe","sandal","high_heel","lipstick","boot","shirt","tshirt","necktie","womans_clothes","dress","running_shirt_with_sash","jeans","kimono","bikini","ribbon","tophat","crown","womans_hat","mans_shoe","closed_umbrella","briefcase","handbag","pouch","purse","eyeglasses","fishing_pole_and_fish","coffee","tea","sake","baby_bottle","beer","beers","cocktail","tropical_drink","wine_glass","fork_and_knife","pizza","hamburger","fries","poultry_leg","meat_on_bone","spaghetti","curry","fried_shrimp","bento","sushi","fish_cake","rice_ball","rice_cracker","rice","ramen","stew","oden","dango","egg","bread","doughnut","custard","icecream","ice_cream","shaved_ice","birthday","cake","cookie","chocolate_bar","candy","lollipop","honey_pot","apple","green_apple","tangerine","lemon","cherries","grapes","watermelon","strawberry","peach","melon","banana","pear","pineapple","sweet_potato","eggplant","tomato","corn"] + }, + { + "category" :"Places", + "list" : ["house","house_with_garden","school","office","post_office","hospital","bank","convenience_store","love_hotel","hotel","wedding","church","department_store","european_post_office","city_sunrise","city_sunset","japanese_castle","european_castle","tent","factory","tokyo_tower","japan","mount_fuji","sunrise_over_mountains","sunrise","stars","statue_of_liberty","bridge_at_night","carousel_horse","rainbow","ferris_wheel","fountain","roller_coaster","ship","speedboat","boat","sailboat","rowboat","anchor","rocket","airplane","helicopter","steam_locomotive","tram","mountain_railway","bike","aerial_tramway","suspension_railway","mountain_cableway","tractor","blue_car","oncoming_automobile","car","red_car","taxi","oncoming_taxi","articulated_lorry","bus","oncoming_bus","rotating_light","police_car","oncoming_police_car","fire_engine","ambulance","minibus","truck","train","station","train2","bullettrain_front","bullettrain_side","light_rail","monorail","railway_car","trolleybus","ticket","fuelpump","vertical_traffic_light","traffic_light","warning","construction","beginner","atm","slot_machine","busstop","barber","hotsprings","checkered_flag","crossed_flags","izakaya_lantern","moyai","circus_tent","performing_arts","round_pushpin","triangular_flag_on_post","jp","kr","cn","us","fr","es","it","ru","gb","uk","de"] + }, + { + "category" :"Symbols", + "list" : ["one","two","three","four","five","six","seven","eight","nine","keycap_ten","1234","zero","hash","symbols","arrow_backward","arrow_down","arrow_forward","arrow_left","capital_abcd","abcd","abc","arrow_lower_left","arrow_lower_right","arrow_right","arrow_up","arrow_upper_left","arrow_upper_right","arrow_double_down","arrow_double_up","arrow_down_small","arrow_heading_down","arrow_heading_up","leftwards_arrow_with_hook","arrow_right_hook","left_right_arrow","arrow_up_down","arrow_up_small","arrows_clockwise","arrows_counterclockwise","rewind","fast_forward","information_source","ok","twisted_rightwards_arrows","repeat","repeat_one","new","top","up","cool","free","ng","cinema","koko","signal_strength","u5272","u5408","u55b6","u6307","u6708","u6709","u6e80","u7121","u7533","u7a7a","u7981","sa","restroom","mens","womens","baby_symbol","no_smoking","parking","wheelchair","metro","baggage_claim","accept","wc","potable_water","put_litter_in_its_place","secret","congratulations","m","passport_control","left_luggage","customs","ideograph_advantage","cl","sos","id","no_entry_sign","underage","no_mobile_phones","do_not_litter","non-potable_water","no_bicycles","no_pedestrians","children_crossing","no_entry","eight_spoked_asterisk","sparkle","eight_pointed_black_star","heart_decoration","vs","vibration_mode","mobile_phone_off","chart","currency_exchange","aries","taurus","gemini","cancer","leo","virgo","libra","scorpius","sagittarius","capricorn","aquarius","pisces","ophiuchus","six_pointed_star","negative_squared_cross_mark","a","b","ab","o2","diamond_shape_with_a_dot_inside","recycle","end","back","on","soon","clock1","clock130","clock10","clock1030","clock11","clock1130","clock12","clock1230","clock2","clock230","clock3","clock330","clock4","clock430","clock5","clock530","clock6","clock630","clock7","clock730","clock8","clock830","clock9","clock930","heavy_dollar_sign","copyright","registered","tm","x","heavy_exclamation_mark","bangbang","interrobang","o","heavy_multiplication_x","heavy_plus_sign","heavy_minus_sign","heavy_division_sign","white_flower","100","heavy_check_mark","ballot_box_with_check","radio_button","link","curly_loop","wavy_dash","part_alternation_mark","trident","black_small_square","white_small_square","black_medium_small_square","white_medium_small_square","black_medium_square","white_medium_square","black_large_square","white_large_square","white_check_mark","black_square_button","white_square_button","black_circle","white_circle","red_circle","large_blue_circle","large_blue_diamond","large_orange_diamond","small_blue_diamond","small_orange_diamond","small_red_triangle","small_red_triangle_down","shipit"] + } + ], + + "twemoji" : ["1f004","1f0cf","1f170","1f171","1f17e","1f17f","1f18e","1f191","1f192","1f193","1f194","1f195","1f196","1f197","1f198","1f199","1f19a","1f1e6","1f1e7","1f1e8-1f1f3","1f1e8","1f1e9-1f1ea","1f1e9","1f1ea-1f1f8","1f1ea","1f1eb-1f1f7","1f1eb","1f1ec-1f1e7","1f1ec","1f1ed","1f1ee-1f1f9","1f1ee","1f1ef-1f1f5","1f1ef","1f1f0-1f1f7","1f1f0","1f1f1","1f1f2","1f1f3","1f1f4","1f1f5","1f1f6","1f1f7-1f1fa","1f1f7","1f1f8","1f1f9","1f1fa-1f1f8","1f1fa","1f1fb","1f1fc","1f1fd","1f1fe","1f1ff","1f201","1f202","1f21a","1f22f","1f232","1f233","1f234","1f235","1f236","1f237","1f238","1f239","1f23a","1f250","1f251","1f300","1f301","1f302","1f303","1f304","1f305","1f306","1f307","1f308","1f309","1f30a","1f30b","1f30c","1f30d","1f30e","1f30f","1f310","1f311","1f312","1f313","1f314","1f315","1f316","1f317","1f318","1f319","1f31a","1f31b","1f31c","1f31d","1f31e","1f31f","1f320","1f330","1f331","1f332","1f333","1f334","1f335","1f337","1f338","1f339","1f33a","1f33b","1f33c","1f33d","1f33e","1f33f","1f340","1f341","1f342","1f343","1f344","1f345","1f346","1f347","1f348","1f349","1f34a","1f34b","1f34c","1f34d","1f34e","1f34f","1f350","1f351","1f352","1f353","1f354","1f355","1f356","1f357","1f358","1f359","1f35a","1f35b","1f35c","1f35d","1f35e","1f35f","1f360","1f361","1f362","1f363","1f364","1f365","1f366","1f367","1f368","1f369","1f36a","1f36b","1f36c","1f36d","1f36e","1f36f","1f370","1f371","1f372","1f373","1f374","1f375","1f376","1f377","1f378","1f379","1f37a","1f37b","1f37c","1f380","1f381","1f382","1f383","1f384","1f385","1f386","1f387","1f388","1f389","1f38a","1f38b","1f38c","1f38d","1f38e","1f38f","1f390","1f391","1f392","1f393","1f3a0","1f3a1","1f3a2","1f3a3","1f3a4","1f3a5","1f3a6","1f3a7","1f3a8","1f3a9","1f3aa","1f3ab","1f3ac","1f3ad","1f3ae","1f3af","1f3b0","1f3b1","1f3b2","1f3b3","1f3b4","1f3b5","1f3b6","1f3b7","1f3b8","1f3b9","1f3ba","1f3bb","1f3bc","1f3bd","1f3be","1f3bf","1f3c0","1f3c1","1f3c2","1f3c3","1f3c4","1f3c6","1f3c7","1f3c8","1f3c9","1f3ca","1f3e0","1f3e1","1f3e2","1f3e3","1f3e4","1f3e5","1f3e6","1f3e7","1f3e8","1f3e9","1f3ea","1f3eb","1f3ec","1f3ed","1f3ee","1f3ef","1f3f0","1f400","1f401","1f402","1f403","1f404","1f405","1f406","1f407","1f408","1f409","1f40a","1f40b","1f40c","1f40d","1f40e","1f40f","1f410","1f411","1f412","1f413","1f414","1f415","1f416","1f417","1f418","1f419","1f41a","1f41b","1f41c","1f41d","1f41e","1f41f","1f420","1f421","1f422","1f423","1f424","1f425","1f426","1f427","1f428","1f429","1f42a","1f42b","1f42c","1f42d","1f42e","1f42f","1f430","1f431","1f432","1f433","1f434","1f435","1f436","1f437","1f438","1f439","1f43a","1f43b","1f43c","1f43d","1f43e","1f440","1f442","1f443","1f444","1f445","1f446","1f447","1f448","1f449","1f44a","1f44b","1f44c","1f44d","1f44e","1f44f","1f450","1f451","1f452","1f453","1f454","1f455","1f456","1f457","1f458","1f459","1f45a","1f45b","1f45c","1f45d","1f45e","1f45f","1f460","1f461","1f462","1f463","1f464","1f465","1f466","1f467","1f468","1f469","1f46a","1f46b","1f46c","1f46d","1f46e","1f46f","1f470","1f471","1f472","1f473","1f474","1f475","1f476","1f477","1f478","1f479","1f47a","1f47b","1f47c","1f47d","1f47e","1f47f","1f480","1f481","1f482","1f483","1f484","1f485","1f486","1f487","1f488","1f489","1f48a","1f48b","1f48c","1f48d","1f48e","1f48f","1f490","1f491","1f492","1f493","1f494","1f495","1f496","1f497","1f498","1f499","1f49a","1f49b","1f49c","1f49d","1f49e","1f49f","1f4a0","1f4a1","1f4a2","1f4a3","1f4a4","1f4a5","1f4a6","1f4a7","1f4a8","1f4a9","1f4aa","1f4ab","1f4ac","1f4ad","1f4ae","1f4af","1f4b0","1f4b1","1f4b2","1f4b3","1f4b4","1f4b5","1f4b6","1f4b7","1f4b8","1f4b9","1f4ba","1f4bb","1f4bc","1f4bd","1f4be","1f4bf","1f4c0","1f4c1","1f4c2","1f4c3","1f4c4","1f4c5","1f4c6","1f4c7","1f4c8","1f4c9","1f4ca","1f4cb","1f4cc","1f4cd","1f4ce","1f4cf","1f4d0","1f4d1","1f4d2","1f4d3","1f4d4","1f4d5","1f4d6","1f4d7","1f4d8","1f4d9","1f4da","1f4db","1f4dc","1f4dd","1f4de","1f4df","1f4e0","1f4e1","1f4e2","1f4e3","1f4e4","1f4e5","1f4e6","1f4e7","1f4e8","1f4e9","1f4ea","1f4eb","1f4ec","1f4ed","1f4ee","1f4ef","1f4f0","1f4f1","1f4f2","1f4f3","1f4f4","1f4f5","1f4f6","1f4f7","1f4f9","1f4fa","1f4fb","1f4fc","1f500","1f501","1f502","1f503","1f504","1f505","1f506","1f507","1f508","1f509","1f50a","1f50b","1f50c","1f50d","1f50e","1f50f","1f510","1f511","1f512","1f513","1f514","1f515","1f516","1f517","1f518","1f519","1f51a","1f51b","1f51c","1f51d","1f51e","1f51f","1f520","1f521","1f522","1f523","1f524","1f525","1f526","1f527","1f528","1f529","1f52a","1f52b","1f52c","1f52d","1f52e","1f52f","1f530","1f531","1f532","1f533","1f534","1f535","1f536","1f537","1f538","1f539","1f53a","1f53b","1f53c","1f53d","1f550","1f551","1f552","1f553","1f554","1f555","1f556","1f557","1f558","1f559","1f55a","1f55b","1f55c","1f55d","1f55e","1f55f","1f560","1f561","1f562","1f563","1f564","1f565","1f566","1f567","1f5fb","1f5fc","1f5fd","1f5fe","1f5ff","1f600","1f601","1f602","1f603","1f604","1f605","1f606","1f607","1f608","1f609","1f60a","1f60b","1f60c","1f60d","1f60e","1f60f","1f610","1f611","1f612","1f613","1f614","1f615","1f616","1f617","1f618","1f619","1f61a","1f61b","1f61c","1f61d","1f61e","1f61f","1f620","1f621","1f622","1f623","1f624","1f625","1f626","1f627","1f628","1f629","1f62a","1f62b","1f62c","1f62d","1f62e","1f62f","1f630","1f631","1f632","1f633","1f634","1f635","1f636","1f637","1f638","1f639","1f63a","1f63b","1f63c","1f63d","1f63e","1f63f","1f640","1f645","1f646","1f647","1f648","1f649","1f64a","1f64b","1f64c","1f64d","1f64e","1f64f","1f680","1f681","1f682","1f683","1f684","1f685","1f686","1f687","1f688","1f689","1f68a","1f68b","1f68c","1f68d","1f68e","1f68f","1f690","1f691","1f692","1f693","1f694","1f695","1f696","1f697","1f698","1f699","1f69a","1f69b","1f69c","1f69d","1f69e","1f69f","1f6a0","1f6a1","1f6a2","1f6a3","1f6a4","1f6a5","1f6a6","1f6a7","1f6a8","1f6a9","1f6aa","1f6ab","1f6ac","1f6ad","1f6ae","1f6af","1f6b0","1f6b1","1f6b2","1f6b3","1f6b4","1f6b5","1f6b6","1f6b7","1f6b8","1f6b9","1f6ba","1f6bb","1f6bc","1f6bd","1f6be","1f6bf","1f6c0","1f6c1","1f6c2","1f6c3","1f6c4","1f6c5","203c","2049","2122","2139","2194","2195","2196","2197","2198","2199","21a9","21aa","23-20e3","231a","231b","23e9","23ea","23eb","23ec","23f0","23f3","24c2","25aa","25ab","25b6","25c0","25fb","25fc","25fd","25fe","2600","2601","260e","2611","2614","2615","261d","263a","2648","2649","264a","264b","264c","264d","264e","264f","2650","2651","2652","2653","2660","2663","2665","2666","2668","267b","267f","2693","26a0","26a1","26aa","26ab","26bd","26be","26c4","26c5","26ce","26d4","26ea","26f2","26f3","26f5","26fa","26fd","2702","2705","2708","2709","270a","270b","270c","270f","2712","2714","2716","2728","2733","2734","2744","2747","274c","274e","2753","2754","2755","2757","2764","2795","2796","2797","27a1","27b0","27bf","2934","2935","2b05","2b06","2b07","2b1b","2b1c","2b50","2b55","30-20e3","3030","303d","31-20e3","32-20e3","3297","3299","33-20e3","34-20e3","35-20e3","36-20e3","37-20e3","38-20e3","39-20e3","a9","ae","e50a"], + + "font-awesome" : ["glass","music","search","envelope-o","heart","star","star-o","user","film","th-large","th","th-list","check","times","search-plus","search-minus","power-off","signal","cog","trash-o","home","file-o","clock-o","road","download","arrow-circle-o-down","arrow-circle-o-up","inbox","play-circle-o","repeat","refresh","list-alt","lock","flag","headphones","volume-off","volume-down","volume-up","qrcode","barcode","tag","tags","book","bookmark","print","camera","font","bold","italic","text-height","text-width","align-left","align-center","align-right","align-justify","list","outdent","indent","video-camera","picture-o","pencil","map-marker","adjust","tint","pencil-square-o","share-square-o","check-square-o","arrows","step-backward","fast-backward","backward","play","pause","stop","forward","fast-forward","step-forward","eject","chevron-left","chevron-right","plus-circle","minus-circle","times-circle","check-circle","question-circle","info-circle","crosshairs","times-circle-o","check-circle-o","ban","arrow-left","arrow-right","arrow-up","arrow-down","share","expand","compress","plus","minus","asterisk","exclamation-circle","gift","leaf","fire","eye","eye-slash","exclamation-triangle","plane","calendar","random","comment","magnet","chevron-up","chevron-down","retweet","shopping-cart","folder","folder-open","arrows-v","arrows-h","bar-chart","twitter-square","facebook-square","camera-retro","key","cogs","comments","thumbs-o-up","thumbs-o-down","star-half","heart-o","sign-out","linkedin-square","thumb-tack","external-link","sign-in","trophy","github-square","upload","lemon-o","phone","square-o","bookmark-o","phone-square","twitter","facebook","github","unlock","credit-card","rss","hdd-o","bullhorn","bell","certificate","hand-o-right","hand-o-left","hand-o-up","hand-o-down","arrow-circle-left","arrow-circle-right","arrow-circle-up","arrow-circle-down","globe","wrench","tasks","filter","briefcase","arrows-alt","users","link","cloud","flask","scissors","files-o","paperclip","floppy-o","square","bars","list-ul","list-ol","strikethrough","underline","table","magic","truck","pinterest","pinterest-square","google-plus-square","google-plus","money","caret-down","caret-up","caret-left","caret-right","columns","sort","sort-desc","sort-asc","envelope","linkedin","undo","gavel","tachometer","comment-o","comments-o","bolt","sitemap","umbrella","clipboard","lightbulb-o","exchange","cloud-download","cloud-upload","user-md","stethoscope","suitcase","bell-o","coffee","cutlery","file-text-o","building-o","hospital-o","ambulance","medkit","fighter-jet","beer","h-square","plus-square","angle-double-left","angle-double-right","angle-double-up","angle-double-down","angle-left","angle-right","angle-up","angle-down","desktop","laptop","tablet","mobile","circle-o","quote-left","quote-right","spinner","circle","reply","github-alt","folder-o","folder-open-o","smile-o","frown-o","meh-o","gamepad","keyboard-o","flag-o","flag-checkered","terminal","code","reply-all","star-half-o","location-arrow","crop","code-fork","chain-broken","question","info","exclamation","superscript","subscript","eraser","puzzle-piece","microphone","microphone-slash","shield","calendar-o","fire-extinguisher","rocket","maxcdn","chevron-circle-left","chevron-circle-right","chevron-circle-up","chevron-circle-down","html5","css3","anchor","unlock-alt","bullseye","ellipsis-h","ellipsis-v","rss-square","play-circle","ticket","minus-square","minus-square-o","level-up","level-down","check-square","pencil-square","share-square","compass","caret-square-o-down","caret-square-o-up","caret-square-o-right","eur","gbp","usd","inr","jpy","rub","krw","btc","file","file-text","sort-alpha-asc","sort-alpha-desc","sort-amount-asc","sort-amount-desc","sort-numeric-asc","sort-numeric-desc","thumbs-up","thumbs-down","youtube-square","youtube","xing","xing-square","youtube-play","dropbox","stack-overflow","instagram","flickr","adn","bitbucket","bitbucket-square","tumblr","tumblr-square","long-arrow-down","long-arrow-up","long-arrow-left","long-arrow-right","apple","windows","android","linux","dribbble","skype","foursquare","trello","female","male","gratipay","sun-o","moon-o","archive","bug","vk","weibo","renren","pagelines","stack-exchange","arrow-circle-o-right","arrow-circle-o-left","caret-square-o-left","dot-circle-o","wheelchair","vimeo-square","try","plus-square-o","space-shuttle","slack","envelope-square","wordpress","openid","university","graduation-cap","yahoo","google","reddit","reddit-square","stumbleupon-circle","stumbleupon","delicious","digg","pied-piper","pied-piper-alt","drupal","joomla","language","fax","building","child","paw","spoon","cube","cubes","behance","behance-square","steam","steam-square","recycle","car","taxi","tree","spotify","deviantart","soundcloud","database","file-pdf-o","file-word-o","file-excel-o","file-powerpoint-o","file-image-o","file-archive-o","file-audio-o","file-video-o","file-code-o","vine","codepen","jsfiddle","life-ring","circle-o-notch","rebel","empire","git-square","git","hacker-news","tencent-weibo","qq","weixin","paper-plane","paper-plane-o","history","circle-thin","header","paragraph","sliders","share-alt","share-alt-square","bomb","futbol-o","tty","binoculars","plug","slideshare","twitch","yelp","newspaper-o","wifi","calculator","paypal","google-wallet","cc-visa","cc-mastercard","cc-discover","cc-amex","cc-paypal","cc-stripe","bell-slash","bell-slash-o","trash","copyright","at","eyedropper","paint-brush","birthday-cake","area-chart","pie-chart","line-chart","lastfm","lastfm-square","toggle-off","toggle-on","bicycle","bus","ioxhost","angellist","cc","ils","meanpath","buysellads","connectdevelop","dashcube","forumbee","leanpub","sellsy","shirtsinbulk","simplybuilt","skyatlas","cart-plus","cart-arrow-down","diamond","ship","user-secret","motorcycle","street-view","heartbeat","venus","mars","mercury","transgender","transgender-alt","venus-double","mars-double","venus-mars","mars-stroke","mars-stroke-v","mars-stroke-h","neuter","facebook-official","pinterest-p","whatsapp","server","user-plus","user-times","bed","viacoin","train","subway","medium","GitHub","bed","buysellads","cart-arrow-down","cart-plus","connectdevelop","dashcube","diamond","facebook-official","forumbee","heartbeat","hotel","leanpub","mars","mars-double","mars-stroke","mars-stroke-h","mars-stroke-v","medium","mercury","motorcycle","neuter","pinterest-p","sellsy","server","ship","shirtsinbulk","simplybuilt","skyatlas","street-view","subway","train","transgender","transgender-alt","user-plus","user-secret","user-times","venus","venus-double","venus-mars","viacoin","whatsapp","adjust","anchor","archive","area-chart","arrows","arrows-h","arrows-v","asterisk","at","automobile","ban","bank","bar-chart","bar-chart-o","barcode","bars","bed","beer","bell","bell-o","bell-slash","bell-slash-o","bicycle","binoculars","birthday-cake","bolt","bomb","book","bookmark","bookmark-o","briefcase","bug","building","building-o","bullhorn","bullseye","bus","cab","calculator","calendar","calendar-o","camera","camera-retro","car","caret-square-o-down","caret-square-o-left","caret-square-o-right","caret-square-o-up","cart-arrow-down","cart-plus","cc","certificate","check","check-circle","check-circle-o","check-square","check-square-o","child","circle","circle-o","circle-o-notch","circle-thin","clock-o","close","cloud","cloud-download","cloud-upload","code","code-fork","coffee","cog","cogs","comment","comment-o","comments","comments-o","compass","copyright","credit-card","crop","crosshairs","cube","cubes","cutlery","dashboard","database","desktop","diamond","dot-circle-o","download","edit","ellipsis-h","ellipsis-v","envelope","envelope-o","envelope-square","eraser","exchange","exclamation","exclamation-circle","exclamation-triangle","external-link","external-link-square","eye","eye-slash","eyedropper","fax","female","fighter-jet","file-archive-o","file-audio-o","file-code-o","file-excel-o","file-image-o","file-movie-o","file-pdf-o","file-photo-o","file-picture-o","file-powerpoint-o","file-sound-o","file-video-o","file-word-o","file-zip-o","film","filter","fire","fire-extinguisher","flag","flag-checkered","flag-o","flash","flask","folder","folder-o","folder-open","folder-open-o","frown-o","futbol-o","gamepad","gavel","gear","gears","genderless","gift","glass","globe","graduation-cap","group","hdd-o","headphones","heart","heart-o","heartbeat","history","home","hotel","image","inbox","info","info-circle","institution","key","keyboard-o","language","laptop","leaf","legal","lemon-o","level-down","level-up","life-bouy","life-buoy","life-ring","life-saver","lightbulb-o","line-chart","location-arrow","lock","magic","magnet","mail-forward","mail-reply","mail-reply-all","male","map-marker","meh-o","microphone","microphone-slash","minus","minus-circle","minus-square","minus-square-o","mobile","mobile-phone","money","moon-o","mortar-board","motorcycle","music","navicon","newspaper-o","paint-brush","paper-plane","paper-plane-o","paw","pencil","pencil-square","pencil-square-o","phone","phone-square","photo","picture-o","pie-chart","plane","plug","plus","plus-circle","plus-square","plus-square-o","power-off","print","puzzle-piece","qrcode","question","question-circle","quote-left","quote-right","random","recycle","refresh","remove","reorder","reply","reply-all","retweet","road","rocket","rss","rss-square","search","search-minus","search-plus","send","send-o","server","share","share-alt","share-alt-square","share-square","share-square-o","shield","ship","shopping-cart","sign-in","sign-out","signal","sitemap","sliders","smile-o","soccer-ball-o","sort","sort-alpha-asc","sort-alpha-desc","sort-amount-asc","sort-amount-desc","sort-asc","sort-desc","sort-down","sort-numeric-asc","sort-numeric-desc","sort-up","space-shuttle","spinner","spoon","square","square-o","star","star-half","star-half-empty","star-half-full","star-half-o","star-o","street-view","suitcase","sun-o","support","tablet","tachometer","tag","tags","tasks","taxi","terminal","thumb-tack","thumbs-down","thumbs-o-down","thumbs-o-up","thumbs-up","ticket","times","times-circle","times-circle-o","tint","toggle-down","toggle-left","toggle-off","toggle-on","toggle-right","toggle-up","trash","trash-o","tree","trophy","truck","tty","umbrella","university","unlock","unlock-alt","unsorted","upload","user","user-plus","user-secret","user-times","users","video-camera","volume-down","volume-off","volume-up","warning","wheelchair","wifi","wrench","ambulance","automobile","bicycle","bus","cab","car","fighter-jet","motorcycle","plane","rocket","ship","space-shuttle","subway","taxi","train","truck","wheelchair","circle-thin","genderless","mars","mars-double","mars-stroke","mars-stroke-h","mars-stroke-v","mercury","neuter","transgender","transgender-alt","venus","venus-double","venus-mars","file","file-archive-o","file-audio-o","file-code-o","file-excel-o","file-image-o","file-movie-o","file-o","file-pdf-o","file-photo-o","file-picture-o","file-powerpoint-o","file-sound-o","file-text","file-text-o","file-video-o","file-word-o","file-zip-o","circle-o-notch","cog","gear","refresh","spinner","check-square","check-square-o","circle","circle-o","dot-circle-o","minus-square","minus-square-o","plus-square","plus-square-o","square","square-o","cc-amex","cc-discover","cc-mastercard","cc-paypal","cc-stripe","cc-visa","credit-card","google-wallet","paypal","area-chart","bar-chart","bar-chart-o","line-chart","pie-chart","bitcoin","btc","cny","dollar","eur","euro","gbp","ils","inr","jpy","krw","money","rmb","rouble","rub","ruble","rupee","shekel","sheqel","try","turkish-lira","usd","won","yen","align-center","align-justify","align-left","align-right","bold","chain","chain-broken","clipboard","columns","copy","cut","dedent","eraser","file","file-o","file-text","file-text-o","files-o","floppy-o","font","header","indent","italic","link","list","list-alt","list-ol","list-ul","outdent","paperclip","paragraph","paste","repeat","rotate-left","rotate-right","save","scissors","strikethrough","subscript","superscript","table","text-height","text-width","th","th-large","th-list","underline","undo","unlink","angle-double-down","angle-double-left","angle-double-right","angle-double-up","angle-down","angle-left","angle-right","angle-up","arrow-circle-down","arrow-circle-left","arrow-circle-o-down","arrow-circle-o-left","arrow-circle-o-right","arrow-circle-o-up","arrow-circle-right","arrow-circle-up","arrow-down","arrow-left","arrow-right","arrow-up","arrows","arrows-alt","arrows-h","arrows-v","caret-down","caret-left","caret-right","caret-square-o-down","caret-square-o-left","caret-square-o-right","caret-square-o-up","caret-up","chevron-circle-down","chevron-circle-left","chevron-circle-right","chevron-circle-up","chevron-down","chevron-left","chevron-right","chevron-up","hand-o-down","hand-o-left","hand-o-right","hand-o-up","long-arrow-down","long-arrow-left","long-arrow-right","long-arrow-up","toggle-down","toggle-left","toggle-right","toggle-up","arrows-alt","backward","compress","eject","expand","fast-backward","fast-forward","forward","pause","play","play-circle","play-circle-o","step-backward","step-forward","stop","youtube-play","report an issue with Adblock Plus","adn","android","angellist","apple","behance","behance-square","bitbucket","bitbucket-square","bitcoin","btc","buysellads","cc-amex","cc-discover","cc-mastercard","cc-paypal","cc-stripe","cc-visa","codepen","connectdevelop","css3","dashcube","delicious","deviantart","digg","dribbble","dropbox","drupal","empire","facebook","facebook-f","facebook-official","facebook-square","flickr","forumbee","foursquare","ge","git","git-square","github","github-alt","github-square","gittip","google","google-plus","google-plus-square","google-wallet","gratipay","hacker-news","html5","instagram","ioxhost","joomla","jsfiddle","lastfm","lastfm-square","leanpub","linkedin","linkedin-square","linux","maxcdn","meanpath","medium","openid","pagelines","paypal","pied-piper","pied-piper-alt","pinterest","pinterest-p","pinterest-square","qq","ra","rebel","reddit","reddit-square","renren","sellsy","share-alt","share-alt-square","shirtsinbulk","simplybuilt","skyatlas","skype","slack","slideshare","soundcloud","spotify","stack-exchange","stack-overflow","steam","steam-square","stumbleupon","stumbleupon-circle","tencent-weibo","trello","tumblr","tumblr-square","twitch","twitter","twitter-square","viacoin","vimeo-square","vine","vk","wechat","weibo","weixin","whatsapp","windows","wordpress","xing","xing-square","yahoo","yelp","youtube","youtube-play","youtube-square","ambulance","h-square","heart","heart-o","heartbeat","hospital-o","medkit","plus-square","stethoscope","user-md","wheelchair"] +} \ No newline at end of file diff --git a/src/main/resources/templates/editor/plugins/goto-line-dialog/goto-line-dialog.js b/src/main/resources/templates/editor/plugins/goto-line-dialog/goto-line-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..f8757437b898fe4b95c6fade4c4a2bc0d4214731 --- /dev/null +++ b/src/main/resources/templates/editor/plugins/goto-line-dialog/goto-line-dialog.js @@ -0,0 +1,157 @@ +/*! + * Goto line dialog plugin for Editor.md + * + * @file goto-line-dialog.js + * @author pandao + * @version 1.2.1 + * @updateTime 2015-06-09 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "goto-line-dialog"; + + var langs = { + "zh-cn" : { + toolbar : { + "goto-line" : "跳转到行" + }, + dialog : { + "goto-line" : { + title : "跳转到行", + label : "请输入行号", + error : "错误:" + } + } + }, + "zh-tw" : { + toolbar : { + "goto-line" : "跳轉到行" + }, + dialog : { + "goto-line" : { + title : "跳轉到行", + label : "請輸入行號", + error : "錯誤:" + } + } + }, + "en" : { + toolbar : { + "goto-line" : "Goto line" + }, + dialog : { + "goto-line" : { + title : "Goto line", + label : "Enter a line number, range ", + error : "Error: " + } + } + } + }; + + exports.fn.gotoLineDialog = function() { + var _this = this; + var cm = this.cm; + var editor = this.editor; + var settings = this.settings; + var path = settings.pluginPath + pluginName +"/"; + var classPrefix = this.classPrefix; + var dialogName = classPrefix + pluginName, dialog; + + $.extend(true, this.lang, langs[this.lang.name]); + this.setToolbar(); + + var lang = this.lang; + var dialogLang = lang.dialog["goto-line"]; + var lineCount = cm.lineCount(); + + dialogLang.error += dialogLang.label + " 1-" + lineCount; + + if (editor.find("." + dialogName).length < 1) + { + var dialogContent = [ + "
        ", + "

        " + dialogLang.label + " 1-" + lineCount +"   

        ", + "
        " + ].join("\n"); + + dialog = this.createDialog({ + name : dialogName, + title : dialogLang.title, + width : 400, + height : 180, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + content : dialogContent, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + enter : [lang.buttons.enter, function() { + var line = parseInt(this.find("[data-line-number]").val()); + + if (line < 1 || line > lineCount) { + alert(dialogLang.error); + + return false; + } + + _this.gotoLine(line); + + this.hide().lockScreen(false).hideMask(); + + return false; + }], + + cancel : [lang.buttons.cancel, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + dialog = editor.find("." + dialogName); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/help-dialog/help-dialog.js b/src/main/resources/templates/editor/plugins/help-dialog/help-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..339b3c0edf7db94937a58b48f7b3b7c7b8c7fe11 --- /dev/null +++ b/src/main/resources/templates/editor/plugins/help-dialog/help-dialog.js @@ -0,0 +1,102 @@ +/*! + * Help dialog plugin for Editor.md + * + * @file help-dialog.js + * @author pandao + * @version 1.2.0 + * @updateTime 2015-03-08 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "help-dialog"; + + exports.fn.helpDialog = function() { + var _this = this; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var path = settings.pluginPath + pluginName + "/"; + var classPrefix = this.classPrefix; + var dialogName = classPrefix + pluginName, dialog; + var dialogLang = lang.dialog.help; + + if (editor.find("." + dialogName).length < 1) + { + var dialogContent = "
        "; + + dialog = this.createDialog({ + name : dialogName, + title : dialogLang.title, + width : 840, + height : 540, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + content : dialogContent, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + close : [lang.buttons.close, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + dialog = editor.find("." + dialogName); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + + var helpContent = dialog.find(".markdown-body"); + + if (helpContent.html() === "") + { + $.get(path + "help.md", function(text) { + var md = exports.$marked(text); + helpContent.html(md); + + helpContent.find("a").attr("target", "_blank"); + }); + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/help-dialog/help.md b/src/main/resources/templates/editor/plugins/help-dialog/help.md new file mode 100644 index 0000000000000000000000000000000000000000..9a030f2f5ae6742f2a2d048ba40ec5d714402d9e --- /dev/null +++ b/src/main/resources/templates/editor/plugins/help-dialog/help.md @@ -0,0 +1,77 @@ +##### Markdown语法教程 (Markdown syntax tutorial) + +- [Markdown Syntax](http://daringfireball.net/projects/markdown/syntax/ "Markdown Syntax") +- [Mastering Markdown](https://guides.github.com/features/mastering-markdown/ "Mastering Markdown") +- [Markdown Basics](https://help.github.com/articles/markdown-basics/ "Markdown Basics") +- [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/ "GitHub Flavored Markdown") +- [Markdown 语法说明(简体中文)](http://www.markdown.cn/ "Markdown 语法说明(简体中文)") +- [Markdown 語法說明(繁體中文)](http://markdown.tw/ "Markdown 語法說明(繁體中文)") + +##### 键盘快捷键 (Keyboard shortcuts) + +> If Editor.md code editor is on focus, you can use keyboard shortcuts. + +| Keyboard shortcuts (键盘快捷键) | 说明 | Description | +| :---------------------------------------------- |:--------------------------------- | :------------------------------------------------- | +| F9 | 切换实时预览 | Switch watch/unwatch | +| F10 | 全屏HTML预览(按 Shift + ESC 退出) | Full preview HTML (Press Shift + ESC exit) | +| F11 | 切换全屏状态 | Switch fullscreen (Press ESC exit) | +| Ctrl + 1~6 / Command + 1~6 | 插入标题1~6 | Insert heading 1~6 | +| Ctrl + A / Command + A | 全选 | Select all | +| Ctrl + B / Command + B | 插入粗体 | Insert bold | +| Ctrl + D / Command + D | 插入日期时间 | Insert datetime | +| Ctrl + E / Command + E | 插入Emoji符号 | Insert :emoji: | +| Ctrl + F / Command + F | 查找/搜索 | Start searching | +| Ctrl + G / Command + G | 切换到下一个搜索结果项 | Find next search results | +| Ctrl + H / Command + H | 插入水平线 | Insert horizontal rule | +| Ctrl + I / Command + I | 插入斜体 | Insert italic | +| Ctrl + K / Command + K | 插入行内代码 | Insert inline code | +| Ctrl + L / Command + L | 插入链接 | Insert link | +| Ctrl + U / Command + U | 插入无序列表 | Insert unordered list | +| Ctrl + Q | 代码折叠切换 | Switch code fold | +| Ctrl + Z / Command + Z | 撤销 | Undo | +| Ctrl + Y / Command + Y | 重做 | Redo | +| Ctrl + Shift + A | 插入@链接 | Insert @link | +| Ctrl + Shift + C | 插入行内代码 | Insert inline code | +| Ctrl + Shift + E | 打开插入Emoji表情对话框 | Open emoji dialog | +| Ctrl + Shift + F / Command + Option + F | 替换 | Replace | +| Ctrl + Shift + G / Shift + Command + G | 切换到上一个搜索结果项 | Find previous search results | +| Ctrl + Shift + H | 打开HTML实体字符对话框 | Open HTML Entities dialog | +| Ctrl + Shift + I | 插入图片 | Insert image ![]() | +| Ctrl + Shift + K | 插入TeX(KaTeX)公式符号 | Insert TeX(KaTeX) symbol $$TeX$$ | +| Ctrl + Shift + L | 打开插入链接对话框 | Open link dialog | +| Ctrl + Shift + O | 插入有序列表 | Insert ordered list | +| Ctrl + Shift + P | 打开插入PRE对话框 | Open Preformatted text dialog | +| Ctrl + Shift + Q | 插入引用 | Insert blockquotes | +| Ctrl + Shift + R / Shift + Command + Option + F | 全部替换 | Replace all | +| Ctrl + Shift + S | 插入删除线 | Insert strikethrough | +| Ctrl + Shift + T | 打开插入表格对话框 | Open table dialog | +| Ctrl + Shift + U | 将所选文字转成大写 | Selection text convert to uppercase | +| Shift + Alt + C | 插入```代码 | Insert code blocks (```) | +| Shift + Alt + H | 打开使用帮助对话框 | Open help dialog | +| Shift + Alt + L | 将所选文本转成小写 | Selection text convert to lowercase | +| Shift + Alt + P | 插入分页符 | Insert page break | +| Alt + L | 将所选文本转成小写 | Selection text convert to lowercase | +| Shift + Alt + U | 将所选的每个单词的首字母转成大写 | Selection words first letter convert to Uppercase | +| Ctrl + Shift + Alt + C | 打开插入代码块对话框层 | Open code blocks dialog | +| Ctrl + Shift + Alt + I | 打开插入图片对话框层 | Open image dialog | +| Ctrl + Shift + Alt + U | 将所选文本的第一个首字母转成大写 | Selection text first letter convert to uppercase | +| Ctrl + Alt + G | 跳转到指定的行 | Goto line | + +##### Emoji表情参考 (Emoji reference) + +- [Github emoji](http://www.emoji-cheat-sheet.com/ "Github emoji") +- [Twitter Emoji \(Twemoji\)](http://twitter.github.io/twemoji/preview.html "Twitter Emoji \(Twemoji\)") +- [FontAwesome icons emoji](http://fortawesome.github.io/Font-Awesome/icons/ "FontAwesome icons emoji") + +##### 流程图参考 (Flowchart reference) + +[http://adrai.github.io/flowchart.js/](http://adrai.github.io/flowchart.js/) + +##### 时序图参考 (SequenceDiagram reference) + +[http://bramp.github.io/js-sequence-diagrams/](http://bramp.github.io/js-sequence-diagrams/) + +##### TeX/LaTeX reference + +[http://meta.wikimedia.org/wiki/Help:Formula](http://meta.wikimedia.org/wiki/Help:Formula) diff --git a/src/main/resources/templates/editor/plugins/html-entities-dialog/html-entities-dialog.js b/src/main/resources/templates/editor/plugins/html-entities-dialog/html-entities-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..6c770535b491daceeb4da7fd98c2d1543f44dfad --- /dev/null +++ b/src/main/resources/templates/editor/plugins/html-entities-dialog/html-entities-dialog.js @@ -0,0 +1,173 @@ +/*! + * HTML entities dialog plugin for Editor.md + * + * @file html-entities-dialog.js + * @author pandao + * @version 1.2.0 + * @updateTime 2015-03-08 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "html-entities-dialog"; + var selecteds = []; + var entitiesData = []; + + exports.fn.htmlEntitiesDialog = function() { + var _this = this; + var cm = this.cm; + var lang = _this.lang; + var settings = _this.settings; + var path = settings.pluginPath + pluginName + "/"; + var editor = this.editor; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = _this.classPrefix; + + var dialogName = classPrefix + "dialog-" + pluginName, dialog; + var dialogLang = lang.dialog.htmlEntities; + + var dialogContent = [ + '
        ', + '
        ', + '
        ', + '
        ', + ].join("\r\n"); + + cm.focus(); + + if (editor.find("." + dialogName).length > 0) + { + dialog = editor.find("." + dialogName); + + selecteds = []; + dialog.find("a").removeClass("selected"); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + } + else + { + dialog = this.createDialog({ + name : dialogName, + title : dialogLang.title, + width : 800, + height : 475, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + content : dialogContent, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + enter : [lang.buttons.enter, function() { + cm.replaceSelection(selecteds.join(" ")); + this.hide().lockScreen(false).hideMask(); + + return false; + }], + cancel : [lang.buttons.cancel, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + var table = dialog.find("." + classPrefix + "grid-table"); + + var drawTable = function() { + + if (entitiesData.length < 1) return ; + + var rowNumber = 20; + var pageTotal = Math.ceil(entitiesData.length / rowNumber); + + table.html(""); + + for (var i = 0; i < pageTotal; i++) + { + var row = "
        "; + + for (var x = 0; x < rowNumber; x++) + { + var entity = entitiesData[(i * rowNumber) + x]; + + if (typeof entity !== "undefined") + { + var name = entity.name.replace("&", "&"); + + row += "" + name + ""; + } + } + + row += "
        "; + + table.append(row); + } + + dialog.find("." + classPrefix + "html-entity-btn").bind(exports.mouseOrTouch("click", "touchend"), function() { + $(this).toggleClass("selected"); + + if ($(this).hasClass("selected")) + { + selecteds.push($(this).attr("value")); + } + }); + }; + + if (entitiesData.length < 1) + { + if (typeof (dialog.loading) == "function") dialog.loading(true); + + $.getJSON(path + pluginName.replace("-dialog", "") + ".json", function(json) { + + if (typeof (dialog.loading) == "function") dialog.loading(false); + + entitiesData = json; + drawTable(); + }); + } + else + { + drawTable(); + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/html-entities-dialog/html-entities.json b/src/main/resources/templates/editor/plugins/html-entities-dialog/html-entities.json new file mode 100644 index 0000000000000000000000000000000000000000..e9e8229cb15c4c1aac7a7461991ebb5cbcdf835f --- /dev/null +++ b/src/main/resources/templates/editor/plugins/html-entities-dialog/html-entities.json @@ -0,0 +1,936 @@ +[ + { + "name" : "&#64;", + "description":"at symbol" + }, + { + "name":"&copy;", + "description":"copyright symbol" + }, + { + "name":"&reg;", + "description":"registered symbol" + }, + { + "name":"&trade;", + "description":"trademark symbol" + }, + { + "name":"&hearts;", + "description":"heart" + }, + { + "name":"&nbsp;", + "description":"Inserts a non-breaking blank space" + }, + { + "name":"&amp;", + "description":"Ampersand" + }, + { + "name":"&#36;", + "description":"dollar symbol" + }, + { + "name":"&cent;", + "description":"Cent symbol" + }, + { + "name":"&pound;", + "description":"Pound" + }, + { + "name":"&yen;", + "description":"Yen" + }, + { + "name":"&euro;", + "description":"Euro symbol" + }, + { + "name":"&quot;", + "description":"quotation mark" + }, + { + "name":"&ldquo;", + "description":"Opening Double Quotes " + }, + { + "name":"&rdquo;", + "description":"Closing Double Quotes " + }, + { + "name":"&lsquo;", + "description":"Opening Single Quote Mark " + }, + { + "name":"&rsquo;", + "description":"Closing Single Quote Mark " + }, + { + "name":"&laquo;", + "description":"angle quotation mark (left)" + }, + { + "name":"&raquo;", + "description":"angle quotation mark (right)" + }, + { + "name":"&lsaquo;", + "description":"single left angle quotation" + }, + { + "name":"&rsaquo;", + "description":"single right angle quotation" + }, + { + "name":"&sect;", + "description":"Section Symbol" + }, + { + "name":"&micro;", + "description":"micro sign" + }, + { + "name":"&para;", + "description":"Paragraph symbol" + }, + { + "name":"&bull;", + "description":"Big List Dot" + }, + { + "name":"&middot;", + "description":"Medium List Dot" + }, + { + "name":"&hellip;", + "description":"horizontal ellipsis" + }, + { + "name":"&#124;", + "description":"vertical bar" + }, + { + "name":"&brvbar;", + "description":"broken vertical bar" + }, + { + "name":"&ndash;", + "description":"en-dash" + }, + { + "name":"&mdash;", + "description":"em-dash" + }, + { + "name":"&curren;", + "description":"Generic currency symbol" + }, + { + "name":"&#33;", + "description":"exclamation point" + }, + { + "name":"&#35;", + "description":"number sign" + }, + { + "name":"&#39;", + "description":"single quote" + }, + { + "name":"&#40;", + "description":"" + }, + { + "name":"&#41;", + "description":"" + }, + { + "name":"&#42;", + "description":"asterisk" + }, + { + "name":"&#43;", + "description":"plus sign" + }, + { + "name":"&#44;", + "description":"comma" + }, + { + "name":"&#45;", + "description":"minus sign - hyphen" + }, + { + "name":"&#46;", + "description":"period" + }, + { + "name":"&#47;", + "description":"slash" + }, + { + "name":"&#48;", + "description":"0" + }, + { + "name":"&#49;", + "description":"1" + }, + { + "name":"&#50;", + "description":"2" + }, + { + "name":"&#51;", + "description":"3" + }, + { + "name":"&#52;", + "description":"4" + }, + { + "name":"&#53;", + "description":"5" + }, + { + "name":"&#54;", + "description":"6" + }, + { + "name":"&#55;", + "description":"7" + }, + { + "name":"&#56;", + "description":"8" + }, + { + "name":"&#57;", + "description":"9" + }, + { + "name":"&#58;", + "description":"colon" + }, + { + "name":"&#59;", + "description":"semicolon" + }, + { + "name":"&#61;", + "description":"equal sign" + }, + { + "name":"&#63;", + "description":"question mark" + }, + { + "name":"&lt;", + "description":"Less than" + }, + { + "name":"&gt;", + "description":"Greater than" + }, + { + "name":"&le;", + "description":"Less than or Equal to" + }, + { + "name":"&ge;", + "description":"Greater than or Equal to" + }, + { + "name":"&times;", + "description":"Multiplication symbol" + }, + { + "name":"&divide;", + "description":"Division symbol" + }, + { + "name":"&minus;", + "description":"Minus symbol" + }, + { + "name":"&plusmn;", + "description":"Plus/minus symbol" + }, + { + "name":"&ne;", + "description":"Not Equal" + }, + { + "name":"&sup1;", + "description":"Superscript 1" + }, + { + "name":"&sup2;", + "description":"Superscript 2" + }, + { + "name":"&sup3;", + "description":"Superscript 3" + }, + { + "name":"&frac12;", + "description":"Fraction ½" + }, + { + "name":"&frac14;", + "description":"Fraction ¼" + }, + { + "name":"&frac34;", + "description":"Fraction ¾" + }, + { + "name":"&permil;", + "description":"per mille" + }, + { + "name":"&deg;", + "description":"Degree symbol" + }, + { + "name":"&radic;", + "description":"square root" + }, + { + "name":"&infin;", + "description":"Infinity" + }, + { + "name":"&larr;", + "description":"left arrow" + }, + { + "name":"&uarr;", + "description":"up arrow" + }, + { + "name":"&rarr;", + "description":"right arrow" + }, + { + "name":"&darr;", + "description":"down arrow" + }, + { + "name":"&harr;", + "description":"left right arrow" + }, + { + "name":"&crarr;", + "description":"carriage return arrow" + }, + { + "name":"&lceil;", + "description":"left ceiling" + }, + { + "name":"&rceil;", + "description":"right ceiling" + }, + { + "name":"&lfloor;", + "description":"left floor" + }, + { + "name":"&rfloor;", + "description":"right floor" + }, + { + "name":"&spades;", + "description":"spade" + }, + { + "name":"&clubs;", + "description":"club" + }, + { + "name":"&hearts;", + "description":"heart" + }, + { + "name":"&diams;", + "description":"diamond" + }, + { + "name":"&loz;", + "description":"lozenge" + }, + { + "name":"&dagger;", + "description":"dagger" + }, + { + "name":"&Dagger;", + "description":"double dagger" + }, + { + "name":"&iexcl;", + "description":"inverted exclamation mark" + }, + { + "name":"&iquest;", + "description":"inverted question mark" + }, + { + "name":"&#338;", + "description":"latin capital letter OE" + }, + { + "name":"&#339;", + "description":"latin small letter oe" + }, + { + "name":"&#352;", + "description":"latin capital letter S with caron" + }, + { + "name":"&#353;", + "description":"latin small letter s with caron" + }, + { + "name":"&#376;", + "description":"latin capital letter Y with diaeresis" + }, + { + "name":"&#402;", + "description":"latin small f with hook - function" + }, + { + "name":"&not;", + "description":"not sign" + }, + { + "name":"&ordf;", + "description":"feminine ordinal indicator" + }, + { + "name":"&uml;", + "description":"spacing diaeresis - umlaut" + }, + { + "name":"&macr;", + "description":"spacing macron - overline" + }, + { + "name":"&acute;", + "description":"acute accent - spacing acute" + }, + { + "name":"&Agrave;", + "description":"latin capital letter A with grave" + }, + { + "name":"&Aacute;", + "description":"latin capital letter A with acute" + }, + { + "name":"&Acirc;", + "description":"latin capital letter A with circumflex" + }, + { + "name":"&Atilde;", + "description":"latin capital letter A with tilde" + }, + { + "name":"&Auml;", + "description":"latin capital letter A with diaeresis" + }, + { + "name":"&Aring;", + "description":"latin capital letter A with ring above" + }, + { + "name":"&AElig;", + "description":"latin capital letter AE" + }, + { + "name":"&Ccedil;", + "description":"latin capital letter C with cedilla" + }, + { + "name":"&Egrave;", + "description":"latin capital letter E with grave" + }, + { + "name":"&Eacute;", + "description":"latin capital letter E with acute" + }, + { + "name":"&Ecirc;", + "description":"latin capital letter E with circumflex" + }, + { + "name":"&Euml;", + "description":"latin capital letter E with diaeresis" + }, + { + "name":"&Igrave;", + "description":"latin capital letter I with grave" + }, + { + "name":"&Iacute;", + "description":"latin capital letter I with acute" + }, + { + "name":"&Icirc;", + "description":"latin capital letter I with circumflex" + }, + { + "name":"&Iuml;", + "description":"latin capital letter I with diaeresis" + }, + + { + "name":"&ETH;", + "description":"latin capital letter ETH" + }, + { + "name":"&Ntilde;", + "description":"latin capital letter N with tilde" + }, + { + "name":"&Ograve;", + "description":"latin capital letter O with grave" + }, + { + "name":"&Oacute;", + "description":"latin capital letter O with acute" + }, + { + "name":"&Ocirc;", + "description":"latin capital letter O with circumflex" + }, + { + "name":"&Otilde;", + "description":"latin capital letter O with tilde" + }, + { + "name":"&Ouml;", + "description":"latin capital letter O with diaeresis" + }, + { + "name":"&times;", + "description":"multiplication sign" + }, + { + "name":"&Oslash;", + "description":"latin capital letter O with slash" + }, + { + "name":"&Ugrave;", + "description":"latin capital letter U with grave" + }, + { + "name":"&Uacute;", + "description":"latin capital letter U with acute" + }, + { + "name":"&Ucirc;", + "description":"latin capital letter U with circumflex" + }, + { + "name":"&Uuml;", + "description":"latin capital letter U with diaeresis" + }, + { + "name":"&Yacute;", + "description":"latin capital letter Y with acute" + }, + { + "name":"&THORN;", + "description":"latin capital letter THORN" + }, + { + "name":"&szlig;", + "description":"latin small letter sharp s - ess-zed" + }, + + + { + "name":"&eth;", + "description":"latin capital letter eth" + }, + { + "name":"&ntilde;", + "description":"latin capital letter n with tilde" + }, + { + "name":"&ograve;", + "description":"latin capital letter o with grave" + }, + { + "name":"&oacute;", + "description":"latin capital letter o with acute" + }, + { + "name":"&ocirc;", + "description":"latin capital letter o with circumflex" + }, + { + "name":"&otilde;", + "description":"latin capital letter o with tilde" + }, + { + "name":"&ouml;", + "description":"latin capital letter o with diaeresis" + }, + { + "name":"&times;", + "description":"multiplication sign" + }, + { + "name":"&oslash;", + "description":"latin capital letter o with slash" + }, + { + "name":"&ugrave;", + "description":"latin capital letter u with grave" + }, + { + "name":"&uacute;", + "description":"latin capital letter u with acute" + }, + { + "name":"&ucirc;", + "description":"latin capital letter u with circumflex" + }, + { + "name":"&uuml;", + "description":"latin capital letter u with diaeresis" + }, + { + "name":"&yacute;", + "description":"latin capital letter y with acute" + }, + { + "name":"&thorn;", + "description":"latin capital letter thorn" + }, + { + "name":"&yuml;", + "description":"latin small letter y with diaeresis" + }, + + { + "name":"&agrave;", + "description":"latin capital letter a with grave" + }, + { + "name":"&aacute;", + "description":"latin capital letter a with acute" + }, + { + "name":"&acirc;", + "description":"latin capital letter a with circumflex" + }, + { + "name":"&atilde;", + "description":"latin capital letter a with tilde" + }, + { + "name":"&auml;", + "description":"latin capital letter a with diaeresis" + }, + { + "name":"&aring;", + "description":"latin capital letter a with ring above" + }, + { + "name":"&aelig;", + "description":"latin capital letter ae" + }, + { + "name":"&ccedil;", + "description":"latin capital letter c with cedilla" + }, + { + "name":"&egrave;", + "description":"latin capital letter e with grave" + }, + { + "name":"&eacute;", + "description":"latin capital letter e with acute" + }, + { + "name":"&ecirc;", + "description":"latin capital letter e with circumflex" + }, + { + "name":"&euml;", + "description":"latin capital letter e with diaeresis" + }, + { + "name":"&igrave;", + "description":"latin capital letter i with grave" + }, + { + "name":"&Iacute;", + "description":"latin capital letter i with acute" + }, + { + "name":"&icirc;", + "description":"latin capital letter i with circumflex" + }, + { + "name":"&iuml;", + "description":"latin capital letter i with diaeresis" + }, + + { + "name":"&#65;", + "description":"A" + }, + { + "name":"&#66;", + "description":"B" + }, + { + "name":"&#67;", + "description":"C" + }, + { + "name":"&#68;", + "description":"D" + }, + { + "name":"&#69;", + "description":"E" + }, + { + "name":"&#70;", + "description":"F" + }, + { + "name":"&#71;", + "description":"G" + }, + { + "name":"&#72;", + "description":"H" + }, + { + "name":"&#73;", + "description":"I" + }, + { + "name":"&#74;", + "description":"J" + }, + { + "name":"&#75;", + "description":"K" + }, + { + "name":"&#76;", + "description":"L" + }, + { + "name":"&#77;", + "description":"M" + }, + { + "name":"&#78;", + "description":"N" + }, + { + "name":"&#79;", + "description":"O" + }, + { + "name":"&#80;", + "description":"P" + }, + { + "name":"&#81;", + "description":"Q" + }, + { + "name":"&#82;", + "description":"R" + }, + { + "name":"&#83;", + "description":"S" + }, + { + "name":"&#84;", + "description":"T" + }, + { + "name":"&#85;", + "description":"U" + }, + { + "name":"&#86;", + "description":"V" + }, + { + "name":"&#87;", + "description":"W" + }, + { + "name":"&#88;", + "description":"X" + }, + { + "name":"&#89;", + "description":"Y" + }, + { + "name":"&#90;", + "description":"Z" + }, + { + "name":"&#91;", + "description":"opening bracket" + }, + { + "name":"&#92;", + "description":"backslash" + }, + { + "name":"&#93;", + "description":"closing bracket" + }, + { + "name":"&#94;", + "description":"caret - circumflex" + }, + { + "name":"&#95;", + "description":"underscore" + }, + + { + "name":"&#96;", + "description":"grave accent" + }, + { + "name":"&#97;", + "description":"a" + }, + { + "name":"&#98;", + "description":"b" + }, + { + "name":"&#99;", + "description":"c" + }, + { + "name":"&#100;", + "description":"d" + }, + { + "name":"&#101;", + "description":"e" + }, + { + "name":"&#102;", + "description":"f" + }, + { + "name":"&#103;", + "description":"g" + }, + { + "name":"&#104;", + "description":"h" + }, + { + "name":"&#105;", + "description":"i" + }, + { + "name":"&#106;", + "description":"j" + }, + { + "name":"&#107;", + "description":"k" + }, + { + "name":"&#108;", + "description":"l" + }, + { + "name":"&#109;", + "description":"m" + }, + { + "name":"&#110;", + "description":"n" + }, + { + "name":"&#111;", + "description":"o" + }, + { + "name":"&#112;", + "description":"p" + }, + { + "name":"&#113;", + "description":"q" + }, + { + "name":"&#114;", + "description":"r" + }, + { + "name":"&#115;", + "description":"s" + }, + { + "name":"&#116;", + "description":"t" + }, + { + "name":"&#117;", + "description":"u" + }, + { + "name":"&#118;", + "description":"v" + }, + { + "name":"&#119;", + "description":"w" + }, + { + "name":"&#120;", + "description":"x" + }, + { + "name":"&#121;", + "description":"y" + }, + { + "name":"&#122;", + "description":"z" + }, + { + "name":"&#123;", + "description":"opening brace" + }, + { + "name":"&#124;", + "description":"vertical bar" + }, + { + "name":"&#125;", + "description":"closing brace" + }, + { + "name":"&#126;", + "description":"equivalency sign - tilde" + } +] \ No newline at end of file diff --git a/src/main/resources/templates/editor/plugins/image-dialog/image-dialog.js b/src/main/resources/templates/editor/plugins/image-dialog/image-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..58c5d25fd373c118b78f3c50dac834a871e300de --- /dev/null +++ b/src/main/resources/templates/editor/plugins/image-dialog/image-dialog.js @@ -0,0 +1,221 @@ +/*! + * Image (upload) dialog plugin for Editor.md + * + * @file image-dialog.js + * @author pandao + * @version 1.3.4 + * @updateTime 2015-06-09 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var pluginName = "image-dialog"; + + exports.fn.imageDialog = function() { + + var _this = this; + var cm = this.cm; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var imageLang = lang.dialog.image; + var classPrefix = this.classPrefix; + var iframeName = classPrefix + "image-iframe"; + var dialogName = classPrefix + pluginName, dialog; + + cm.focus(); + + var loading = function(show) { + var _loading = dialog.find("." + classPrefix + "dialog-mask"); + _loading[(show) ? "show" : "hide"](); + }; + + if (editor.find("." + dialogName).length < 1) + { + var guid = (new Date).getTime(); + var action = settings.imageUploadURL + (settings.imageUploadURL.indexOf("?") >= 0 ? "&" : "?") + "guid=" + guid; + + if (settings.crossDomainUpload) + { + action += "&callback=" + settings.uploadCallbackURL + "&dialog_id=editormd-image-dialog-" + guid; + } + + var dialogContent = ( (settings.imageUpload) ? "
        " : "
        " ) + + ( (settings.imageUpload) ? "" : "" ) + + "" + + "" + (function(){ + return (settings.imageUpload) ? "
        " + + "" + + "" + + "
        " : ""; + })() + + "
        " + + "" + + "" + + "
        " + + "" + + "" + + "
        " + + ( (settings.imageUpload) ? "" : "
        "); + + //var imageFooterHTML = ""; + + dialog = this.createDialog({ + title : imageLang.title, + width : (settings.imageUpload) ? 465 : 380, + height : 254, + name : dialogName, + content : dialogContent, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + enter : [lang.buttons.enter, function() { + var url = this.find("[data-url]").val(); + var alt = this.find("[data-alt]").val(); + var link = this.find("[data-link]").val(); + + if (url === "") + { + alert(imageLang.imageURLEmpty); + return false; + } + + var altAttr = (alt !== "") ? " \"" + alt + "\"" : ""; + + if (link === "" || link === "http://") + { + cm.replaceSelection("![" + alt + "](" + url + altAttr + ")"); + } + else + { + cm.replaceSelection("[![" + alt + "](" + url + altAttr + ")](" + link + altAttr + ")"); + } + + if (alt === "") { + cm.setCursor(cursor.line, cursor.ch + 2); + } + + this.hide().lockScreen(false).hideMask(); + + return false; + }], + + cancel : [lang.buttons.cancel, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + + dialog.attr("id", classPrefix + "image-dialog-" + guid); + + if (!settings.imageUpload) { + return ; + } + + var fileInput = dialog.find("[name=\"" + classPrefix + "image-file\"]"); + + fileInput.bind("change", function() { + var fileName = fileInput.val(); + var isImage = new RegExp("(\\.(" + settings.imageFormats.join("|") + "))$"); // /(\.(webp|jpg|jpeg|gif|bmp|png))$/ + + if (fileName === "") + { + alert(imageLang.uploadFileEmpty); + + return false; + } + + if (!isImage.test(fileName)) + { + alert(imageLang.formatNotAllowed + settings.imageFormats.join(", ")); + + return false; + } + + loading(true); + + var submitHandler = function() { + + var uploadIframe = document.getElementById(iframeName); + + uploadIframe.onload = function() { + + loading(false); + + var body = (uploadIframe.contentWindow ? uploadIframe.contentWindow : uploadIframe.contentDocument).document.body; + var json = (body.innerText) ? body.innerText : ( (body.textContent) ? body.textContent : null); + + json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")"); + + if(!settings.crossDomainUpload) + { + if (json.success === 1) + { + dialog.find("[data-url]").val(json.url); + } + else + { + alert(json.message); + } + } + + return false; + }; + }; + + dialog.find("[type=\"submit\"]").bind("click", submitHandler).trigger("click"); + }); + } + + dialog = editor.find("." + dialogName); + dialog.find("[type=\"text\"]").val(""); + dialog.find("[type=\"file\"]").val(""); + dialog.find("[data-link]").val("http://"); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/link-dialog/link-dialog.js b/src/main/resources/templates/editor/plugins/link-dialog/link-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..3e1d0bf04c7a7a9ddeb4e61aa6274f8d25f3e58e --- /dev/null +++ b/src/main/resources/templates/editor/plugins/link-dialog/link-dialog.js @@ -0,0 +1,133 @@ +/*! + * Link dialog plugin for Editor.md + * + * @file link-dialog.js + * @author pandao + * @version 1.2.1 + * @updateTime 2015-06-09 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var pluginName = "link-dialog"; + + exports.fn.linkDialog = function() { + + var _this = this; + var cm = this.cm; + var editor = this.editor; + var settings = this.settings; + var selection = cm.getSelection(); + var lang = this.lang; + var linkLang = lang.dialog.link; + var classPrefix = this.classPrefix; + var dialogName = classPrefix + pluginName, dialog; + + cm.focus(); + + if (editor.find("." + dialogName).length > 0) + { + dialog = editor.find("." + dialogName); + dialog.find("[data-url]").val("http://"); + dialog.find("[data-title]").val(selection); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + } + else + { + var dialogHTML = "
        " + + "" + + "" + + "
        " + + "" + + "" + + "
        " + + "
        "; + + dialog = this.createDialog({ + title : linkLang.title, + width : 380, + height : 211, + content : dialogHTML, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + enter : [lang.buttons.enter, function() { + var url = this.find("[data-url]").val(); + var title = this.find("[data-title]").val(); + + if (url === "http://" || url === "") + { + alert(linkLang.urlEmpty); + return false; + } + + /*if (title === "") + { + alert(linkLang.titleEmpty); + return false; + }*/ + + var str = "[" + title + "](" + url + " \"" + title + "\")"; + + if (title == "") + { + str = "[" + url + "](" + url + ")"; + } + + cm.replaceSelection(str); + + this.hide().lockScreen(false).hideMask(); + + return false; + }], + + cancel : [lang.buttons.cancel, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/plugin-template.js b/src/main/resources/templates/editor/plugins/plugin-template.js new file mode 100644 index 0000000000000000000000000000000000000000..8e301697dc2fdce34716b4d3efb26683c8cacec3 --- /dev/null +++ b/src/main/resources/templates/editor/plugins/plugin-template.js @@ -0,0 +1,111 @@ +/*! + * Link dialog plugin for Editor.md + * + * @file link-dialog.js + * @author pandao + * @version 1.2.0 + * @updateTime 2015-03-07 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var $ = jQuery; // if using module loader(Require.js/Sea.js). + + var langs = { + "zh-cn" : { + toolbar : { + table : "表格" + }, + dialog : { + table : { + title : "添加表格", + cellsLabel : "单元格数", + alignLabel : "对齐方式", + rows : "行数", + cols : "列数", + aligns : ["默认", "左对齐", "居中对齐", "右对齐"] + } + } + }, + "zh-tw" : { + toolbar : { + table : "添加表格" + }, + dialog : { + table : { + title : "添加表格", + cellsLabel : "單元格數", + alignLabel : "對齊方式", + rows : "行數", + cols : "列數", + aligns : ["默認", "左對齊", "居中對齊", "右對齊"] + } + } + }, + "en" : { + toolbar : { + table : "Tables" + }, + dialog : { + table : { + title : "Tables", + cellsLabel : "Cells", + alignLabel : "Align", + rows : "Rows", + cols : "Cols", + aligns : ["Default", "Left align", "Center align", "Right align"] + } + } + } + }; + + exports.fn.htmlEntities = function() { + /* + var _this = this; // this == the current instance object of Editor.md + var lang = _this.lang; + var settings = _this.settings; + var editor = this.editor; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = this.classPrefix; + + $.extend(true, this.lang, langs[this.lang.name]); // l18n + this.setToolbar(); + + cm.focus(); + */ + //.... + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/preformatted-text-dialog/preformatted-text-dialog.js b/src/main/resources/templates/editor/plugins/preformatted-text-dialog/preformatted-text-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..c890adc68498e145487c6fcaecd582537f823ba9 --- /dev/null +++ b/src/main/resources/templates/editor/plugins/preformatted-text-dialog/preformatted-text-dialog.js @@ -0,0 +1,172 @@ +/*! + * Preformatted text dialog plugin for Editor.md + * + * @file preformatted-text-dialog.js + * @author pandao + * @version 1.2.0 + * @updateTime 2015-03-07 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + var cmEditor; + var pluginName = "preformatted-text-dialog"; + + exports.fn.preformattedTextDialog = function() { + + var _this = this; + var cm = this.cm; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = this.classPrefix; + var dialogLang = lang.dialog.preformattedText; + var dialogName = classPrefix + pluginName, dialog; + + cm.focus(); + + if (editor.find("." + dialogName).length > 0) + { + dialog = editor.find("." + dialogName); + dialog.find("textarea").val(selection); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + } + else + { + var dialogContent = ""; + + dialog = this.createDialog({ + name : dialogName, + title : dialogLang.title, + width : 780, + height : 540, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + content : dialogContent, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + enter : [lang.buttons.enter, function() { + var codeTexts = this.find("textarea").val(); + + if (codeTexts === "") + { + alert(dialogLang.emptyAlert); + return false; + } + + codeTexts = codeTexts.split("\n"); + + for (var i in codeTexts) + { + codeTexts[i] = " " + codeTexts[i]; + } + + codeTexts = codeTexts.join("\n"); + + if (cursor.ch !== 0) { + codeTexts = "\r\n\r\n" + codeTexts; + } + + cm.replaceSelection(codeTexts); + + this.hide().lockScreen(false).hideMask(); + + return false; + }], + cancel : [lang.buttons.cancel, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + var cmConfig = { + mode : "text/html", + theme : settings.theme, + tabSize : 4, + autofocus : true, + autoCloseTags : true, + indentUnit : 4, + lineNumbers : true, + lineWrapping : true, + extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }}, + foldGutter : true, + gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], + matchBrackets : true, + indentWithTabs : true, + styleActiveLine : true, + styleSelectedText : true, + autoCloseBrackets : true, + showTrailingSpace : true, + highlightSelectionMatches : true + }; + + var textarea = dialog.find("textarea"); + var cmObj = dialog.find(".CodeMirror"); + + if (dialog.find(".CodeMirror").length < 1) + { + cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig); + cmObj = dialog.find(".CodeMirror"); + + cmObj.css({ + "float" : "none", + margin : "0 0 5px", + border : "1px solid #ddd", + fontSize : settings.fontSize, + width : "100%", + height : "410px" + }); + + cmEditor.on("change", function(cm) { + textarea.val(cm.getValue()); + }); + } + else + { + cmEditor.setValue(cm.getSelection()); + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/reference-link-dialog/reference-link-dialog.js b/src/main/resources/templates/editor/plugins/reference-link-dialog/reference-link-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..f1ad086bf21cbbe553cd78242aab388f8d9bc8bf --- /dev/null +++ b/src/main/resources/templates/editor/plugins/reference-link-dialog/reference-link-dialog.js @@ -0,0 +1,153 @@ +/*! + * Reference link dialog plugin for Editor.md + * + * @file reference-link-dialog.js + * @author pandao + * @version 1.2.1 + * @updateTime 2015-06-09 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var pluginName = "reference-link-dialog"; + var ReLinkId = 1; + + exports.fn.referenceLinkDialog = function() { + + var _this = this; + var cm = this.cm; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var dialogLang = lang.dialog.referenceLink; + var classPrefix = this.classPrefix; + var dialogName = classPrefix + pluginName, dialog; + + cm.focus(); + + if (editor.find("." + dialogName).length < 1) + { + var dialogHTML = "
        " + + "" + + "" + + "
        " + + "" + + "" + + "
        " + + "" + + "" + + "
        " + + "" + + "" + + "
        " + + "
        "; + + dialog = this.createDialog({ + name : dialogName, + title : dialogLang.title, + width : 380, + height : 296, + content : dialogHTML, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + enter : [lang.buttons.enter, function() { + var name = this.find("[data-name]").val(); + var url = this.find("[data-url]").val(); + var rid = this.find("[data-url-id]").val(); + var title = this.find("[data-title]").val(); + + if (name === "") + { + alert(dialogLang.nameEmpty); + return false; + } + + if (rid === "") + { + alert(dialogLang.idEmpty); + return false; + } + + if (url === "http://" || url === "") + { + alert(dialogLang.urlEmpty); + return false; + } + + //cm.replaceSelection("[" + title + "][" + name + "]\n[" + name + "]: " + url + ""); + cm.replaceSelection("[" + name + "][" + rid + "]"); + + if (selection === "") { + cm.setCursor(cursor.line, cursor.ch + 1); + } + + title = (title === "") ? "" : " \"" + title + "\""; + + cm.setValue(cm.getValue() + "\n[" + rid + "]: " + url + title + ""); + + this.hide().lockScreen(false).hideMask(); + + return false; + }], + cancel : [lang.buttons.cancel, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + dialog = editor.find("." + dialogName); + dialog.find("[data-name]").val("[" + ReLinkId + "]"); + dialog.find("[data-url-id]").val(""); + dialog.find("[data-url]").val("http://"); + dialog.find("[data-title]").val(selection); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + + ReLinkId++; + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/table-dialog/table-dialog.js b/src/main/resources/templates/editor/plugins/table-dialog/table-dialog.js new file mode 100644 index 0000000000000000000000000000000000000000..578adf25bc63789ac2537aa09b13209632d0b172 --- /dev/null +++ b/src/main/resources/templates/editor/plugins/table-dialog/table-dialog.js @@ -0,0 +1,218 @@ +/*! + * Table dialog plugin for Editor.md + * + * @file table-dialog.js + * @author pandao + * @version 1.2.1 + * @updateTime 2015-06-09 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "table-dialog"; + + var langs = { + "zh-cn" : { + toolbar : { + table : "表格" + }, + dialog : { + table : { + title : "添加表格", + cellsLabel : "单元格数", + alignLabel : "对齐方式", + rows : "行数", + cols : "列数", + aligns : ["默认", "左对齐", "居中对齐", "右对齐"] + } + } + }, + "zh-tw" : { + toolbar : { + table : "添加表格" + }, + dialog : { + table : { + title : "添加表格", + cellsLabel : "單元格數", + alignLabel : "對齊方式", + rows : "行數", + cols : "列數", + aligns : ["默認", "左對齊", "居中對齊", "右對齊"] + } + } + }, + "en" : { + toolbar : { + table : "Tables" + }, + dialog : { + table : { + title : "Tables", + cellsLabel : "Cells", + alignLabel : "Align", + rows : "Rows", + cols : "Cols", + aligns : ["Default", "Left align", "Center align", "Right align"] + } + } + } + }; + + exports.fn.tableDialog = function() { + var _this = this; + var cm = this.cm; + var editor = this.editor; + var settings = this.settings; + var path = settings.path + "../plugins/" + pluginName +"/"; + var classPrefix = this.classPrefix; + var dialogName = classPrefix + pluginName, dialog; + + $.extend(true, this.lang, langs[this.lang.name]); + this.setToolbar(); + + var lang = this.lang; + var dialogLang = lang.dialog.table; + + var dialogContent = [ + "
        ", + "", + dialogLang.rows + "   ", + dialogLang.cols + "
        ", + "", + "
        ", + "
        " + ].join("\n"); + + if (editor.find("." + dialogName).length > 0) + { + dialog = editor.find("." + dialogName); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + } + else + { + dialog = this.createDialog({ + name : dialogName, + title : dialogLang.title, + width : 360, + height : 226, + mask : settings.dialogShowMask, + drag : settings.dialogDraggable, + content : dialogContent, + lockScreen : settings.dialogLockScreen, + maskStyle : { + opacity : settings.dialogMaskOpacity, + backgroundColor : settings.dialogMaskBgColor + }, + buttons : { + enter : [lang.buttons.enter, function() { + var rows = parseInt(this.find("[data-rows]").val()); + var cols = parseInt(this.find("[data-cols]").val()); + var align = this.find("[name=\"table-align\"]:checked").val(); + var table = ""; + var hrLine = "------------"; + + var alignSign = { + _default : hrLine, + left : ":" + hrLine, + center : ":" + hrLine + ":", + right : hrLine + ":" + }; + + if ( rows > 1 && cols > 0) + { + for (var r = 0, len = rows; r < len; r++) + { + var row = []; + var head = []; + + for (var c = 0, len2 = cols; c < len2; c++) + { + if (r === 1) { + head.push(alignSign[align]); + } + + row.push(" "); + } + + if (r === 1) { + table += "| " + head.join(" | ") + " |" + "\n"; + } + + table += "| " + row.join( (cols === 1) ? "" : " | " ) + " |" + "\n"; + } + } + + cm.replaceSelection(table); + + this.hide().lockScreen(false).hideMask(); + + return false; + }], + + cancel : [lang.buttons.cancel, function() { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + var faBtns = dialog.find(".fa-btns"); + + if (faBtns.html() === "") + { + var icons = ["align-justify", "align-left", "align-center", "align-right"]; + var _lang = dialogLang.aligns; + var values = ["_default", "left", "center", "right"]; + + for (var i = 0, len = icons.length; i < len; i++) + { + var checked = (i === 0) ? " checked=\"checked\"" : ""; + var btn = ""; + + faBtns.append(btn); + } + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/src/main/resources/templates/editor/plugins/test-plugin/test-plugin.js b/src/main/resources/templates/editor/plugins/test-plugin/test-plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..bc4da31de0dd52b834bb48e5d719e9925141aec6 --- /dev/null +++ b/src/main/resources/templates/editor/plugins/test-plugin/test-plugin.js @@ -0,0 +1,66 @@ +/*! + * Test plugin for Editor.md + * + * @file test-plugin.js + * @author pandao + * @version 1.2.0 + * @updateTime 2015-03-07 + * {@link https://github.com/pandao/editor.md} + * @license MIT + */ + +(function() { + + var factory = function (exports) { + + var $ = jQuery; // if using module loader(Require.js/Sea.js). + + exports.testPlugin = function(){ + alert("testPlugin"); + }; + + exports.fn.testPluginMethodA = function() { + /* + var _this = this; // this == the current instance object of Editor.md + var lang = _this.lang; + var settings = _this.settings; + var editor = this.editor; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = this.classPrefix; + + cm.focus(); + */ + //.... + + alert("testPluginMethodA"); + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") + { + module.exports = factory; + } + else if (typeof define === "function") // AMD/CMD/Sea.js + { + if (define.amd) { // for Require.js + + define(["editormd"], function(editormd) { + factory(editormd); + }); + + } else { // for Sea.js + define(function(require) { + var editormd = require("./../../editormd"); + factory(editormd); + }); + } + } + else + { + factory(window.editormd); + } + +})(); diff --git a/bootdo/src/main/resources/templates/error/403.html b/src/main/resources/templates/error/403.html similarity index 100% rename from bootdo/src/main/resources/templates/error/403.html rename to src/main/resources/templates/error/403.html diff --git a/bootdo/src/main/resources/templates/error/404.html b/src/main/resources/templates/error/404.html similarity index 100% rename from bootdo/src/main/resources/templates/error/404.html rename to src/main/resources/templates/error/404.html diff --git a/bootdo/src/main/resources/templates/error/500.html b/src/main/resources/templates/error/500.html similarity index 100% rename from bootdo/src/main/resources/templates/error/500.html rename to src/main/resources/templates/error/500.html diff --git a/bootdo/src/main/resources/templates/error/error.html b/src/main/resources/templates/error/error.html similarity index 100% rename from bootdo/src/main/resources/templates/error/error.html rename to src/main/resources/templates/error/error.html diff --git a/bootdo/src/main/resources/templates/include.html b/src/main/resources/templates/include.html similarity index 97% rename from bootdo/src/main/resources/templates/include.html rename to src/main/resources/templates/include.html index dd77d8cca2b2b98db4bbff16250bfffe9c8dd357..7604d19c4aab9aaef72ce246a6f0a5ae728b7cb8 100644 --- a/bootdo/src/main/resources/templates/include.html +++ b/src/main/resources/templates/include.html @@ -1,47 +1,47 @@ - - - - - - - - - - - - - - - - - - -
        - - - - - - - - - - - - - - - - - - -
        + + + + + + + + + + + + + + + + + + +
        + + + + + + + + + + + + + + + + + + +
        diff --git a/bootdo/src/main/resources/templates/index_v1.html b/src/main/resources/templates/index_v1.html similarity index 96% rename from bootdo/src/main/resources/templates/index_v1.html rename to src/main/resources/templates/index_v1.html index eef180c8663c70bcbe0e9135ca978939b618b934..76d139b600519cbc871284a51d2844d4219a3668 100644 --- a/bootdo/src/main/resources/templates/index_v1.html +++ b/src/main/resources/templates/index_v1.html @@ -67,15 +67,17 @@ data-index="0" th:href="@{/main}">了解BootDo
    • -
    • - 基础信息 - +
    • + + + 基础信息 +
    • @@ -130,7 +132,7 @@ - +