text
stringlengths
1
2.83M
id
stringlengths
16
152
metadata
dict
__index_level_0__
int64
0
949
Feature: Download As a user I want to download resources Background: Given "Admin" creates following user using API | id | | Alice | | Brian | Scenario: download resources When "Alice" logs in And "Alice" creates the following folders in personal space using API | name | | folderPublic | | emptyFolder | And "Alice" creates the following files into personal space using API | pathToFile | content | | folderPublic/lorem.txt | lorem ipsum | And "Alice" uploads the following local file into personal space using API | localFile | to | | filesForUpload/testavatar.jpg | testavatar.jpg | And "Alice" shares the following resource using API | resource | recipient | type | role | | folderPublic | Brian | user | Can edit | | emptyFolder | Brian | user | Can edit | | testavatar.jpg | Brian | user | Can edit | When "Alice" opens the "files" app And "Alice" downloads the following resources using the batch action | resource | type | | folderPublic | folder | | emptyFolder | folder | | testavatar.jpg | file | And "Alice" opens the following file in mediaviewer | resource | | testavatar.jpg | And "Alice" downloads the following image from the mediaviewer | resource | | testavatar.jpg | And "Alice" closes the file viewer And "Alice" logs out And "Brian" logs in And "Brian" navigates to the shared with me page And "Brian" downloads the following resources using the batch action | resource | type | | folderPublic | folder | | emptyFolder | folder | | testavatar.jpg | file | And "Brian" downloads the following resources using the sidebar panel | resource | from | type | | lorem.txt | folderPublic | file | | testavatar.jpg | | file | | folderPublic | | folder | | emptyFolder | | folder | And "Brian" opens the following file in mediaviewer | resource | | testavatar.jpg | And "Brian" downloads the following image from the mediaviewer | resource | | testavatar.jpg | And "Brian" logs out
owncloud/web/tests/e2e/cucumber/features/smoke/download.feature/0
{ "file_path": "owncloud/web/tests/e2e/cucumber/features/smoke/download.feature", "repo_id": "owncloud", "token_count": 970 }
880
Feature: spaces member expiry Scenario: space members can be invited with an expiration date Given "Admin" creates following users using API | id | | Alice | | Brian | And "Admin" assigns following roles to the users using API | id | role | | Alice | Space Admin | And "Alice" logs in And "Alice" creates the following project space using API | name | id | | team | team.1 | When "Alice" opens the "files" app And "Alice" navigates to the projects space page And "Alice" navigates to the project space "team.1" And "Alice" adds following users to the project space | user | role | kind | | Brian | Can edit | user | And "Alice" sets the expiration date of the member "Brian" of the project space to "+5 days" When "Brian" logs in And "Brian" navigates to the projects space page And "Brian" navigates to the project space "team.1" And "Brian" logs out When "Alice" navigates to the projects space page And "Alice" navigates to the project space "team.1" And "Alice" removes the expiration date of the member "Brian" of the project space And "Alice" logs out
owncloud/web/tests/e2e/cucumber/features/spaces/memberExpiry.feature/0
{ "file_path": "owncloud/web/tests/e2e/cucumber/features/spaces/memberExpiry.feature", "repo_id": "owncloud", "token_count": 408 }
881
import { When, Then } from '@cucumber/cucumber' import { World } from '../../environment' import { objects } from '../../../support' import { expect } from '@playwright/test' Then( '{string} should see the message {string} on the webUI', async function (this: World, stepUser: string, message: string): Promise<void> { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const searchObject = new objects.applicationFiles.Search({ page }) const actualMessage = await searchObject.getSearchResultMessage() expect(actualMessage).toBe(message) } ) When( '{string} selects tag {string} from the search result filter chip', async function (this: World, stepUser: string, tag: string): Promise<void> { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const searchObject = new objects.applicationFiles.Search({ page }) await searchObject.selectTagFilter({ tag }) } ) When( /^"([^"]*)" (enable|disable)s the option to search title only?$/, async function (this: World, stepUser: string, enableOrDisable: string): Promise<void> { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const searchObject = new objects.applicationFiles.Search({ page }) await searchObject.toggleSearchTitleOnly({ enableOrDisable }) } ) When( '{string} selects mediaType {string} from the search result filter chip', async function (this: World, stepUser: string, mediaType: string): Promise<void> { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const searchObject = new objects.applicationFiles.Search({ page }) await searchObject.selectMediaTypeFilter({ mediaType }) } ) When( '{string} selects lastModified {string} from the search result filter chip', async function (this: World, stepUser: string, lastModified: string): Promise<void> { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const searchObject = new objects.applicationFiles.Search({ page }) await searchObject.selectlastModifiedFilter({ lastModified }) } ) When( /^"([^"].*)" clears (mediaType|tags|lastModified|fullText) filter$/, async function (this: World, stepUser: string, filter: string): Promise<void> { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const searchObject = new objects.applicationFiles.Search({ page }) await searchObject.clearFilter({ filter: filter as 'mediaType' | 'tags' | 'lastModified' | 'fullText' }) } )
owncloud/web/tests/e2e/cucumber/steps/ui/search.ts/0
{ "file_path": "owncloud/web/tests/e2e/cucumber/steps/ui/search.ts", "repo_id": "owncloud", "token_count": 763 }
882
import { Response } from 'node-fetch' import join from 'join-path' import { checkResponseStatus, request } from '../http' import { Space, User } from '../../types' import { createFolderInsideSpaceBySpaceName, getIdOfFileInsideSpace, uploadFileInsideSpaceBySpaceName } from '../davSpaces' interface DrivesResponse { value: Space[] } export const getPersonalSpaceId = async ({ user }: { user: User }): Promise<string> => { const response = await request({ method: 'GET', path: join('graph', 'v1.0', 'me', 'drives', "?$filter=driveType eq 'personal'"), user: user }) checkResponseStatus(response, 'Failed while geting personal space') const resBody = (await response.json()) as DrivesResponse return resBody.value[0].id } export const getSpaceIdBySpaceName = async ({ user, spaceType, spaceName }: { user: User spaceType: string spaceName: string }): Promise<string> => { const response = await request({ method: 'GET', path: join('graph', 'v1.0', 'me', 'drives', `?$filter=driveType eq '${spaceType}'`), user: user }) checkResponseStatus(response, 'Failed while fetching spaces') // search for the space with the space name const resBody = (await response.json()) as DrivesResponse for (const spaceProject of resBody.value) { if (spaceProject.name === spaceName) { return spaceProject.id } } throw new Error(`Could not find space ${spaceName}`) } export const createSpace = async ({ user, space }: { user: User space: Space }): Promise<string> => { const body = JSON.stringify({ id: space.id, name: space.name }) const response = await request({ method: 'POST', path: join('graph', 'v1.0', 'drives'), body, user: user }) // To make api request work consistently with UI we need to create a hidden folder '.space' // Inside .space it consist of files that may be required to update the space (e.g. change description of space (stored by readme.md), change image of space) checkResponseStatus(response, 'Failed while creating a space project') const resBody = (await response.json()) as Space const spaceName = resBody.name // API call to make a hidden file when the space creation is successful await createFolderInsideSpaceBySpaceName({ user, folder: '.space', spaceName }) // Again make an api call to create a readme.md file so that the description is shown in the web UI await uploadFileInsideSpaceBySpaceName({ user, pathToFile: '.space/readme.md', spaceName }) // Again make an api call to get file id of the uploaded file `readme.md` const fileId = await getIdOfFileInsideSpace({ user, pathToFileName: '.space/readme.md', spaceType: 'project', spaceName }) // After getting file id make a patch request to update space special section await updateSpaceSpecialSection({ user, spaceId: resBody.id, type: 'description', fileId: fileId }) return resBody.id } export const updateSpaceSpecialSection = async ({ user, spaceId, type, fileId }: { user: User spaceId: string type: string fileId: string }): Promise<void> => { if (type === 'description') { type = 'readme' } else { type = 'image' } const body = JSON.stringify({ special: [ { specialFolder: { name: type }, id: fileId } ] }) const response = await request({ method: 'PATCH', path: join('graph', 'v1.0', 'drives', spaceId), body: body, user: user }) checkResponseStatus( response, `Failed while creating special section "${type}" inside project space` ) } export const disableSpace = ({ user, space }: { user: User; space: Space }): Promise<Response> => { return request({ method: 'DELETE', path: join('graph', 'v1.0', 'drives', space.id), user: user }) } export const deleteSpace = ({ user, space }: { user: User; space: Space }): Promise<Response> => { return request({ method: 'DELETE', path: join('graph', 'v1.0', 'drives', space.id), user: user, header: { Purge: 'T' } }) }
owncloud/web/tests/e2e/support/api/graph/spaces.ts/0
{ "file_path": "owncloud/web/tests/e2e/support/api/graph/spaces.ts", "repo_id": "owncloud", "token_count": 1395 }
883
export { ActorsEnvironment } from './actors'
owncloud/web/tests/e2e/support/environment/actor/index.ts/0
{ "file_path": "owncloud/web/tests/e2e/support/environment/actor/index.ts", "repo_id": "owncloud", "token_count": 13 }
884
import { Page } from '@playwright/test' export class General { #page: Page constructor({ page }: { page: Page }) { this.#page = page } async navigate(): Promise<void> { await this.#page.locator('//a[@data-nav-name="admin-settings-general"]').click() await this.#page.locator('#app-loading-spinner').waitFor({ state: 'detached' }) } }
owncloud/web/tests/e2e/support/objects/app-admin-settings/page/general.ts/0
{ "file_path": "owncloud/web/tests/e2e/support/objects/app-admin-settings/page/general.ts", "repo_id": "owncloud", "token_count": 126 }
885
import { Page } from '@playwright/test' const personalSpaceNavSelector = '//a[@data-nav-name="files-spaces-generic"]' export class Personal { #page: Page constructor({ page }: { page: Page }) { this.#page = page } async navigate(): Promise<void> { await this.#page.locator(personalSpaceNavSelector).click() } }
owncloud/web/tests/e2e/support/objects/app-files/page/spaces/personal.ts/0
{ "file_path": "owncloud/web/tests/e2e/support/objects/app-files/page/spaces/personal.ts", "repo_id": "owncloud", "token_count": 113 }
886
import { Page } from '@playwright/test' import * as po from './actions' import { SpacesEnvironment } from '../../../environment' export class Trashbin { #page: Page #spacesEnvironment: SpacesEnvironment constructor({ page }: { page: Page }) { this.#page = page this.#spacesEnvironment = new SpacesEnvironment() } async open(key: string): Promise<void> { const { id } = this.#spacesEnvironment.getSpace({ key }) await po.openTrashbin({ page: this.#page, id }) } }
owncloud/web/tests/e2e/support/objects/app-files/trashbin/index.ts/0
{ "file_path": "owncloud/web/tests/e2e/support/objects/app-files/trashbin/index.ts", "repo_id": "owncloud", "token_count": 155 }
887
import { Space } from '../types' export const createdSpaceStore = new Map<string, Space>()
owncloud/web/tests/e2e/support/store/space.ts/0
{ "file_path": "owncloud/web/tests/e2e/support/store/space.ts", "repo_id": "owncloud", "token_count": 26 }
888
import { defineConfig, searchForWorkspaceRoot } from 'vite' import _defineConfig, { historyModePlugins } from './vite.config' import { join } from 'path' /** * NOTE: This is a special config file for CERN. It overwrites some of the code paths to implement custom logic * that only applies to CERN. It can and should be ignored in all other cases! * * Web can be run using this config via `pnpm build:w -c vite.cern.config.ts` or `pnpm vite -c vite.cern.config.ts`. */ const projectRootDir = searchForWorkspaceRoot(process.cwd()) export default defineConfig(async (args) => { let config if (typeof _defineConfig === 'function') { config = await _defineConfig(args) } else { config = _defineConfig } config.server = { port: 9201, strictPort: true } // collapsible table config.resolve.alias['design-system/src/components/OcTable/OcTable.vue'] = join( projectRootDir, 'packages/web-pkg/src/cern/components/CollapsibleOcTable.vue' ) // token info request config.resolve.alias['web-runtime/src/composables/tokenInfo'] = join( projectRootDir, 'packages/web-pkg/src/cern/composables/useLoadTokenInfo' ) // create space component config.resolve.alias['../../components/AppBar/CreateSpace.vue'] = join( projectRootDir, 'packages/web-pkg/src/cern/components/CreateSpace.vue' ) config.plugins.push(historyModePlugins()[0]) return config })
owncloud/web/vite.cern.config.ts/0
{ "file_path": "owncloud/web/vite.cern.config.ts", "repo_id": "owncloud", "token_count": 482 }
889
<?php include_once "inc/config.inc.php"; include_once "inc/mysql.inc.php"; $link=connect(); $html=''; if(isset($_POST['submit'])){ if($_POST['username']!=null && $_POST['password']!=null){ //转义,防注入 $username=escape($link, $_POST['username']); $password=escape($link, $_POST['password']); $query="select * from users where username='$username' and password=md5('$password')"; $result=execute($link, $query); if(mysqli_num_rows($result)==1){ $data=mysqli_fetch_assoc($result); $_SESSION['pkxss']['username']=$username; $_SESSION['pkxss']['password']=sha1(md5($password)); header("location:xssmanager.php"); }else{ $html.="<p>登录失败,请重新登录</p>"; } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>pikachu Xss 后台</title> <link rel="stylesheet" type="text/css" href="pkxss.css"/> </head> <body> <div id="title"> <h1>pikachu Xss 后台</h1> <?php echo $html;?> <div> <form method="post"> 用户:<input name="username" type="text" /> 密码<input name="password" type="password" /> <input type="submit" name="submit" value="login" /> </form> </div> </div> <p>admin/123456</p> </body> </html>
zhuifengshaonianhanlu/pikachu/pkxss/pkxss_login.php/0
{ "file_path": "zhuifengshaonianhanlu/pikachu/pkxss/pkxss_login.php", "repo_id": "zhuifengshaonianhanlu", "token_count": 745 }
890
<?php $html=<<<A <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div id="dt_jarheads"> <pre> a man has a lots of choices and these choices made in life are rarely perfect so he decides to sign a contract cause h wants to make a difference he wants to save this world make it a better place when that contract is signed he will no longer choose when he wants to eat, sleep, fuck or fight those decisions will be made for him he will be part of something bigger than himself he will train for 70 consecutive days and get to know every inch of his m16A4 rifle better then his own dick then he will go to the desert and fight and die. why is he fighting? why is he dying? what's the fucking point? we're professional fighting men! we're jarheads! </pre> </div> </body> </html> A; ?>
zhuifengshaonianhanlu/pikachu/vul/dir/soup/jarheads.php/0
{ "file_path": "zhuifengshaonianhanlu/pikachu/vul/dir/soup/jarheads.php", "repo_id": "zhuifengshaonianhanlu", "token_count": 331 }
891
<?php /** * Created by runner.han * There is nothing new under the sun */ $SELF_PAGE = substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1); if ($SELF_PAGE = "abc.php"){ $ACTIVE = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','active open','','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); } $PIKA_ROOT_DIR = "../../"; include_once $PIKA_ROOT_DIR.'header.php'; if(isset($_GET['logout']) && $_GET['logout'] == '1'){ setcookie('abc[uname]',''); setcookie('abc[pw]',''); header("location:findabc.php"); } ?> <div class="main-content"> <div class="main-content-inner"> <div class="breadcrumbs ace-save-state" id="breadcrumbs"> <ul class="breadcrumb"> <li> <i class="ace-icon fa fa-home home-icon"></i> <a href="infoleak.php">敏感信息泄露</a> </li> <li class="active">abc</li> </ul> </div> <div class="page-content"> <a href="abc.php?logout=1">退出登陆</a> <br /> <br /> <p>那一天我二十一岁,在我一生的黄金时代</p> <p>我有好多奢望。我想爱,想吃,还想在一瞬间变成天上半明半暗的云</p> <p>后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消失,最后变得像挨了锤的牛一样</p> <p>可是我过二十一岁生日时没有预见到这一点。我觉得自己会永远生猛下去,什么也锤不了我</p> -----王小波《黄金时代》 </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <?php include_once $PIKA_ROOT_DIR . 'footer.php'; ?>
zhuifengshaonianhanlu/pikachu/vul/infoleak/abc.php/0
{ "file_path": "zhuifengshaonianhanlu/pikachu/vul/infoleak/abc.php", "repo_id": "zhuifengshaonianhanlu", "token_count": 1192 }
892
<?php /** * Created by runner.han * There is nothing new under the sun */ $SELF_PAGE = substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1); if ($SELF_PAGE = "sqli_del.php"){ $ACTIVE = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','active open','','','','','','','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); } $PIKA_ROOT_DIR = "../../"; include_once $PIKA_ROOT_DIR . 'header.php'; include_once $PIKA_ROOT_DIR . "inc/config.inc.php"; include_once $PIKA_ROOT_DIR . "inc/function.php"; include_once $PIKA_ROOT_DIR . "inc/mysql.inc.php"; $link=connect(); $html=''; if(array_key_exists("message",$_POST) && $_POST['message']!=null){ //插入转义 $message=escape($link, $_POST['message']); $query="insert into message(content,time) values('$message',now())"; $result=execute($link, $query); if(mysqli_affected_rows($link)!=1){ $html.="<p>出现异常,提交失败!</p>"; } } // if(array_key_exists('id', $_GET) && is_numeric($_GET['id'])){ //没对传进来的id进行处理,导致DEL注入 if(array_key_exists('id', $_GET)){ $query="delete from message where id={$_GET['id']}"; $result=execute($link, $query); if(mysqli_affected_rows($link)==1){ header("location:sqli_del.php"); }else{ $html.="<p style='color: red'>删除失败,检查下数据库是不是挂了</p>"; } } ?> <div class="main-content"> <div class="main-content-inner"> <div class="breadcrumbs ace-save-state" id="breadcrumbs"> <ul class="breadcrumb"> <li> <i class="ace-icon fa fa-home home-icon"></i> <a href="../sqli.php">sqli</a> </li> <li class="active">delete注入</li> </ul><!-- /.breadcrumb --> <a href="#" style="float:right" data-container="body" data-toggle="popover" data-placement="bottom" title="tips(再点一下关闭)" data-content="删除留言的的时候,好像有点问题"> 点一下提示~ </a> </div> <div class="page-content"> <div id="sqli_del_main"> <p class="sqli_del_title">我是一个不正经的留言板:</p> <form method="post"> <textarea class="sqli_del_in" name="message"></textarea><br /> <input class="sqli_del_submit" type="submit" name="submit" value="submit" /> </form> <?php echo $html;?> <br /> <div id="show_message"> <p class="line">留言列表:</p> <?php $query="select * from message"; $result=execute($link, $query); while($data=mysqli_fetch_assoc($result)){ //输出转义,防XSS $content=htmlspecialchars($data['content'],ENT_QUOTES); echo "<p class='con'>{$content}</p><a href='sqli_del.php?id={$data['id']}'>删除</a>"; } ?> </div> </div> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <?php include_once $PIKA_ROOT_DIR . 'footer.php'; ?>
zhuifengshaonianhanlu/pikachu/vul/sqli/sqli_del.php/0
{ "file_path": "zhuifengshaonianhanlu/pikachu/vul/sqli/sqli_del.php", "repo_id": "zhuifengshaonianhanlu", "token_count": 1911 }
893
<?php $html = <<<A <br> <pre> 我爱这土地—艾青 假如我是一只鸟, 我也应该用嘶哑的喉咙歌唱: 这被暴风雨所打击着的土地, 这永远汹涌着我们的悲愤的河流, 这无止息地吹刮着的激怒的风, 和那来自林间的无比温柔的黎明…… ——然后我死了, 连羽毛也腐烂在土地里面。 为什么我的眼里常含泪水? 因为我对这土地爱得深沉…… </pre> A; echo $html;
zhuifengshaonianhanlu/pikachu/vul/ssrf/ssrf_info/info2.php/0
{ "file_path": "zhuifengshaonianhanlu/pikachu/vul/ssrf/ssrf_info/info2.php", "repo_id": "zhuifengshaonianhanlu", "token_count": 331 }
894
<?php /** * Created by runner.han * There is nothing new under the sun */ $SELF_PAGE = substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1); if ($SELF_PAGE = "clientcheck.php"){ $ACTIVE = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','active open','','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); } $PIKA_ROOT_DIR = "../../"; include_once $PIKA_ROOT_DIR . 'header.php'; include_once $PIKA_ROOT_DIR.'inc/uploadfunction.php'; $html=''; if(isset($_POST['submit'])){ // var_dump($_FILES); $save_path='uploads';//指定在当前目录建立一个目录 $upload=upload_client('uploadfile',$save_path);//调用函数 if($upload['return']){ $html.="<p class='notice'>文件上传成功</p><p class='notice'>文件保存的路径为:{$upload['new_path']}</p>"; }else{ $html.="<p class=notice>{$upload['error']}</p>"; } } ?> <div class="main-content"> <div class="main-content-inner"> <div class="breadcrumbs ace-save-state" id="breadcrumbs"> <ul class="breadcrumb"> <li> <i class="ace-icon fa fa-home home-icon"></i> <a href="upload.php">unsafe upfileupload</a> </li> <li class="active">客户端check</li> </ul><!-- /.breadcrumb --> <a href="#" style="float:right" data-container="body" data-toggle="popover" data-placement="bottom" title="tips(再点一下关闭)" data-content="一切在前端做的安全措施都是不靠谱的"> 点一下提示~ </a> </div> <div class="page-content"> <div id="usu_main"> <p class="title">这里只允许上传图片o!</p> <form class="upload" method="post" enctype="multipart/form-data" action=""> <input class="uploadfile" type="file" name="uploadfile" onchange="checkFileExt(this.value)"/><br /> <input class="sub" type="submit" name="submit" value="开始上传" /> </form> <?php echo $html;//输出了路径,暴露了 ?> </div> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <script> function checkFileExt(filename) { var flag = false; //状态 var arr = ["jpg","png","gif"]; //取出上传文件的扩展名 var index = filename.lastIndexOf("."); var ext = filename.substr(index+1); //比较 for(var i=0;i<arr.length;i++) { if(ext == arr[i]) { flag = true; //一旦找到合适的,立即退出循环 break; } } //条件判断 if(!flag) { alert("上传的文件不符合要求,请重新选择!"); location.reload(true); } } </script> <?php include_once $PIKA_ROOT_DIR . 'footer.php'; ?>
zhuifengshaonianhanlu/pikachu/vul/unsafeupload/clientcheck.php/0
{ "file_path": "zhuifengshaonianhanlu/pikachu/vul/unsafeupload/clientcheck.php", "repo_id": "zhuifengshaonianhanlu", "token_count": 1778 }
895
<?php /** * Created by runner.han * There is nothing new under the sun */ $SELF_PAGE = substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],'/')+1); if ($SELF_PAGE = "xss_reflected_get.php"){ $ACTIVE = array('','','','','','','','active open','','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); } $PIKA_ROOT_DIR = "../../"; include_once $PIKA_ROOT_DIR.'header.php'; $html=''; if(isset($_GET['submit'])){ if(empty($_GET['message'])){ $html.="<p class='notice'>输入'kobe'试试-_-</p>"; }else{ if($_GET['message']=='kobe'){ $html.="<p class='notice'>愿你和{$_GET['message']}一样,永远年轻,永远热血沸腾!</p><img src='{$PIKA_ROOT_DIR}assets/images/nbaplayer/kobe.png' />"; }else{ $html.="<p class='notice'>who is {$_GET['message']},i don't care!</p>"; } } } ?> <div class="main-content"> <div class="main-content-inner"> <div class="breadcrumbs ace-save-state" id="breadcrumbs"> <ul class="breadcrumb"> <li> <i class="ace-icon fa fa-home home-icon"></i> <a href="xss.php">xss</a> </li> <li class="active">反射型xss(get)</li> </ul><!-- /.breadcrumb --> <a href="#" style="float:right" data-container="body" data-toggle="popover" data-placement="bottom" title="tips(再点一下关闭)" data-content="管tmd什么xss,首先你应该输入kobe看一下再说"> 点一下提示~ </a> </div> <div class="page-content"> <div id="xssr_main"> <p class="xssr_title">Which NBA player do you like?</p> <form method="get"> <input class="xssr_in" type="text" maxlength="20" name="message" /> <input class="xssr_submit" type="submit" name="submit" value="submit" /> </form> <?php echo $html;?> </div> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <?php include_once $PIKA_ROOT_DIR.'footer.php'; ?>
zhuifengshaonianhanlu/pikachu/vul/xss/xss_reflected_get.php/0
{ "file_path": "zhuifengshaonianhanlu/pikachu/vul/xss/xss_reflected_get.php", "repo_id": "zhuifengshaonianhanlu", "token_count": 1277 }
896
// Copyright (c) 2021 8th Wall, Inc. /* globals XR8 */ // add 'Tap + Hold to Add to Photos' prompt when user takes a photo window.addEventListener('mediarecorder-photocomplete', () => { document.getElementById('overlay') ? document.getElementById('overlay').style.display = 'block' : document.body.insertAdjacentHTML('beforeend', '<div id="overlay"><div id="savePrompt">Tap + Hold to Add to Photos</div></div>') }) // hide 'Tap + Hold to Add to Photos' prompt when user dismisses preview modal window.addEventListener('mediarecorder-previewclosed', () => { if (document.getElementById('overlay')) { document.getElementById('overlay').style.display = 'none' } }) const onxrloaded = () => { XR8.CanvasScreenshot.configure({maxDimension: 1920, jpgCompression: 100}) } window.XR8 ? onxrloaded() : window.addEventListener('xrloaded', onxrloaded)
8thwall/web/examples/aframe/capturephoto/photo-mode.js/0
{ "file_path": "8thwall/web/examples/aframe/capturephoto/photo-mode.js", "repo_id": "8thwall", "token_count": 289 }
0
# 8th Wall Web Examples - AFrame - Portal [Try the live demo here](https://8thwall.8thwall.app/portal-aframe) This example shows off the popular portal illusion in web AR using three.js materials and the camera position as an event trigger. ![](https://media.giphy.com/media/S5cOkP6H4UbFY8Tlsg/giphy.gif) ### Project Components ```portal``` component hides and shows certain elements as the camera moves. ```xrextras-hider-material``` is applied to any mesh or primitive that must be transparent while blocking the rendering of models behind it. ```cubemap-static``` applies environment cubemaps to glb models. - 'cubemap-static.js' is a slightly modified version of ['cube-env-map.js'](https://raw.githubusercontent.com/donmccurdy/aframe-extras/master/src/misc/cube-env-map.js) that works with 8th Wall's asset hierarchy. Learn more about donmccurdy's aframe-extras [here](https://github.com/donmccurdy/aframe-extras/tree/master/src/misc#cube-env-map). ```bob``` animates the ball up and down depending on 'distance' and 'duration' parameters. - distance: (default: 0.15) - duration: (default: 1000)
8thwall/web/examples/aframe/portal/README.md/0
{ "file_path": "8thwall/web/examples/aframe/portal/README.md", "repo_id": "8thwall", "token_count": 360 }
1
# A-Frame: Sky Effects Template This Sky Effects template project showcases the sky coaching overlay, explains how to use the sky scene to attach assets to the sky segmentation layer, and how to replace the sky texture. ![](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExNGJhMTBmZDZmMDA2ODQwNzkzMmY5MmZmOTY0MDQ4NzQyODUzMjA3NCZjdD1n/5XPvrqoJ64p54GLj3i/giphy.gif) For detailed documentation, visit the [Sky Effects docs](https://www.8thwall.com/docs/web/#xr8layerscontroller) 🔗 #### Sky Effects Overview * **sky-recenter.js** recenters the sky scene automatically when sky is initially detected to ensure that the scene forward direction is the same as where sky was found. * **sky-coaching-overlay** configures a sky coaching overlay to instruct users to look towards the sky when they are not looking at it. This component comes from the API and can be added using `<meta name="8thwall:package" content="@8thwall.coaching-overlay">` * **sky-remote-authoring** reconfigures your scene for sky effects desktop development and allows for remote authoring. * **space.png** default space texture with an opacity gradient applied to the bottom to help with edge feathering ### *Developing Sky Effects Experiences* Sky effects scenes are designed for scenes that exist only in the sky. 1. In your `<a-scene>` add the `xrlayers` component 2. In your scene, add a sky scene using `<a-entity xrlayerscene="name:sky"></a-entity>` 3. Parent objects under the sky scene to attach them to the sky layer. Using Components for Sky Effects * The `#pivot` `<a-entity>` will help you position assets in a spherical manner, it acts as a pivot that you offset your object from and then lets you position the object by rotating the pivot on the x and y axes. You may have to alter the rotation of the object itself depending on where you are positioning the object. * Use the `edgeSmoothness` attribute of the `<a-entity xrlayerscene="name:sky>` element to feather the segmentation mask so that the edge between sky and not sky is more natural. * Use the `invertLayerMask` attribute of the `<a-entity xrlayerscene="name:sky>` element to overlay everything but sky pixels within the sky scene. * The `sky-coaching-overlay` helps instruct users to find the sky in order to start the sky effects experience. ### *Remote Desktop Development Setup* ![](https://media.giphy.com/media/HyrfHNnj0UKpnDj7PM/giphy-downsized-large.gif) It is often helpful to use the `sky-remote-authoring` component to position sky effects content remotely on your desktop. To set up this project's scene for remote desktop development, disable any components related to 8thWall's AR engine or mobile development by adding a letter to the beginning (i.e. "Zxrlayers") or removing it altogether. The `sky-remote-authoring` component will automatically remove the following components: - xrlayers - xrextras-loading - xrextras-runtime-error - landing-page - sky-coaching-overlay Next, add the `sky-remote-authoring` component to your <a-scene> element as last component in the list of attached components (after `xrlayers`). Now you can open the sky effects scene and position content relative to the sky through any desktop browser! Extra Notes: * Make sure opacity is set to 1 on the <a-sky> element if the sky texture is not visible. * Toggle the foreground element using the schema value `foreground` on the `sky-remote-authoring` component. * The `sky-remote-authoring` component will automatically reparent elements in your sky scene to the <a-scene> for desktop development * Ensure `sky-remote-authoring` is listed last/in the correct order on the <a-scene> element or else remote authoring may not work correctly. ### *Other Features* * Laptop Mode: Sky effects also work on laptop cameras. * Pin to Camera: Pin sky effects to the camera instead of to the world by nesting the whole sky scene within the `<a-camera>` or you can append the camera to the sky scene and append specific objects to the camera. * Remote Development: An alternative to using the `sky-remote-authoring` component would be to use a stock image of the sky ([example](https://wallpapercave.com/wp/wp2894344.jpg)) on a monitor. ### About Sky Effects With Sky Effects for 8th Wall, developers now have the power to turn day into night, stage an AR alien invasion with flying UFOs and let users interact with larger than life characters that tower over the city skyline. While the sky's the limit in the use of this new feature, Sky Effects are a perfect way to celebrate a new movie release, add visual effects to an outdoor concert or take a sports game to the next level
8thwall/web/examples/aframe/sky/README.md/0
{ "file_path": "8thwall/web/examples/aframe/sky/README.md", "repo_id": "8thwall", "token_count": 1256 }
2
/* Ported to JavaScript by Lazar Laszlo 2011 lazarsoft@gmail.com, www.lazarsoft.info */ /* * * Copyright 2007 ZXing authors * * 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. */ function ErrorCorrectionLevel(ordinal, bits, name) { this.ordinal_Renamed_Field = ordinal; this.bits = bits; this.name = name; this.__defineGetter__("Bits", function() { return this.bits; }); this.__defineGetter__("Name", function() { return this.name; }); this.ordinal=function() { return this.ordinal_Renamed_Field; } } ErrorCorrectionLevel.forBits=function( bits) { if (bits < 0 || bits >= FOR_BITS.length) { throw "ArgumentException"; } return FOR_BITS[bits]; } var L = new ErrorCorrectionLevel(0, 0x01, "L"); var M = new ErrorCorrectionLevel(1, 0x00, "M"); var Q = new ErrorCorrectionLevel(2, 0x03, "Q"); var H = new ErrorCorrectionLevel(3, 0x02, "H"); var FOR_BITS = new Array( M, L, H, Q);
8thwall/web/examples/camerapipeline/qrcode/jsqrcode/src/errorlevel.js/0
{ "file_path": "8thwall/web/examples/camerapipeline/qrcode/jsqrcode/src/errorlevel.js", "repo_id": "8thwall", "token_count": 485 }
3
<!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <title>8th Wall Web: 8i</title> <link rel="stylesheet" type="text/css" href="index.css"> <!-- THREE.js must be supplied --> <script src="//cdnjs.cloudflare.com/ajax/libs/three.js/93/three.min.js"></script> <!-- XR Extras - provides utilities like load screen, almost there, and error handling. See github.com/8thwall/web/tree/master/xrextras --> <script src="//cdn.8thwall.com/web/xrextras/xrextras.js"></script> <!-- 8thWall Web - Replace the app key here with your own app key --> <script async src="//apps.8thwall.com/xrweb?appKey=XXXXXXXX"></script> <!-- 8i library --> <script type="text/javascript" src="https://player.8i.com/interface/1.4/eighti.min.js"></script> <!-- client code --> <script src="index.js"></script> </head> <body> <canvas id="camerafeed"></canvas> </body> </html>
8thwall/web/examples/threejs/8i-hologram/index.html/0
{ "file_path": "8thwall/web/examples/threejs/8i-hologram/index.html", "repo_id": "8thwall", "token_count": 387 }
4
/*jshint esversion: 6, asi: true, laxbreak: true*/ // handcontroller.js: Opens the browser's web camera and runs AR with Hand Tracking. // Attach this to an entity in the PlayCanvas scene. var HandController = pc.createScript('handController'); HandController.attributes.add('coverimage', { type: 'asset', assetType: 'texture' }); // initialize code called once per entity HandController.prototype.initialize = function() { XR8.HandController.configure({ coordinates: { axes: 'RIGHT_HANDED', mirroredDisplay: false, } }) const pcCamera = XRExtras.PlayCanvas.findOneCamera(this.entity) let box_ = null let mesh_ = null let handKind_ = 2 let rightIndices_ = null let leftIndices_ = null // Fires when loading begins for additional hand AR resources. this.app.on('xr:handloading', ({maxDetections, pointsPerDetection, rightIndices, leftIndices}) => { const node = new pc.GraphNode(); console.log('number of verts') console.log(pointsPerDetection) console.log('number of triangles') console.log(rightIndices.length) rightIndices_ = rightIndices.map((i) => [i.a, i.b, i.c]).flat() leftIndices_ = leftIndices.map((i) => [i.a, i.b, i.c]).flat() // const material = this.material.resource; mesh_ = pc.createMesh( this.app.graphicsDevice, new Array(pointsPerDetection * 3).fill(0.0), // setting filler vertex positions { indices: rightIndices, // normals: new Array(pointsPerDetection * 3).fill(0.0), } ); const material = new pc.StandardMaterial() const meshInstance = new pc.MeshInstance(node, mesh_, material) const model = new pc.Model() model.graph = node model.meshInstances.push(meshInstance) this.entity.model.model = model box_ = this.app.root.findByName('Box') const scale = 0.05 box_.setLocalScale(scale, scale, scale) this.entity.addChild(box_) }, {}) // Fires when all hand AR resources have been loaded and scanning has begun. this.app.on('xr:handscanning', ({maxDetections, pointsPerDetection, indices, uvs}) => { }, {}) // Fires when a hand first found this.app.on('xr:handfound', ({id, transform, attachmentPoints, vertices, normals}) => { // console.log('hand found') this.entity.enabled = true }, {}) // Fires when a hand is lost this.app.on('xr:handlost', ({id}) => { // console.log('hand lost') this.entity.enabled = false }, {}) // Fires when a hand is subsequently found. this.app.on('xr:handupdated', ({id, handKind, transform, attachmentPoints, vertices, normals}) => { if (handKind_ !== handKind) { handKind_ = handKind if (handKind_ === 1) { mesh_.setIndices(leftIndices_) } else { mesh_.setIndices(rightIndices_) } } const {position, rotation, scale} = transform this.entity.setPosition(position.x, position.y, position.z) this.entity.setLocalScale(scale, scale, scale) this.entity.setRotation(rotation.x, rotation.y, rotation.z, rotation.w) const palmPt = attachmentPoints['palm'] box_.setLocalPosition(palmPt.position.x, palmPt.position.y, palmPt.position.z) box_.translateLocal(0, 0, .05) box_.setLocalRotation(palmPt.rotation.x, palmPt.rotation.y, palmPt.rotation.z, palmPt.rotation.w) // Set mesh vertices in local space mesh_.setPositions(vertices.map((vertexPos) => [vertexPos.x, vertexPos.y, vertexPos.z]).flat()) // Set vertex normals mesh_.setNormals(normals.map((normal) => [normal.x, normal.y, normal.z]).flat()) mesh_.update() }, {}) // After XR has fully loaded, open the camera feed and start displaying AR. const runOnLoad = ({pcCamera, pcApp}, extramodules) => () => { const config = { allowedDevices: XR8.XrConfig.device().ANY, cameraConfig: {direction: XR8.XrConfig.camera().FRONT}, // Pass in your canvas name. Typically this is 'application-canvas'. canvas: document.getElementById('application-canvas') } XRExtras.MediaRecorder.initRecordButton() // Adds record button XRExtras.MediaRecorder.initMediaPreview() // Adds media preview and share XRExtras.MediaRecorder.configure({ coverImageUrl: this.coverimage.getFileUrl(), shortLink: 'playcanv.as/xxx', }) XR8.PlayCanvas.run({pcCamera, pcApp}, extramodules, config) } XRExtras.Loading.showLoading({onxrloaded: runOnLoad({pcCamera, pcApp: this.app}, [ XRExtras.Loading.pipelineModule(), // Manages the loading screen on startup. XR8.CanvasScreenshot.pipelineModule(), // Required for photo capture XR8.HandController.pipelineModule(), // Runs Hand Tracking. ])}) };
8thwall/web/gettingstarted/playcanvas/scripts/handcontroller.js/0
{ "file_path": "8thwall/web/gettingstarted/playcanvas/scripts/handcontroller.js", "repo_id": "8thwall", "token_count": 1725 }
5
import type {ComponentDefinition} from 'aframe' declare const THREE: any const handAnchorComponent: ComponentDefinition = { init() { let id_ = null const show = ({detail}) => { if (id_ && detail.id !== id_) { return } id_ = detail.id const {position, rotation, scale} = detail.transform this.el.object3D.position.copy(position) this.el.object3D.quaternion.copy(rotation) this.el.object3D.scale.set(scale, scale, scale) this.el.object3D.visible = true } const hide = () => { this.el.object3D.visible = false id_ = null } this.el.sceneEl.addEventListener('xrhandfound', show) this.el.sceneEl.addEventListener('xrhandupdated', show) this.el.sceneEl.addEventListener('xrhandlost', hide) }, } const handAttachmentComponent: ComponentDefinition = { schema: { 'point': {type: 'string', default: 'palm'}, 'pointType': {type: 'string', default: 'center'}, }, init() { let id_ = null let position const show = ({detail}) => { if (id_ && detail.id !== id_) { return } id_ = detail.id const apt = detail.attachmentPoints[this.data.point] if (!apt) { // eslint-disable-next-line no-console console.error(`Invalid attachmentPoint ${this.data.point}`) return } const {rotation} = apt // set position based on pointType parameter const {pointType} = this.data if (pointType === 'center') { position = apt.position } else if (pointType === 'inner') { position = apt.innerPoint } else if (pointType === 'outer') { position = apt.outerPoint } else { // eslint-disable-next-line no-console console.error('Please input a valid pointType, options are: center, inner, outer') return } this.el.object3D.position.copy(position) this.el.object3D.quaternion.copy(rotation) this.el.object3D.visible = true } const hide = () => { this.el.object3D.visible = false id_ = null } this.el.sceneEl.addEventListener('xrhandfound', show) this.el.sceneEl.addEventListener('xrhandupdated', show) this.el.sceneEl.addEventListener('xrhandlost', hide) }, } const handMesh = (modelGeometry, material, wireframe, uvOrientation) => { let handKind = 2 const geometry = new THREE.BufferGeometry() // Fill geometry with default vertices. const vertices = new Float32Array(modelGeometry.pointsPerDetection * 3) geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3)) // Fill geometry with default normals. const normals = new Float32Array(modelGeometry.pointsPerDetection * 3) geometry.setAttribute('normal', new THREE.BufferAttribute(normals, 3)) // Create and set UVs based on uvOrientation // Instantiate both left and right hand indices as we use them at runtime const rightIndices = new Array(modelGeometry.rightIndices.length * 3) for (let i = 0; i < modelGeometry.rightIndices.length; ++i) { rightIndices[i * 3] = modelGeometry.rightIndices[i].a rightIndices[i * 3 + 1] = modelGeometry.rightIndices[i].b rightIndices[i * 3 + 2] = modelGeometry.rightIndices[i].c } const leftIndices = new Array(modelGeometry.leftIndices.length * 3) for (let i = 0; i < modelGeometry.leftIndices.length; ++i) { leftIndices[i * 3] = modelGeometry.leftIndices[i].a leftIndices[i * 3 + 1] = modelGeometry.leftIndices[i].b leftIndices[i * 3 + 2] = modelGeometry.leftIndices[i].c } // Construct UVs based on hand mesh orientation let uv if (uvOrientation === 'left') { const leftUvs = new Float32Array(modelGeometry.leftUvs.length * 2) for (let i = 0; i < modelGeometry.pointsPerDetection; i++) { leftUvs[2 * i] = modelGeometry.leftUvs[i].u leftUvs[2 * i + 1] = modelGeometry.leftUvs[i].v } const leftUvBuffer = new THREE.BufferAttribute(leftUvs, 2) uv = leftUvBuffer geometry.setIndex(leftIndices) } else if (uvOrientation === 'right') { const rightUvs = new Float32Array(modelGeometry.rightUvs.length * 2) for (let i = 0; i < modelGeometry.pointsPerDetection; i++) { rightUvs[2 * i] = modelGeometry.rightUvs[i].u rightUvs[2 * i + 1] = modelGeometry.rightUvs[i].v } const rightUvBuffer = new THREE.BufferAttribute(rightUvs, 2) uv = rightUvBuffer geometry.setIndex(rightIndices) } geometry.setAttribute('uv', uv) if (wireframe) { material.wireframe = true } const mesh = new THREE.Mesh(geometry, material) const show = ({detail}) => { // set indices based on handKind if (handKind !== detail.handKind) { handKind = detail.handKind if (handKind === 1) { mesh.geometry.setIndex(leftIndices) } else { mesh.geometry.setIndex(rightIndices) } } // Update vertex positions. for (let i = 0; i < detail.vertices.length; ++i) { vertices[i * 3] = detail.vertices[i].x vertices[i * 3 + 1] = detail.vertices[i].y vertices[i * 3 + 2] = detail.vertices[i].z } mesh.geometry.attributes.position.needsUpdate = true // Update vertex normals. for (let i = 0; i < detail.normals.length; ++i) { normals[i * 3] = detail.normals[i].x normals[i * 3 + 1] = detail.normals[i].y normals[i * 3 + 2] = detail.normals[i].z } mesh.geometry.attributes.normal.needsUpdate = true // make it so frustum doesn't cull mesh when hand is close to camera mesh.frustumCulled = false mesh.visible = true } const hide = () => { mesh.visible = false } return { mesh, show, hide, } } const handMeshComponent: ComponentDefinition = { schema: { 'material-resource': {type: 'string'}, 'wireframe': {type: 'boolean', default: false}, 'uv-orientation': {type: 'string', default: 'right'}, }, init() { this.handMesh = null const beforeRun = ({detail}) => { let material if (this.el.getAttribute('material')) { material = this.el.components.material.material } else if (this.data['material-resource']) { material = this.el.sceneEl.querySelector(this.data['material-resource']).material } else { material = new THREE.MeshBasicMaterial( {color: '#7611B6', opacity: 0.5, transparent: true} ) } this.handMesh = handMesh(detail, material, this.data.wireframe, this.data['uv-orientation']) this.el.setObject3D('mesh', this.handMesh.mesh) this.el.emit('model-loaded') } const show = (event) => { this.handMesh.show(event) this.el.object3D.visible = true } const hide = () => { this.handMesh.hide() this.el.object3D.visible = false } this.el.sceneEl.addEventListener('xrhandloading', beforeRun) this.el.sceneEl.addEventListener('xrhandfound', show) this.el.sceneEl.addEventListener('xrhandupdated', show) this.el.sceneEl.addEventListener('xrhandlost', hide) }, update() { if (!this.handMesh) { return } let material if (this.el.getAttribute('material')) { material = this.el.components.material.material } else if (this.data['material-resource']) { material = this.el.sceneEl.querySelector(this.data['material-resource']).material } else { material = new THREE.MeshBasicMaterial({color: '#7611B6', opacity: 0.5, transparent: true}) } this.handMesh.mesh.material = material }, } const handOccluder = (modelGeometry, material, adjustment) => { let handKind = 2 const geometry = new THREE.BufferGeometry() // Fill geometry with default vertices. const vertices = new Float32Array(modelGeometry.pointsPerDetection * 3) geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3)) // Fill geometry with default normals. const normals = new Float32Array(modelGeometry.pointsPerDetection * 3) geometry.setAttribute('normal', new THREE.BufferAttribute(normals, 3)) // Add the indices. const rightIndices = new Array(modelGeometry.rightIndices.length * 3) for (let i = 0; i < modelGeometry.rightIndices.length; ++i) { rightIndices[i * 3] = modelGeometry.rightIndices[i].a rightIndices[i * 3 + 1] = modelGeometry.rightIndices[i].b rightIndices[i * 3 + 2] = modelGeometry.rightIndices[i].c } const leftIndices = new Array(modelGeometry.leftIndices.length * 3) for (let i = 0; i < modelGeometry.leftIndices.length; ++i) { leftIndices[i * 3] = modelGeometry.leftIndices[i].a leftIndices[i * 3 + 1] = modelGeometry.leftIndices[i].b leftIndices[i * 3 + 2] = modelGeometry.leftIndices[i].c } geometry.setIndex(rightIndices) const mesh = new THREE.Mesh(geometry, material) const show = ({detail}) => { // Update vertex indices based on handKind if (detail.handKind !== handKind) { handKind = detail.handKind if (handKind === 1) { mesh.geometry.setIndex(leftIndices) } else { mesh.geometry.setIndex(rightIndices) } } // Update vertex positions. for (let i = 0; i < detail.vertices.length; ++i) { vertices[i * 3] = detail.vertices[i].x vertices[i * 3 + 1] = detail.vertices[i].y vertices[i * 3 + 2] = detail.vertices[i].z } mesh.geometry.attributes.position.needsUpdate = true // Update vertex normals. for (let i = 0; i < detail.normals.length; ++i) { normals[i * 3] = detail.normals[i].x normals[i * 3 + 1] = detail.normals[i].y normals[i * 3 + 2] = detail.normals[i].z } mesh.geometry.attributes.normal.needsUpdate = true // Update vertex positions along the normal to make occluder smaller and prevent z-fighting for (let i = 0; i < detail.vertices.length; ++i) { const normal = detail.normals[i] // Shift the position along the normal. const shiftAmount = adjustment // Adjust this value as needed vertices[i * 3] += normal.x * shiftAmount vertices[i * 3 + 1] += normal.y * shiftAmount vertices[i * 3 + 2] += normal.z * shiftAmount } mesh.geometry.attributes.position.needsUpdate = true // make it so frustum doesn't cull mesh when hand is close to camera mesh.frustumCulled = false mesh.visible = true } const hide = () => { mesh.visible = false } return { mesh, show, hide, } } const handOccluderComponent: ComponentDefinition = { schema: { 'show': {type: 'boolean', default: false}, 'adjustment': {type: 'number', default: 0.002}, }, init() { this.handOccluder = null const beforeRun = ({detail}) => { const material = new THREE.MeshStandardMaterial( {color: '#F5F5F5', transparent: false, colorWrite: false} ) this.handOccluder = handOccluder(detail, material, this.data.adjustment) this.el.setObject3D('mesh', this.handOccluder.mesh) this.el.emit('model-loaded') } const show = (event) => { if (this.data.show) { this.handOccluder.mesh.material.colorWrite = true } else { this.handOccluder.mesh.material.colorWrite = false } this.handOccluder.show(event) this.el.object3D.visible = true } const hide = () => { this.handOccluder.hide() this.el.object3D.visible = false } this.el.sceneEl.addEventListener('xrhandloading', beforeRun) this.el.sceneEl.addEventListener('xrhandfound', show) this.el.sceneEl.addEventListener('xrhandupdated', show) this.el.sceneEl.addEventListener('xrhandlost', hide) }, } export { handAnchorComponent, handAttachmentComponent, handMeshComponent, handOccluderComponent, }
8thwall/web/xrextras/src/aframe/components/hand-components.ts/0
{ "file_path": "8thwall/web/xrextras/src/aframe/components/hand-components.ts", "repo_id": "8thwall", "token_count": 4586 }
6
import {XRExtras} from './xrextras' const onxr = () => { setTimeout(() => { window.dispatchEvent(new CustomEvent('xrandextrasloaded')) }, 1) } const onearly = () => { // The XR device API conflicts with deprecated usage of the XR library. To avoid this conflict, // XR8 should be used for the 8th Wall XR API. This renames the device api if present to help keep // compatibility for legacy callers. if (!window.XR8 && window.XR && typeof (window.XR) === 'function') { window.nativeXR = window.XR window.XR = undefined } window.XRExtras = XRExtras setTimeout(() => window.dispatchEvent(new CustomEvent('xrextrasloaded')), 1) window.XR8 ? onxr() : window.addEventListener('xrloaded', onxr) } onearly()
8thwall/web/xrextras/src/index.js/0
{ "file_path": "8thwall/web/xrextras/src/index.js", "repo_id": "8thwall", "token_count": 260 }
7
let playcanvas = null const PlayCanvasFactory = () => { if (!playcanvas) { playcanvas = create() } return playcanvas } function create() { // Attach a shader to a material that makes it appear transparent while still receiving shadows. const makeShadowMaterial = ({pc, material}) => { const materialResource = material.resource || material materialResource.chunks.APIVersion = pc.CHUNKAPI_1_62 materialResource.chunks.endPS = ` litShaderArgs.opacity = mix(light0_shadowIntensity, 0.0, shadow0); gl_FragColor.rgb = vec3(0.0); ` materialResource.blendType = pc.BLEND_PREMULTIPLIED materialResource.update() } // Finds one camera entity in the scene graph of a given entity. If there are multiple cameras, a // warning is printed and one of them is returned arbitrarily. If there are no cameras, an error // is printed, and undefined is returned. const findOneCamera = (entity) => { // Find all camera components in the graph of an entity. const cameras = entity.root.findComponents('camera') if (!cameras.length) { console.error(`Couldn't find any cameras in the scene graph of ${entity.name}`) return } if (cameras.length > 1) { console.warn(`Found too many cameras (${cameras.length}) in the scene graph of ${entity.name}`) } // Pick the first camera if there are multiple. return cameras[0].entity } // Configures the playcanvas entity to to track the image target with the specified name. This // matches the name set in the 8th Wall console. const trackImageTargetWithName = ({name, entity, app}) => { entity.enabled = false const showImage = (detail) => { if (name != detail.name) { return } const {rotation, position, scale} = detail entity.setRotation(rotation.x, rotation.y, rotation.z, rotation.w) entity.setPosition(position.x, position.y, position.z) entity.setLocalScale(scale, scale, scale) entity.enabled = true } const hideImage = (detail) => { if (name != detail.name) { return } entity.enabled = false } app.on('xr:imagefound', showImage, {}) app.on('xr:imageupdated', showImage, {}) app.on('xr:imagelost', hideImage, {}) } return { findOneCamera, makeShadowMaterial, trackImageTargetWithName, } } export { PlayCanvasFactory, }
8thwall/web/xrextras/src/playcanvas/playcanvas.js/0
{ "file_path": "8thwall/web/xrextras/src/playcanvas/playcanvas.js", "repo_id": "8thwall", "token_count": 818 }
8
{ "compilerOptions": { "allowJs": true, "declaration": true, "emitDecoratorMetadata": true, "esModuleInterop": true, "experimentalDecorators": true, "importHelpers": true, "isolatedModules": false, "module": "commonjs", "moduleResolution": "node", "noImplicitAny": false, "noImplicitUseStrict": false, "noLib": false, "outDir": "dist/", "preserveConstEnums": true, "removeComments": true, "rootDir": "./", "sourceMap": true, "resolveJsonModule": true, "target": "es2019" }, "exclude": [ "node_modules", "dist", ], "include": [ "./*.ts*", "./*.d.ts*", "./**/*.ts*", "./**/*.js*" ], "compileOnSave": false, "buildOnSave": false, "atom": { "rewriteTsconfig": false } }
8thwall/web/xrextras/tsconfig.json/0
{ "file_path": "8thwall/web/xrextras/tsconfig.json", "repo_id": "8thwall", "token_count": 357 }
9
## 一、多列布局 CSS3中新出现的多列布局 (multi-column) 是传统 HTML 网页中块状布局模式的有力扩充。 这种新语法能够让 WEB 开发人员轻松的让文本呈现多列显示。 我们知道,当一行文字太长时,读者读起来就比较费劲,有可能读错行或读串行;人们的视点从文本的一端移到另一端、然后换到下一行的行首,如果眼球移动浮动过大,他们的注意力就会减退,容易读不下去。所以,为了最大效率的使用大屏幕显示器,页面设计中需要限制文本的宽度,让文本按多列呈现,就像报纸上的新闻排版一样。 **常用属性:** ```css column-count: 属性设置列的具体个数 column-width: 属性控制列的宽度 column-gap: 两列之间的缝隙间隔 column-rule: 规定列之间的宽度、样式和颜色 column-span: 规定元素应横跨多少列(1:跨1列 all:跨所有列) max-height: 列高度 /*如果设定列的最大高度,这个时候,文本内容会从第一列开始填充,然后第二列...*/ ``` > 如果设置列的宽度和设置列的个数时自动计算的宽度有冲突时,原则是“**取大优先**”。 > > 比如:如果设置的列的宽度大于自动计算的列的宽度,那么实际显示的效果以设置的列的宽度为准;如果设置的列的宽度无法填充整个屏幕,那么实际的宽度可能大于设置的宽度; > > 如果设置的列的宽度小于自动计算的列的宽度,那么实际显示的效果以自动计算的的列的宽度为准。 **示例:** ```css .wrapper { width: 100%; padding: 20px; box-sizing: border-box; /*设置多列布局*/ /*1.设置列数*/ column-count: 3; /*2.添加列间隙样式,与边框样式的添加一样*/ column-rule: dashed 3px red; /*3。设置列间隙大小*/ column-gap: 50px; /*4.设置列宽 原则:取大优先 1.如果人为设置宽度更大,则取更大的值,但是会填充整个屏幕,意味最终的宽度可能也会大于设置的宽度--填充满整个屏幕 2.如果人为设置宽度更小,使用默认计算的宽度*/ column-width: 200px; } h4{ /*设置跨列显示:取值:1 / all */ column-span: all; } ``` ![](./images/13.png) ## 二、伸缩布局(多用于移动端) ### 1、flex 和 justify-content(父元素使用) 布局的传统解决方案,基于盒状模型,依赖 **display属性 + position属性 + float属性** ,它对于那些特殊布局非常不方便。 CSS3在布局方面做了非常大的改进,使得我们对块级元素的布局排列变得十分灵活,适应性非常强,其强大的伸缩性,在响应式开发中可以发挥极大的作用。**(代替浮动)** **重要属性:** ```css display: flex; /*justify-content:设置或检索弹性盒子元素在主轴(横轴)方向上的对齐方式 。*/ justify-content:flex-start | flex-end | center | space-between | space-around ``` >`display: flex; ` :如果一个容器设置了这个属性,那么这个盒子里面的所有直接子元素都会自动的变成伸缩项(**子元素会横向排列。**)。 > >`justify-content`:设置或检索弹性盒子元素在主轴(横轴)方向上的对齐方式 。 > >- `flex-start`:让子元素向父元素的起始位置对齐,父元素右边可能会有空余。 >- `flex-end`:让子元素向父元素结束位置对齐,父元素左边可能会有空余。 >- `center`:让子元素向父元素中间位置对齐,父元素两边可能会有空余。 >- `space-between`:最左边与最右边子元素和父元素的左右边对齐,中间子元素平均分布,产生相同的间距。 >- `space-around`:将父盒子多余的空间平均分布在子元素的两边。这时子元素与子元素之间的间距是最左边和最右边子元素与父元素间距的2倍。 **注意:** *当所有子元素的宽度之和大于父盒子的宽度时,所有子元素的宽度会平均收缩,变窄,以适应父盒子的宽度。* *但是这样就不是我想要的了,我想要其换行怎么办?* 解答:见下面第4节。 ### 2、align-items(父元素使用) 我们之前学的`justify-content` 设置的是**主轴**方向上的对齐方式, 而 align-items 设置的是**侧轴**方向的对齐方式。 语法: ```css align-items: center; // 设置子元素(伸缩项)在侧轴方向上的对齐方式 ``` - `center`:设置在侧轴方向上居中对齐 - `flex-start`:设置在侧轴方向上顶对齐 - `flex-end`:设置在侧轴方向上底对齐 - `stretch`:(默认值)拉伸:让子元素在侧轴方向上进行拉伸,填充满整个侧轴方向。(在子元素未设置高度时有效) - `baseline`:以子元素中文本基线对齐来来对齐*/ **问题:** *align-items 既然写在父元素中,是对所有子元素在侧轴方向的对齐方式进行设置。那么,能不能单独设置某个子元素在侧轴的对齐方式呢?* ### 3、align-self (子元素使用) 单独设置某个子元素**在侧轴的对齐方式**,属性值和 align-items 相同。 ```css align-self: flex-start; ``` ### 4、flex-flow(父元素使用) `flex-flow` 属性:flex-flow 是 `flex-direction` 属性和 `flex-wrap` 属性的简写形式,默认值为`row nowrap`。 它用来**设置弹性盒模型对象的子元素排列方式**。它的两种取值: #### 4.1、flex-wrap ```css flex-wrap: 控制子元素是否换行显示,默认不换行 ``` - `nowrap`:不换行--则收缩 - `wrap`:换行 - `wrap-reverse`:翻转,原来是从上到下,翻转后就是从下到上来排列 #### 4.2、flex-content 属性(该属性对单行弹性盒子模型无效。(即:带有 flex-wrap: nowrap)。) 当`flex-wrap: warp` 或者 `flex-wrap: warp-reverse` 的时候,设置弹性盒子子元素在纵轴的布局方式。详细参考:https://developer.mozilla.org/zh-CN/docs/Web/CSS/align-content ![image](https://user-images.githubusercontent.com/23518990/116525729-65a55300-a90b-11eb-93df-c1fbfe2d80a6.png) ![image](https://user-images.githubusercontent.com/23518990/116525697-5f16db80-a90b-11eb-8ac0-a9880b67a2dc.png) #### 4.3、flex-direction ```css flex-direction:定义弹性盒子元素的排列方向。就是设置主轴方向,默认主轴方向是row(水平方向) ``` - `row`: 水平排列方向,从左到右 - `row-reverse`:水平排列方向,从右到左 - `column`:垂直排列方向,从上到下 - `column-reverse`:垂直排列方向,从下到上 最后,这两个属性可以连写: ```css flex-flow: wrap row; /* 设置子元素水平方向排列,换行显示*/ ``` > 注意:以上属性均设置的是父元素的属性。 ### 5、flex属性(子元素使用) flex 属性是由以下3个属性组成: - flex-grow - flex-shrink - flex-basis #### 5.1、flex-grow `flow-grow`:可以来扩展子元素的宽度:**设置当前元素应该占据剩余空间的比例值**,这个比例值是和其他兄弟子元素占据的剩余空间平分的。 **flex-grow 默认值为0。** **比例值的计算:当前子元素的 flex-grow 的值 / 所有兄弟元素的 flex-grow 值的和。** 示例: ```css .first{ flex-grow: 1; /*first子元素宽度拉伸,拉伸的宽度占据父元素剩余空间的三分之一*/ } .second{ flex-grow: 0;/*second子元素宽度不拉伸*/ } .third{ flex-grow: 2;/*third子元素宽度拉伸,拉伸的宽度占据父元素剩余空间的三分之二*/ } ``` #### 5.2、flex-shrink 同 flex-grow 相反,flex-grow 设置的是父盒子剩余空间的比例分配,而 flex-shrink 设置的是,如果父盒子宽度不够时,子元素的收缩比例。 **flex-shrink 默认值为1。** 如果将 flex-shrink 的值设置为 0 的话,父盒子宽度不够时,子元素不收缩,会溢出。 > 比例值的计算与flex-grow相似。 #### 5.3、flex-basis 属性 flex-basis 指定了 flex 元素在主轴方向上的初始宽度,比如设置`flex-basis:200px`则该元素的默认宽度为200px。**默认为 auto。** > **注意:当一个元素同时被设置了 flex-basis (除值为 auto 外) 和 width , flex-basis 具有更高的优先级。** #### 5.4、flex flex属性:flex属性是flex-grow, 或者 flex-shrink 和 flex-basis的简写, **flex 默认值为0 。** ```css flex: [number]:这个语法指定了一个数字,代表了这个伸缩项目该占用的剩余空间比例。 flex: auto:属性值被设为auto的伸缩项目,会根据主轴自动伸缩以占用所有剩余空间 ``` 可以使用一个,两个或三个值来指定 flex属性。 **单值语法:** 值必须为以下其中之一: - 一个无单位数(number): 它会被当作`flex: number 1 0;` flex-grow的值为number,flex-shrink的值被假定为1,然后flex-basis 的值被假定为0。 - 一个有效的宽度(width)值: 它会被当作 flex-basis的值。 **双值语法:** 第一个值**必须**为一个无单位数,并且它会被当作 flex-grow 的值。 第二个值必须为以下之一: - 一个无单位数:它会被当作 `<flex-shrink>` 的值。 - 一个有效的宽度值: 它会被当作 `<flex-basis>` 的值。 **三值语法:** - 第一个值**必须**为一个无单位数,并且它会被当作 `<flex-grow>` 的值。 - 第二个值**必须**为一个无单位数,并且它会被当作 `<flex-shrink>` 的值。 - 第三个值**必须**为一个有效的宽度值, 并且它会被当作 `<flex-basis>` 的值。 示例如下(**注意是有顺序的**): ```css /* 一个值, 无单位数字: flex-grow */ flex: 2; /* 一个值, width/height: flex-basis */ flex: 10em; flex: 30px; flex: min-content; /* 两个值: flex-grow | flex-basis */ flex: 1 30px; /* 两个值: flex-grow | flex-shrink */ flex: 2 2; /* 三个值: flex-grow | flex-shrink | flex-basis */ flex: 2 2 10%; /*全局属性值 */ flex: inherit; flex: initial; flex: unset; ``` #### 5.5、flex 应用案例 需求:不管有多少个 li 标签,总是能平分父盒子(因为从服务器获取的 li 标签的个数可能不是固定的)。 ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> * { padding: 0; margin: 0; } div { width: 500px; height: 100px; margin: 100px auto; border: 1px solid red; } div > ul { width: 100%; height: 36px;; list-style: none; /*设置父盒子为伸缩盒子*/ display: flex; } ul > li { /* 宽度不知道设置多少 */ /* width: ??? */ background-color: pink; border-right: 1px solid #ccc; line-height: 36px; text-align: center; /* 所有li平分父盒子宽度 */ flex: 1; } </style> </head> <body> <div> <ul> <li>首页</li> <li>C++</li> <li>Web</li> <li>嵌入式</li> <li>Python</li> </ul> </div> </body> </html> ``` ![](./images/14.png) ### 6、案例:宽高自适应盒子 需求:改变最外边父盒子的大小,里面所有子盒子宽高自适应。 ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> * { margin: 0; padding: 0; } div { width: 500px; height: 500px; margin: 50px auto; background-color: pink; /* 设置父盒子为伸缩盒子 */ display: flex; /* 设置主轴方法为纵向 */ flex-direction: column; } header { width: 100%; height: 100px; background-color: red; } main { width: 100%; background-color: yellow; flex: 1; /* 设置为弹性盒子 */ display: flex; /* 设置 display: flex; 的时候,主轴方向会默认横向,不会继承上一次的。 */ /* flex-direction: row; */ } article { height: 100%; background-color: green; flex: 1; } aside { height: 100%; background-color: orange; flex: 3; } footer { width: 100%; height: 100px; background-color: blue; } </style> </head> <body> <div> <header></header> <main> <article></article> <aside></aside> </main> <footer></footer> </div> </body> </html> ``` ![](./images/15.png)
Daotin/Web/02-CSS/02-CSS3/07-多列布局,伸缩布局.md/0
{ "file_path": "Daotin/Web/02-CSS/02-CSS3/07-多列布局,伸缩布局.md", "repo_id": "Daotin", "token_count": 8150 }
10
获取显示器屏幕的宽高 ```js window.screen.height //返回显示器屏幕的高度。 window.screen.width //返回显示器屏幕的宽度。 ``` 获取显示器屏幕的可用宽高 ```js screen.availHeight // 返回可用显示屏幕的高度 (除 Windows 任务栏之外)。 screen.availWidth//返回可用显示屏幕的宽度 (除 Windows 任务栏之外)。 ``` 获取页面实际宽高: ```js document.documentElement.scrollWidth || document.body.scrollWidth; document.documentElement.scrollHeight || document.body.scrollHeight; ``` 获取页面可视区域宽高: ```js document.documentElement.clientWidth || document.body.clientWidth; document.documentElement.clientHeight || document.body.clientHeight; ``` 获取滚动条距离左边/上边的距离: ```js document.documentElement.scrollLeft || document.body.scrollLeft; document.documentElement.scrollTop || document.body.scrollTop; ```
Daotin/Web/03-JavaScript/03-BOM/05-获取元素宽高总结.md/0
{ "file_path": "Daotin/Web/03-JavaScript/03-BOM/05-获取元素宽高总结.md", "repo_id": "Daotin", "token_count": 452 }
11
### 1、hasOwnProperty 描述:hasOwnProperty() 方法会返回一个布尔值,指示对象自身属性中是否具有指定的属性 语法:`obj.hasOwnProperty(prop)` 示例: ```js var obj = { a: 1 }; console.log(obj.hasOwnProperty("a")); // true console.log(obj.hasOwnProperty("b")); // false ``` ### 2、isPrototypeOf 描述:isPrototypeOf() 方法用于测试一个对象(prototypeObj)是否存在于另一个对象(object)的原型链上。 语法:`prototypeObj.isPrototypeOf(object)` 示例: ```js var Box = (function () { function Box() {} Box.prototype = {} Box.prototype.constructor = Box; return Box; })(); var box1 = new Box(); // Box.prototype 在 box1 对象的原型链上 console.log(Box.prototype.isPrototypeOf(box1)); // true ``` 下面有张图:可以看看 `isPrototypeOf` 与 `getPrototypeOf` 的关系: ![](./img/2.png) ### 3、propertyIsEnumerable 描述:propertyIsEnumerable() 方法返回一个布尔值,表示指定的属性是否可枚举。 语法:`obj.propertyIsEnumerable(prop)` 示例: ```js var Box = (function () { function Box(a) { this.a = a; } Box.prototype = { b: 2 } Box.prototype.constructor = Box; return Box; })(); var box1 = new Box(); console.log(box1.propertyIsEnumerable("a")); // true 可枚举 console.log(box1.propertyIsEnumerable("b")); // false 不可枚举 ``` ### 4、constructor 描述:返回创建实例对象的 Object 构造函数的引用。(可以通过调用对象的constructor重新执行对象的构造函数。) 示例: ```js var o = {}; o.constructor === Object; // true var o = new Object; o.constructor === Object; // true var a = []; a.constructor === Array; // true var a = new Array; a.constructor === Array // true var n = new Number(3); n.constructor === Number; // true ``` > 字面量方式为什么constructor会指向Object? > >这个就是JS内部的操作了,当在一个实例对象上找不到某个属性时,JS就会去它的原型对象上找是否有相关的共享属性或方法,所以上面的例子中,o对象内部虽然没有自己的constructor属性,但它的原型对象上有,所以能实现我们上面提到的效果。也就是 `o.constructor` 没有,找 `o.__proto__.constructor` ,o是个对象是由Object对象创建的所以指向Object。
Daotin/Web/03-JavaScript/04-JavaScript高级知识/03-原型的方法.md/0
{ "file_path": "Daotin/Web/03-JavaScript/04-JavaScript高级知识/03-原型的方法.md", "repo_id": "Daotin", "token_count": 1253 }
12
## 一、元素的创建添加和删除 ### 1、对象方式创建元素 - `父元素.append(子元素)`,`子元素.appendTo(父元素)` :在被选元素所有子元素的**结尾插入**内容(增加子元素)。 - `prepend`,`prependTo`:在被选元素所有子元素的**开头插入**元素(增加子元素)。 - `A.before(B)`:在A元素之前插入兄弟元素B。 - `A.after(B)`:在A元素之后插入兄弟元素B。 - `A.insertBefore(B)`: 将兄弟元素A元素插入到B元素之前。 - `A.insertAfter(B)`:将兄弟元素A元素插入到B元素之后。 语法: ```js // 元素的创建 $("html代码"); // $("<a herf='http://fengdaoting.com'>Daontin</a>") // 元素的添加(被动) 父元素.append(子元素); // $("#dv").append($("<a>...</a>")); 父元素.append(function(index,item){ return `<a href="#">${item}</a>`; }; ``` ```js // 元素的添加(主动) 子元素.appendTo(父元素); // $("<a>...</a>").appendTo($("#dv")); ``` > append和appendTo区别: > > 1、append()括号里面可以写函数,但是appendTo里面不可以。 > > 2、append()后面不可链式编程,appendTo可以。 **案例:动态创建列表** ```html <script> $("#btn1").click(function () { var ulObj = $("<ul></ul>"); // 创建ul添加到div $("#dv").append(ulObj); // 创建li添加到ul,并设置鼠标进入离开事件 $("<li>鸣人</li><li>卡卡西</li><li>佐助</li>").appendTo(ulObj).mouseenter(function () { $(this).css("backgroundColor","yellow"); }).mouseleave(function () { $(this).css("backgroundColor",""); }); }); </script> ``` > 注意:获取的元素通过 `append` 或者 `appendTo` 的方式添加到另一个元素的时候,相当于剪切。 > > **如果要保留获取的元素,可以在 append 或者 appendTo 之前使用克隆 `clone()` 方法。** ### 2、字符串方式创建元素 语法: ```js 父元素.html("html代码"); // $("#dv").html("<a herf='http://fengdaoting.com'>Dao</a>"); ``` ### 3、包裹元素 ```js // 在A元素之外包裹一层B元素,如果A是元素集合,那么A中的每个元素都包裹一层B。 A.wrap(B); A.wrap(function(index,item){}); //将所有的标签A挪移在一起,外面增加一个包裹B. A.wrapAll(B); //不管A元素在不在一起都挪到一起。 $("span").wrapAll("<div></div>") // 给A元素里面内容加一层包裹B. A.wrapInner(B); // $("span").wrapInner("<a href='#'></a>") ``` 示例: ```js var arr=["163","sina","baidu","taobao"]; $("span").wrap(function (index) { return `<a href='http://www.${arr[index]}.com'></a>` }); ``` ### 4、元素的克隆 在DOM操作时,通过`元素A.cloneNode(false/true)` 进行浅/深复制。 浅复制是只复制A元素本身,而深复制可以复制到元素A里面的元素。 但是在JQuery里面只有深复制。 ```js A.clone(); // 元素A深复制 A.clone(true); // 元素A深复制,并且还复制A绑定的事件 ``` ### 5、元素的删除 **5.1、清除父元素中所有的子元素** ```js 父元素.html(""); 父元素.empty(); ``` **5.2、清除单个子元素** ```js 子元素.remove(); // 完全清除,包括事件。 子元素.detach(); // 相当于DOM中的子元素remove(),此时还存在于内存,而且其绑定的事件也没清除。 ``` **5.3、替换元素** ```js // A用B来替换 A.replaceWith(B); //旧元素.replaceWith(新元素) // A替换所有的B A.replaceAll(B)// 新元素.replaceAll(旧元素) ``` ## 二、元素 value 属性的操作 一般 `val()` 是获取表单的 value 属性; `val(值); ` 设置表单的 value 属性。 **示例1:获取设置文本框value的值** ```html <input type="text" value="text" id="txt"> //------------------------------------------ <script> $("#btn1").click(function () { // 获取文本框的value属性值 console.log($("#txt").val()); // 设置文本框的value属性值 $("#txt").val("text2"); }); </script> ``` **示例2:获取设置单选框value的值** ```html <input type="radio" value="1" name="sex" id="nan">男 <input type="radio" value="2" name="sex">女 //----------------------------------------------- console.log($("#nan").val()); $("#nan").val("3"); ``` **示例3:获取设置复选框value的值** ```html <input type="checkbox" value="1">吃饭 <input type="checkbox" value="2" id="c1">睡觉 <input type="checkbox" value="3">大豆豆 //--------------------------------------- console.log($("#c1").val()); $("#c1").val("33"); ``` **示例4:获取设置文本域value的值** ```html <textarea name="text" id="t1" cols="30" rows="10"> 等你下课 </textarea> //------------------------------------------------ console.log($("#t1").val()); // 等你下课 $("#t1").val("Jay"); console.log($("#t1").val()); // Jay // 成对的标签可以使用 text() 方法来获取和设置 console.log($("#t1").text());// 等你下课 $("#t1").text("Jay"); console.log($("#t1").text());// Jay ``` > 1、使用 val() 进行设置之后,在源码中 value 的值没有改变,但是打印出来的值改变了。 > > 2、使用 text() 行设置之后,在源码中 value 的值也改变了。 > > **3、成对的标签可以使用 text() 方法来获取和设置,推荐使用 text();** > 注意: > > 对于 textarea 标签。如果没有设置value的值,不管有没有设置 innerHTML 的值,value的值都等于innerHTML的值;一旦设置了value的值,获取的value就不一定是innerHTML的值了。 > > 这个结论不管是DOM操作还是jq操作,结果一样。 **示例5:获取设置下拉框value的值** ```html <select id="s1"> <option value="1">op1</option> <option value="2">op2</option> <option value="3">op3</option> <option value="4">op4</option> <option value="5">op5</option> </select> //----------------------------------- console.log($("#s1").val()); $("#s1").val("3"); console.log($("#s1").val()); ``` > 1、获取下拉框的 value 属性,就是获取 option 的 value 的值 > > 2、设置下拉框的 value 属性,就是选中相应 value 值的 option 标签。 ## 三、自定义属性 ### 1、自定义属性和对象属性 **自定义属性是添加在标签上的。对象属性是添加对象的属性。**例如: ```js var div = document.querySelector("div"); div.setAttribute("index",1); // 自定义属性 div.index = 1; // 对象属性 ``` > 注意:jQuery不能直接添加对象属性,如果想添加,需要转化为DOM对象来添加,这时jQuery对象中就有了这个对象属性。 > PS: 自定义属性一般都是小写,多个单词之间用`-` 连接。例如:`toggle-name` ### 1、attr 语法: ```js // 获取自定义属性 元素.attr("自定义属性/自带属性"); 元素集合.attr("自定义属性/自带属性") // 获取的是元素集合中的第一个元素的自定义属性/自带属性。 // 设置自定义属性 元素.attr("自定义属性名/自带属性","自定义属性值"); // 设置多个自定义属性为不同的值 var arr=["a","b","c","d","e"]; 元素.attr("自定义属性", function(index,item){ return arr[index]; }) // 设置多个不同的属性,分别对应不同的属性值 元素.attr({ "属性1":function(index,item){ return index; }, "属性2":function(index,item){ return index+1; } }) ``` > 注意:**attr只有一个参数时是获取自定义属性的值,当有两个参数时是设置自定义属性的值。** 示例: ```html <div id="dv"></div> //------------------------------------------- $("#dv").attr("hello","world"); //<div id="dv" hello="world"></div> $("#dv").attr("id","box"); //<div id="box"></div> console.log($("div").attr("id")); ``` > 1、attr 方法主要操作元素的自定义属性的,但是也可以操作元素的自带属性。但是操作元素是否选中的 checked 属性时不合适。 > > 2、操作元素的选中 checked 属性,推荐使用 prop 方法。 **自定义属性的选中问题** ```js 元素.attr(); // 获取某个元素是否被选中的状态 元素.attr("checked",true); //设置某个元素为选中 ``` ```html <input type="radio" value="1" name="sex" id="r1">男 <input type="radio" value="2" name="sex">女 //----------------------------------------------- console.log($("#r1").attr("checked")); $("#r1").attr("checked", true); ``` > PS:attr 方法针对单选框和复选框的是否选中问题操作复杂(选中返回值为 checked,未选中返回值为 undefined,不是直接显示 true 或者 false 那么简单,并且反复操作多次易失效),几乎不用。 ### 2、prop **主要用于获取元素的选中问题。** 语法: ```js 元素.prop("checked"); // 获取这个元素是否选中 元素.prop("checked",true/false); // 设置这个元素选中或不选中 ``` 示例: ```js <input type="checkbox" value="1">吃饭 <input type="checkbox" value="2" id="c1">睡觉 <input type="checkbox" value="3">大豆豆 //-------------------------------------------- console.log($("#c1").prop("checked")); // false $("#c1").prop("checked", true); // true ``` ### 案例:全选与全不选 ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> * { padding: 0; margin: 0; } table { border-collapse: collapse; } td { width: 100px; height: 30px; background-color: #f8f8f8; border: 1px solid #7b7b7b; text-align: center; } .th td { background-color: #e95d71; color: #f8f8f8; } .little-td { width: 50px; } </style> </head> <body> <div id="dv"> <table class="table"> <thead class="th"> <tr> <td class="little-td"><input type="checkbox"></td> <td>Web技术</td> </tr> </thead> <tbody class="tb"> <tr> <td class="little-td"><input type="checkbox"></td> <td>Web技术</td> </tr> <tr> <td class="little-td"><input type="checkbox"></td> <td>Web技术</td> </tr> <tr> <td class="little-td"><input type="checkbox"></td> <td>Web技术</td> </tr> <tr> <td class="little-td"><input type="checkbox"></td> <td>Web技术</td> </tr> </tbody> </table> </div> <script src="jquery-1.12.4.js"></script> <script> // 设置总的复选框对子复选框的影响 $(".th input").click(function () { $(".little-td input").prop("checked", $(this).prop("checked")); }); // 设置每一个子复选框事件 $(".little-td input").click(function () { var childLength = $(".tb").find("input").length;//总的子复选框的个数 var actualLength = $(".tb :checked").length;// 已经选中的子复选框的个数 $(".th input").prop("checked", childLength === actualLength); }); </script> </body> </html> ``` > 0、`border-collapse: collapse;` 细线表格。 > > 1、子类复选框的集合在 prop 和 click 中会自动遍历操作。 > > 2、`var actualLength = $(".tb :checked").length;` 中 `.tb` 和 `:checked` 中间有空格,表示的是 类 tb 下面的子元素集合中带有 checked 的元素,而没有空格表示,设置了类 tb 的所有元素集合中带有 checked 的元素。一个是 tb 下面的子元素集合中,一个是 tb 自身元素集合中。 ![1](./img/1.png)
Daotin/Web/04-jQuery/04-元素的创建添加和删除,自定义属性.md/0
{ "file_path": "Daotin/Web/04-jQuery/04-元素的创建添加和删除,自定义属性.md", "repo_id": "Daotin", "token_count": 6845 }
13
我们现在需要做一个用户信息的注册登录和显示所有用户注册信息的功能。 我们目前数据库是:`mydb`,数据表:`mytable`。 首先需要一个注册界面: #### register.html ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> 用户名: <input id="username"></br> 密&nbsp;码:<input id="userpwd"></br> <button id="btn">注册</button> </body> <script> var btn = document.getElementById("btn"); var userpwdInput = document.getElementById("userpwd"); var usernameInput = document.getElementById("username"); btn.onclick = function () { //此处省略表单验证 var username = usernameInput.value; var userpwd = userpwdInput.value; var req = new XMLHttpRequest(); req.open("get", "php/register.php?username=" + username + "&userpwd=" + userpwd, true); req.send(); req.onreadystatechange = function () { if (req.readyState == 4 && req.status == 200) { let result = req.responseText; //只需要知道 是否注册成功 let obj = JSON.parse(result); if (obj.code == 1) { window.location.href = "login.html"; } else { alert(obj.msg); } } } } </script> </html> ``` 注册的时候,必然后台会提示我们是否注册成功,这就需要一个后台接口来处理。 这个接口我们在 `register.php` 中实现。 #### register.php ```php <?php @require_once("config.php");//引入数据库配置信息 $name = $_GET["username"]; $pwd = $_GET["userpwd"]; // 准备用户名查询语句 $sql_query = "select * from mytable where name = '$name'"; $result = mysql_query($sql_query); $item = mysql_fetch_array($result); // 将结果组合成对象 $obj = array(); if($item){ // echo "存在"; $obj["code"]=0; $obj["msg"]= "该用户名已经存在"; }else{ // echo "不存在"; //把数据新增到数据库 $sql_insert = "INSERT INTO mytable(name,pwd) VALUES ('$name','$pwd')"; mysql_query($sql_insert); $count = mysql_affected_rows();//受影响的行数 if($count>0){ $obj["code"]=1; $obj["msg"]= "注册成功"; }else{ $obj["code"]=0; $obj["msg"]= "注册失败"; } } echo json_encode($obj); ?> ``` 我们返回给注册前端的是一个对象,对象中有两个属性,一个是状态码 `code`,一个是说明 `msg`。 类似下面的结构: ```json { "code": 0, "msg": "注册失败" } ``` 在 `register.php` 的开头,我们引入了 `config.php` 配置文件,这样我们就可以每次少配置一些信息: #### config.php ```php <?php @header("content-type:text/html;charset=utf8"); // 支持中文字符 //@header("Access-Control-Allow-Origin:http://localhost:63342");//cors 配置请求头 @header("Access-Control-Allow-Origin:*");// 运行所有网站访问此php文件 mysql_connect("localhost:3306", "root", "root"); // 如果无法链接将会报错,报错信息如下: // Warning: mysql_connect() [function.mysql-connect]: [2002] 由于目标计算机积极拒绝,无法连接。 (trying to connect via tcp://localhost:33062) in mysql_select_db("mydb"); // 选择的数据库存在返回1,否则为空 ?> ``` 主要是设置php支持中文,设置跨域请求,以及连接到我们的数据库 `mgdb`。 注册成功后,我们来进行登录验证: #### login.html ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> 用户名: <input id="username"></br> 密&nbsp;码:<input id="userpwd"></br> <button id="btn">登录</button> </body> <script> var btn = document.getElementById("btn"); var userpwdInput = document.getElementById("userpwd"); var usernameInput = document.getElementById("username"); btn.onclick = function () { //此处省略表单验证 var username = usernameInput.value; var userpwd = userpwdInput.value; var req = new XMLHttpRequest(); req.open("get", "php/login.php?username=" + username + "&userpwd=" + userpwd, true); req.send(); req.onreadystatechange = function () { if (req.readyState == 4 && req.status == 200) { let obj = JSON.parse(req.responseText); if (obj.code == 1) { window.location.href = "list.html"; } else { alert(obj.msg); } } } } </script> </html> ``` 登录的时候也是一样,由 `login.php` 来处理,处理完后只需一个对象,告知我们有没有登录成功即可。 ```json { "code": 0, "msg": "密码错误" } ``` #### login.php ```php <?php @require_once("config.php");//引入数据库配置信息 $name = $_GET["username"]; $pwd = $_GET["userpwd"]; // 准备用户名查询语句 $sql_query = "select * from mytable where name = '$name'"; $result = mysql_query($sql_query); $item = mysql_fetch_array($result); // 将结果组合成对象 $obj = array(); if($item){ if($item["pwd"] == $pwd) { $obj["code"]=1; $obj["msg"]= "密码正确"; } else { $obj["code"]=0; $obj["msg"]= "密码错误"; } }else{ $obj["code"]=0; $obj["msg"]= "该用户名不存在"; } echo json_encode($obj); ?> ``` 登录成功跳转到用户信息列表 `list.html` 中, `list.html` 用于展示所有我们注册的数据,并且可以实现搜索查找,id或者名称排序,还可以升序降序,类似于后台管理一样。 由于实现的功能很多,所以写起来最复杂。关键性的代码都标了注释。 #### list.html ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> * { margin: 0; padding: 0; list-style: none; } #table { width: 440px; margin: 10px auto; } #table ul { width: 440px; height: 30px } #table ul li { float: left; height: 30px; width: 110px; text-align: center; line-height: 30px; background-color: #e42942; color: aliceblue; } .box { width: 440px; overflow: hidden; margin: 10px auto; } </style> </head> <body> <div class="box"> <input type="text" id="search-txt"> <button class="search">搜索</button> <input type="radio" name="type" value="id" checked> ID <input type="radio" name="type" value="name"> 名称 <input type="radio" name="upordown" value="asc" checked> 升序 <input type="radio" name="upordown" value="desc"> 降序 <br> <button class="prev">上一页</button> <button class="next">下一页</button> </div> <div id="table"> <ul id="th"> <li>编号</li> <li>用户名</li> <li>密码</li> <li>操作</li> </ul> <div id="tbody"> </div> </div> </body> <script> var tbody = document.getElementById("tbody"); var searchBtn = document.querySelector(".search"); var orderTypeList = document.getElementsByName("type"); var orderUpDownList = document.getElementsByName("upordown"); var prevBtn = document.querySelector(".prev"); var nextBtn = document.querySelector(".next"); var key = ""; var orderType = "id"; // 获取value作为id或name排序的依据 var orderUpDown = "asc"; // 获取value作为升序或降序排序的依据 var showIndex = 0; // 每页的索引 var showNum = 6; // 每页显示的个数 searchBtn.onclick = function () { var searchTxt = document.querySelector("#search-txt"); key = searchTxt.value; showList(key, orderType, orderUpDown, showIndex * showNum, showNum); }; for (var i = 0; i < orderTypeList.length; i++) { orderTypeList[i].onclick = function () { orderType = this.value; showList(key, orderType, orderUpDown, showIndex * showNum, showNum); }; } for (var i = 0; i < orderUpDownList.length; i++) { orderUpDownList[i].onclick = function () { orderUpDown = this.value; showList(key, orderType, orderUpDown, showIndex * showNum, showNum); }; } showList(key, orderType, orderUpDown, showIndex * showNum, showNum); // 封装显示函数 // key: 搜索框的内容 // orderType: id或name排序 // orderUpDown: 升序或降序 // showSkip: 从第几条开始显示(showSkip = showIndex * showNum) // showNum: 每页显示的个数 function showList(key, orderType, orderUpDown, showSkip, showNum) { var url = `php/list.php?key=${key}&orderType=${orderType}&orderUpDown=${orderUpDown}&showSkip=${showSkip}&showNum=${showNum}`; myAjax(url, function (data) { let list = data; let html = ""; for (let i = 0; i < list.length; i++) { let userinfo = list[i]; let userid = userinfo["id"]; let username = userinfo["name"]; let userpwd = userinfo["pwd"]; // onclick="del(${userid}, this) this是精华,可以将li这个元素作为参数传入,这样就可以获取这个元素,进而可以进行删除操作。 html += `<ul class="tr"> <li>${userid}</li> <li>${username}</li> <li>${userpwd}</li> <li onclick="del(${userid}, this)">删除</li> </ul>`; } tbody.innerHTML = html; prevBtn.disabled = false; nextBtn.disabled = false; // 获取数据库的总数量来决定翻页的个数 myAjax(`php/count.php?key=${key}`, function (data) { let count = data["count"]; let maxShowIndex = Math.ceil(count / showNum) - 1; prevBtn.onclick = function () { showIndex--; showList(key, orderType, orderUpDown, showIndex * showNum, showNum); }; nextBtn.onclick = function () { showIndex++; showList(key, orderType, orderUpDown, showIndex * showNum, showNum); }; if (showIndex == 0) { prevBtn.disabled = true; prevBtn.onclick = null; } if (showIndex == maxShowIndex) { nextBtn.disabled = true; nextBtn.onclick = null; } }); }); } // 一个用户信息的删除 function del(id, liObj) { var url = `php/delete.php?id=${id}`; myAjax(url, function (data) { if (data.code == 1) { tbody.removeChild(liObj.parentNode); } else { alert("删除失败"); } }); } function myAjax(url, fn) { var xhr = new XMLHttpRequest(); xhr.open("get", url, true); xhr.send(); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { fn(JSON.parse(xhr.responseText)); } } }; </script> </html> ``` > TIPS: > > 不管是购物车,还是用户信息等,都会在页面中增加元素。有的很少的元素,一般使用 createElement 来新增,而有大片的元素的时候,都会使用字符串模板来填写。 > > 但是字符串模板有个不好的地方就是添加事件和获取这个元素。 > > > > **大概有下列处理办法:** > > 1、添加事件可以使用内联事件,需要用的变量可以以事件参数的形式传入。需要用到本身对象,可以使用 `this` 传入事件参数中。 > > 2、在向页面中添加完元素之后,使用DOM操作来获取元素,需要用到的参数使用自定义参数来传入。然后既然获取到了元素,绑定事件就简单了。 用户数据的遍历使用到 `list.php` 来处理, 用户数据的总量使用 `count.php` 来处理, 用户数据的删除使用 `delete.php` 来处理。 #### list.php ```php <?php @header("content-type:text/html;charset=utf8"); mysql_connect("localhost:3306", "root", "root"); // 如果无法链接将会报错,报错信息如下: // Warning: mysql_connect() [function.mysql-connect]: [2002] 由于目标计算机积极拒绝,无法连接。 (trying to connect via tcp://localhost:33062) in $connect = mysql_select_db("mydb"); // 选择的数据库存在返回1,否则为空 $key = $_GET["key"]; $orderType = $_GET["orderType"]; $orderUpDown = $_GET["orderUpDown"]; $showSkip = $_GET["showSkip"]; $showNum = $_GET["showNum"]; // ORDER BY: 以什么排序 // limit 0,3 : 从第0条开始,显示3条 $sql = "SELECT * FROM mytable WHERE `status` = 1 and (`name` LIKE '%$key%' or pwd like '%$key%') ORDER BY $orderType $orderUpDown limit $showSkip, $showNum"; // 定义查询数据表(mytable)语句 $res = mysql_query($sql); // 执行数据表查询语句,返回值是resouce格式的数据。 // mysql_fetch_array 将resouce格式的数据转化成Array数据类型 // 由于mysql_fetch_array每次只能转换数据表的一行数据,所以要循环转换。 // 使用while是因为没有数据的地方转换的结果为false // 最后将多个array加入数组list中。 $list = array(); while($item = mysql_fetch_array($res)) { $tmp = array(); if($item["status"] == 1) { $tmp["id"] = $item["id"]; $tmp["name"] = $item["name"]; $tmp["pwd"] = $item["pwd"]; $tmp["status"] = $item["status"]; $list[] = $tmp; } } // 使用json_encode将转换的array集合变成json对象集合。 echo json_encode($list); ?> ``` 用户数据的总量使用 `count.php` 来处理, #### count.php ```php <?php require_once("config.php"); $key = $_GET["key"]; $sql = "select count(*) from mytable WHERE `status` = 1 and ( name like '%$key%' or pwd like '%$key%' ) "; $result = mysql_query($sql); $item = mysql_fetch_array($result); $obj= array(); $obj["count"]= $item[0]; echo json_encode($obj); ?> ``` 用户数据的删除,用到了 delete.php 来处理: > 用户删除数据,一般不是真正的删除数据,而是将数据中的一个 flag 改变,这里是 `status == 0`,来表示删除,我们在显示的时候不显示 `status == 0` 的即可。 #### delete.php ```php <?php @require_once("config.php");//引入数据库配置信息 $userid = $_GET["id"]; $spl_del = "update mytable set `status` = 0 where id = $userid "; mysql_query($spl_del); $count = mysql_affected_rows(); $obj = array(); if($count>0) { $obj["code"] = 1; } else { $obj["code"] = 0; } echo JSON_encode($obj); ?> ``` 删除操作,返回的是删除成功或者失败的信息对象。 #### 演示: ![](./images/2.gif)
Daotin/Web/06-Ajax/案例01:Ajax用户注册登录,用户数据的查询删除.md/0
{ "file_path": "Daotin/Web/06-Ajax/案例01:Ajax用户注册登录,用户数据的查询删除.md", "repo_id": "Daotin", "token_count": 8715 }
14
// Fixed Width Icons // ------------------------- .#{$fa-css-prefix}-fw { width: (18em / 14); text-align: center; }
Daotin/Web/07-移动Web开发/案例源码/03-微金所/lib/font-awesome-4.7.0/scss/_fixed-width.scss/0
{ "file_path": "Daotin/Web/07-移动Web开发/案例源码/03-微金所/lib/font-awesome-4.7.0/scss/_fixed-width.scss", "repo_id": "Daotin", "token_count": 44 }
15
## require.js使用教程 AMD(Asynchronous Module Definition(异步模块定义)) 官网:https://github.com/amdjs/amdjs-api/wiki/AMD 特点:专门用于浏览器端的一种模块化规范,模块的加载是异步的。 ### 基础语法 **定义暴露模块:** ```js //定义没有依赖的模块 define(function(){ return 模块 }) //定义有依赖的模块 // 这里的m1,m2 形参,分别对应传入过来的依赖module1,module2 define(['module1', 'module2'], function(m1, m2){ return 模块 }) ``` **引入使用模块** ```js require(['module1', 'module2'], function(m1, m2){ 使用m1/m2 }) ``` 相关参考资料: http://www.requirejs.cn/ http://www.ruanyifeng.com/blog/2012/11/require_js.html ### 使用步骤 1、下载require.js, 并引入 * 官网: http://www.requirejs.cn/ * github : https://github.com/requirejs/requirejs * 将require.js导入项目: `js/libs/require.js ` 2、创建项目结构 ``` |-js |-libs |-require.js |-modules |-alerter.js |-dataService.js |-main.js |-index.html ``` 3、定义require.js的模块代码 * dataService.js(没有依赖的js模块) ```js define(function () { let msg = 'atguigu.com' function getMsg() { return msg.toUpperCase() } return {getMsg} }) ``` * alerter.js(依赖dataService.js 和 jquery 的 js 模块) ```js define(['dataService', 'jquery'], function (dataService, $) { let name = 'Tom2' function showMsg() { $('body').css('background', 'gray') alert(dataService.getMsg() + ', ' + name) } return {showMsg} }) ``` 4、应用主(入口)js: main.js ```js (function () { //配置 require.config({ //基本路径 baseUrl: "js/", //模块标识名与模块路径映射 // 模块依赖名的路径 paths: { "alerter": "modules/alerter", "dataService": "modules/dataService", 'jquery': 'libs/jquery-1.10.1' } }) //引入使用模块 require( ['alerter'], function(alerter) { alerter.showMsg() }) })() ``` > 注意: > > 在引入 jQuery 模块的时候,jQuery 的依赖名称不能使用大写,只能是小写 `jquery` ,在jQuery内部是支持AMD语法的,在AMD中使用jQuery 的时候,它直接定义了一个模块的名字叫`jquery` ,这个在 jQuery.js 文件 的最后有说明。 5、页面使用模块: ```html <script data-main="js/main" src="js/libs/require.js"></script> ```
Daotin/Web/09-模块化规范/04-AMD-RequireJS模块化教程.md/0
{ "file_path": "Daotin/Web/09-模块化规范/04-AMD-RequireJS模块化教程.md", "repo_id": "Daotin", "token_count": 1410 }
16
## 一、vue实例的生命周期 vue实例的生命周期指的是:**从Vue实例创建,运行,到销毁期间,会伴随着各种各样的事件,这些事件统称为生命周期。** 生命周期事件,也称生命周期函数,也称生命周期钩子。 ## 二、生命周期函数三个阶段 ### 1、实例化期和加载期 **创建期间的生命周期函数**:`beforeCreate` 和 `created`,`beforeMount` 和 `mounted`。 ![](./images/6.png) ### 2、更新期 **运行期间的生命周期函数**:`beforeUpdate` 和 `updated` ![](./images/7.png) ### 3、卸载期 **销毁期间的生命周期函数**:`beforeDestroy` 和 `destroyed` ![](./images/8.png) ## 三、生命周期函数详解 **创建期间:** - `beforeCreate`:表示实例完全被创建出来之前,会执行beforeCreate函数,这时data 和 methods 中的 数据都还没有没初始化,**如果调用data和methods的数据的话,会报错。** - `created`:实例已经在内存中创建OK,此时 data 和 methods 已经创建OK,此时还没有开始 编译模板。 - `beforeMount`:此时已经完成了模板的编译,但是还没有从内存挂载到页面中。 **注意:在 beforeMount 执行的时候,页面中的元素,还没有被真正替换过来,只是之前写的一些模板(比如插值表达式)还只是字符串的形式。** - `mounted`: 此时,已经将编译好的模板,挂载到了页面指定的容器中显示。 **运行期间:** - `beforeUpdate`:data数据更新之后,但是还未渲染到页面时执行的函数。**这时data数据已经更新,但是页面的数据还是旧的。** - `updated`:updated 事件执行的时候,页面和 data 数据已经保持同步了,都是最新的。 **销毁期间:** - `beforeDestroy`:实例销毁之前调用。在这一步,实例上的data,methods等仍然完全可用。 - `destroyed`:Vue 实例销毁后调用。调用后,Vue 实例指示的所有东西都会解绑定,所有的事件监听器会被移除,所有的子实例也会被销毁。 示例代码: ```js export let User = { data(){ return { username: "zhuiszhu", count : 0 } }, template : ` <div> <h3 id="test">{{username}}</h3> <p>用户中心页页面内容</p> <p>{{count}}</p> <button @click="add">+</button> </div> `, methods : { add(){ this.count ++ } }, // 声明周期函数 beforeCreate(){ console.log(this.username) }, created(){ console.log(this.username) }, beforeMount(){ let dom = document.getElementById("test") // console.log(dom) }, mounted(){ let dom = document.getElementById("test") // console.log(dom) }, beforeUpdate(){ // console.log("组件即将发生更新") }, updated(){ // console.log("组件已经发生更新") }, beforeDestroy(){ // console.log("组件即将被卸载") }, destroyed(){ // console.log("组件已经被卸载") } } ``` **整个生命周期的图示为:** ![](./images/lifecycle.png)
Daotin/Web/12-Vue/03-Vue实例的生命周期.md/0
{ "file_path": "Daotin/Web/12-Vue/03-Vue实例的生命周期.md", "repo_id": "Daotin", "token_count": 2046 }
17
/* Navicat Premium Data Transfer Source Server : 阿里云MySQL Source Server Type : MySQL Source Server Version : 50718 Source Host : rm-wz9lp2i9322g0n06zvo.mysql.rds.aliyuncs.com:3306 Source Schema : web Target Server Type : MySQL Target Server Version : 50718 File Encoding : 65001 Date: 07/03/2018 09:59:04 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for article_category -- ---------------------------- DROP TABLE IF EXISTS `article_category`; CREATE TABLE `article_category` ( `category_id` int(32) NOT NULL AUTO_INCREMENT, `category_name` char(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `create_date` timestamp(0) NULL DEFAULT NULL, `category_delete` int(32) NOT NULL, PRIMARY KEY (`category_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1;
Humsen/web/docs/数据库部署/第1步 - 创建数据库/article_category.sql/0
{ "file_path": "Humsen/web/docs/数据库部署/第1步 - 创建数据库/article_category.sql", "repo_id": "Humsen", "token_count": 370 }
18
package pers.husen.web.bean.vo; import java.io.Serializable; import java.util.Date; /** * @desc 文章分类 * * @author 何明胜 * * @created 2017年12月12日 上午9:55:10 */ public class ArticleCategoryVo implements Serializable{ private static final long serialVersionUID = 1L; private int categoryId; private String categoryName; private Date createDate; private String categoryDelete; private int categoryNum; /** * @return the categoryId */ public int getCategoryId() { return categoryId; } /** * @param categoryId the categoryId to set */ public void setCategoryId(int categoryId) { this.categoryId = categoryId; } /** * @return the categoryName */ public String getCategoryName() { return categoryName; } /** * @param categoryName the categoryName to set */ public void setCategoryName(String categoryName) { this.categoryName = categoryName; } /** * @return the createDate */ public Date getCreateDate() { return createDate; } /** * @param createDate the createDate to set */ public void setCreateDate(Date createDate) { this.createDate = createDate; } /** * @return the categoryDelete */ public String getCategoryDelete() { return categoryDelete; } /** * @param categoryDelete the categoryDelete to set */ public void setCategoryDelete(String categoryDelete) { this.categoryDelete = categoryDelete; } /** * @return the categoryNum */ public int getCategoryNum() { return categoryNum; } /** * @param categoryNum the categoryNum to set */ public void setCategoryNum(int categoryNum) { this.categoryNum = categoryNum; } }
Humsen/web/web-core/src/pers/husen/web/bean/vo/ArticleCategoryVo.java/0
{ "file_path": "Humsen/web/web-core/src/pers/husen/web/bean/vo/ArticleCategoryVo.java", "repo_id": "Humsen", "token_count": 537 }
19
package pers.husen.web.common.handler; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import pers.husen.web.config.ProjectDeployConfig; /** * 图片下载 * * @author 何明胜 * * 2017年10月20日 */ public class ImageDownloadHandler { private final Logger logger = LogManager.getLogger(ImageUploadHandler.class.getName()); public void imageDownloadHandler(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); //得到要下载的url String imageUrl = request.getParameter("imageUrl"); //上传的图片都是保存在工程文件的兄弟级文件images目录下 String saveFile = ProjectDeployConfig.IMAGE_PATH; File fileSaveRootPath = new File(saveFile); //得到要下载的文件 logger.info("下载文件:" + fileSaveRootPath + "/" + imageUrl); File file = new File(fileSaveRootPath + "/" + imageUrl); //如果文件不存在 if(!file.exists()){ return; } //获取文件名 int index = imageUrl.lastIndexOf("/"); String imageName = imageUrl.substring(index+1); //设置响应头,控制浏览器下载该文件 response.setHeader("content-disposition", "attachment;filename=" + imageName); //读取要下载的文件,保存到文件输入流 FileInputStream in = new FileInputStream(fileSaveRootPath + "/" + imageUrl); //创建输出流 OutputStream out = response.getOutputStream(); //创建缓冲区 byte[] buffer = new byte[1024]; int len = 0; //循环将输入流中的内容读取到缓冲区当中 while((len=in.read(buffer))>0){ //输出缓冲区的内容到浏览器,实现文件下载 out.write(buffer, 0, len); } //关闭文件输入流 in.close(); //关闭输出流 out.close(); } }
Humsen/web/web-core/src/pers/husen/web/common/handler/ImageDownloadHandler.java/0
{ "file_path": "Humsen/web/web-core/src/pers/husen/web/common/handler/ImageDownloadHandler.java", "repo_id": "Humsen", "token_count": 1099 }
20
package pers.husen.web.config.filter; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import pers.husen.web.common.helper.StackTrace2Str; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; /** * 错误捕获 * * @author 何明胜 * * 2017年11月7日 */ public class WebFilter implements Filter { private final Logger logger = LogManager.getLogger(WebFilter.class); @Override public void destroy() { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) { //异常捕获,继续后面的请求 try { chain.doFilter(request, response); } catch (Exception e) { logger.error(StackTrace2Str.exceptionStackTrace2Str(e)); } } @Override public void init(FilterConfig arg0) throws ServletException { } }
Humsen/web/web-core/src/pers/husen/web/config/filter/WebFilter.java/0
{ "file_path": "Humsen/web/web-core/src/pers/husen/web/config/filter/WebFilter.java", "repo_id": "Humsen", "token_count": 379 }
21
package pers.husen.web.dao.impl; import java.util.ArrayList; import java.util.Date; import pers.husen.web.bean.vo.ImageUploadVo; import pers.husen.web.dao.ImageUploadDao; import pers.husen.web.dbutil.DbManipulationUtils; /** * @author 何明胜 * * 2017年10月20日 */ public class ImageUploadDaoImpl implements ImageUploadDao { @Override public int insertImageUpload(ImageUploadVo iVo) { String sql = "INSERT INTO image_upload (image_name, image_url, image_upload_date, image_type, image_download_count) VALUES (?, ?, ?, ?, ?)"; ArrayList<Object> paramList = new ArrayList<>(); Object obj; paramList.add((obj = iVo.getImageName()) != null ? obj : ""); paramList.add((obj = iVo.getImageUrl()) != null ? obj : ""); paramList.add((obj = iVo.getImageUploadDate()) != null ? obj : new Date()); paramList.add(iVo.getImageType()); paramList.add(iVo.getImageDownloadCount()); return DbManipulationUtils.insertNewRecord(sql, paramList); } }
Humsen/web/web-core/src/pers/husen/web/dao/impl/ImageUploadDaoImpl.java/0
{ "file_path": "Humsen/web/web-core/src/pers/husen/web/dao/impl/ImageUploadDaoImpl.java", "repo_id": "Humsen", "token_count": 356 }
22
package pers.husen.web.dbutil.mappingdb; /** * 留言区数据库 * * @author 何明胜 * * 2017年10月20日 */ public class MessageAreaMapping { /** * 数据库名称 */ public static String DB_NAME = "message_area"; }
Humsen/web/web-core/src/pers/husen/web/dbutil/mappingdb/MessageAreaMapping.java/0
{ "file_path": "Humsen/web/web-core/src/pers/husen/web/dbutil/mappingdb/MessageAreaMapping.java", "repo_id": "Humsen", "token_count": 111 }
23
package pers.husen.web.servlet.article; import java.io.IOException; import java.io.PrintWriter; import java.net.URLDecoder; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONArray; import pers.husen.web.bean.vo.BlogArticleVo; import pers.husen.web.common.constants.RequestConstants; import pers.husen.web.service.BlogArticleSvc; /** * 博客查询servlet,如博客总数量、某一页的博客等 * * @author 何明胜 * * 2017年11月7日 */ @WebServlet(urlPatterns = "/blog/query.hms") public class BlogQuerySvt extends HttpServlet { private static final long serialVersionUID = 1L; public BlogQuerySvt() { super(); } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("application/json; charset=UTF-8"); PrintWriter out = response.getWriter(); BlogArticleSvc bSvc = new BlogArticleSvc(); String requestType = request.getParameter(RequestConstants.PARAM_TYPE); String requestKeywords = request.getParameter(RequestConstants.PARAM_KEYWORDS); requestKeywords = (requestKeywords == null ? "" : URLDecoder.decode(requestKeywords, "utf-8")); String category = request.getParameter(RequestConstants.PARAM_CATEGORY); BlogArticleVo bVo = new BlogArticleVo(); bVo.setBlogTitle(requestKeywords); if (category != null && !category.trim().equals("")) { bVo.setBlogCategory(Integer.parseInt(category)); } else { bVo.setBlogCategory(-1); } /** 如果是请求查询总共数量 */ String queryTotalCount = RequestConstants.REQUEST_TYPE_QUERY + RequestConstants.MODE_TOTAL_NUM; if (queryTotalCount.equals(requestType)) { int count = bSvc.queryBlogTotalCount(bVo); out.println(count); return; } /** 如果是请求查询某一页的博客 */ String queryOnePage = RequestConstants.REQUEST_TYPE_QUERY + RequestConstants.MODE_ONE_PAGE; if (queryOnePage.equals(requestType)) { int pageSize = Integer.parseInt(request.getParameter("pageSize")); int pageNo = Integer.parseInt(request.getParameter("pageNo")); ArrayList<BlogArticleVo> bVos = bSvc.queryBlogArticlePerPage(bVo, pageSize, pageNo); String json = JSONArray.fromObject(bVos).toString(); out.println(json); return; } /** 如果是请求查询所有博客 */ String queryAllBlog = RequestConstants.REQUEST_TYPE_QUERY + RequestConstants.MODE_ALL; if (queryAllBlog.equals(requestType)) { ArrayList<BlogArticleVo> aVos = bSvc.queryBlogArticles(); String json = JSONArray.fromObject(aVos).toString(); out.println(json); return; } /** 如果是请求查询上一篇有效博客 */ String queryPrevious = RequestConstants.REQUEST_TYPE_QUERY + RequestConstants.MODE_PREVIOUS; if (queryPrevious.equals(requestType)) { int blogId = Integer.parseInt(request.getParameter("blogId")); bVo = bSvc.queryPreviousBlog(blogId); int previousBlog = 0; if (bVo != null && bVo.getBlogId() != 0) { previousBlog = bVo.getBlogId(); } out.println(previousBlog); return; } /** 如果是请求查询下一篇有效博客 */ String queryNext = RequestConstants.REQUEST_TYPE_QUERY + RequestConstants.MODE_NEXT; if (queryNext.equals(requestType)) { int blogId = Integer.parseInt(request.getParameter("blogId")); bVo = bSvc.queryNextBlog(blogId); int nextBlog = 0; if (bVo != null && bVo.getBlogId() != 0) { nextBlog = bVo.getBlogId(); } out.println(nextBlog); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
Humsen/web/web-core/src/pers/husen/web/servlet/article/BlogQuerySvt.java/0
{ "file_path": "Humsen/web/web-core/src/pers/husen/web/servlet/article/BlogQuerySvt.java", "repo_id": "Humsen", "token_count": 1538 }
24
package pers.husen.web.servlet.module; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import pers.husen.web.common.constants.ResponseConstants; import pers.husen.web.common.helper.ReadH5Helper; /** * @desc 联系站长模块 * * @author 何明胜 * * @created 2017年12月20日 下午9:33:13 */ @WebServlet(urlPatterns = "/module/contact.hms") public class ContactModuleSvt extends HttpServlet { private static final long serialVersionUID = 1L; public ContactModuleSvt() { super(); } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setCharacterEncoding("UTF-8"); response.setContentType("text/html; charset=UTF-8"); ReadH5Helper.writeHtmlByName(ResponseConstants.CONTACT_MODULE_TEMPLATE_PATH, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
Humsen/web/web-core/src/pers/husen/web/servlet/module/ContactModuleSvt.java/0
{ "file_path": "Humsen/web/web-core/src/pers/husen/web/servlet/module/ContactModuleSvt.java", "repo_id": "Humsen", "token_count": 431 }
25
@charset "UTF-8"; body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, p, pre, code, form, fieldset, legend, blockquote, th, td, figure { margin: 0; padding: 0; } li { list-style: none; } html { -webkit-text-size-adjust: none; -ms-text-size-adjust: none; } body { font: 75%/1.5 Arial, Sans-serif; } h1, h2, h3, h4, h5, h6 { font-size: 100%; } .clearfix { zoom: 1; } .clearfix:after { content: "."; display: block; height: 0; clear: both; overflow: hidden; visibility: hidden; } a:link, a:visited { color: #06c; text-decoration: none; } a:hover, a:active { text-decoration: underline; } body { background: #F9FAFD; color: #818181; } .box { width: 624px; height: 188px; padding: 99px 30px 0 184px; background: url("/images/mainbg.png") no-repeat 0 0; position: absolute; margin: -144px 0 0 -419px; top: 50%; left: 50%; font-size: 14px; line-height: 24px; } .box .title { margin-bottom: 11px; } .box .text { padding-left: 29px; }
Humsen/web/web-mobile/WebContent/css/error/error.css/0
{ "file_path": "Humsen/web/web-mobile/WebContent/css/error/error.css", "repo_id": "Humsen", "token_count": 465 }
26
@charset "UTF-8"; .secondmenu a { /* text-align: center; */ margin-left: 20px; } .version-input { /* resize: none; */ } .form-show-userinfo { margin-top: 50px; } .img-user-head { width: 80px; height: 80px; } .form-show-p { width: 30%; } .return-index-blank { float: left; margin-left: 20px; } .left-bar{ clear:both; margin-top: 40px; }
Humsen/web/web-mobile/WebContent/css/personal_center/mycenter.css/0
{ "file_path": "Humsen/web/web-mobile/WebContent/css/personal_center/mycenter.css", "repo_id": "Humsen", "token_count": 169 }
27
/** * @author 何明胜 * * 2017年9月27日 */ $(function() { queryLatestBlog(3);// 加载博客 }); /** * 查询最新更新的3篇博客,如果小于3,则有多少查多少 相当于按照时间排序后根据页面大小查询第1页 * * @param pageSize * @returns */ function queryLatestBlog(pageSize){ $.ajax({ type : 'POST', async: true, url : '/blog/query.hms', dataType : 'json', data : { type : 'query_one_page', pageSize : pageSize, pageNo : 1, }, success : function(response, status){ for(x in response){ loadSimpleBlog(response[x]); } }, error : function(XMLHttpRequest, textStatus){ $.confirm({ title: '博客加载出错', content: textStatus + ' : ' + XMLHttpRequest.status, autoClose: 'ok|2000', type: 'red', buttons: { ok: { text: '确认', btnClass: 'btn-primary', }, } }); } }); } /** * 加载简介形式的博客 * * @param blogData * @returns */ function loadSimpleBlog(blogData){ $('#latestBlog').append('<div class="col-md-3 col-sm-6 col-padding article-box-div" >' + '<div class="blog-entry">' + '<div class="desc">' + '<h3 class="article-title"><a href="/blog.hms?blogId=' + blogData.blogId +'">' + blogData.blogTitle + '</a></h3>' + '<span class="article-author">'+ '作者:'+ blogData.userNickName +'&nbsp;' + new Date(blogData.blogDate.time).format('yyyy-MM-dd hh:mm:ss') + '&nbsp;' + '<i class="icon-comment"></i>浏览' + blogData.blogRead + '次</span>' + '<p><b>摘要:</b>' + blogData.blogSummary + '</p>' + '<a href="/blog.hms?blogId='+ blogData.blogId +'" class="lead read-more">阅读更多 <i class="glyphicon glyphicon-arrow-right"></i></a>' + '</div>' + '</div>'); }
Humsen/web/web-mobile/WebContent/js/index/latestblog.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/js/index/latestblog.js", "repo_id": "Humsen", "token_count": 903 }
28
/** * @author 何明胜 * * 2017年12月1日 */ var $fileList; var $btnUpload; var state = 'pending'; var web_uploader; $(function() { $fileList = $('#file_list'); $btnUpload = $('#btn_uploadStart'); initWebLoader(); showFileList(); uploadProgress(); callbackFun(); uploadClick(); }); /** * 初始化Web Uploader * * @returns */ function initWebLoader() { web_uploader = WebUploader.create({ // swf文件路径 swf : '/plugins/webuploader/Uploader.swf', // 文件接收服务端。 server : '/fileUpload.hms', // 选择文件的按钮。可选。 // 内部根据当前运行时创建,可能是input元素,也可能是flash. pick : '#file_choose', // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传! resize : false }); } /** * 显示用户选择 * * @returns */ function showFileList() { // 当有文件被添加进队列的时候 web_uploader.on('fileQueued', function(file) { $fileList.append('<div id="' + file.id + '" class="item">' + '<h4 class="info">' + file.name + '</h4>' + '<p class="state">等待上传...</p>' + '</div>'); }); } /** * 文件上传进度显示 * @returns */ function uploadProgress(){ // 文件上传过程中创建进度条实时显示。 web_uploader.on( 'uploadProgress', function( file, percentage ) { var $li = $( '#'+file.id ); var $percent = $li.find('.progress .progress-bar'); // 避免重复创建 if ( !$percent.length ) { $percent = $('<div class="progress progress-striped active">' + '<div class="progress-bar" role="progressbar" style="width: 0%">' + '</div>' + '</div>').appendTo( $li ).find('.progress-bar'); } $li.find('p.state').text('上传中'); $percent.css( 'width', percentage * 100 + '%' ); }); } /** * 回调函数 * @returns */ function callbackFun(){ /** 文件上传成功 **/ web_uploader.on('uploadSuccess', function( file ) { $('#'+file.id).find('p.state').text('已上传'); }); /** 文件上传失败 **/ web_uploader.on('uploadError', function( file ) { $('#'+file.id).find('p.state').text('上传出错'); }); /** 不管成功或者失败,在文件上传完后都会触发uploadComplete事件 **/ web_uploader.on('uploadComplete', function( file ) { $('#'+file.id).find('.progress').fadeOut(); }); /** 所有的事件触发都会响应到,改变当前状态 **/ web_uploader.on( 'all', function( type ) { if ( type === 'startUpload' ) { state = 'uploading'; } else if ( type === 'stopUpload' ) { state = 'paused'; } else if ( type === 'uploadFinished' ) { state = 'done'; } if ( state === 'uploading' ) { $btnUpload.text('暂停上传'); } else { $btnUpload.text('开始上传'); } }); } /** * 开始上传点击事件 * @returns */ function uploadClick(){ $btnUpload.click(function() { if (state === 'uploading') { web_uploader.stop(); } else { web_uploader.upload(); } }); }
Humsen/web/web-mobile/WebContent/js/personal_center/upload-file.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/js/personal_center/upload-file.js", "repo_id": "Humsen", "token_count": 1561 }
29
// 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" }); }); });
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/edit/trailingspace.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/edit/trailingspace.js", "repo_id": "Humsen", "token_count": 405 }
30
// 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 == "</") { tagType = "close"; } if (!tag && !inner.state.tagName || tagType) { if (tagName) prefix = token.string; replaceToken = tagType; var cx = inner.state.context, curTag = cx && tags[cx.tagName]; var childList = cx ? curTag && curTag.children : tags["!top"]; if (childList && tagType != "close") { for (var i = 0; i < childList.length; ++i) if (!prefix || childList[i].lastIndexOf(prefix, 0) == 0) result.push("<" + childList[i]); } else if (tagType != "close") { for (var name in tags) if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || name.lastIndexOf(prefix, 0) == 0)) result.push("<" + name); } if (cx && (!prefix || tagType == "close" && cx.tagName.lastIndexOf(prefix, 0) == 0)) result.push("</" + cx.tagName + ">"); } 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); });
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/hint/xml-hint.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/hint/xml-hint.js", "repo_id": "Humsen", "token_count": 2046 }
31
// 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; } } }; })();
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/runmode/runmode-standalone.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/runmode/runmode-standalone.js", "repo_id": "Humsen", "token_count": 2088 }
32
// 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 + ": <input type=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); }; } });
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/tern/tern.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/addon/tern/tern.js", "repo_id": "Humsen", "token_count": 10035 }
33
// 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("css", function(config, parserConfig) { if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css"); var indentUnit = config.indentUnit, tokenHooks = parserConfig.tokenHooks, documentTypes = parserConfig.documentTypes || {}, mediaTypes = parserConfig.mediaTypes || {}, mediaFeatures = parserConfig.mediaFeatures || {}, propertyKeywords = parserConfig.propertyKeywords || {}, nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {}, fontProperties = parserConfig.fontProperties || {}, counterDescriptors = parserConfig.counterDescriptors || {}, colorKeywords = parserConfig.colorKeywords || {}, valueKeywords = parserConfig.valueKeywords || {}, allowNested = parserConfig.allowNested; var type, override; function ret(style, tp) { type = tp; return style; } // Tokenizers function tokenBase(stream, state) { var ch = stream.next(); if (tokenHooks[ch]) { var result = tokenHooks[ch](stream, state); if (result !== false) return result; } if (ch == "@") { stream.eatWhile(/[\w\\\-]/); return ret("def", stream.current()); } else if (ch == "=" || (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.eatWhile(/[\w\\\-]/); return ret("atom", "hash"); } else if (ch == "!") { stream.match(/^\s*\w*/); return ret("keyword", "important"); } else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) { stream.eatWhile(/[\w.%]/); return ret("number", "unit"); } else if (ch === "-") { if (/[\d.]/.test(stream.peek())) { stream.eatWhile(/[\w.%]/); return ret("number", "unit"); } else if (stream.match(/^-[\w\\\-]+/)) { stream.eatWhile(/[\w\\\-]/); if (stream.match(/^\s*:/, false)) return ret("variable-2", "variable-definition"); return ret("variable-2", "variable"); } else if (stream.match(/^\w+-/)) { return ret("meta", "meta"); } } else if (/[,+>*\/]/.test(ch)) { return ret(null, "select-op"); } else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) { return ret("qualifier", "qualifier"); } else if (/[:;{}\[\]\(\)]/.test(ch)) { return ret(null, ch); } else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) || (ch == "d" && stream.match("omain(")) || (ch == "r" && stream.match("egexp("))) { stream.backUp(1); state.tokenize = tokenParenthesized; return ret("property", "word"); } else if (/[\w\\\-]/.test(ch)) { stream.eatWhile(/[\w\\\-]/); return ret("property", "word"); } else { return ret(null, null); } } function tokenString(quote) { return function(stream, state) { var escaped = false, ch; while ((ch = stream.next()) != null) { if (ch == quote && !escaped) { if (quote == ")") stream.backUp(1); break; } escaped = !escaped && ch == "\\"; } if (ch == quote || !escaped && quote != ")") state.tokenize = null; return ret("string", "string"); }; } function tokenParenthesized(stream, state) { stream.next(); // Must be '(' if (!stream.match(/\s*[\"\')]/, false)) state.tokenize = tokenString(")"); else state.tokenize = null; return ret(null, "("); } // Context management function Context(type, indent, prev) { this.type = type; this.indent = indent; this.prev = prev; } function pushContext(state, stream, type) { state.context = new Context(type, stream.indentation() + indentUnit, state.context); return type; } function popContext(state) { state.context = state.context.prev; return state.context.type; } function pass(type, stream, state) { return states[state.context.type](type, stream, state); } function popAndPass(type, stream, state, n) { for (var i = n || 1; i > 0; i--) state.context = state.context.prev; return pass(type, stream, state); } // Parser function wordAsValue(stream) { var word = stream.current().toLowerCase(); if (valueKeywords.hasOwnProperty(word)) override = "atom"; else if (colorKeywords.hasOwnProperty(word)) override = "keyword"; else override = "variable"; } var states = {}; states.top = function(type, stream, state) { if (type == "{") { return pushContext(state, stream, "block"); } else if (type == "}" && state.context.prev) { return popContext(state); } else if (/@(media|supports|(-moz-)?document)/.test(type)) { return pushContext(state, stream, "atBlock"); } else if (/@(font-face|counter-style)/.test(type)) { state.stateArg = type; return "restricted_atBlock_before"; } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) { return "keyframes"; } else if (type && type.charAt(0) == "@") { return pushContext(state, stream, "at"); } else if (type == "hash") { override = "builtin"; } else if (type == "word") { override = "tag"; } else if (type == "variable-definition") { return "maybeprop"; } else if (type == "interpolation") { return pushContext(state, stream, "interpolation"); } else if (type == ":") { return "pseudo"; } else if (allowNested && type == "(") { return pushContext(state, stream, "parens"); } return state.context.type; }; states.block = function(type, stream, state) { if (type == "word") { var word = stream.current().toLowerCase(); if (propertyKeywords.hasOwnProperty(word)) { override = "property"; return "maybeprop"; } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) { override = "string-2"; return "maybeprop"; } else if (allowNested) { override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag"; return "block"; } else { override += " error"; return "maybeprop"; } } else if (type == "meta") { return "block"; } else if (!allowNested && (type == "hash" || type == "qualifier")) { override = "error"; return "block"; } else { return states.top(type, stream, state); } }; states.maybeprop = function(type, stream, state) { if (type == ":") return pushContext(state, stream, "prop"); return pass(type, stream, state); }; states.prop = function(type, stream, state) { if (type == ";") return popContext(state); if (type == "{" && allowNested) return pushContext(state, stream, "propBlock"); if (type == "}" || type == "{") return popAndPass(type, stream, state); if (type == "(") return pushContext(state, stream, "parens"); if (type == "hash" && !/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) { override += " error"; } else if (type == "word") { wordAsValue(stream); } else if (type == "interpolation") { return pushContext(state, stream, "interpolation"); } return "prop"; }; states.propBlock = function(type, _stream, state) { if (type == "}") return popContext(state); if (type == "word") { override = "property"; return "maybeprop"; } return state.context.type; }; states.parens = function(type, stream, state) { if (type == "{" || type == "}") return popAndPass(type, stream, state); if (type == ")") return popContext(state); if (type == "(") return pushContext(state, stream, "parens"); if (type == "word") wordAsValue(stream); return "parens"; }; states.pseudo = function(type, stream, state) { if (type == "word") { override = "variable-3"; return state.context.type; } return pass(type, stream, state); }; states.atBlock = function(type, stream, state) { if (type == "(") return pushContext(state, stream, "atBlock_parens"); if (type == "}") return popAndPass(type, stream, state); if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top"); if (type == "word") { var word = stream.current().toLowerCase(); if (word == "only" || word == "not" || word == "and" || word == "or") override = "keyword"; else if (documentTypes.hasOwnProperty(word)) override = "tag"; else if (mediaTypes.hasOwnProperty(word)) override = "attribute"; else if (mediaFeatures.hasOwnProperty(word)) override = "property"; else if (propertyKeywords.hasOwnProperty(word)) override = "property"; else if (nonStandardPropertyKeywords.hasOwnProperty(word)) override = "string-2"; else if (valueKeywords.hasOwnProperty(word)) override = "atom"; else override = "error"; } return state.context.type; }; states.atBlock_parens = function(type, stream, state) { if (type == ")") return popContext(state); if (type == "{" || type == "}") return popAndPass(type, stream, state, 2); return states.atBlock(type, stream, state); }; states.restricted_atBlock_before = function(type, stream, state) { if (type == "{") return pushContext(state, stream, "restricted_atBlock"); if (type == "word" && state.stateArg == "@counter-style") { override = "variable"; return "restricted_atBlock_before"; } return pass(type, stream, state); }; states.restricted_atBlock = function(type, stream, state) { if (type == "}") { state.stateArg = null; return popContext(state); } if (type == "word") { if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) || (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase()))) override = "error"; else override = "property"; return "maybeprop"; } return "restricted_atBlock"; }; states.keyframes = function(type, stream, state) { if (type == "word") { override = "variable"; return "keyframes"; } if (type == "{") return pushContext(state, stream, "top"); return pass(type, stream, state); }; states.at = function(type, stream, state) { if (type == ";") return popContext(state); if (type == "{" || type == "}") return popAndPass(type, stream, state); if (type == "word") override = "tag"; else if (type == "hash") override = "builtin"; return "at"; }; states.interpolation = function(type, stream, state) { if (type == "}") return popContext(state); if (type == "{" || type == ";") return popAndPass(type, stream, state); if (type != "variable") override = "error"; return "interpolation"; }; return { startState: function(base) { return {tokenize: null, state: "top", stateArg: null, context: new Context("top", base || 0, null)}; }, token: function(stream, state) { if (!state.tokenize && stream.eatSpace()) return null; var style = (state.tokenize || tokenBase)(stream, state); if (style && typeof style == "object") { type = style[1]; style = style[0]; } override = style; state.state = states[state.state](type, stream, state); return override; }, indent: function(state, textAfter) { var cx = state.context, ch = textAfter && textAfter.charAt(0); var indent = cx.indent; if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev; if (cx.prev && (ch == "}" && (cx.type == "block" || cx.type == "top" || cx.type == "interpolation" || cx.type == "restricted_atBlock") || ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") || ch == "{" && (cx.type == "at" || cx.type == "atBlock"))) { indent = cx.indent - indentUnit; cx = cx.prev; } return indent; }, electricChars: "}", blockCommentStart: "/*", blockCommentEnd: "*/", fold: "brace" }; }); function keySet(array) { var keys = {}; for (var i = 0; i < array.length; ++i) { keys[array[i]] = true; } return keys; } var documentTypes_ = [ "domain", "regexp", "url", "url-prefix" ], documentTypes = keySet(documentTypes_); var mediaTypes_ = [ "all", "aural", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "embossed" ], mediaTypes = keySet(mediaTypes_); var mediaFeatures_ = [ "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" ], mediaFeatures = keySet(mediaFeatures_); var propertyKeywords_ = [ "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", // SVG-specific "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" ], propertyKeywords = keySet(propertyKeywords_); var nonStandardPropertyKeywords_ = [ "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" ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_); var fontProperties_ = [ "font-family", "src", "unicode-range", "font-variant", "font-feature-settings", "font-stretch", "font-weight", "font-style" ], fontProperties = keySet(fontProperties_); var counterDescriptors_ = [ "additive-symbols", "fallback", "negative", "pad", "prefix", "range", "speak-as", "suffix", "symbols", "system" ], counterDescriptors = keySet(counterDescriptors_); var colorKeywords_ = [ "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" ], colorKeywords = keySet(colorKeywords_); var valueKeywords_ = [ "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" ], valueKeywords = keySet(valueKeywords_); var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(propertyKeywords_) .concat(nonStandardPropertyKeywords_).concat(colorKeywords_).concat(valueKeywords_); CodeMirror.registerHelper("hintWords", "css", allWords); function tokenCComment(stream, state) { var maybeEnd = false, ch; while ((ch = stream.next()) != null) { if (maybeEnd && ch == "/") { state.tokenize = null; break; } maybeEnd = (ch == "*"); } return ["comment", "comment"]; } function tokenSGMLComment(stream, state) { if (stream.skipTo("-->")) { stream.match("-->"); state.tokenize = null; } else { stream.skipToEnd(); } return ["comment", "comment"]; } CodeMirror.defineMIME("text/css", { documentTypes: documentTypes, mediaTypes: mediaTypes, mediaFeatures: mediaFeatures, propertyKeywords: propertyKeywords, nonStandardPropertyKeywords: nonStandardPropertyKeywords, fontProperties: fontProperties, counterDescriptors: counterDescriptors, colorKeywords: colorKeywords, valueKeywords: valueKeywords, tokenHooks: { "<": function(stream, state) { if (!stream.match("!--")) return false; state.tokenize = tokenSGMLComment; return tokenSGMLComment(stream, state); }, "/": function(stream, state) { if (!stream.eat("*")) return false; state.tokenize = tokenCComment; return tokenCComment(stream, state); } }, name: "css" }); CodeMirror.defineMIME("text/x-scss", { mediaTypes: mediaTypes, mediaFeatures: mediaFeatures, propertyKeywords: propertyKeywords, nonStandardPropertyKeywords: nonStandardPropertyKeywords, colorKeywords: colorKeywords, valueKeywords: valueKeywords, fontProperties: fontProperties, allowNested: true, tokenHooks: { "/": function(stream, state) { if (stream.eat("/")) { stream.skipToEnd(); return ["comment", "comment"]; } else if (stream.eat("*")) { state.tokenize = tokenCComment; return tokenCComment(stream, state); } else { return ["operator", "operator"]; } }, ":": function(stream) { if (stream.match(/\s*\{/)) return [null, "{"]; return false; }, "$": function(stream) { stream.match(/^[\w-]+/); if (stream.match(/^\s*:/, false)) return ["variable-2", "variable-definition"]; return ["variable-2", "variable"]; }, "#": function(stream) { if (!stream.eat("{")) return false; return [null, "interpolation"]; } }, name: "css", helperType: "scss" }); CodeMirror.defineMIME("text/x-less", { mediaTypes: mediaTypes, mediaFeatures: mediaFeatures, propertyKeywords: propertyKeywords, nonStandardPropertyKeywords: nonStandardPropertyKeywords, colorKeywords: colorKeywords, valueKeywords: valueKeywords, fontProperties: fontProperties, allowNested: true, tokenHooks: { "/": function(stream, state) { if (stream.eat("/")) { stream.skipToEnd(); return ["comment", "comment"]; } else if (stream.eat("*")) { state.tokenize = tokenCComment; return tokenCComment(stream, state); } else { return ["operator", "operator"]; } }, "@": function(stream) { if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false; stream.eatWhile(/[\w\\\-]/); if (stream.match(/^\s*:/, false)) return ["variable-2", "variable-definition"]; return ["variable-2", "variable"]; }, "&": function() { return ["atom", "atom"]; } }, name: "css", helperType: "less" }); });
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/css/css.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/css/css.js", "repo_id": "Humsen", "token_count": 13603 }
34
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE // Author: Aliaksei Chapyzhenka (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 toWordList(words) { var ret = []; words.split(' ').forEach(function(e){ ret.push({name: e}); }); return ret; } var coreWordList = toWordList( 'INVERT AND OR XOR\ 2* 2/ LSHIFT RSHIFT\ 0= = 0< < > U< MIN MAX\ 2DROP 2DUP 2OVER 2SWAP ?DUP DEPTH DROP DUP OVER ROT SWAP\ >R R> R@\ + - 1+ 1- ABS NEGATE\ S>D * M* UM*\ FM/MOD SM/REM UM/MOD */ */MOD / /MOD MOD\ HERE , @ ! CELL+ CELLS C, C@ C! CHARS 2@ 2!\ ALIGN ALIGNED +! ALLOT\ CHAR [CHAR] [ ] BL\ FIND EXECUTE IMMEDIATE COUNT LITERAL STATE\ ; DOES> >BODY\ EVALUATE\ SOURCE >IN\ <# # #S #> HOLD SIGN BASE >NUMBER HEX DECIMAL\ FILL MOVE\ . CR EMIT SPACE SPACES TYPE U. .R U.R\ ACCEPT\ TRUE FALSE\ <> U> 0<> 0>\ NIP TUCK ROLL PICK\ 2>R 2R@ 2R>\ WITHIN UNUSED MARKER\ I J\ TO\ COMPILE, [COMPILE]\ SAVE-INPUT RESTORE-INPUT\ PAD ERASE\ 2LITERAL DNEGATE\ D- D+ D0< D0= D2* D2/ D< D= DMAX DMIN D>S DABS\ M+ M*/ D. D.R 2ROT DU<\ CATCH THROW\ FREE RESIZE ALLOCATE\ CS-PICK CS-ROLL\ GET-CURRENT SET-CURRENT FORTH-WORDLIST GET-ORDER SET-ORDER\ PREVIOUS SEARCH-WORDLIST WORDLIST FIND ALSO ONLY FORTH DEFINITIONS ORDER\ -TRAILING /STRING SEARCH COMPARE CMOVE CMOVE> BLANK SLITERAL'); var immediateWordList = toWordList('IF ELSE THEN BEGIN WHILE REPEAT UNTIL RECURSE [IF] [ELSE] [THEN] ?DO DO LOOP +LOOP UNLOOP LEAVE EXIT AGAIN CASE OF ENDOF ENDCASE'); CodeMirror.defineMode('forth', function() { function searchWordList (wordList, word) { var i; for (i = wordList.length - 1; i >= 0; i--) { if (wordList[i].name === word.toUpperCase()) { return wordList[i]; } } return undefined; } return { startState: function() { return { state: '', base: 10, coreWordList: coreWordList, immediateWordList: immediateWordList, wordList: [] }; }, token: function (stream, stt) { var mat; if (stream.eatSpace()) { return null; } if (stt.state === '') { // interpretation if (stream.match(/^(\]|:NONAME)(\s|$)/i)) { stt.state = ' compilation'; return 'builtin compilation'; } mat = stream.match(/^(\:)\s+(\S+)(\s|$)+/); if (mat) { stt.wordList.push({name: mat[2].toUpperCase()}); stt.state = ' compilation'; return 'def' + stt.state; } mat = stream.match(/^(VARIABLE|2VARIABLE|CONSTANT|2CONSTANT|CREATE|POSTPONE|VALUE|WORD)\s+(\S+)(\s|$)+/i); if (mat) { stt.wordList.push({name: mat[2].toUpperCase()}); return 'def' + stt.state; } mat = stream.match(/^(\'|\[\'\])\s+(\S+)(\s|$)+/); if (mat) { return 'builtin' + stt.state; } } else { // compilation // ; [ if (stream.match(/^(\;|\[)(\s)/)) { stt.state = ''; stream.backUp(1); return 'builtin compilation'; } if (stream.match(/^(\;|\[)($)/)) { stt.state = ''; return 'builtin compilation'; } if (stream.match(/^(POSTPONE)\s+\S+(\s|$)+/)) { return 'builtin'; } } // dynamic wordlist mat = stream.match(/^(\S+)(\s+|$)/); if (mat) { if (searchWordList(stt.wordList, mat[1]) !== undefined) { return 'variable' + stt.state; } // comments if (mat[1] === '\\') { stream.skipToEnd(); return 'comment' + stt.state; } // core words if (searchWordList(stt.coreWordList, mat[1]) !== undefined) { return 'builtin' + stt.state; } if (searchWordList(stt.immediateWordList, mat[1]) !== undefined) { return 'keyword' + stt.state; } if (mat[1] === '(') { stream.eatWhile(function (s) { return s !== ')'; }); stream.eat(')'); return 'comment' + stt.state; } // // strings if (mat[1] === '.(') { stream.eatWhile(function (s) { return s !== ')'; }); stream.eat(')'); return 'string' + stt.state; } if (mat[1] === 'S"' || mat[1] === '."' || mat[1] === 'C"') { stream.eatWhile(function (s) { return s !== '"'; }); stream.eat('"'); return 'string' + stt.state; } // numbers if (mat[1] - 0xfffffffff) { return 'number' + stt.state; } // if (mat[1].match(/^[-+]?[0-9]+\.[0-9]*/)) { // return 'number' + stt.state; // } return 'atom' + stt.state; } } }; }); CodeMirror.defineMIME("text/x-forth", "forth"); });
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/forth/forth.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/forth/forth.js", "repo_id": "Humsen", "token_count": 2627 }
35
// 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"), require("../css/css"), require("../htmlmixed/htmlmixed")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror", "../javascript/javascript", "../css/css", "../htmlmixed/htmlmixed"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.defineMode('jade', function (config) { // token types var KEYWORD = 'keyword'; var DOCTYPE = 'meta'; var ID = 'builtin'; var CLASS = 'qualifier'; var ATTRS_NEST = { '{': '}', '(': ')', '[': ']' }; var jsMode = CodeMirror.getMode(config, 'javascript'); function State() { this.javaScriptLine = false; this.javaScriptLineExcludesColon = false; this.javaScriptArguments = false; this.javaScriptArgumentsDepth = 0; this.isInterpolating = false; this.interpolationNesting = 0; this.jsState = jsMode.startState(); this.restOfLine = ''; this.isIncludeFiltered = false; this.isEach = false; this.lastTag = ''; this.scriptType = ''; // Attributes Mode this.isAttrs = false; this.attrsNest = []; this.inAttributeName = true; this.attributeIsType = false; this.attrValue = ''; // Indented Mode this.indentOf = Infinity; this.indentToken = ''; this.innerMode = null; this.innerState = null; this.innerModeForLine = false; } /** * Safely copy a state * * @return {State} */ State.prototype.copy = function () { var res = new State(); res.javaScriptLine = this.javaScriptLine; res.javaScriptLineExcludesColon = this.javaScriptLineExcludesColon; res.javaScriptArguments = this.javaScriptArguments; res.javaScriptArgumentsDepth = this.javaScriptArgumentsDepth; res.isInterpolating = this.isInterpolating; res.interpolationNesting = this.intpolationNesting; res.jsState = CodeMirror.copyState(jsMode, this.jsState); res.innerMode = this.innerMode; if (this.innerMode && this.innerState) { res.innerState = CodeMirror.copyState(this.innerMode, this.innerState); } res.restOfLine = this.restOfLine; res.isIncludeFiltered = this.isIncludeFiltered; res.isEach = this.isEach; res.lastTag = this.lastTag; res.scriptType = this.scriptType; res.isAttrs = this.isAttrs; res.attrsNest = this.attrsNest.slice(); res.inAttributeName = this.inAttributeName; res.attributeIsType = this.attributeIsType; res.attrValue = this.attrValue; res.indentOf = this.indentOf; res.indentToken = this.indentToken; res.innerModeForLine = this.innerModeForLine; return res; }; function javaScript(stream, state) { if (stream.sol()) { // if javaScriptLine was set at end of line, ignore it state.javaScriptLine = false; state.javaScriptLineExcludesColon = false; } if (state.javaScriptLine) { if (state.javaScriptLineExcludesColon && stream.peek() === ':') { state.javaScriptLine = false; state.javaScriptLineExcludesColon = false; return; } var tok = jsMode.token(stream, state.jsState); if (stream.eol()) state.javaScriptLine = false; return tok || true; } } function javaScriptArguments(stream, state) { if (state.javaScriptArguments) { if (state.javaScriptArgumentsDepth === 0 && stream.peek() !== '(') { state.javaScriptArguments = false; return; } if (stream.peek() === '(') { state.javaScriptArgumentsDepth++; } else if (stream.peek() === ')') { state.javaScriptArgumentsDepth--; } if (state.javaScriptArgumentsDepth === 0) { state.javaScriptArguments = false; return; } var tok = jsMode.token(stream, state.jsState); return tok || true; } } function yieldStatement(stream) { if (stream.match(/^yield\b/)) { return 'keyword'; } } function doctype(stream) { if (stream.match(/^(?:doctype) *([^\n]+)?/)) { return DOCTYPE; } } function interpolation(stream, state) { if (stream.match('#{')) { state.isInterpolating = true; state.interpolationNesting = 0; return 'punctuation'; } } function interpolationContinued(stream, state) { if (state.isInterpolating) { if (stream.peek() === '}') { state.interpolationNesting--; if (state.interpolationNesting < 0) { stream.next(); state.isInterpolating = false; return 'puncutation'; } } else if (stream.peek() === '{') { state.interpolationNesting++; } return jsMode.token(stream, state.jsState) || true; } } function caseStatement(stream, state) { if (stream.match(/^case\b/)) { state.javaScriptLine = true; return KEYWORD; } } function when(stream, state) { if (stream.match(/^when\b/)) { state.javaScriptLine = true; state.javaScriptLineExcludesColon = true; return KEYWORD; } } function defaultStatement(stream) { if (stream.match(/^default\b/)) { return KEYWORD; } } function extendsStatement(stream, state) { if (stream.match(/^extends?\b/)) { state.restOfLine = 'string'; return KEYWORD; } } function append(stream, state) { if (stream.match(/^append\b/)) { state.restOfLine = 'variable'; return KEYWORD; } } function prepend(stream, state) { if (stream.match(/^prepend\b/)) { state.restOfLine = 'variable'; return KEYWORD; } } function block(stream, state) { if (stream.match(/^block\b *(?:(prepend|append)\b)?/)) { state.restOfLine = 'variable'; return KEYWORD; } } function include(stream, state) { if (stream.match(/^include\b/)) { state.restOfLine = 'string'; return KEYWORD; } } function includeFiltered(stream, state) { if (stream.match(/^include:([a-zA-Z0-9\-]+)/, false) && stream.match('include')) { state.isIncludeFiltered = true; return KEYWORD; } } function includeFilteredContinued(stream, state) { if (state.isIncludeFiltered) { var tok = filter(stream, state); state.isIncludeFiltered = false; state.restOfLine = 'string'; return tok; } } function mixin(stream, state) { if (stream.match(/^mixin\b/)) { state.javaScriptLine = true; return KEYWORD; } } function call(stream, state) { if (stream.match(/^\+([-\w]+)/)) { if (!stream.match(/^\( *[-\w]+ *=/, false)) { state.javaScriptArguments = true; state.javaScriptArgumentsDepth = 0; } return 'variable'; } if (stream.match(/^\+#{/, false)) { stream.next(); state.mixinCallAfter = true; return interpolation(stream, state); } } function callArguments(stream, state) { if (state.mixinCallAfter) { state.mixinCallAfter = false; if (!stream.match(/^\( *[-\w]+ *=/, false)) { state.javaScriptArguments = true; state.javaScriptArgumentsDepth = 0; } return true; } } function conditional(stream, state) { if (stream.match(/^(if|unless|else if|else)\b/)) { state.javaScriptLine = true; return KEYWORD; } } function each(stream, state) { if (stream.match(/^(- *)?(each|for)\b/)) { state.isEach = true; return KEYWORD; } } function eachContinued(stream, state) { if (state.isEach) { if (stream.match(/^ in\b/)) { state.javaScriptLine = true; state.isEach = false; return KEYWORD; } else if (stream.sol() || stream.eol()) { state.isEach = false; } else if (stream.next()) { while (!stream.match(/^ in\b/, false) && stream.next()); return 'variable'; } } } function whileStatement(stream, state) { if (stream.match(/^while\b/)) { state.javaScriptLine = true; return KEYWORD; } } function tag(stream, state) { var captures; if (captures = stream.match(/^(\w(?:[-:\w]*\w)?)\/?/)) { state.lastTag = captures[1].toLowerCase(); if (state.lastTag === 'script') { state.scriptType = 'application/javascript'; } return 'tag'; } } function filter(stream, state) { if (stream.match(/^:([\w\-]+)/)) { var innerMode; if (config && config.innerModes) { innerMode = config.innerModes(stream.current().substring(1)); } if (!innerMode) { innerMode = stream.current().substring(1); } if (typeof innerMode === 'string') { innerMode = CodeMirror.getMode(config, innerMode); } setInnerMode(stream, state, innerMode); return 'atom'; } } function code(stream, state) { if (stream.match(/^(!?=|-)/)) { state.javaScriptLine = true; return 'punctuation'; } } function id(stream) { if (stream.match(/^#([\w-]+)/)) { return ID; } } function className(stream) { if (stream.match(/^\.([\w-]+)/)) { return CLASS; } } function attrs(stream, state) { if (stream.peek() == '(') { stream.next(); state.isAttrs = true; state.attrsNest = []; state.inAttributeName = true; state.attrValue = ''; state.attributeIsType = false; return 'punctuation'; } } function attrsContinued(stream, state) { if (state.isAttrs) { if (ATTRS_NEST[stream.peek()]) { state.attrsNest.push(ATTRS_NEST[stream.peek()]); } if (state.attrsNest[state.attrsNest.length - 1] === stream.peek()) { state.attrsNest.pop(); } else if (stream.eat(')')) { state.isAttrs = false; return 'punctuation'; } if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) { if (stream.peek() === '=' || stream.peek() === '!') { state.inAttributeName = false; state.jsState = jsMode.startState(); if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') { state.attributeIsType = true; } else { state.attributeIsType = false; } } return 'attribute'; } var tok = jsMode.token(stream, state.jsState); if (state.attributeIsType && tok === 'string') { state.scriptType = stream.current().toString(); } if (state.attrsNest.length === 0 && (tok === 'string' || tok === 'variable' || tok === 'keyword')) { try { Function('', 'var x ' + state.attrValue.replace(/,\s*$/, '').replace(/^!/, '')); state.inAttributeName = true; state.attrValue = ''; stream.backUp(stream.current().length); return attrsContinued(stream, state); } catch (ex) { //not the end of an attribute } } state.attrValue += stream.current(); return tok || true; } } function attributesBlock(stream, state) { if (stream.match(/^&attributes\b/)) { state.javaScriptArguments = true; state.javaScriptArgumentsDepth = 0; return 'keyword'; } } function indent(stream) { if (stream.sol() && stream.eatSpace()) { return 'indent'; } } function comment(stream, state) { if (stream.match(/^ *\/\/(-)?([^\n]*)/)) { state.indentOf = stream.indentation(); state.indentToken = 'comment'; return 'comment'; } } function colon(stream) { if (stream.match(/^: */)) { return 'colon'; } } function text(stream, state) { if (stream.match(/^(?:\| ?| )([^\n]+)/)) { return 'string'; } if (stream.match(/^(<[^\n]*)/, false)) { // html string setInnerMode(stream, state, 'htmlmixed'); state.innerModeForLine = true; return innerMode(stream, state, true); } } function dot(stream, state) { if (stream.eat('.')) { var innerMode = null; if (state.lastTag === 'script' && state.scriptType.toLowerCase().indexOf('javascript') != -1) { innerMode = state.scriptType.toLowerCase().replace(/"|'/g, ''); } else if (state.lastTag === 'style') { innerMode = 'css'; } setInnerMode(stream, state, innerMode); return 'dot'; } } function fail(stream) { stream.next(); return null; } function setInnerMode(stream, state, mode) { mode = CodeMirror.mimeModes[mode] || mode; mode = config.innerModes ? config.innerModes(mode) || mode : mode; mode = CodeMirror.mimeModes[mode] || mode; mode = CodeMirror.getMode(config, mode); state.indentOf = stream.indentation(); if (mode && mode.name !== 'null') { state.innerMode = mode; } else { state.indentToken = 'string'; } } function innerMode(stream, state, force) { if (stream.indentation() > state.indentOf || (state.innerModeForLine && !stream.sol()) || force) { if (state.innerMode) { if (!state.innerState) { state.innerState = state.innerMode.startState ? state.innerMode.startState(stream.indentation()) : {}; } return stream.hideFirstChars(state.indentOf + 2, function () { return state.innerMode.token(stream, state.innerState) || true; }); } else { stream.skipToEnd(); return state.indentToken; } } else if (stream.sol()) { state.indentOf = Infinity; state.indentToken = null; state.innerMode = null; state.innerState = null; } } function restOfLine(stream, state) { if (stream.sol()) { // if restOfLine was set at end of line, ignore it state.restOfLine = ''; } if (state.restOfLine) { stream.skipToEnd(); var tok = state.restOfLine; state.restOfLine = ''; return tok; } } function startState() { return new State(); } function copyState(state) { return state.copy(); } /** * Get the next token in the stream * * @param {Stream} stream * @param {State} state */ function nextToken(stream, state) { var tok = innerMode(stream, state) || restOfLine(stream, state) || interpolationContinued(stream, state) || includeFilteredContinued(stream, state) || eachContinued(stream, state) || attrsContinued(stream, state) || javaScript(stream, state) || javaScriptArguments(stream, state) || callArguments(stream, state) || yieldStatement(stream, state) || doctype(stream, state) || interpolation(stream, state) || caseStatement(stream, state) || when(stream, state) || defaultStatement(stream, state) || extendsStatement(stream, state) || append(stream, state) || prepend(stream, state) || block(stream, state) || include(stream, state) || includeFiltered(stream, state) || mixin(stream, state) || call(stream, state) || conditional(stream, state) || each(stream, state) || whileStatement(stream, state) || tag(stream, state) || filter(stream, state) || code(stream, state) || id(stream, state) || className(stream, state) || attrs(stream, state) || attributesBlock(stream, state) || indent(stream, state) || text(stream, state) || comment(stream, state) || colon(stream, state) || dot(stream, state) || fail(stream, state); return tok === true ? null : tok; } return { startState: startState, copyState: copyState, token: nextToken }; }); CodeMirror.defineMIME('text/x-jade', 'jade'); });
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/jade/jade.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/jade/jade.js", "repo_id": "Humsen", "token_count": 6756 }
36
// 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"); });
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/octave/octave.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/octave/octave.js", "repo_id": "Humsen", "token_count": 1878 }
37
// 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"); });
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/rust/rust.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/rust/rust.js", "repo_id": "Humsen", "token_count": 6591 }
38
// 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"); });
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/stex/stex.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/stex/stex.js", "repo_id": "Humsen", "token_count": 3161 }
39
// 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]", "" ); })();
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/verilog/test.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/mode/verilog/test.js", "repo_id": "Humsen", "token_count": 3210 }
40
/* 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}
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/blackboard.css/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/blackboard.css", "repo_id": "Humsen", "token_count": 724 }
41
/** * 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; }
Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/pastel-on-dark.css/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/lib/codemirror/theme/pastel-on-dark.css", "repo_id": "Humsen", "token_count": 1012 }
42
/*! * 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 = "<div class=\"" + classPrefix + "form\">" + "<label>" + linkLang.url + "</label>" + "<input type=\"text\" value=\"http://\" data-url />" + "<br/>" + "<label>" + linkLang.urlTitle + "</label>" + "<input type=\"text\" value=\"" + selection + "\" data-title />" + "<br/>" + "</div>"; 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); } })();
Humsen/web/web-mobile/WebContent/plugins/editormd/plugins/link-dialog/link-dialog.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/editormd/plugins/link-dialog/link-dialog.js", "repo_id": "Humsen", "token_count": 2778 }
43
<!-- 插件统一放 --> <!-- Animate.css --> <link rel="stylesheet" href="/plugins/template/css/animate.css"> <!-- Icomoon Icon Fonts--> <link rel="stylesheet" href="/plugins/template/css/icomoon.css"> <!-- Bootstrap --> <link rel="stylesheet" href="/plugins/bootstrap/css/bootstrap.min.css"> <!-- Flexslider --> <link rel="stylesheet" href="/plugins/template/css/flexslider.css"> <!-- Theme style --> <link rel="stylesheet" href="/plugins/template/css/style.css"> <!-- validator --> <link rel="stylesheet" href="/plugins/validator/css/bootstrapValidator.min.css" /> <!-- jquery confirm --> <link rel="stylesheet" href="/plugins/jqueryconfirm/css/jquery-confirm.min.css" /> <!-- 左侧菜单栏 --> <link rel="stylesheet" href="/css/navigation/left-menu-bar.css"> <!-- jQuery --> <script src="/plugins/jquery/js/jquery-3.2.1.min.js"></script> <!-- jQuery form --> <script src="/plugins/jquery/js/jquery.form.min.js"></script> <!-- 初始化菜单栏 --> <script src="/js/navigation/left-menu-bar.js"></script> <!-- 判断访问类型是电脑还是手机 --> <script src="/js/is-pc-or-mobile.js"></script> <!-- jQuery Easing --> <script src="/plugins/jquery/js/jquery.easing.1.3.js"></script> <!-- Bootstrap --> <script src="/plugins/bootstrap/js/bootstrap.min.js"></script> <!-- Waypoints --> <script src="/plugins/jquery/js/jquery.waypoints.min.js"></script> <!-- Flexslider --> <script src="/plugins/jquery/js/jquery.flexslider-min.js"></script> <!-- MAIN JS --> <script src="/plugins/template/js/main.js"></script> <!-- validator --> <script src="/plugins/validator/js/bootstrapValidator.min.js"></script> <!-- JQuery cookie --> <script src="/plugins/jquery/js/jquery.cookie.js"></script> <!-- Modernizr JS --> <script src="/plugins/template/js/modernizr-2.6.2.min.js"></script> <!-- jquery confirm --> <script src="/plugins/jqueryconfirm/js/jquery-confirm.min.js"></script> <!-- 自定义开发工具包 --> <script src="/js/customize-sdk.js"></script>
Humsen/web/web-mobile/WebContent/plugins/plugins.html/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/plugins.html", "repo_id": "Humsen", "token_count": 737 }
44
(function($) { /** * Czech language package * Translated by @AdwinTrave. Improved by @cuchac */ $.fn.bootstrapValidator.i18n = $.extend(true, $.fn.bootstrapValidator.i18n, { base64: { 'default': 'Prosím zadejte správný base64' }, between: { 'default': 'Prosím zadejte hodnotu mezi %s a %s', notInclusive: 'Prosím zadejte hodnotu mezi %s a %s (včetně těchto čísel)' }, callback: { 'default': 'Prosím zadejte správnou hodnotu' }, choice: { 'default': 'Prosím vyberte správnou hodnotu', less: 'Hodnota musí být minimálně %s', more: 'Hodnota nesmí být více jak %s', between: 'Prosím vyberte mezi %s a %s' }, color: { 'default': 'Prosím zadejte správnou barvu' }, creditCard: { 'default': 'Prosím zadejte správné číslo kreditní karty' }, cusip: { 'default': 'Prosím zadejte správné CUSIP číslo' }, cvv: { 'default': 'Prosím zadejte správné CVV číslo' }, date: { 'default': 'Prosím zadejte správné datum', min: 'Prosím zadejte datum před %s', max: 'Prosím zadejte datum po %s', range: 'Prosím zadejte datum v rozmezí %s až %s' }, different: { 'default': 'Prosím zadejte jinou hodnotu' }, digits: { 'default': 'Toto pole může obsahovat pouze čísla' }, ean: { 'default': 'Prosím zadejte správné EAN číslo' }, emailAddress: { 'default': 'Prosím zadejte správnou emailovou adresu' }, file: { 'default': 'Prosím vyberte soubor' }, greaterThan: { 'default': 'Prosím zadejte hodnotu větší nebo rovnu %s', notInclusive: 'Prosím zadejte hodnotu větší než %s' }, grid: { 'default': 'Prosím zadejte správné GRId číslo' }, hex: { 'default': 'Prosím zadejte správné hexadecimální číslo' }, hexColor: { 'default': 'Prosím zadejte správnou hex barvu' }, iban: { 'default': 'Prosím zadejte správné IBAN číslo', countryNotSupported: 'IBAN pro %s není podporován', country: 'Prosím zadejte správné IBAN číslo pro %s', countries: { AD: 'Andorru', AE: 'Spojené arabské emiráty', AL: 'Albanii', AO: 'Angolu', AT: 'Rakousko', AZ: 'Ázerbajdžán', BA: 'Bosnu a Herzegovinu', BE: 'Belgie', BF: 'Burkina Faso', BG: 'Bulharsko', BH: 'Bahrajn', BI: 'Burundi', BJ: 'Benin', BR: 'Brazílii', CH: 'Švýcarsko', CI: 'Pobřeží slonoviny', CM: 'Kamerun', CR: 'Kostariku', CV: 'Cape Verde', CY: 'Kypr', CZ: 'Českou republiku', DE: 'Německo', DK: 'Dánsko', DO: 'Dominikánskou republiku', DZ: 'Alžírsko', EE: 'Estonsko', ES: 'Španělsko', FI: 'Finsko', FO: 'Faerské ostrovy', FR: 'Francie', GB: 'Velkou Británii', GE: 'Gruzii', GI: 'Gibraltar', GL: 'Grónsko', GR: 'Řecko', GT: 'Guatemala', HR: 'Chorvatsko', HU: 'Maďarsko', IE: 'Irsko', IL: 'Israel', IR: 'Irán', IS: 'Island', IT: 'Itálii', JO: 'Jordansko', KW: 'Kuwait', KZ: 'Kazakhstán', LB: 'Lebanon', LI: 'Lichtenštejnsko', LT: 'Litvu', LU: 'Lucembursko', LV: 'Lotyšsko', MC: 'Monaco', MD: 'Moldavsko', ME: 'Černou Horu', MG: 'Madagaskar', MK: 'Makedonii', ML: 'Mali', MR: 'Mauritánii', MT: 'Malta', MU: 'Mauritius', MZ: 'Mosambik', NL: 'Nizozemsko', NO: 'Norsko', PK: 'Pakistán', PL: 'Polsko', PS: 'Palestinu', PT: 'Portugalsko', QA: 'Katar', RO: 'Rumunsko', RS: 'Srbsko', SA: 'Saudskou Arábii', SE: 'Švédsko', SI: 'Slovinsko', SK: 'Slovensko', SM: 'San Marino', SN: 'Senegal', TN: 'Tunisko', TR: 'Turecko', VG: 'Britské Panenské ostrovy' } }, id: { 'default': 'Prosím zadejte správné rodné číslo', countryNotSupported: 'Rodné číslo pro %s není podporované', country: 'Prosím zadejte správné rodné číslo pro %s', countries: { BA: 'Bosnu a Hercegovinu', BG: 'Bulharsko', BR: 'Brazílii', CH: 'Švýcarsko', CL: 'Chile', CN: 'Čína', CZ: 'Českou Republiku', DK: 'Dánsko', EE: 'Estonsko', ES: 'Špaňelsko', FI: 'Finsko', HR: 'Chorvatsko', IE: 'Irsko', IS: 'Island', LT: 'Litvu', LV: 'Lotyšsko', ME: 'Montenegro', MK: 'Makedonii', NL: 'Nizozemí', RO: 'Rumunsko', RS: 'Srbsko', SE: 'Švédsko', SI: 'Slovinsko', SK: 'Slovensko', SM: 'San Marino', TH: 'Thajsko', ZA: 'Jižní Afriku' } }, identical: { 'default': 'Prosím zadejte stejnou hodnotu' }, imei: { 'default': 'Prosím zadejte správné IMEI číslo' }, imo: { 'default': 'Prosím zadejte správné IMO číslo' }, integer: { 'default': 'Prosím zadejte celé číslo' }, ip: { 'default': 'Prosím zadejte správnou IP adresu', ipv4: 'Prosím zadejte správnou IPv4 adresu', ipv6: 'Prosím zadejte správnou IPv6 adresu' }, isbn: { 'default': 'Prosím zadejte správné ISBN číslo' }, isin: { 'default': 'Prosím zadejte správné ISIN číslo' }, ismn: { 'default': 'Prosím zadejte správné ISMN číslo' }, issn: { 'default': 'Prosím zadejte správné ISSN číslo' }, lessThan: { 'default': 'Prosím zadejte hodnotu menší nebo rovno %s', notInclusive: 'Prosím zadejte hodnotu menčí než %s' }, mac: { 'default': 'Prosím zadejte správnou MAC adresu' }, meid: { 'default': 'Prosím zadejte správné MEID číslo' }, notEmpty: { 'default': 'Toto pole nesmí být prázdné' }, numeric: { 'default': 'Prosím zadejte číselnou hodnotu' }, phone: { 'default': 'Prosím zadejte správné telefoní číslo', countryNotSupported: 'Telefoní číslo pro %s není podporované', country: 'Prosím zadejte správné telefoní číslo pro %s', countries: { BR: 'Brazílii', CN: 'Čína', CZ: 'Českou Republiku', DE: 'Německo', DK: 'Dánsko', ES: 'Španělsko', FR: 'Francie', GB: 'Velkou Británii', MA: 'Maroko', PK: 'Pákistán', RO: 'Rumunsko', RU: 'Rusko', SK: 'Slovensko', TH: 'Thajsko', US: 'Spojené Státy Americké', VE: 'Venezuelský' } }, regexp: { 'default': 'Prosím zadejte hodnotu splňující zadání' }, remote: { 'default': 'Prosím zadejte správnou hodnotu' }, rtn: { 'default': 'Prosím zadejte správné RTN číslo' }, sedol: { 'default': 'Prosím zadejte správné SEDOL číslo' }, siren: { 'default': 'Prosím zadejte správné SIREN číslo' }, siret: { 'default': 'Prosím zadejte správné SIRET číslo' }, step: { 'default': 'Prosím zadejte správný krok %s' }, stringCase: { 'default': 'Pouze malá písmen jsou povoleny v tomto poli', upper: 'Pouze velké písmena jsou povoleny v tomto poli' }, stringLength: { 'default': 'Toto pole nesmí být prázdné', less: 'Prosím zadejte méně než %s znaků', more: 'Prosím zadejte více než %s znaků', between: 'Prosím zadejte mezi %s a %s znaky' }, uri: { 'default': 'Prosím zadejte správnou URI' }, uuid: { 'default': 'Prosím zadejte správné UUID číslo', version: 'Prosím zadejte správné UUID verze %s' }, vat: { 'default': 'Prosím zadejte správné VAT číslo', countryNotSupported: 'VAT pro %s není podporované', country: 'Prosím zadejte správné VAT číslo pro %s', countries: { AT: 'Rakousko', BE: 'Belgii', BG: 'Bulharsko', BR: 'Brazílii', CH: 'Švýcarsko', CY: 'Kypr', CZ: 'Českou Republiku', DE: 'Německo', DK: 'Dánsko', EE: 'Estonsko', ES: 'Špaňelsko', FI: 'Finsko', FR: 'Francie', GB: 'Velkou Británii', GR: 'Řecko', EL: 'Řecko', HU: 'Maďarsko', HR: 'Chorvatsko', IE: 'Irsko', IS: 'Island', IT: 'Itálie', LT: 'Litvu', LU: 'Lucembursko', LV: 'Lotyšsko', MT: 'Maltu', NL: 'Nizozemí', NO: 'Norsko', PL: 'Polsko', PT: 'Portugalsko', RO: 'Rumunsko', RU: 'Rusko', RS: 'Srbsko', SE: 'Švédsko', SI: 'Slovinsko', SK: 'Slovensko', VE: 'Venezuelský', ZA: 'Jižní Afriku' } }, vin: { 'default': 'Prosím zadejte správné VIN číslo' }, zipCode: { 'default': 'Prosím zadejte správné PSČ', countryNotSupported: '%s není podporované', country: 'Prosím zadejte správné PSČ pro %s', countries: { AT: 'Rakousko', BR: 'Brazílie', CA: 'Kanada', CH: 'Švýcarsko', CZ: 'Českou Republiku', DE: 'Německo', DK: 'Dánsko', FR: 'Francie', GB: 'Velkou Británii', IE: 'Irsko', IT: 'Itálie', MA: 'Maroko', NL: 'Nizozemí', PT: 'Portugalsko', RO: 'Rumunsko', RU: 'Rusko', SE: 'Švédsko', SG: 'Singapur', SK: 'Slovensko', US: 'Spojené Státy Americké' } } }); }(window.jQuery));
Humsen/web/web-mobile/WebContent/plugins/validator/js/language/cs_CZ.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/validator/js/language/cs_CZ.js", "repo_id": "Humsen", "token_count": 8254 }
45
(function($) { /** * Polish language package * Translated by @grzesiek */ $.fn.bootstrapValidator.i18n = $.extend(true, $.fn.bootstrapValidator.i18n, { base64: { 'default': 'Wpisz poprawny ciąg znaków zakodowany w base 64' }, between: { 'default': 'Wprowadź wartość pomiędzy %s i %s', notInclusive: 'Wprowadź wartość pomiędzy %s i %s (zbiór otwarty)' }, callback: { 'default': 'Wprowadź poprawną wartość' }, choice: { 'default': 'Wprowadź poprawną wartość', less: 'Wybierz przynajmniej %s opcji', more: 'Wybierz maksymalnie %s opcji', between: 'Wybierz przynajmniej %s i maksymalnie %s opcji' }, color: { 'default': 'Wprowadź poprawny kolor w formacie' }, creditCard: { 'default': 'Wprowadź poprawny numer karty kredytowej' }, cusip: { 'default': 'Wprowadź poprawny numer CUSIP' }, cvv: { 'default': 'Wprowadź poprawny numer CVV' }, date: { 'default': 'Wprowadź poprawną datę', min: 'Wprowadź datę po %s', max: 'Wprowadź datę przed %s', range: 'Wprowadź datę pomiędzy %s i %s' }, different: { 'default': 'Wprowadź inną wartość' }, digits: { 'default': 'Wprowadź tylko cyfry' }, ean: { 'default': 'Wprowadź poprawny numer EAN' }, emailAddress: { 'default': 'Wprowadź poprawny adres e-mail' }, file: { 'default': 'Wybierz prawidłowy plik' }, greaterThan: { 'default': 'Wprowadź wartość większą bądź równą %s', notInclusive: 'Wprowadź wartość większą niż %s' }, grid: { 'default': 'Wprowadź poprawny numer GRId' }, hex: { 'default': 'Wprowadź poprawną liczbę w formacie heksadecymalnym' }, hexColor: { 'default': 'Wprowadź poprawny kolor w formacie hex' }, iban: { 'default': 'Wprowadź poprawny numer IBAN', countryNotSupported: 'Kod kraju %s nie jest obsługiwany', country: 'Wprowadź poprawny numer IBAN w kraju %s', countries: { AD: 'Andora', AE: 'Zjednoczone Emiraty Arabskie', AL: 'Albania', AO: 'Angola', AT: 'Austria', AZ: 'Azerbejdżan', BA: 'Bośnia i Hercegowina', BE: 'Belgia', BF: 'Burkina Faso', BG: 'Bułgaria', BH: 'Bahrajn', BI: 'Burundi', BJ: 'Benin', BR: 'Brazylia', CH: 'Szwajcaria', CI: 'Wybrzeże Kości Słoniowej', CM: 'Kamerun', CR: 'Kostaryka', CV: 'Republika Zielonego Przylądka', CY: 'Cypr', CZ: 'Czechy', DE: 'Niemcy', DK: 'Dania', DO: 'Dominikana', DZ: 'Algeria', EE: 'Estonia', ES: 'Hiszpania', FI: 'Finlandia', FO: 'Wyspy Owcze', FR: 'Francja', GB: 'Wielka Brytania', GE: 'Gruzja', GI: 'Gibraltar', GL: 'Grenlandia', GR: 'Grecja', GT: 'Gwatemala', HR: 'Chorwacja', HU: 'Węgry', IE: 'Irlandia', IL: 'Izrael', IR: 'Iran', IS: 'Islandia', IT: 'Włochy', JO: 'Jordania', KW: 'Kuwejt', KZ: 'Kazahstan', LB: 'Liban', LI: 'Liechtenstein', LT: 'Litwa', LU: 'Luksemburg', LV: 'Łotwa', MC: 'Monako', MD: 'Mołdawia', ME: 'Czarnogóra', MG: 'Madagaskar', MK: 'Macedonia', ML: 'Mali', MR: 'Mauretania', MT: 'Malta', MU: 'Mauritius', MZ: 'Mozambik', NL: 'Holandia', NO: 'Norwegia', PK: 'Pakistan', PL: 'Polska', PS: 'Palestyna', PT: 'Portugalia', QA: 'Katar', RO: 'Rumunia', RS: 'Serbia', SA: 'Arabia Saudyjska', SE: 'Szwecja', SI: 'Słowenia', SK: 'Słowacja', SM: 'San Marino', SN: 'Senegal', TN: 'Tunezja', TR: 'Turcja', VG: 'Brytyjskie Wyspy Dziewicze' } }, id: { 'default': 'Wprowadź poprawny numer identyfikacyjny', countryNotSupported: 'Kod kraju %s nie jest obsługiwany', country: 'Wprowadź poprawny numer identyfikacyjny w kraju %s', countries: { BA: 'Bośnia i Hercegowina', BG: 'Bułgaria', BR: 'Brazylia', CH: 'Szwajcaria', CL: 'Chile', CN: 'Chiny', CZ: 'Czechy', DK: 'Dania', EE: 'Estonia', ES: 'Hiszpania', FI: 'Finlandia', HR: 'Chorwacja', IE: 'Irlandia', IS: 'Islandia', LT: 'Litwa', LV: 'Łotwa', ME: 'Czarnogóra', MK: 'Macedonia', NL: 'Holandia', RO: 'Rumunia', RS: 'Serbia', SE: 'Szwecja', SI: 'Słowenia', SK: 'Słowacja', SM: 'San Marino', TH: 'Tajlandia', ZA: 'Republika Południowej Afryki' } }, identical: { 'default': 'Wprowadź taką samą wartość' }, imei: { 'default': 'Wprowadź poprawny numer IMEI' }, imo: { 'default': 'Wprowadź poprawny numer IMO' }, integer: { 'default': 'Wprowadź poprawną liczbę całkowitą' }, ip: { 'default': 'Wprowadź poprawny adres IP', ipv4: 'Wprowadź poprawny adres IPv4', ipv6: 'Wprowadź poprawny adres IPv6' }, isbn: { 'default': 'Wprowadź poprawny numer ISBN' }, isin: { 'default': 'Wprowadź poprawny numer ISIN' }, ismn: { 'default': 'Wprowadź poprawny numer ISMN' }, issn: { 'default': 'Wprowadź poprawny numer ISSN' }, lessThan: { 'default': 'Wprowadź wartość mniejszą bądź równą %s', notInclusive: 'Wprowadź wartość mniejszą niż %s' }, mac: { 'default': 'Wprowadź poprawny adres MAC' }, meid: { 'default': 'Wprowadź poprawny numer MEID' }, notEmpty: { 'default': 'Wprowadź wartość, pole nie może być puste' }, numeric: { 'default': 'Wprowadź poprawną liczbę zmiennoprzecinkową' }, phone: { 'default': 'Wprowadź poprawny numer telefonu', countryNotSupported: 'Kod kraju %s nie jest wspierany', country: 'Wprowadź poprawny numer telefonu w kraju %s', countries: { BR: 'Brazylia', CN: 'Chiny', CZ: 'Czechy', DE: 'Niemcy', DK: 'Dania', ES: 'Hiszpania', FR: 'Francja', GB: 'Wielka Brytania', MA: 'Maroko', PK: 'Pakistan', RO: 'Rumunia', RU: 'Rosja', SK: 'Słowacja', TH: 'Tajlandia', US: 'USA', VE: 'Wenezuela' } }, regexp: { 'default': 'Wprowadź wartość pasującą do wzoru' }, remote: { 'default': 'Wprowadź poprawną wartość' }, rtn: { 'default': 'Wprowadź poprawny numer RTN' }, sedol: { 'default': 'Wprowadź poprawny numer SEDOL' }, siren: { 'default': 'Wprowadź poprawny numer SIREN' }, siret: { 'default': 'Wprowadź poprawny numer SIRET' }, step: { 'default': 'Wprowadź wielokrotność %s' }, stringCase: { 'default': 'Wprowadź tekst składającą się tylko z małych liter', upper: 'Wprowadź tekst składający się tylko z dużych liter' }, stringLength: { 'default': 'Wprowadź wartość o poprawnej długości', less: 'Wprowadź mniej niż %s znaków', more: 'Wprowadź więcej niż %s znaków', between: 'Wprowadź wartość składająca się z min %s i max %s znaków' }, uri: { 'default': 'Wprowadź poprawny URI' }, uuid: { 'default': 'Wprowadź poprawny numer UUID', version: 'Wprowadź poprawny numer UUID w wersji %s' }, vat: { 'default': 'Wprowadź poprawny numer VAT', countryNotSupported: 'Kod kraju %s nie jest wsperany', country: 'Wprowadź poprawny numer VAT w kraju %s', countries: { AT: 'Austria', BE: 'Belgia', BG: 'Bułgaria', BR: 'Brazylia', CH: 'Szwajcaria', CY: 'Cypr', CZ: 'Czechy', DE: 'Niemcy', DK: 'Dania', EE: 'Estonia', ES: 'Hiszpania', FI: 'Finlandia', FR: 'Francja', GB: 'Wielka Brytania', GR: 'Grecja', EL: 'Grecja', HU: 'Węgry', HR: 'Chorwacja', IE: 'Irlandia', IS: 'Islandia', IT: 'Włochy', LT: 'Litwa', LU: 'Luksemburg', LV: 'Łotwa', MT: 'Malta', NL: 'Holandia', NO: 'Norwegia', PL: 'Polska', PT: 'Portugalia', RO: 'Rumunia', RU: 'Rosja', RS: 'Serbia', SE: 'Szwecja', SI: 'Słowenia', SK: 'Słowacja', VE: 'Wenezuela', ZA: 'Republika Południowej Afryki' } }, vin: { 'default': 'Wprowadź poprawny numer VIN' }, zipCode: { 'default': 'Wprowadź poprawny kod pocztowy', countryNotSupported: 'Kod kraju %s nie jest obsługiwany', country: 'Wprowadź poprawny kod pocztowy w kraju %s', countries: { AT: 'Austria', BR: 'Brazylia', CA: 'Kanada', CH: 'Szwajcaria', CZ: 'Czechy', DE: 'Niemcy', DK: 'Dania', FR: 'Francja', GB: 'Wielka Brytania', IE: 'Irlandia', IT: 'Włochy', MA: 'Maroko', NL: 'Holandia', PT: 'Portugalia', RO: 'Rumunia', RU: 'Rosja', SE: 'Szwecja', SG: 'Singapur', SK: 'Słowacja', US: 'USA' } } }); }(window.jQuery));
Humsen/web/web-mobile/WebContent/plugins/validator/js/language/pl_PL.js/0
{ "file_path": "Humsen/web/web-mobile/WebContent/plugins/validator/js/language/pl_PL.js", "repo_id": "Humsen", "token_count": 8080 }
46
/** * 加载某篇详细的代码的js * * @author 何明胜 * * 2017年11月8日 */ $(document).ready(function() { // 如果删除代码按钮存在,绑定点击事件 var $btnDeleteCode = $('#btn_deleteCode'); if ($btnDeleteCode.length > 0) { $btnDeleteCode.click(deleteCodeClick); } }); /** * 删除代码按钮点击 * * @returns */ function deleteCodeClick() { $.confirm({ title : '删除代码确认', content : '是否确定删除这篇代码?', type : 'green', buttons : { ok : { text : '确定', btnClass : 'btn-primary', keys : [ 'enter' ], action : function() { deleteRemoteCodeLogic(); } }, cancel : { text : '否,点错了', btnClass : 'btn-primary', keys : [ 'ESC' ], } } }); } /** * 逻辑删除某篇代码 * * @returns */ function deleteRemoteCodeLogic() { $.post('/article/delete.hms', { type : 'logic_delete_code', codeId : $('#hiden_codeId').val() }, function(response) { if (response == 1) { // 删除成功,跳转到博客目录界面 window.location = "/module/code.hms"; } }, 'json'); }
Humsen/web/web-pc/WebContent/js/article/code-details.js/0
{ "file_path": "Humsen/web/web-pc/WebContent/js/article/code-details.js", "repo_id": "Humsen", "token_count": 599 }
47
/** * 自动显示分页的工具类 将当前分页的容器节点传入 * * 2017年9月29日 */ var currentPageNum = 1; // 当前页码 var paginationDisplayLength = 5;// 分页栏的显示条数 var totalPages = 1; // 总页数 var onlyOnePageIsShow = true;// 只有一页的时候是否显示 /** * 调用入口 * * @param paginationContainer * @returns */ function PaginationHelper(paginationContainer, pageSize) { initPagination(paginationContainer, pageSize); } /** * 初始化分页 * * @param element * @returns */ function initPagination(paginationContainer, pageSize) { paginationContainer.html(''); // 当前选中页码 currentPageNum = Number(paginationContainer.attr('currpagenum')); // 分页显示几个页面 paginationDisplayLength = Number(paginationContainer .attr('paginationmaxlength')); // 一共有多少页 totalPages = Number(paginationContainer.attr('totalpages')); // 只有一页是否显示 onlyOnePageIsShow = paginationContainer.attr('onlyonepageshow'); // 如果需要分页 if (isNeedPagination(totalPages, onlyOnePageIsShow)) { // 左边的箭头 var content = '<ul class="pagination pagination-sm"><li value="0"><a href="javascript:void(0);">«</a></li>'; // 中间的数字 for (var i = 1; i <= totalPages; i++) { content += '<li value="' + i + '"><a href="javascript:void(0);">' + i + '</a></li>' } // 右边的箭头 content += '<li value="-1"><a href="javascript:void(0);">»</a></li></ul>'; paginationContainer.append(content); // 添加每页大小选择显示 addPageSizeChoose(paginationContainer, pageSize); // 当前页面添加激活类 paginationContainer.children('ul').children( 'li[value=' + currentPageNum + ']').attr('class', 'active'); // 设置显示最大长度 setDisplayMaxLength(paginationContainer, paginationDisplayLength); // 注册监听器 addClickListener(paginationContainer); } } /** * 是否需要分页 * * @param totalpage * @param settingfromHTML * @returns */ function isNeedPagination(totalPages, settingFromHTML) { var condition; // 先从页面获取是否需要显示分页,再从js变量 if (settingFromHTML == 'true') { condition = true; } else if (settingFromHTML == 'false') { condition = false; } else { condition = onlyOnePageIsShow; } if (condition && totalPages < 1) { return false; } else if (!condition && totalPages <= 1) { return false; } return true; } /** * 设置显示最大长度 * * @param element * @param len * @returns */ function setDisplayMaxLength(element, len) { if (checkParamIsPositiveInteger(len)) { len = Number(len); } else { // 如果不是整数就使用默认 len = paginationDisplayLength; } if (len < totalPages) { var temp1 = parseInt((len - 1) / 2); var temp2 = parseInt(len / 2); if (temp1 < temp2) { // len为偶数 var leftstart = currentPageNum - temp1; var rightend = currentPageNum + temp1 + 1; } else { // len为奇数 var leftstart = currentPageNum - temp1; var rightend = currentPageNum + temp1; } // 如果左边小于1,右边来补 if (leftstart < 1) { rightend += (1 - leftstart); leftstart = 1; } // 右边大于总数,左边来补 if (rightend > totalPages) { if (leftstart > 1) { leftstart -= (rightend - totalPages); } rightend = totalPages; } if (leftstart < 1) { leftstart = 1 } // 隐藏左边 while (leftstart > 1) { element.children('ul') .children('li[value = ' + (--leftstart) + ']').css( 'display', 'none'); } // 隐藏右边 while (rightend < totalPages) { element.children('ul').children('li[value = ' + (++rightend) + ']') .css('display', 'none'); } } } /** * 点击事件注册 * * @param element * @returns */ function addClickListener(element) { element.children('ul').children('li') .bind( 'click', function() { var pageNumValue = Number($(this).attr('value')); if (pageNumValue == 0) { // 左边减一页 pageNumValue = currentPageNum - 1; } else if (pageNumValue == -1) { // 右边加一页 pageNumValue = currentPageNum + 1; } // 跳转 if (pageNumValue != currentPageNum && pageNumValue != 0 && pageNumValue <= totalPages) { $(this).parent().parent().attr('currpagenum', pageNumValue); // 回调相应文章的相应函数,跨js paginationClick(pageNumValue); initPagination(element); } return false; }); } /** * 检查是否为整数 * * @param param * @returns */ function checkParamIsPositiveInteger(param) { var reg = /^[1-9]+[0-9]*]*$/; return reg.test(param); } /** * 在分页后面显示选择每页数量 * * @param paginationContainer * @param currPageSize * @returns */ function addPageSizeChoose(paginationContainer, currPageSize) { var isDownload = new RegExp('download').test(window.location.href); //目前不支持文件 if (!isDownload) { paginationContainer .append(' <!-- 选择每页显示的条数 -->' + '<div id="choose_page_size" class="btn-group pagination pagination-sm dropup choose-page-size">' + '<button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' + '每页显示<span>' + currPageSize + '</span>条 <span class="caret"></span>' + '</button>' + '<ul class="dropdown-menu">' + '<li value="5"><a href="#">每页显示5条</a></li>' + '<li value="10"><a href="#">每页显示10条</a></li>' + '<li value="20"><a href="#">每页显示20条</a></li>' + '</ul>' + '</div>'); } }
Humsen/web/web-pc/WebContent/js/pagination.js/0
{ "file_path": "Humsen/web/web-pc/WebContent/js/pagination.js", "repo_id": "Humsen", "token_count": 2661 }
48
<link rel="stylesheet" href="/css/personal_center/editor_version.css"> <!-- 编辑版本特性脚本 --> <script src="/js/personal_center/editor_version.js"></script> <form id="form_editorVersion" class="form-horizontal form-editor-version"> <div class="form-group"> <label class="col-sm-3 control-label">当前最新版本</label> <div class="col-sm-3"> <input id="txt_latestV" type="text" class="form-control" disabled="disabled"> </div> <button id="btn_clearCurr" class="btn btn-default col-sm-offset-1 col-sm-3">清空编辑区</button> </div> <!-- 版本号 --> <div class="form-group"> <label class="col-sm-3 control-label">当前编辑版本</label> <div class="col-sm-3"> <input id="txt_newV" type="text" class="form-control" placeholder="版本号"> </div> <button id="btn_prevV" class="btn btn-default col-sm-offset-1 col-sm-2">前一个版本</button> <button id="btn_nextV" class="btn btn-default col-sm-offset-1 col-sm-2">后一个版本</button> </div> <!-- 版本特性 --> <br /> <div class="form-group"> <label class="col-sm-3 control-label">特性1:</label> <div class="col-sm-9"> <textarea class="form-control version-input" placeholder="版本特性" rows="1"></textarea> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">特性2:</label> <div class="col-sm-9"> <textarea class="form-control version-input" placeholder="版本特性" rows="1"></textarea> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">特性3:</label> <div class="col-sm-9"> <textarea class="form-control version-input" placeholder="版本特性" rows="1"></textarea> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">特性4:</label> <div class="col-sm-9"> <textarea class="form-control version-input" placeholder="版本特性" rows="1"></textarea> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">特性5:</label> <div class="col-sm-9"> <textarea class="form-control version-input" placeholder="版本特性" rows="1"></textarea> </div> </div> <!-- 提交 --> <div class="form-group"> <div class="col-sm-offset-10 col-sm-2"> <a id="btn_subEditVsion" class="btn btn-default" href="#" role="button">提交</a> </div> </div> </form>
Humsen/web/web-pc/WebContent/personal_center/editor_version.html/0
{ "file_path": "Humsen/web/web-pc/WebContent/personal_center/editor_version.html", "repo_id": "Humsen", "token_count": 1050 }
49
div.dataTables_wrapper div.dataTables_filter { text-align: right; } div.dataTables_wrapper div.dataTables_filter input { margin-left: 0.5em; } div.dataTables_wrapper div.dataTables_info { padding-top: 10px; white-space: nowrap; } div.dataTables_wrapper div.dataTables_processing { position: absolute; top: 50%; left: 50%; width: 200px; margin-left: -100px; text-align: center; } div.dataTables_wrapper div.dataTables_paginate { text-align: right; } div.dataTables_wrapper div.mdl-grid.dt-table { padding-top: 0; padding-bottom: 0; } div.dataTables_wrapper div.mdl-grid.dt-table > div.mdl-cell { margin-top: 0; margin-bottom: 0; } table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, table.dataTable thead > tr > td.sorting_asc, table.dataTable thead > tr > td.sorting_desc, table.dataTable thead > tr > td.sorting { padding-right: 30px; } table.dataTable thead > tr > th:active, table.dataTable thead > tr > td:active { outline: none; } table.dataTable thead .sorting, table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc, table.dataTable thead .sorting_asc_disabled, table.dataTable thead .sorting_desc_disabled { cursor: pointer; position: relative; } table.dataTable thead .sorting:before, table.dataTable thead .sorting:after, table.dataTable thead .sorting_asc:before, table.dataTable thead .sorting_asc:after, table.dataTable thead .sorting_desc:before, table.dataTable thead .sorting_desc:after, table.dataTable thead .sorting_asc_disabled:before, table.dataTable thead .sorting_asc_disabled:after, table.dataTable thead .sorting_desc_disabled:before, table.dataTable thead .sorting_desc_disabled:after { position: absolute; bottom: 11px; display: block; opacity: 0.3; font-size: 1.3em; } table.dataTable thead .sorting:before, table.dataTable thead .sorting_asc:before, table.dataTable thead .sorting_desc:before, table.dataTable thead .sorting_asc_disabled:before, table.dataTable thead .sorting_desc_disabled:before { right: 1em; content: "\2191"; } table.dataTable thead .sorting:after, table.dataTable thead .sorting_asc:after, table.dataTable thead .sorting_desc:after, table.dataTable thead .sorting_asc_disabled:after, table.dataTable thead .sorting_desc_disabled:after { right: 0.5em; content: "\2193"; } table.dataTable thead .sorting_asc:before, table.dataTable thead .sorting_desc:after { opacity: 1; } table.dataTable thead .sorting_asc_disabled:before, table.dataTable thead .sorting_desc_disabled:after { opacity: 0; }
Humsen/web/web-pc/WebContent/plugins/DataTables/css/dataTables.material.css/0
{ "file_path": "Humsen/web/web-pc/WebContent/plugins/DataTables/css/dataTables.material.css", "repo_id": "Humsen", "token_count": 950 }
50
(function($) { /** * Persian (Farsi) Language package. * Translated by @i0 */ $.fn.bootstrapValidator.i18n = $.extend(true, $.fn.bootstrapValidator.i18n, { base64: { 'default': 'لطفا متن کد گذاری شده base 64 صحیح وارد فرمایید' }, between: { 'default': 'لطفا یک مقدار بین %s و %s وارد فرمایید', notInclusive: 'لطفا یک مقدار بین فقط %s و %s وارد فرمایید' }, callback: { 'default': 'لطفا یک مقدار صحیح وارد فرمایید' }, choice: { 'default': 'لطفا یک مقدار صحیح وارد فرمایید', less: 'لطفا حداقل %s گزینه را انتخاب فرمایید', more: 'لطفا حداکثر %s گزینه را انتخاب فرمایید', between: 'لطفا %s - %s گزینه انتخاب فرمایید' }, color: { 'default': 'لطفا رنگ صحیح وارد فرمایید' }, creditCard: { 'default': 'لطفا یک شماره کارت اعتباری معتبر وارد فرمایید' }, cusip: { 'default': 'لطفا یک شماره CUSIP معتبر وارد فرمایید' }, cvv: { 'default': 'لطفا یک شماره CVV معتبر وارد فرمایید' }, date: { 'default': 'لطفا یک تاریخ معتبر وارد فرمایید', min: 'لطفا یک تاریخ بعد از %s وارد فرمایید', max: 'لطفا یک تاریخ قبل از %s وارد فرمایید', range: 'لطفا یک تاریخ در بازه %s - %s وارد فرمایید' }, different: { 'default': 'لطفا یک مقدار متفاوت وارد فرمایید' }, digits: { 'default': 'لطفا فقط عدد وارد فرمایید' }, ean: { 'default': 'لطفا یک شماره EAN معتبر وارد فرمایید' }, emailAddress: { 'default': 'لطفا آدرس ایمیل معتبر وارد فرمایید' }, file: { 'default': 'لطفا فایل معتبر انتخاب فرمایید' }, greaterThan: { 'default': 'لطفا مقدار بزرگتر یا مساوی با %s وارد فرمایید', notInclusive: 'لطفا مقدار بزرگتر از %s وارد فرمایید' }, grid: { 'default': 'لطفا شماره GRId معتبر وارد فرمایید' }, hex: { 'default': 'لطفا عدد هگزادسیمال صحیح وارد فرمایید' }, hexColor: { 'default': 'لطفا رنگ hex صحیح وارد فرمایید' }, iban: { 'default': 'لطفا شماره IBAN معتبر وارد فرمایید', countryNotSupported: 'کد کشور %s پشتیبانی نمیشود', country: 'لطفا یک شماره IBAN صحیح در %s وارد فرمایید', countries: { AD: 'آندورا', AE: 'امارات متحده عربی', AL: 'آلبانی', AO: 'آنگولا', AT: 'اتریش', AZ: 'آذربایجان', BA: 'بوسنی و هرزگوین', BE: 'بلژیک', BF: 'بورکینا فاسو', BG: 'بلغارستان', BH: 'بحرین', BI: 'بروندی', BJ: 'بنین', BR: 'برزیل', CH: 'سوئیس', CI: 'ساحل عاج', CM: 'کامرون', CR: 'کاستاریکا', CV: 'کیپ ورد', CY: 'قبرس', CZ: 'جمهوری چک', DE: 'آلمان', DK: 'دانمارک', DO: 'جمهوری دومینیکن', DZ: 'الجزایر', EE: 'استونی', ES: 'اسپانیا', FI: 'فنلاند', FO: 'جزایر فارو', FR: 'فرانسه', GB: 'بریتانیا', GE: 'گرجستان', GI: 'جبل الطارق', GL: 'گرینلند', GR: 'یونان', GT: 'گواتمالا', HR: 'کرواسی', HU: 'مجارستان', IE: 'ایرلند', IL: 'اسرائیل', IR: 'ایران', IS: 'ایسلند', IT: 'ایتالیا', JO: 'اردن', KW: 'کویت', KZ: 'قزاقستان', LB: 'لبنان', LI: 'لیختن اشتاین', LT: 'لیتوانی', LU: 'لوکزامبورگ', LV: 'لتونی', MC: 'موناکو', MD: 'مولدووا', ME: 'مونته نگرو', MG: 'ماداگاسکار', MK: 'مقدونیه', ML: 'مالی', MR: 'موریتانی', MT: 'مالت', MU: 'موریس', MZ: 'موزامبیک', NL: 'هلند', NO: 'نروژ', PK: 'پاکستان', PL: 'لهستان', PS: 'فلسطین', PT: 'پرتغال', QA: 'قطر', RO: 'رومانی', RS: 'صربستان', SA: 'عربستان سعودی', SE: 'سوئد', SI: 'اسلوونی', SK: 'اسلواکی', SM: 'سان مارینو', SN: 'سنگال', TN: 'تونس', TR: 'ترکیه', VG: 'جزایر ویرجین، بریتانیا' } }, id: { 'default': 'لطفا شماره شناسایی صحیح وارد فرمایید', countryNotSupported: 'کد کشور %s پشتیبانی نمیگردد', country: 'لطفا یک شماره شناسایی معتبر در %s وارد کنید', countries: { BA: 'بوسنی و هرزگوین', BG: 'بلغارستان', BR: 'برزیل', CH: 'سوئیس', CL: 'شیلی', CN: 'چین', CZ: 'چک', DK: 'دانمارک', EE: 'استونی', ES: 'اسپانیا', FI: 'فنلاند', HR: 'کرواسی', IE: 'ایرلند', IS: 'ایسلند', LT: 'لیتوانی', LV: 'لتونی', ME: 'مونته نگرو', MK: 'مقدونیه', NL: 'هلند', RO: 'رومانی', RS: 'صربی', SE: 'سوئد', SI: 'اسلوونی', SK: 'اسلواکی', SM: 'سان مارینو', TH: 'تایلند', ZA: 'آفریقای جنوبی' } }, identical: { 'default': 'لطفا مقدار یکسان وارد فرمایید' }, imei: { 'default': 'لطفا شماره IMEI معتبر وارد فرمایید' }, imo: { 'default': 'لطفا شماره IMO معتبر وارد فرمایید' }, integer: { 'default': 'لطفا یک عدد صحیح وارد فرمایید' }, ip: { 'default': 'لطفا یک آدرس IP معتبر وارد فرمایید', ipv4: 'لطفا یک آدرس IPv4 معتبر وارد فرمایید', ipv6: 'لطفا یک آدرس IPv6 معتبر وارد فرمایید' }, isbn: { 'default': 'لطفا شماره ISBN معتبر وارد فرمایید' }, isin: { 'default': 'لطفا شماره ISIN معتبر وارد فرمایید' }, ismn: { 'default': 'لطفا شماره ISMN معتبر وارد فرمایید' }, issn: { 'default': 'لطفا شماره ISSN معتبر وارد فرمایید' }, lessThan: { 'default': 'لطفا مقدار کمتر یا مساوی با %s وارد فرمایید', notInclusive: 'لطفا مقدار کمتر از %s وارد فرمایید' }, mac: { 'default': 'لطفا یک MAC address معتبر وارد فرمایید' }, meid: { 'default': 'لطفا یک شماره MEID معتبر وارد فرمایید' }, notEmpty: { 'default': 'لطفا یک مقدار وارد فرمایید' }, numeric: { 'default': 'لطفا یک عدد اعشاری صحیح وارد فرمایید' }, phone: { 'default': 'لطفا یک شماره تلفن صحیح وارد فرمایید', countryNotSupported: 'کد کشور %s پشتیبانی نمیشود', country: 'لطفا یک شماره تلفن معتبر وارد کنید در %s', countries: { BR: 'برزیل', CN: 'کشور چین', CZ: 'چک', DE: 'آلمان', DK: 'دانمارک', ES: 'اسپانیا', FR: 'فرانسه', GB: 'بریتانیا', MA: 'مراکش', PK: 'پاکستان', RO: 'رومانی', RU: 'روسیه', SK: 'اسلواکی', TH: 'تایلند', US: 'ایالات متحده آمریکا', VE: 'ونزوئلا' } }, regexp: { 'default': 'لطفا یک مقدار مطابق با الگو وارد فرمایید' }, remote: { 'default': 'لطفا یک مقدار معتبر وارد فرمایید' }, rtn: { 'default': 'لطفا یک شماره RTN صحیح وارد فرمایید' }, sedol: { 'default': 'لطفا یک شماره SEDOL صحیح وارد فرمایید' }, siren: { 'default': 'لطفا یک شماره SIREN صحیح وارد فرمایید' }, siret: { 'default': 'لطفا یک شماره SIRET صحیح وارد فرمایید' }, step: { 'default': 'لطفا یک گام صحیح از %s وارد فرمایید' }, stringCase: { 'default': 'لطفا فقط حروف کوچک وارد فرمایید', upper: 'لطفا فقط حروف بزرگ وارد فرمایید' }, stringLength: { 'default': 'لطفا یک مقدار با طول صحیح وارد فرمایید', less: 'لطفا کمتر از %s حرف وارد فرمایید', more: 'لطفا بیش از %s حرف وارد فرمایید', between: 'لطفا مقداری بین %s و %s حرف وارد فرمایید' }, uri: { 'default': 'لطفا یک آدرس URI صحیح وارد فرمایید' }, uuid: { 'default': 'لطفا یک شماره UUID معتبر وارد فرمایید', version: 'لطفا یک نسخه UUID صحیح %s شماره وارد فرمایید' }, vat: { 'default': 'لطفا یک شماره VAT صحیح وارد فرمایید', countryNotSupported: 'کد کشور %s پشتیبانی نمیگردد', country: 'لطفا یک شماره VAT معتبر در %s وارد کنید', countries: { AT: 'اتریش', BE: 'بلژیک', BG: 'بلغارستان', BR: 'برزیل', CH: 'سوئیس', CY: 'قبرس', CZ: 'چک', DE: 'آلمان', DK: 'دانمارک', EE: 'استونی', ES: 'اسپانیا', FI: 'فنلاند', FR: 'فرانسه', GB: 'بریتانیا', GR: 'یونان', EL: 'یونان', HU: 'مجارستان', HR: 'کرواسی', IE: 'ایرلند', IS: 'ایسلند', IT: 'ایتالیا', LT: 'لیتوانی', LU: 'لوکزامبورگ', LV: 'لتونی', MT: 'مالت', NL: 'هلند', NO: 'نروژ', PL: 'لهستانی', PT: 'پرتغال', RO: 'رومانی', RU: 'روسیه', RS: 'صربستان', SE: 'سوئد', SI: 'اسلوونی', SK: 'اسلواکی', VE: 'ونزوئلا', ZA: 'آفریقای جنوبی' } }, vin: { 'default': 'لطفا یک شماره VIN صحیح وارد فرمایید' }, zipCode: { 'default': 'لطفا یک کدپستی صحیح وارد فرمایید', countryNotSupported: 'کد کشور %s پشتیبانی نمیگردد', country: 'لطفا یک کد پستی معتبر در %s وارد کنید', countries: { AT: 'اتریش', BR: 'برزیل', CA: 'کانادا', CH: 'سوئیس', CZ: 'چک', DE: 'آلمان', DK: 'دانمارک', FR: 'فرانسه', GB: 'بریتانیا', IE: 'ایرلند', IT: 'ایتالیا', MA: 'مراکش', NL: 'هلند', PT: 'پرتغال', RO: 'رومانی', RU: 'روسیه', SE: 'سوئد', SG: 'سنگاپور', SK: 'اسلواکی', US: 'ایالات متحده' } } }); }(window.jQuery));
Humsen/web/web-pc/WebContent/plugins/validator/js/language/fa_IR.js/0
{ "file_path": "Humsen/web/web-pc/WebContent/plugins/validator/js/language/fa_IR.js", "repo_id": "Humsen", "token_count": 10546 }
51
(function($) { /** * Serbian Latin language package * Translated by @markocrni */ $.fn.bootstrapValidator.i18n = $.extend(true, $.fn.bootstrapValidator.i18n, { base64: { 'default': 'Molimo da unesete važeći base 64 enkodovan' }, between: { 'default': 'Molimo da unesete vrednost između %s i %s', notInclusive: 'Molimo da unesete vrednost strogo između %s i %s' }, callback: { 'default': 'Molimo da unesete važeću vrednost' }, choice: { 'default': 'Molimo da unesete važeću vrednost', less: 'Molimo da odaberete minimalno %s opciju(a)', more: 'Molimo da odaberete maksimalno %s opciju(a)', between: 'Molimo odaberite %s - %s opcije(a)' }, color: { 'default': 'Molimo da unesete ispravnu boju' }, creditCard: { 'default': 'Molimo da unesete ispravan broj kreditne kartice' }, cusip: { 'default': 'Molimo da unesete ispravan CUSIP broj' }, cvv: { 'default': 'Molimo da unesete ispravan CVV broj' }, date: { 'default': 'Molimo da unesete ispravan datum', min: 'Molimo da unesete datum posle %s', max: 'Molimo da unesete datum pre %s', range: 'Molimo da unesete datum od %s do %s' }, different: { 'default': 'Molimo da unesete drugu vrednost' }, digits: { 'default': 'Molimo da unesete samo cifre' }, ean: { 'default': 'Molimo da unesete ispravan EAN broj' }, emailAddress: { 'default': 'Molimo da unesete važeću e-mail adresu' }, file: { 'default': 'Molimo da unesete ispravan fajl' }, greaterThan: { 'default': 'Molimo da unesete vrednost veću ili jednaku od %s', notInclusive: 'Molimo da unesete vrednost veću od %s' }, grid: { 'default': 'Molimo da unesete ispravan GRId broj' }, hex: { 'default': 'Molimo da unesete ispravan heksadecimalan broj' }, hexColor: { 'default': 'Molimo da unesete ispravnu heksa boju' }, iban: { 'default': 'Molimo da unesete ispravan IBAN broj', countryNotSupported: 'Kod %s nije podržan', country: 'Molimo da unesete ispravan IBAN broj %s', countries: { AD: 'Andore', AE: 'Ujedinjenih Arapskih Emirata', AL: 'Albanije', AO: 'Angole', AT: 'Austrije', AZ: 'Azerbejdžana', BA: 'Bosne i Hercegovine', BE: 'Belgije', BF: 'Burkina Fasa', BG: 'Bugarske', BH: 'Bahraina', BI: 'Burundija', BJ: 'Benina', BR: 'Brazila', CH: 'Švajcarske', CI: 'Obale slonovače', CM: 'Kameruna', CR: 'Kostarike', CV: 'Zelenorotskih Ostrva', CY: 'Kipra', CZ: 'Češke', DE: 'Nemačke', DK: 'Danske', DO: 'Dominike', DZ: 'Alžira', EE: 'Estonije', ES: 'Španije', FI: 'Finske', FO: 'Farskih Ostrva', FR: 'Francuske', GB: 'Engleske', GE: 'Džordžije', GI: 'Giblartara', GL: 'Grenlanda', GR: 'Grčke', GT: 'Gvatemale', HR: 'Hrvatske', HU: 'Mađarske', IE: 'Irske', IL: 'Izraela', IR: 'Irana', IS: 'Islanda', IT: 'Italije', JO: 'Jordana', KW: 'Kuvajta', KZ: 'Kazahstana', LB: 'Libana', LI: 'Lihtenštajna', LT: 'Litvanije', LU: 'Luksemburga', LV: 'Latvije', MC: 'Monaka', MD: 'Moldove', ME: 'Crne Gore', MG: 'Madagaskara', MK: 'Makedonije', ML: 'Malija', MR: 'Mauritanije', MT: 'Malte', MU: 'Mauricijusa', MZ: 'Mozambika', NL: 'Holandije', NO: 'Norveške', PK: 'Pakistana', PL: 'Poljske', PS: 'Palestine', PT: 'Portugala', QA: 'Katara', RO: 'Rumunije', RS: 'Srbije', SA: 'Saudijske Arabije', SE: 'Švedske', SI: 'Slovenije', SK: 'Slovačke', SM: 'San Marina', SN: 'Senegala', TN: 'Tunisa', TR: 'Turske', VG: 'Britanskih Devičanskih Ostrva' } }, id: { 'default': 'Molimo da unesete ispravan identifikacioni broj', countryNotSupported: 'Kod %s nije podržan', country: 'Molimo da unesete ispravan identifikacioni broj %s', countries: { BA: 'Bosne i Herzegovine', BG: 'Bugarske', BR: 'Brazila', CH: 'Švajcarske', CL: 'Čilea', CN: 'Kine', CZ: 'Češke', DK: 'Danske', EE: 'Estonije', ES: 'Španije', FI: 'Finske', HR: 'Hrvatske', IE: 'Irske', IS: 'Islanda', LT: 'Litvanije', LV: 'Letonije', ME: 'Crne Gore', MK: 'Makedonije', NL: 'Holandije', RO: 'Rumunije', RS: 'Srbije', SE: 'Švedske', SI: 'Slovenije', SK: 'Slovačke', SM: 'San Marina', TH: 'Tajlanda', ZA: 'Južne Afrike' } }, identical: { 'default': 'Molimo da unesete istu vrednost' }, imei: { 'default': 'Molimo da unesete ispravan IMEI broj' }, imo: { 'default': 'Molimo da unesete ispravan IMO broj' }, integer: { 'default': 'Molimo da unesete ispravan broj' }, ip: { 'default': 'Molimo da unesete ispravnu IP adresu', ipv4: 'Molimo da unesete ispravnu IPv4 adresu', ipv6: 'Molimo da unesete ispravnu IPv6 adresu' }, isbn: { 'default': 'Molimo da unesete ispravan ISBN broj' }, isin: { 'default': 'Molimo da unesete ispravan ISIN broj' }, ismn: { 'default': 'Molimo da unesete ispravan ISMN broj' }, issn: { 'default': 'Molimo da unesete ispravan ISSN broj' }, lessThan: { 'default': 'Molimo da unesete vrednost manju ili jednaku od %s', notInclusive: 'Molimo da unesete vrednost manju od %s' }, mac: { 'default': 'Molimo da unesete ispravnu MAC adresu' }, meid: { 'default': 'Molimo da unesete ispravan MEID broj' }, notEmpty: { 'default': 'Molimo da unesete vrednost' }, numeric: { 'default': 'Molimo da unesete ispravan decimalni broj' }, phone: { 'default': 'Molimo da unesete ispravan broj telefona', countryNotSupported: 'Broj %s nije podržan', country: 'Molimo da unesete ispravan broj telefona %s', countries: { BR: 'Brazila', CN: 'Kine', CZ: 'Češke', DE: 'Nemačke', DK: 'Danske', ES: 'Španije', FR: 'Francuske', GB: 'Engleske', MA: 'Maroka', PK: 'Pakistana', RO: 'Rumunije', RU: 'Rusije', SK: 'Slovačke', TH: 'Tajlanda', US: 'Amerike', VE: 'Venecuele' } }, regexp: { 'default': 'Molimo da unesete vrednost koja se poklapa sa paternom' }, remote: { 'default': 'Molimo da unesete ispravnu vrednost' }, rtn: { 'default': 'Molimo da unesete ispravan RTN broj' }, sedol: { 'default': 'Molimo da unesete ispravan SEDOL broj' }, siren: { 'default': 'Molimo da unesete ispravan SIREN broj' }, siret: { 'default': 'Molimo da unesete ispravan SIRET broj' }, step: { 'default': 'Molimo da unesete ispravan korak od %s' }, stringCase: { 'default': 'Molimo da unesete samo mala slova', upper: 'Molimo da unesete samo velika slova' }, stringLength: { 'default': 'Molimo da unesete vrednost sa ispravnom dužinom', less: 'Molimo da unesete manje od %s karaktera', more: 'Molimo da unesete više od %s karaktera', between: 'Molimo da unesete vrednost dužine između %s i %s karaktera' }, uri: { 'default': 'Molimo da unesete ispravan URI' }, uuid: { 'default': 'Molimo da unesete ispravan UUID broj', version: 'Molimo da unesete ispravnu verziju UUID %s broja' }, vat: { 'default': 'Molimo da unesete ispravan VAT broj', countryNotSupported: 'Kod %s nije podržan', country: 'Molimo da unesete ispravan VAT broj %s', countries: { AT: 'Austrije', BE: 'Belgije', BG: 'Bugarske', BR: 'Brazila', CH: 'Švajcarske', CY: 'Kipra', CZ: 'Češke', DE: 'Nemačke', DK: 'Danske', EE: 'Estonije', ES: 'Španije', FI: 'Finske', FR: 'Francuske', GB: 'Engleske', GR: 'Grčke', EL: 'Grčke', HU: 'Mađarske', HR: 'Hrvatske', IE: 'Irske', IS: 'Islanda', IT: 'Italije', LT: 'Litvanije', LU: 'Luksemburga', LV: 'Letonije', MT: 'Malte', NL: 'Holandije', NO: 'Norveške', PL: 'Poljske', PT: 'Portugala', RO: 'Romunje', RU: 'Rusije', RS: 'Srbije', SE: 'Švedske', SI: 'Slovenije', SK: 'Slovačke', VE: 'Venecuele', ZA: 'Južne Afrike' } }, vin: { 'default': 'Molimo da unesete ispravan VIN broj' }, zipCode: { 'default': 'Molimo da unesete ispravan poštanski broj', countryNotSupported: 'Kod %s nije podržan', country: 'Molimo da unesete ispravan poštanski broj %s', countries: { AT: 'Austrije', BR: 'Brazila', CA: 'Kanade', CH: 'Švajcarske', CZ: 'Češke', DE: 'Nemačke', DK: 'Danske', FR: 'Francuske', GB: 'Engleske', IE: 'Irske', IT: 'Italije', MA: 'Maroka', NL: 'Holandije', PT: 'Portugala', RO: 'Rumunije', RU: 'Rusije', SE: 'Švedske', SG: 'Singapura', SK: 'Slovačke', US: 'Amerike' } } }); }(window.jQuery));
Humsen/web/web-pc/WebContent/plugins/validator/js/language/sr_RS.js/0
{ "file_path": "Humsen/web/web-pc/WebContent/plugins/validator/js/language/sr_RS.js", "repo_id": "Humsen", "token_count": 8020 }
52
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>分享</title> <meta name="description" content="欢迎来到何明胜的个人网站.本站主要用于记录和分享本人的学习心得和编程经验,并分享常见可复用代码、推荐书籍以及软件等资源.本站源码已托管github,欢迎访问:https://github.com/HelloHusen/web" /> <meta name="keywords" content="何明胜,何明胜的个人网站,何明胜的博客,一格的程序人生" /> <meta name="author" content="何明胜,一格"> <!-- 网站图标 --> <link rel="shortcut icon" href="/images/favicon.ico"> <!-- jQuery --> <script src="/plugins/jquery/js/jquery-3.2.1.min.js"></script> <!-- 自定义css --> <link rel="stylesheet" href="/css/download/download.css"> <!-- 自定义脚本 --> <script src="/js/download/download.js"></script> <script src="/js/pagination.js"></script> </head> <body> <input id="menuBarNo" type="hidden" value="4" /> <div id="fh5co-page"> <!-- 左侧导航 --> <!-- 中间内容 --> <div id="fh5co-main"> <div class="fh5co-narrow-content download-div"> <h2 class="fh5co-heading" data-animate-effect="fadeInLeft">下载分享区</h2> <input type="hidden" id="num_downloadPageSize" value="10"> <div id="list_file" class="row"></div> </div> </div> <!-- 右侧导航 --> </div> </body> </html>
Humsen/web/web-pc/WebContent/topic/download/download.html/0
{ "file_path": "Humsen/web/web-pc/WebContent/topic/download/download.html", "repo_id": "Humsen", "token_count": 707 }
53
# addons listed in this file are ignored by # setuptools-odoo-make-default (one addon per line)
OCA/web/setup/.setuptools-odoo-make-default-ignore/0
{ "file_path": "OCA/web/setup/.setuptools-odoo-make-default-ignore", "repo_id": "OCA", "token_count": 29 }
54
# Translation of Odoo Server. # This file contains the translation of the following modules: # * web_advanced_search # msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2023-11-27 11:33+0000\n" "Last-Translator: mymage <stefano.consolaro@mymage.it>\n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.17\n" #. module: web_advanced_search #. odoo-javascript #: code:addons/web_advanced_search/static/src/js/utils.esm.js:0 #, python-format msgid " and " msgstr " e " #. module: web_advanced_search #. odoo-javascript #: code:addons/web_advanced_search/static/src/js/utils.esm.js:0 #, python-format msgid " is not " msgstr " non è " #. module: web_advanced_search #. odoo-javascript #: code:addons/web_advanced_search/static/src/js/utils.esm.js:0 #, python-format msgid " or " msgstr " o " #. module: web_advanced_search #. odoo-javascript #: code:addons/web_advanced_search/static/src/search/filter_menu/advanced_filter_item.xml:0 #, python-format msgid "Add Advanced Filter" msgstr "Aggiungi Filtro Avanzato"
OCA/web/web_advanced_search/i18n/it.po/0
{ "file_path": "OCA/web/web_advanced_search/i18n/it.po", "repo_id": "OCA", "token_count": 501 }
55
/** @odoo-module **/ import BasicModel from "web.BasicModel"; import {ComponentAdapter} from "web.OwlCompatibility"; import {Dropdown} from "@web/core/dropdown/dropdown"; import FieldManagerMixin from "web.FieldManagerMixin"; import {FieldMany2One} from "web.relational_fields"; import {SelectCreateDialog} from "web.view_dialogs"; import {patch} from "@web/core/utils/patch"; import {session} from "@web/session"; const {Component, xml} = owl; patch(Dropdown.prototype, "dropdown", { onWindowClicked(ev) { // This patch is created to prevent the closing of the Filter menu // when a selection is made in the RecordPicker if ($(ev.target.closest("ul.dropdown-menu")).attr("id") !== undefined) { const dropdown = $("body > ul.dropdown-menu"); for (let i = 0; i < dropdown.length; i++) { if ( $(ev.target.closest("ul.dropdown-menu")).attr("id") === $(dropdown[i]).attr("id") ) { return; } } } this._super(ev); }, }); export const FakeMany2oneFieldWidget = FieldMany2One.extend(FieldManagerMixin, { supportedFieldTypes: ["many2many", "many2one", "one2many"], /** * @override */ init: function (parent) { this.componentAdapter = parent; const options = this.componentAdapter.props.attrs; // Create a dummy record with only a dummy m2o field to search on const model = new BasicModel("dummy"); const params = { fieldNames: ["dummy"], modelName: "dummy", context: {}, type: "record", viewType: "default", fieldsInfo: {default: {dummy: {}}}, fields: { dummy: { string: options.string, relation: options.model, context: options.context, domain: options.domain, type: "many2one", }, }, }; // Emulate `model.load()`, without RPC-calling `default_get()` this.dataPointID = model._makeDataPoint(params).id; model.generateDefaultValues(this.dataPointID, {}); this._super(this.componentAdapter, "dummy", this._get_record(model), { mode: "edit", attrs: { options: { no_create_edit: true, no_create: true, no_open: true, no_quick_create: true, }, }, }); FieldManagerMixin.init.call(this, model); }, /** * Get record * * @param {BasicModel} model * @returns {String} */ _get_record: function (model) { return model.get(this.dataPointID); }, /** * @override */ _confirmChange: function (id, fields, event) { this.componentAdapter.trigger("change", event.data.changes[fields[0]]); this.dataPointID = id; return this.reset(this._get_record(this.model), event); }, /** * Stop propagation of the 'Search more..' dialog click event. * Otherwise, the filter's dropdown will be closed after a selection. * * @override */ _searchCreatePopup: function (view, ids, context, dynamicFilters) { const options = this._getSearchCreatePopupOptions( view, ids, context, dynamicFilters ); const dialog = new SelectCreateDialog( this, _.extend({}, this.nodeOptions, options) ); // Hack to stop click event propagation dialog._opened.then(() => dialog.$el .get(0) .addEventListener("click", (event) => event.stopPropagation()) ); return dialog.open(); }, _onFieldChanged: function (event) { const self = this; event.stopPropagation(); if (event.data.changes.dummy.display_name === undefined) { return this._rpc({ model: this.field.relation, method: "name_get", args: [event.data.changes.dummy.id], context: session.user_context, }).then(function (result) { event.data.changes.dummy.display_name = result[0][1]; return ( self ._applyChanges( event.data.dataPointID, event.data.changes, event ) // eslint-disable-next-line no-empty-function .then(event.data.onSuccess || function () {}) // eslint-disable-next-line no-empty-function .guardedCatch(event.data.onFailure || function () {}) ); }); } return ( this._applyChanges(event.data.dataPointID, event.data.changes, event) // eslint-disable-next-line no-empty-function .then(event.data.onSuccess || function () {}) // eslint-disable-next-line no-empty-function .guardedCatch(event.data.onFailure || function () {}) ); }, }); export class FakeMany2oneFieldWidgetAdapter extends ComponentAdapter { constructor() { super(...arguments); this.env = Component.env; } renderWidget() { this.widget._render(); } get widgetArgs() { if (this.props.widgetArgs) { return this.props.widgetArgs; } return [this.props.attrs]; } } /** * A record selector widget. * * Underneath, it implements and extends the `FieldManagerMixin`, and acts as if it * were a reduced dummy controller. Some actions "mock" the underlying model, since * sometimes we use a char widget to fill related fields (which is not supported by * that widget), and fields need an underlying model implementation, which can only * hold fake data, given a search view has no data on it by definition. * * @extends Component */ export class RecordPicker extends Component { setup() { this.attrs = { string: this.props.string, model: this.props.model, domain: this.props.domain, context: this.props.context, }; this.FakeMany2oneFieldWidget = FakeMany2oneFieldWidget; } } RecordPicker.template = xml` <div> <FakeMany2oneFieldWidgetAdapter Component="FakeMany2oneFieldWidget" class="d-block" attrs="attrs" /> </div>`; RecordPicker.components = {FakeMany2oneFieldWidgetAdapter};
OCA/web/web_advanced_search/static/src/js/RecordPicker.esm.js/0
{ "file_path": "OCA/web/web_advanced_search/static/src/js/RecordPicker.esm.js", "repo_id": "OCA", "token_count": 3246 }
56
# © 2023 David BEAL @ Akretion # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import models # R8180 rule asks for merging demo/base.py and models/base.py content # We need to keep these class separated because of demo mode. # pylint: disable=R8180 class Base(models.AbstractModel): _inherit = "base" def _get_field_styles(self): res = super()._get_field_styles() style = self.env.context.get("style") if style == "nice": # only this entry is correct res["res.users"] = { "bg-info": ["login", "type"], "bg-warning": ["partner_id"], } elif style == "no_dict": res = "any" elif style == "no_field_list": res["res.users"] = {"bg-info": "any"} elif style == "empty_dict": res["res.users"] = {} elif style == "no_style": res["res.users"] = False return res
OCA/web/web_apply_field_style/demo/base.py/0
{ "file_path": "OCA/web/web_apply_field_style/demo/base.py", "repo_id": "OCA", "token_count": 450 }
57
# Copyright 2021 Tecnativa - Jairo Llopis # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). { "name": "Calendar slot duration", "summary": "Customizable calendar slot durations", "version": "16.0.1.0.1", "development_status": "Production/Stable", "category": "Extra Tools", "website": "https://github.com/OCA/web", "author": "Tecnativa, Odoo Community Association (OCA)", "maintainers": ["Yajo"], "license": "LGPL-3", "application": False, "installable": True, "assets": { "web.assets_backend": [ "web_calendar_slot_duration/static/src/js/calendar_common_renderer.esm.js", "web_calendar_slot_duration/static/src/js/calendar_model.esm.js", ] }, "depends": ["web"], }
OCA/web/web_calendar_slot_duration/__manifest__.py/0
{ "file_path": "OCA/web/web_calendar_slot_duration/__manifest__.py", "repo_id": "OCA", "token_count": 329 }
58
# Copyright 2022 Hynsys Technologies # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { "name": "Chatter Position", "summary": "Add an option to change the chatter position", "version": "16.0.1.0.2", "author": "Hynsys Technologies, Camptocamp, Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", "license": "LGPL-3", "category": "Extra Tools", "depends": ["web", "mail"], "data": ["views/res_users.xml", "views/web.xml"], "assets": { "web.assets_backend": [ "/web_chatter_position/static/src/**/*.js", ], }, }
OCA/web/web_chatter_position/__manifest__.py/0
{ "file_path": "OCA/web/web_chatter_position/__manifest__.py", "repo_id": "OCA", "token_count": 260 }
59
# Translation of Odoo Server. # This file contains the translation of the following modules: # * web_company_color # msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2024-01-29 19:37+0000\n" "Last-Translator: Peter Romão <peterromao@yahoo.co.uk>\n" "Language-Team: none\n" "Language: pt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Weblate 4.17\n" #. module: web_company_color #: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form msgid "" "<span class=\"fa fa-info fa-2x me-2\"/>\n" " In order for the changes to take effect, please refresh\n" " the page." msgstr "" "<span class=\"fa fa-info fa-2x me-2\"/>\n" " Para que as alterações entrem em vigor, atualize\n" " a página." #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__color_button_bg msgid "Button Background Color" msgstr "Cor de Fundo dos Botões" #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__color_button_bg_hover msgid "Button Background Color Hover" msgstr "Cor de Fundo de Botões com Foco" #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__color_button_text msgid "Button Text Color" msgstr "Cor do Texto do Botão" #. module: web_company_color #: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form msgid "Colors" msgstr "Cores" #. module: web_company_color #: model:ir.model,name:web_company_color.model_res_company msgid "Companies" msgstr "Empresas" #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__company_colors msgid "Company Colors" msgstr "Cores da Empresa" #. module: web_company_color #: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form msgid "Company Styles" msgstr "Estilos da Empresa" #. module: web_company_color #: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form msgid "Compute colors from logo" msgstr "Calcular cores a partir do logotipo" #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text msgid "Link Text Color" msgstr "Cor do Texto das Ligações" #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text_hover msgid "Link Text Color Hover" msgstr "Cor do Texto das Ligações com Foco" #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_bg msgid "Navbar Background Color" msgstr "Cor de Fundo da Barra de Navegação" #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_bg_hover msgid "Navbar Background Color Hover" msgstr "Cor de Fundo da Barra de Navegação com Foco" #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text msgid "Navbar Text Color" msgstr "Cor do Texto da Barra de Navegação" #. module: web_company_color #: model:ir.model,name:web_company_color.model_ir_qweb msgid "Qweb" msgstr "QWeb" #. module: web_company_color #: model:ir.model.fields,field_description:web_company_color.field_res_company__scss_modif_timestamp msgid "SCSS Modif. Timestamp" msgstr "SCSS Modif. Timestamp"
OCA/web/web_company_color/i18n/pt.po/0
{ "file_path": "OCA/web/web_company_color/i18n/pt.po", "repo_id": "OCA", "token_count": 1417 }
60
<?xml version="1.0" encoding="utf-8" ?> <!-- Copyright 2019 Alexandre Díaz License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> <odoo> <!-- Workarround to use custom assets bundle This specific 't-call-assets' xmlid will be handled in a 'special' way --> <template id="webclient_bootstrap" name="web_company_color assets" inherit_id="web.webclient_bootstrap" > <xpath expr="//t[@t-set='head_web']"> <t t-call-assets="web_company_color.company_color_assets" /> </xpath> </template> </odoo>
OCA/web/web_company_color/view/assets.xml/0
{ "file_path": "OCA/web/web_company_color/view/assets.xml", "repo_id": "OCA", "token_count": 261 }
61
# © 2022 Florian Kantelberg - initOS GmbH # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models
OCA/web/web_dark_mode/__init__.py/0
{ "file_path": "OCA/web/web_dark_mode/__init__.py", "repo_id": "OCA", "token_count": 47 }
62
# © 2018 Iván Todorovich <ivan.todorovich@gmail.com> # © 2019-Today GRAP # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import api, fields, models class TileCategory(models.Model): _name = "tile.category" _description = "Dashboard Tile Category" _order = "sequence asc" name = fields.Char(required=True) sequence = fields.Integer(required=True, default=10) active = fields.Boolean(default=True) action_id = fields.Many2one( string="Odoo Action", comodel_name="ir.actions.act_window", readonly=True ) menu_id = fields.Many2one( string="Odoo Menu", comodel_name="ir.ui.menu", readonly=True ) tile_ids = fields.One2many( string="Tiles", comodel_name="tile.tile", inverse_name="category_id" ) tile_qty = fields.Integer( string="Tiles Quantity", compute="_compute_tile_qty", store=True, ) @api.depends("tile_ids") def _compute_tile_qty(self): for category in self: category.tile_qty = len(category.tile_ids) def _prepare_action(self): self.ensure_one() return { "name": self.name, "res_model": "tile.tile", "type": "ir.actions.act_window", "view_mode": "kanban", "domain": """[ ('hidden', '=', False), '|', ('user_id', '=', False), ('user_id', '=', uid), ('category_id', '=', {self.id}) ]""".format( self=self ), } def _prepare_menu(self): self.ensure_one() return { "name": self.name, "parent_id": self.env.ref("web_dashboard_tile.menu_dashboard_tile").id, "action": "ir.actions.act_window,%d" % self.action_id.id, "sequence": self.sequence, } def _create_ui(self): IrUiMenu = self.env["ir.ui.menu"] IrActionsActWindows = self.env["ir.actions.act_window"] for category in self: if not category.action_id: category.action_id = IrActionsActWindows.create( category._prepare_action() ) if not category.menu_id: category.menu_id = IrUiMenu.create(category._prepare_menu()) def _delete_ui(self): for category in self: if category.menu_id: category.menu_id.unlink() if category.action_id: category.action_id.unlink() @api.model_create_multi def create(self, vals_list): categories = super().create(vals_list) categories.filtered(lambda x: x.active)._create_ui() return categories def write(self, vals): res = super().write(vals) if "active" in vals.keys(): if vals.get("active"): self._create_ui() else: self._delete_ui() if "sequence" in vals.keys(): self.mapped("menu_id").write({"sequence": vals["sequence"]}) if "name" in vals.keys(): self.mapped("menu_id").write({"name": vals["name"]}) self.mapped("action_id").write({"name": vals["name"]}) return res def unlink(self): self._delete_ui() return super().unlink()
OCA/web/web_dashboard_tile/models/tile_category.py/0
{ "file_path": "OCA/web/web_dashboard_tile/models/tile_category.py", "repo_id": "OCA", "token_count": 1618 }
63
/* custom kanban style */ .o_kanban_view .oe_dashboard_tile { height: 150px !important; } .o_kanban_view .oe_dashboard_tile .tile_background { padding: 8px; height: 100%; } .o_kanban_view .oe_dashboard_tile .tile_label, .o_kanban_view .oe_dashboard_tile .tile_primary_value, .o_kanban_view .oe_dashboard_tile .tile_secondary_value { text-align: center; font-weight: bold; } .o_kanban_view .oe_dashboard_tile .tile_label { padding: 5px 0px; font-size: 15px; } .o_kanban_view .oe_dashboard_tile .tile_primary_value { font-size: 54px; left: 5px; right: 5px; bottom: 5px; } .o_kanban_view .oe_dashboard_tile .tile_secondary_value { display: none; font-size: 18px; font-style: italic; left: 5px; right: 5px; bottom: 5px; } .o_kanban_view .oe_dashboard_tile .with_secondary .tile_primary_value { font-size: 38px; bottom: 30px; } .o_kanban_view .oe_dashboard_tile .with_secondary .tile_secondary_value { display: block; }
OCA/web/web_dashboard_tile/static/src/css/web_dashboard_tile.css/0
{ "file_path": "OCA/web/web_dashboard_tile/static/src/css/web_dashboard_tile.css", "repo_id": "OCA", "token_count": 439 }
64
from . import ir_config_parameter
OCA/web/web_dialog_size/models/__init__.py/0
{ "file_path": "OCA/web/web_dialog_size/models/__init__.py", "repo_id": "OCA", "token_count": 10 }
65
# Copyright 2018 Tecnativa - Ernesto Tejeda # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0 from odoo.tests.common import TransactionCase class TestWebDialogSize(TransactionCase): def setUp(self): super(TestWebDialogSize, self).setUp() def test_get_web_dialog_size_config(self): obj = self.env["ir.config_parameter"] self.assertFalse(obj.get_web_dialog_size_config()["default_maximize"]) obj.set_param("web_dialog_size.default_maximize", "True") self.assertTrue(obj.get_web_dialog_size_config()["default_maximize"]) obj.set_param("web_dialog_size.default_maximize", "False") self.assertFalse(obj.get_web_dialog_size_config()["default_maximize"])
OCA/web/web_dialog_size/tests/test_web_dialog_size.py/0
{ "file_path": "OCA/web/web_dialog_size/tests/test_web_dialog_size.py", "repo_id": "OCA", "token_count": 290 }
66
- Users in the *Access to export feature* group or admins can export in any way. - Users in the *Direct Export (xlsx)* group can only use the default export feature from the list view.
OCA/web/web_disable_export_group/readme/USAGE.rst/0
{ "file_path": "OCA/web/web_disable_export_group/readme/USAGE.rst", "repo_id": "OCA", "token_count": 48 }
67
* Laurent Mignon <laurent.mignon@acsone.eu> * Denis Roussel <denis.roussel@acsone.eu> * Raf Ven <raf.ven@dynapps.be>
OCA/web/web_domain_field/readme/CONTRIBUTORS.rst/0
{ "file_path": "OCA/web/web_domain_field/readme/CONTRIBUTORS.rst", "repo_id": "OCA", "token_count": 53 }
68
# Translation of Odoo Server. # This file contains the translation of the following modules: # * web_environment_ribbon # # Translators: # OCA Transbot <transbot@odoo-community.org>, 2017 # Quentin THEURET <odoo@kerpeo.com>, 2017 msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-07-26 02:44+0000\n" "PO-Revision-Date: 2017-07-26 02:44+0000\n" "Last-Translator: Quentin THEURET <odoo@kerpeo.com>, 2017\n" "Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: web_environment_ribbon #: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend msgid "Web Environment Ribbon Backend" msgstr "Backend du bandeau de l'environnement Web" #~ msgid "Display Name" #~ msgstr "Nom affiché" #~ msgid "ID" #~ msgstr "ID" #~ msgid "Last Modified on" #~ msgstr "Dernière modification le"
OCA/web/web_environment_ribbon/i18n/fr.po/0
{ "file_path": "OCA/web/web_environment_ribbon/i18n/fr.po", "repo_id": "OCA", "token_count": 422 }
69
To use this module, you need only to install it. After installation, a red ribbon will be visible on top left corner of every Odoo backend page
OCA/web/web_environment_ribbon/readme/USAGE.rst/0
{ "file_path": "OCA/web/web_environment_ribbon/readme/USAGE.rst", "repo_id": "OCA", "token_count": 34 }
70
When grouping a list by a field, this module adds two buttons to expand or collapse all the groups at once. The buttons appear in the top right, in place of the pagination. One level of groups is expanded or collapsed at a time.
OCA/web/web_group_expand/readme/DESCRIPTION.rst/0
{ "file_path": "OCA/web/web_group_expand/readme/DESCRIPTION.rst", "repo_id": "OCA", "token_count": 57 }
71
from . import ir_actions
OCA/web/web_ir_actions_act_multi/models/__init__.py/0
{ "file_path": "OCA/web/web_ir_actions_act_multi/models/__init__.py", "repo_id": "OCA", "token_count": 7 }
72
* add `message_type` to differenciate between warnings, errors, etc. * have one `message_type` to show a nonmodal warning on top right
OCA/web/web_ir_actions_act_window_message/readme/ROADMAP.rst/0
{ "file_path": "OCA/web/web_ir_actions_act_window_message/readme/ROADMAP.rst", "repo_id": "OCA", "token_count": 39 }
73
# Copyright 2023 Hunki Enterprises BV # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import models class IrActionsActWindowPagePrev(models.AbstractModel): _name = "ir.actions.act_window.page.prev" _description = "Action to page to the previous record from a form view button" def _get_readable_fields(self): return set() # pragma: no cover class IrActionsActWindowPageNext(models.AbstractModel): _name = "ir.actions.act_window.page.next" _description = "Action to page to the next record from a form view button" def _get_readable_fields(self): return set() # pragma: no cover class IrActionsActWindowPageList(models.AbstractModel): _name = "ir.actions.act_window.page.list" _description = "Action to switch to the list view" def _get_readable_fields(self): return set() # pragma: no cover
OCA/web/web_ir_actions_act_window_page/models/ir_actions_act_window_page.py/0
{ "file_path": "OCA/web/web_ir_actions_act_window_page/models/ir_actions_act_window_page.py", "repo_id": "OCA", "token_count": 305 }
74
Enables selecting a range of records using the shift key.
OCA/web/web_listview_range_select/readme/DESCRIPTION.rst/0
{ "file_path": "OCA/web/web_listview_range_select/readme/DESCRIPTION.rst", "repo_id": "OCA", "token_count": 13 }
75
# Translation of Odoo Server. # This file contains the translation of the following modules: # * web_m2x_options # # Translators: # Bole <bole@dajmi5.com>, 2017 # OCA Transbot <transbot@odoo-community.org>, 2017 msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-01-03 03:50+0000\n" "PO-Revision-Date: 2018-01-03 03:50+0000\n" "Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n" "Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" "Language: hr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/base.xml:0 #, python-format msgid ", are you sure it does not exist yet?" msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/base.xml:0 #, python-format msgid "Create" msgstr "Kreiraj" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0 #, python-format msgid "Create \"%s\"" msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/base.xml:0 #, python-format msgid "Create and Edit" msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0 #, python-format msgid "Create and edit..." msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/base.xml:0 #, python-format msgid "Discard" msgstr "" #. module: web_m2x_options #: model:ir.model,name:web_m2x_options.model_ir_http msgid "HTTP Routing" msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/form.esm.js:0 #, python-format msgid "New: %s" msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0 #, python-format msgid "No records" msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/form.esm.js:0 #, python-format msgid "Open: " msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0 #, python-format msgid "Search More..." msgstr "Traži dalje..." #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/relational_utils.esm.js:0 #, python-format msgid "Start typing..." msgstr "" #. module: web_m2x_options #: model:ir.model,name:web_m2x_options.model_ir_config_parameter msgid "System Parameter" msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/base.xml:0 #, python-format msgid "You are creating a new" msgstr "" #. module: web_m2x_options #. odoo-javascript #: code:addons/web_m2x_options/static/src/components/base.xml:0 #, python-format msgid "as a new" msgstr "" #, python-format #~ msgid "Cancel" #~ msgstr "Otkaži" #, python-format #~ msgid "Create \"<strong>%s</strong>\"" #~ msgstr "Kreiraj \" <strong>%s</strong>\"" #, python-format #~ msgid "Create a %s" #~ msgstr "Kreiraj %s" #, python-format #~ msgid "Create and Edit..." #~ msgstr "Kreiraj i uredi..." #, python-format #~ msgid "Create and edit" #~ msgstr "Kreiraj i uredi" #, python-format #~ msgid "You are creating a new %s, are you sure it does not exist yet?" #~ msgstr "Želite kreirati novi %s, jeste li sigurni da već ne postoji?" #, fuzzy #~ msgid "!(widget.nodeOptions.no_open || widget.nodeOptions.no_open_edit)" #~ msgstr "!(opcije isključuju otvaranje ili uređivanje)"
OCA/web/web_m2x_options/i18n/hr.po/0
{ "file_path": "OCA/web/web_m2x_options/i18n/hr.po", "repo_id": "OCA", "token_count": 1622 }
76
in the field's options dict ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``create`` *boolean* (Default: depends if user have create rights) Whether to display the "Create..." entry in dropdown panel. ``create_edit`` *boolean* (Default: depends if user have create rights) Whether to display "Create and Edit..." entry in dropdown panel ``m2o_dialog`` *boolean* (Default: depends if user have create rights) Whether to display the many2one dialog in case of validation error. ``limit`` *int* (Default: openerp default value is ``7``) Number of displayed record in drop-down panel ``search_more`` *boolean* Used to force disable/enable search more button. ``field_color`` *string* A string to define the field used to define color. This option has to be used with colors. ``colors`` *dictionary* A dictionary to link field value with a HTML color. This option has to be used with field_color. ``no_open_edit`` *boolean* (Default: value of ``no_open`` which is ``False`` if not set) Causes a many2one not to offer to click through in edit mode, but well in read mode ``open`` *boolean* (Default: ``False``) Makes many2many_tags and one2many rows buttons that open the linked resource ``no_color_picker`` *boolean* (Default: ``False``) Deactivates the color picker on many2many_tags buttons to do nothing (ignored if open is set) ir.config_parameter options ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Now you can disable "Create..." and "Create and Edit..." entry for all widgets in the odoo instance. If you disable one option, you can enable it for particular field by setting "create: True" option directly on the field definition. ``web_m2x_options.create`` *boolean* (Default: depends if user have create rights) Whether to display the "Create..." entry in dropdown panel for all fields in the odoo instance. ``web_m2x_options.create_edit`` *boolean* (Default: depends if user have create rights) Whether to display "Create and Edit..." entry in dropdown panel for all fields in the odoo instance. ``web_m2x_options.m2o_dialog`` *boolean* (Default: depends if user have create rights) Whether to display the many2one dialog in case of validation error for all fields in the odoo instance. ``web_m2x_options.limit`` *int* (Default: openerp default value is ``7``) Number of displayed record in drop-down panel for all fields in the odoo instance ``web_m2x_options.search_more`` *boolean* (Default: default value is ``False``) Whether the field should always show "Search more..." entry or not. ``web_m2x_options.field_limit_entries`` *int* Number of displayed lines on all One2many fields To add these parameters go to Configuration -> Technical -> Parameters -> System Parameters and add new parameters like: - web_m2x_options.create: False - web_m2x_options.create_edit: False - web_m2x_options.m2o_dialog: False - web_m2x_options.limit: 10 - web_m2x_options.search_more: True - web_m2x_options.field_limit_entries: 5 Example ~~~~~~~ Your XML form view definition could contain:: ... <field name="partner_id" options="{'limit': 10, 'create': false, 'create_edit': false, 'search_more':true 'field_color':'state', 'colors':{'active':'green'}}"/> ...
OCA/web/web_m2x_options/readme/USAGE.rst/0
{ "file_path": "OCA/web/web_m2x_options/readme/USAGE.rst", "repo_id": "OCA", "token_count": 936 }
77
# Translation of Odoo Server. # This file contains the translation of the following modules: # * web_notify # # Translators: # Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 2017 msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-06-22 08:27+0000\n" "PO-Revision-Date: 2023-11-09 13:36+0000\n" "Last-Translator: Adriano Prado <adrianojprado@gmail.com>\n" "Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/" "23907/pt_BR/)\n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Weblate 4.17\n" #. module: web_notify #. odoo-python #: code:addons/web_notify/models/res_users.py:0 #, python-format msgid "Danger" msgstr "Perigo" #. module: web_notify #. odoo-python #: code:addons/web_notify/models/res_users.py:0 #, python-format msgid "Default" msgstr "Padrão" #. module: web_notify #. odoo-python #: code:addons/web_notify/models/res_users.py:0 #, python-format msgid "Information" msgstr "Informação" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users__notify_danger_channel_name msgid "Notify Danger Channel Name" msgstr "Notificar o nome do canal de perigo" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users__notify_default_channel_name msgid "Notify Default Channel Name" msgstr "Notificar o nome do canal padrão" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users__notify_info_channel_name msgid "Notify Info Channel Name" msgstr "Notificar o nome do canal de informações" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users__notify_success_channel_name msgid "Notify Success Channel Name" msgstr "Notificar o nome do canal de sucesso" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users__notify_warning_channel_name msgid "Notify Warning Channel Name" msgstr "Notificar o nome do canal de alerta" #. module: web_notify #. odoo-python #: code:addons/web_notify/models/res_users.py:0 #, python-format msgid "Sending a notification to another user is forbidden." msgstr "É proibido enviar uma notificação para outro usuário." #. module: web_notify #. odoo-python #: code:addons/web_notify/models/res_users.py:0 #, python-format msgid "Success" msgstr "Sucesso" #. module: web_notify #: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit msgid "Test danger notification" msgstr "Notificação de teste de perigo" #. module: web_notify #: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit msgid "Test default notification" msgstr "Notificação de Teste padrão" #. module: web_notify #: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit msgid "Test info notification" msgstr "Notificação de Teste informativo" #. module: web_notify #: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit msgid "Test success notification" msgstr "Notificação de Teste de sucesso" #. module: web_notify #: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit msgid "Test warning notification" msgstr "Notificação de Teste de alerta" #. module: web_notify #: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit msgid "Test web notify" msgstr "Notificação de Web Teste" #. module: web_notify #: model:ir.model,name:web_notify.model_res_users msgid "User" msgstr "Usuário" #. module: web_notify #. odoo-python #: code:addons/web_notify/models/res_users.py:0 #, python-format msgid "Warning" msgstr "Alerta" #~ msgid "Users" #~ msgstr "Usuários"
OCA/web/web_notify/i18n/pt_BR.po/0
{ "file_path": "OCA/web/web_notify/i18n/pt_BR.po", "repo_id": "OCA", "token_count": 1524 }
78
# Copyright 2016 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import json from odoo import exceptions from odoo.tests import common from ..models.res_users import DANGER, DEFAULT, INFO, SUCCESS, WARNING class TestResUsers(common.TransactionCase): def test_notify_success(self): bus_bus = self.env["bus.bus"] domain = [("channel", "=", self.env.user.notify_success_channel_name)] existing = bus_bus.search(domain) test_msg = {"message": "message", "title": "title", "sticky": True} self.env.user.notify_success(**test_msg) news = bus_bus.search(domain) - existing self.assertEqual(1, len(news)) test_msg.update({"type": SUCCESS}) payload = json.loads(news.message)["payload"][0] self.assertDictEqual(test_msg, payload) def test_notify_danger(self): bus_bus = self.env["bus.bus"] domain = [("channel", "=", self.env.user.notify_danger_channel_name)] existing = bus_bus.search(domain) test_msg = {"message": "message", "title": "title", "sticky": True} self.env.user.notify_danger(**test_msg) news = bus_bus.search(domain) - existing self.assertEqual(1, len(news)) test_msg.update({"type": DANGER}) payload = json.loads(news.message)["payload"][0] self.assertDictEqual(test_msg, payload) def test_notify_warning(self): bus_bus = self.env["bus.bus"] domain = [("channel", "=", self.env.user.notify_warning_channel_name)] existing = bus_bus.search(domain) test_msg = {"message": "message", "title": "title", "sticky": True} self.env.user.notify_warning(**test_msg) news = bus_bus.search(domain) - existing self.assertEqual(1, len(news)) test_msg.update({"type": WARNING}) payload = json.loads(news.message)["payload"][0] self.assertDictEqual(test_msg, payload) def test_notify_info(self): bus_bus = self.env["bus.bus"] domain = [("channel", "=", self.env.user.notify_info_channel_name)] existing = bus_bus.search(domain) test_msg = {"message": "message", "title": "title", "sticky": True} self.env.user.notify_info(**test_msg) news = bus_bus.search(domain) - existing self.assertEqual(1, len(news)) test_msg.update({"type": INFO}) payload = json.loads(news.message)["payload"][0] self.assertDictEqual(test_msg, payload) def test_notify_default(self): bus_bus = self.env["bus.bus"] domain = [("channel", "=", self.env.user.notify_default_channel_name)] existing = bus_bus.search(domain) test_msg = {"message": "message", "title": "title", "sticky": True} self.env.user.notify_default(**test_msg) news = bus_bus.search(domain) - existing self.assertEqual(1, len(news)) test_msg.update({"type": DEFAULT}) payload = json.loads(news.message)["payload"][0] self.assertDictEqual(test_msg, payload) def test_notify_many(self): # check that the notification of a list of users is done with # a single call to the bus users = self.env.user.search([(1, "=", 1)]) self.assertTrue(len(users) > 1) self.env.user.notify_warning(message="message", target=users.partner_id) def test_notify_other_user(self): other_user = self.env.ref("base.user_demo") other_user_model = self.env["res.users"].with_user(other_user) with self.assertRaises(exceptions.UserError): other_user_model.browse(self.env.uid).notify_info(message="hello") def test_notify_admin_allowed_other_user(self): other_user = self.env.ref("base.user_demo") other_user.notify_info(message="hello")
OCA/web/web_notify/tests/test_res_users.py/0
{ "file_path": "OCA/web/web_notify/tests/test_res_users.py", "repo_id": "OCA", "token_count": 1639 }
79
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). from odoo import api from odoo.tests import common class TestWebNotifyChannelMessage(common.TransactionCase): @classmethod def setUpClass(cls): super(TestWebNotifyChannelMessage, cls).setUpClass() cls.env.user = cls.env.ref("base.user_admin") cls.env = api.Environment(cls.cr, cls.env.user.id, {}) cls.env.user.tz = False # Make sure there's no timezone in user cls.user_internal = cls.env["res.users"].create( { "name": "Test Internal User", "login": "internal_user", "password": "internal_user", "email": "mark.brown23@example.com", } ) cls.channel = cls.env["mail.channel"].create( { "name": "Test channel", "channel_partner_ids": [ (4, cls.env.user.partner_id.id), (4, cls.user_internal.partner_id.id), ], } ) def test_01_post_message(self): initial_message = ( self.env["mail.channel"] .search([("name", "=", "Test channel")], limit=1) .message_ids ) self.assertEqual(len(initial_message), 0) self.channel.message_post( author_id=self.env.user.partner_id.id, body="Hello", message_type="notification", subtype_xmlid="mail.mt_comment", ) message = ( self.env["mail.channel"] .search([("name", "=", "Test channel")], limit=1) .message_ids[0] ) self.assertEqual(len(message), 1)
OCA/web/web_notify_channel_message/tests/test_notify_channel_message.py/0
{ "file_path": "OCA/web/web_notify_channel_message/tests/test_notify_channel_message.py", "repo_id": "OCA", "token_count": 920 }
80
<?xml version="1.0" encoding="UTF-8" ?> <templates xml:space="preserve"> <t t-name="web_pivot_computed_measure.ComputedMeasureOperations" owl="1"> <option name="sum" value="m1+m2"> Sum (m1 + m2) </option> <option name="sub" value="m1-m2"> Sub (m1 - m2) </option> <option name="mult" value="m1*m2"> Mult (m1 * m2) </option> <option name="div" data-format="float" value="m1/m2"> Div (m1 / m2) </option> <option name="perc" data-format="percentage" value="m1/m2"> Perc (m1 * 100 / m2) </option> <option t-if="debug" name="custom" value="custom"> Custom </option> </t> <t t-name="web_pivot_computed_measure.ComputedMeasureFormats" owl="1"> <option name="int" value="integer"> Integer </option> <option name="float" value="float" selected="selected"> Float </option> <option name="percentage" value="percentage"> Percentage </option> </t> <t t-name="web_pivot_computed_measure.DropdownItemCustomMeasure" owl="1"> <div class="o_menu_item dropdown-item" data-id="__computed__"> <a href="#" role="menuitem" t-on-click="onClickComputedMeasure"> Computed Measure <span class="o_submenu_switcher" data-id="__computed__"> <span t-att-class="isOpen.value ? 'fa fa-caret-down' : 'fa fa-caret-right'" /> </span> </a> <t t-if="isOpen.value"> <div id="add_computed_measure_wrapper" class="d-table"> <div class="d-table-row"> <div class="d-table-cell"> <label for="computed_measure_field_1">Measure 1</label> </div> <div class="d-table-cell"> <select class="o_input" id="computed_measure_field_1"> <t t-foreach="props.measures" t-as="measure" t-key="measure" > <option t-att-value="measure" t-if="measure != '__count'" > <t t-esc="props.measures[measure].string" /> </option> </t> </select> </div> </div> <div class="d-table-row"> <div class="d-table-cell"> <label for="computed_measure_field_2">Measure 2</label> </div> <div class="d-table-cell"> <select class="o_input" id="computed_measure_field_2"> <t t-foreach="props.measures" t-as="measure" t-key="measure" > <option t-att-value="measure" t-if="measure != '__count'" > <t t-esc="props.measures[measure].string" /> </option> </t> </select> </div> </div> <div class="d-table-row"> <div class="d-table-cell"> <label for="computed_measure_operation">Operation</label> </div> <div class="d-table-cell"> <select class="o_input" id="computed_measure_operation"> <t t-call="web_pivot_computed_measure.ComputedMeasureOperations" /> </select> </div> </div> <div t-if="debug" class="d-none" id="container_computed_measure_operation_custom" > <div class="d-table-cell"> <label for="computed_measure_operation_custom" >Formula</label> </div> <div class="d-table-cell"> <input type="text" class="o_input" id="computed_measure_operation_custom" /> </div> </div> <div class="d-table-row"> <div class="d-table-cell"> <label for="computed_measure_name">Name</label> </div> <div class="d-table-cell"> <input placeholder="Can be empty" type="text" class="o_input" id="computed_measure_name" /> </div> </div> <div class="d-table-row"> <div class="d-table-cell"> <label for="computed_measure_format">Format</label> </div> <div class="d-table-cell"> <select class="o_input" id="computed_measure_format"> <t t-call="web_pivot_computed_measure.ComputedMeasureFormats" /> </select> </div> </div> <div class="d-table-row"> <div class="d-table-cell"> <button class="btn btn-primary o_add_computed_measure" type="button" t-on-click="addMeasure" >Add</button> </div> </div> </div> </t> </div> </t> </templates>
OCA/web/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml/0
{ "file_path": "OCA/web/web_pivot_computed_measure/static/src/dropdown_item_custom_measure/dropdown_item_custom_measure.xml", "repo_id": "OCA", "token_count": 4725 }
81
# Copyright 2021 Tecnativa - Alexandre D. Díaz # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). from odoo.http import request, route from .main import PWA class ServiceWorker(PWA): JS_PWA_CORE_EVENT_INSTALL = """ self.addEventListener('install', evt => {{ console.log('[ServiceWorker] Installing...'); {} }}); """ JS_PWA_CORE_EVENT_FETCH = """ self.addEventListener('fetch', evt => {{ {} }}); """ JS_PWA_CORE_EVENT_ACTIVATE = """ self.addEventListener('activate', evt => {{ {} }}); """ JS_PWA_MAIN = """ self.importScripts(...{pwa_scripts}); odoo.define("web_pwa_oca.ServiceWorker", function (require) {{ "use strict"; {pwa_requires} {pwa_init} {pwa_core_event_install} {pwa_core_event_activate} {pwa_core_event_fetch} }}); """ def _get_js_pwa_requires(self): return """ const PWA = require('web_pwa_oca.PWA'); """ def _get_js_pwa_init(self): return """ let promise_start = Promise.resolve(); if (typeof self.oca_pwa === "undefined") {{ self.oca_pwa = new PWA({}); promise_start = self.oca_pwa.start(); if (self.serviceWorker.state === "activated") {{ promise_start = promise_start.then( () => self.oca_pwa.activateWorker(true)); }} }} """.format( self._get_pwa_params() ) def _get_js_pwa_core_event_install_impl(self): return """ evt.waitUntil(oca_pwa.installWorker()); self.skipWaiting(); """ def _get_js_pwa_core_event_activate_impl(self): return """ console.log('[ServiceWorker] Activating...'); evt.waitUntil(oca_pwa.activateWorker()); self.clients.claim(); """ def _get_js_pwa_core_event_fetch_impl(self): return "" @route("/service-worker.js", type="http", auth="public") def render_service_worker(self): """Route to register the service worker in the 'main' scope ('/')""" sw_code = self.JS_PWA_MAIN.format( **{ "pwa_scripts": self._get_pwa_scripts(), "pwa_requires": self._get_js_pwa_requires(), "pwa_init": self._get_js_pwa_init(), "pwa_core_event_install": self.JS_PWA_CORE_EVENT_INSTALL.format( self._get_js_pwa_core_event_install_impl() ), "pwa_core_event_activate": self.JS_PWA_CORE_EVENT_ACTIVATE.format( self._get_js_pwa_core_event_activate_impl() ), "pwa_core_event_fetch": self.JS_PWA_CORE_EVENT_FETCH.format( self._get_js_pwa_core_event_fetch_impl() ), } ) return request.make_response( sw_code, [ ("Content-Type", "text/javascript;charset=utf-8"), ("Content-Length", len(sw_code)), ], )
OCA/web/web_pwa_oca/controllers/service_worker.py/0
{ "file_path": "OCA/web/web_pwa_oca/controllers/service_worker.py", "repo_id": "OCA", "token_count": 1741 }
82