text stringlengths 1 2.83M | id stringlengths 16 152 | metadata dict | __index_level_0__ int64 0 949 |
|---|---|---|---|
<?php
$html.=<<<A
<p class=nabname>
here is a secret box!<br />
admin/admin<br />
kobe/123456<br />
</p>
A;
?> | zhuifengshaonianhanlu/pikachu/vul/fileinclude/include/file6.php/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/vul/fileinclude/include/file6.php",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 55
} | 850 |
<?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 = "rce_evel.php"){
$ACTIVE = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','active open','','','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
}
$PIKA_ROOT_DIR = "../../";
include_once $PIKA_ROOT_DIR . 'header.php';
$html='';
if(isset($_POST['submit']) && $_POST['txt'] != null){
if(@!eval($_POST['txt'])){
$html.="<p>你喜欢的字符还挺奇怪的!</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="rce.php">rce</a>
</li>
<li class="active">exec "eval"</li>
</ul><!-- /.breadcrumb -->
<a href="#" style="float:right" data-container="body" data-toggle="popover" data-placement="bottom" title="tips(再点一下关闭)"
data-content="后台不会使用了eval()吧....">
点一下提示~
</a>
</div>
<div class="page-content">
<div id="comm_main">
<p class="comm_title">Here, 请提交一个你喜欢的字符串:</p>
<form method="post">
<input class="ipadd" type="text" name="txt" />
<input class="sub" type="submit" name="submit" value="提交" />
</form>
</div>
<?php echo $html;?>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<?php
include_once $PIKA_ROOT_DIR . 'footer.php';
?>
| zhuifengshaonianhanlu/pikachu/vul/rce/rce_eval.php/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/vul/rce/rce_eval.php",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 1100
} | 851 |
<?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_02.php"){
$ACTIVE = array('','','','','','','','active open','','','','','','','','active','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
}
$PIKA_ROOT_DIR = "../../";
include_once $PIKA_ROOT_DIR.'header.php';
$html='';
$html1='';
$html2='';
if(isset($_GET['submit'])){
if(empty($_GET['message'])){
$html.="<p class='notice'>输入点啥吧!</p>";
}else {
//使用了htmlspecialchars进行处理,是不是就没问题了呢,htmlspecialchars默认不对'处理
$message=htmlspecialchars($_GET['message']);
$html1.="<p class='notice'>你的输入已经被记录:</p>";
//输入的内容被处理后输出到了input标签的value属性里面,试试:' onclick='alert(111)'
// $html2.="<input class='input' type='text' name='inputvalue' readonly='readonly' value='{$message}' style='margin-left:120px;display:block;background-color:#c0c0c0;border-style:none;'/>";
$html2.="<a href='{$message}'>{$message}</a>";
}
}
?>
<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之htmlspecialchars</li>
</ul><!-- /.breadcrumb -->
<a href="#" style="float:right" data-container="body" data-toggle="popover" data-placement="bottom" title="tips(再点一下关闭)"
data-content="先去查一下htmlspecialchars这个方法的含义">
点一下提示~
</a>
</div>
<div class="page-content">
<div id="xssr_main">
<p class="xssr_title">人生之所有苦短,是因为你的xss学习的还不够好</p>
<form method="get">
<input class="xssr_in" type="text" name="message" />
<input class="xssr_submit" type="submit" name="submit" value="submit" />
</form>
<?php
echo $html;
echo $html1;
echo $html2;
?>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<?php
include_once $PIKA_ROOT_DIR.'footer.php';
?>
| zhuifengshaonianhanlu/pikachu/vul/xss/xss_02.php/0 | {
"file_path": "zhuifengshaonianhanlu/pikachu/vul/xss/xss_02.php",
"repo_id": "zhuifengshaonianhanlu",
"token_count": 1496
} | 852 |
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>8th Wall Alpha Video Example</title>
<script src="//cdn.8thwall.com/web/aframe/8frame-1.3.0.min.js"></script>
<!-- https://github.com/nikolaiwarner/aframe-chromakey-material/blob/master/README.md -->
<script src="//unpkg.com/aframe-chromakey-material@1.1.4/dist/aframe-chromakey-material.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>
<!-- Landing Pages - see https://www.8thwall.com/docs/web/#landing-pages -->
<script src='//cdn.8thwall.com/web/landing-page/landing-page.js'></script>
<!-- 8thWall Web - Replace the app key here with your own app key -->
<script async src="//apps.8thwall.com/xrweb?appKey=XXXXX"></script>
<script src="target-video.js">
</script>
</head>
<body>
<a-scene
xrextras-gesture-detector
landing-page
xrextras-loading
xrextras-runtime-error
xrweb="disableWorldTracking: true; allowedDevices: any">
<a-assets>
<video
id="alpha-video"
muted
autoplay
playsinline
crossorigin="anonymous"
loop="true"
src="https://cdn.8thwall.com/web/assets/video/alpaca.mp4">
</video>
</a-assets>
<a-camera
position="0 4 10"
raycaster="objects: .cantap"
cursor="fuse: false; rayOrigin: mouse;">
</a-camera>
<a-light type="directional" intensity="0.5" position="1 1 1"></a-light>
<a-light type="ambient" intensity="1"></a-light>
<!-- Note: "name:" must be set to the name of the image target uploaded to the 8th Wall Console -->
<a-entity
target-video="name: outside; video: #alpha-video;"
material="shader: chromakey; src: #alpha-video; color: 0.1 0.9 0.2"
geometry="primitive: plane; height: 0.6; width: 1.38;">
</a-entity>
</a-scene>
</body>
</html>
| 8thwall/web/examples/aframe/alpha-video/index.html/0 | {
"file_path": "8thwall/web/examples/aframe/alpha-video/index.html",
"repo_id": "8thwall",
"token_count": 871
} | 0 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>8th Wall Web: Manipulate</title>
<!-- We've included a slightly modified version of A-Frame, which fixes some polish concerns -->
<script src="//cdn.8thwall.com/web/aframe/8frame-1.3.0.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>
<!-- Landing Pages - see https://www.8thwall.com/docs/web/#landing-pages -->
<script src='//cdn.8thwall.com/web/landing-page/landing-page.js'></script>
<!-- 8thWall Web - Replace the app key here with your own app key -->
<script async src="//apps.8thwall.com/xrweb?appKey=XXXXX"></script>
</head>
<body>
<a-scene
xrextras-gesture-detector
landing-page
xrextras-loading
xrextras-runtime-error
renderer="colorManagement: true"
xrweb="allowedDevices: any">
<!-- We can define assets here to be loaded when A-Frame initializes -->
<a-assets>
<!-- Credit to Poly by Google for the model: https://poly.google.com/view/5ZMAz7_ucTn -->
<a-asset-item id="sandCastleModel" src="sand-castle.glb"></a-asset-item>
</a-assets>
<!-- The raycaster will emit mouse events on scene objects specified with the cantap class -->
<a-camera
id="camera"
position="0 8 8"
raycaster="objects: .cantap"
cursor="fuse: false; rayOrigin: mouse;">
</a-camera>
<a-entity
light="
type: directional;
intensity: 0.8;
castShadow: true;
shadowMapHeight:2048;
shadowMapWidth:2048;
shadowCameraTop: 10;
target: #model;"
xrextras-attach="target: model; offset: 1 15 3;"
shadow>
</a-entity>
<a-light type="ambient" intensity="0.7"></a-light>
<a-entity
id="model"
gltf-model="#sandCastleModel"
class="cantap"
xrextras-hold-drag
xrextras-two-finger-rotate
xrextras-pinch-scale
scale="3 3 3"
shadow="receive: false">
</a-entity>
<a-plane
id="ground"
rotation="-90 0 0"
width="1000"
height="1000"
material="shader: shadow"
shadow>
</a-plane>
</a-scene>
</body>
</html>
| 8thwall/web/examples/aframe/manipulate/index.html/0 | {
"file_path": "8thwall/web/examples/aframe/manipulate/index.html",
"repo_id": "8thwall",
"token_count": 1097
} | 1 |
// A React component for 8th Wall AFrame scenes. The scene HTML can be supplied, along with
// any components or primitives that should be registered, and any image targets that should be
// loaded if something other than the automatically loaded set is wanted. Passing
// DISABLE_IMAGE_TARGETS will prevent any image targets from loading, including ones that would
// otherwise enabled automatically.
// Helper function to make sure that aframe components are only registered once, since they can't
// be cleanly unregistered.
import {useEffect} from 'react'
const registeredComponents = new Set()
const registerComponents = components => components.forEach(({name, val}) => {
if (registeredComponents.has(name)) {
return
}
registeredComponents.add(name)
window.AFRAME.registerComponent(name, val)
})
// Helper function to make sure that aframe systems are only registered once, since they can't
// be cleanly unregistered.
const registeredSystems = new Set()
const registerSystems = systems => systems.forEach(({name, val}) => {
if (registeredSystems.has(name)) {
return
}
registeredSystems.add(name)
window.AFRAME.registerSystem(name, val)
})
// Helper function to make sure that aframe primitives are only registered once, since they can't
// be cleanly unregistered.
const registeredPrimitives = new Set()
const registerPrimitives = primitives => primitives.forEach(({name, val}) => {
if (registeredPrimitives.has(name)) {
return
}
registeredPrimitives.add(name)
window.AFRAME.registerPrimitive(name, val)
})
// A react component for loading and unloading an aframe scene. The initial scene contents should
// be specified as an html string in sceneHtml. All props must be specified when the component
// mounts. Updates to props will be ignored.
//
// Optionally, aframe coponents to register for this scene can be passed as [{name, val}] arrays.
// Care is needed here to not define the same component different across scenes, since aframe
// components can't be unloaded.
//
// Optionally imageTargets can be specified to override the set loaded by default.
function AFrameScene({sceneHtml, imageTargets, components, systems, primitives}) {
useEffect(() => {
if (imageTargets) {
window.XR8.XrController.configure({imageTargets})
}
if (components) {
registerComponents(components)
}
if (systems) {
registerSystems(systems)
}
if (primitives) {
registerPrimitives(primitives)
}
const html = document.getElementsByTagName('html')[0]
const origHtmlClass = html.className
document.body.insertAdjacentHTML('beforeend', sceneHtml)
// Cleanup
return () => {
const ascene = document.getElementsByTagName('a-scene')[0]
ascene.parentNode.removeChild(ascene)
html.className = origHtmlClass
}
// eslint-disable-next-line
}, [])
return null
}
const DISABLE_IMAGE_TARGETS = []
export {AFrameScene, DISABLE_IMAGE_TARGETS}
| 8thwall/web/examples/aframe/reactapp/src/lib/aframe-components.js/0 | {
"file_path": "8thwall/web/examples/aframe/reactapp/src/lib/aframe-components.js",
"repo_id": "8thwall",
"token_count": 892
} | 2 |
html, body {
-webkit-tap-highlight-color: rgba(0,0,0,0);
overflow: hidden;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#renderCanvas {
width: 100%;
height: 100%;
touch-action: none;
}
| 8thwall/web/examples/babylonjs/placeground/index.css/0 | {
"file_path": "8thwall/web/examples/babylonjs/placeground/index.css",
"repo_id": "8thwall",
"token_count": 89
} | 3 |
/*
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 BitMatrixParser(bitMatrix)
{
var dimension = bitMatrix.Dimension;
if (dimension < 21 || (dimension & 0x03) != 1)
{
throw "Error BitMatrixParser";
}
this.bitMatrix = bitMatrix;
this.parsedVersion = null;
this.parsedFormatInfo = null;
this.copyBit=function( i, j, versionBits)
{
return this.bitMatrix.get_Renamed(i, j)?(versionBits << 1) | 0x1:versionBits << 1;
}
this.readFormatInformation=function()
{
if (this.parsedFormatInfo != null)
{
return this.parsedFormatInfo;
}
// Read top-left format info bits
var formatInfoBits = 0;
for (var i = 0; i < 6; i++)
{
formatInfoBits = this.copyBit(i, 8, formatInfoBits);
}
// .. and skip a bit in the timing pattern ...
formatInfoBits = this.copyBit(7, 8, formatInfoBits);
formatInfoBits = this.copyBit(8, 8, formatInfoBits);
formatInfoBits = this.copyBit(8, 7, formatInfoBits);
// .. and skip a bit in the timing pattern ...
for (var j = 5; j >= 0; j--)
{
formatInfoBits = this.copyBit(8, j, formatInfoBits);
}
this.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);
if (this.parsedFormatInfo != null)
{
return this.parsedFormatInfo;
}
// Hmm, failed. Try the top-right/bottom-left pattern
var dimension = this.bitMatrix.Dimension;
formatInfoBits = 0;
var iMin = dimension - 8;
for (var i = dimension - 1; i >= iMin; i--)
{
formatInfoBits = this.copyBit(i, 8, formatInfoBits);
}
for (var j = dimension - 7; j < dimension; j++)
{
formatInfoBits = this.copyBit(8, j, formatInfoBits);
}
this.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);
if (this.parsedFormatInfo != null)
{
return this.parsedFormatInfo;
}
throw "Error readFormatInformation";
}
this.readVersion=function()
{
if (this.parsedVersion != null)
{
return this.parsedVersion;
}
var dimension = this.bitMatrix.Dimension;
var provisionalVersion = (dimension - 17) >> 2;
if (provisionalVersion <= 6)
{
return Version.getVersionForNumber(provisionalVersion);
}
// Read top-right version info: 3 wide by 6 tall
var versionBits = 0;
var ijMin = dimension - 11;
for (var j = 5; j >= 0; j--)
{
for (var i = dimension - 9; i >= ijMin; i--)
{
versionBits = this.copyBit(i, j, versionBits);
}
}
this.parsedVersion = Version.decodeVersionInformation(versionBits);
if (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)
{
return this.parsedVersion;
}
// Hmm, failed. Try bottom left: 6 wide by 3 tall
versionBits = 0;
for (var i = 5; i >= 0; i--)
{
for (var j = dimension - 9; j >= ijMin; j--)
{
versionBits = this.copyBit(i, j, versionBits);
}
}
this.parsedVersion = Version.decodeVersionInformation(versionBits);
if (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)
{
return this.parsedVersion;
}
throw "Error readVersion";
}
this.readCodewords=function()
{
var formatInfo = this.readFormatInformation();
var version = this.readVersion();
// Get the data mask for the format used in this QR Code. This will exclude
// some bits from reading as we wind through the bit matrix.
var dataMask = DataMask.forReference( formatInfo.DataMask);
var dimension = this.bitMatrix.Dimension;
dataMask.unmaskBitMatrix(this.bitMatrix, dimension);
var functionPattern = version.buildFunctionPattern();
var readingUp = true;
var result = new Array(version.TotalCodewords);
var resultOffset = 0;
var currentByte = 0;
var bitsRead = 0;
// Read columns in pairs, from right to left
for (var j = dimension - 1; j > 0; j -= 2)
{
if (j == 6)
{
// Skip whole column with vertical alignment pattern;
// saves time and makes the other code proceed more cleanly
j--;
}
// Read alternatingly from bottom to top then top to bottom
for (var count = 0; count < dimension; count++)
{
var i = readingUp?dimension - 1 - count:count;
for (var col = 0; col < 2; col++)
{
// Ignore bits covered by the function pattern
if (!functionPattern.get_Renamed(j - col, i))
{
// Read a bit
bitsRead++;
currentByte <<= 1;
if (this.bitMatrix.get_Renamed(j - col, i))
{
currentByte |= 1;
}
// If we've made a whole byte, save it off
if (bitsRead == 8)
{
result[resultOffset++] = currentByte;
bitsRead = 0;
currentByte = 0;
}
}
}
}
readingUp ^= true; // readingUp = !readingUp; // switch directions
}
if (resultOffset != version.TotalCodewords)
{
throw "Error readCodewords";
}
return result;
}
} | 8thwall/web/examples/camerapipeline/qrcode/jsqrcode/src/bmparser.js/0 | {
"file_path": "8thwall/web/examples/camerapipeline/qrcode/jsqrcode/src/bmparser.js",
"repo_id": "8thwall",
"token_count": 2267
} | 4 |
div.nextbutton {
z-index: 10;
width: 33%;
height: 10%;
position: absolute;
top: 10px;
left: 10px;
background-color: #7611B7;
text-align: center;
color: #FFFFFF;
vertical-align: middle;
user-select: none;
visibility: hidden;
}
| 8thwall/web/examples/camerapipeline/simpleshaders/index.css/0 | {
"file_path": "8thwall/web/examples/camerapipeline/simpleshaders/index.css",
"repo_id": "8thwall",
"token_count": 98
} | 5 |
/* eslint-disable no-undef */
// Copyright (c) 2022 8th Wall, Inc.
const onxrloaded = () => {
const purple = 0xAD50FF
const cherry = 0xDD0065
const mint = 0x00EDAF
const canary = 0xFCEE21
// To illustrate how to integrate render updates with the camera run loop, we drive a cone in
// a circle every three seconds.
let animateCone
const startTime = Date.now()
const coneLoopMillis = 3000
// Populates some object into an XR scene and sets the initial camera position. The scene and
// camera come from xr3js, and are only available in the camera loop lifecycle onStart() or later.
const initXrScene = ({scene, camera}) => {
// Add a grid of purple spheres to the scene. Objects in the scene at height/ y=0 will appear to
// stick to physical surfaces.
for (let i = -5; i <=5 ; i += .5) {
for (let j = -5; j <= 5; j += .5) {
if (Math.round(i) != i && Math.round(j) != j) { continue }
const sphere = new THREE.Mesh(
new THREE.SphereGeometry(.03, 8, 8), new THREE.MeshBasicMaterial({color: purple}))
sphere.position.set(i, 0, j)
scene.add(sphere)
}
}
// Add one cone in each cardinal direction, and three ahead. Objects in the scene at height
// y=0 will appear to stick to physical surfaces.
const cones = [
{c: canary, p: [ 5, .5, 0]}, {c: mint, p: [-5, .5, 0]}, {c: cherry, p: [ 0, .5, 5]},
{c: cherry, p: [ 0, .5, -5]}, {c: canary, p: [-1, .5, -5]}, {c: mint, p: [ 1, .5, -5]}
]
const shape = new THREE.ConeGeometry( 0.25, 1, 8 )
cones.forEach(({c, p}) => {
const cone = new THREE.Mesh(shape, new THREE.MeshBasicMaterial({color: c}))
cone.position.set(...p)
if (p[0] == 0 && p[2] == -5) { animateCone = cone } // save one cone for animation.
scene.add(cone)
})
// Set the initial camera position relative to the scene we just laid out. This must be at a
// height greater than y=0.
camera.position.set(0, 3, 0)
}
XR8.addCameraPipelineModules([ // Add camera pipeline modules.
// Existing pipeline modules.
XR8.GlTextureRenderer.pipelineModule(), // Draws the camera feed.
XR8.Threejs.pipelineModule(), // Creates a ThreeJS AR Scene.
XR8.XrController.pipelineModule(), // Enables SLAM tracking.
window.LandingPage.pipelineModule(), // Detects unsupported browsers and gives hints.
XRExtras.FullWindowCanvas.pipelineModule(), // Modifies the canvas to fill the window.
XRExtras.Loading.pipelineModule(), // Manages the loading screen on startup.
XRExtras.RuntimeError.pipelineModule(), // Shows an error image on runtime error.
])
// Add custom logic to the camera loop. This is done with camera pipeline modules that provide
// logic for key lifecycle moments for processing each camera frame. In this case, we'll be
// adding onStart logic for scene initialization, and onUpdate logic for scene updates.
XR8.addCameraPipelineModule({
// Camera pipeline modules need a name. It can be whatever you want but must be unique within
// your app.
name: 'myawesomeapp',
// onStart is called once when the camera feed begins. In this case, we need to wait for the
// XR8.Threejs scene to be ready before we can access it to add content. It was created in
// XR8.Threejs.pipelineModule()'s onStart method.
onStart: ({canvasWidth, canvasHeight}) => {
// Get the 3js sceen from xr3js.
const {scene, camera} = XR8.Threejs.xrScene()
// Add some objects to the scene and set the starting camera position.
initXrScene({scene, camera})
// Sync the xr controller's 6DoF position and camera paremeters with our scene.
XR8.XrController.updateCameraProjectionMatrix({
origin: camera.position,
facing: camera.quaternion,
})
},
// onUpdate is called once per camera loop prior to render. Any 3js geometry scene
// would typically happen here.
onUpdate: () => {
// Update the position of the animating cone at a constant angular velocity.
const coneTheta = ((Date.now() - startTime) % coneLoopMillis) * 2 * Math.PI / coneLoopMillis
animateCone.position.set(Math.sin(coneTheta) * 1.5, .5, -Math.cos(coneTheta) * 1.5 - 3.5)
},
})
const canvas = document.getElementById('camerafeed')
// Call XrController.recenter() when the canvas is tapped. This resets the ar camera
// to the position specified by XrController.updateCameraProjectionMatrix() above.
canvas.addEventListener('touchstart', () => { XR8.XrController.recenter() })
// Open the camera and start running the camera run loop.
XR8.run({canvas})
}
// Show loading screen before the full XR library has been loaded.
window.onload = () => { XRExtras.Loading.showLoading({onxrloaded}) }
| 8thwall/web/gettingstarted/threejs/index.js/0 | {
"file_path": "8thwall/web/gettingstarted/threejs/index.js",
"repo_id": "8thwall",
"token_count": 1721
} | 6 |
# A-Frame XRExtras Library
The XRExtras library contains various A-Frame components and primitives to quickly add common behaviors and interactions to your 8th Wall experience.
## A-Frame Components
- `xrextras-almost-there`
- `xrextras-loading`
- `xrextras-runtime-error`
- `xrextras-stats`
- `xrextras-tap-recenter`
- `xrextras-generate-image-targets`
- `xrextras-gesture-detector`
- `xrextras-one-finger-rotate`
- `xrextras-two-finger-rotate`
- `xrextras-pinch-scale`
- `xrextras-hold-drag`
- `xrextras-attach`
- `xrextras-play-video`
- `xrextras-log-to-screen`
- `xrextras-pwa-installer`
- `xrextras-pause-on-blur`
- `xrextras-pause-on-hidden`
- `xrextras-hide-camera-feed`
- `xrextras-hider-material`
- `xrextras-spin`
## A-Frame Primitives
- `<xrextras-faceanchor>`
- `<xrextras-resource>`
- `<xrextras-pbr-material>`
- `<xrextras-basic-material>`
- `<xrextras-video-material>`
- `<xrextras-face-mesh>`
- `<xrextras-face-attachment>`
- `<xrextras-capture-button>`
- `<xrextras-capture-preview>`
- `<xrextras-capture-config>`
- `<xrextras-curved-target-container>`
- `<xrextras-named-image-target>`
- `<xrextras-target-mesh>`
- `<xrextras-target-video-fade>`
- `<xrextras-target-video-sound>`
- `<xrextras-opaque-background>`
## Components
### `xrextras-almost-there`
Detects incompatible browsers and guides the user to either refresh the page to accept permissions or to open the experience in a compatible browser. This component is succeeded by `xrextras-loading`.
**Properties**
| Property | Type | Default | Description |
|----------|--------|---------|--------------------------------|
| url | string | "" | Used for the QR code and link out button. |
### `xrextras-loading`
Displays almost there flows and a loading screen until scene assets are loaded.
**Properties (all optional)**
| Property | Type | Default | Description |
|-----------------------|--------|---------|--------------------------------------------------------------------|
| loadBackgroundColor | string | "" | Background hex color of the loading screen's lower section. |
| cameraBackgroundColor | string | "" | Background hex color of the loading screen's top section. |
| loadImage | string | "" | The HTML Element ID of an image. The image needs to be an `<a-asset>`. Ex: `#load` |
| loadAnimation | string | "spin" | Animation style of `loadImage`. Choose from `spin`, `pulse`, `scale`, or `none`. |
### `xrextras-runtime-error`
Catches runtime errors and displays a "something went wrong" screen.
**Properties**
None.
### `xrextras-stats`
Displays statistics on framerate, memory, and rendering.
**Properties**
| Property | Type | Default | Description |
|----------|------|---------|--------------------------------|
| version | bool | true | Display the 8th Wall engine version. |
### `xrextras-tap-recenter`
Recenter the scene when the
screen is tapped.
**Properties**
None.
### `xrextras-generate-image-targets`
Materialize A-Frame primitives into the scene at detected image locations. Entities will have the following attributes set:
- Name: The name of the image target.
- Rotated: Whether the image targets are stored rotated.
- Metadata: Metadata of image target supplied in the 8th Wall console.
**Properties**
| Property | Type | Default | Description |
|------------|--------|---------|---------------------------------------------------|
| primitive | string | "" | Use this primitive to populate multiple image targets. |
### `xrextras-gesture-detector`
Component that detects and emits events for touch gestures. Required on the `<a-scene>` for xrextras gesture components to function correctly.
**Properties**
| Property | Type | Default | Description |
|----------|--------|---------|---------------------------------------------------|
| element | string | "" | The element touch event listeners are added to. |
### `xrextras-one-finger-rotate`
Rotate an entity on the Y axis with a one finger swipe.
**Properties**
| Property | Type | Default | Description |
|----------|--------|---------|-----------------------------------------------------------------|
| Factor | number | 6 | Increase this number to spin more given the same drag distance. |
### `xrextras-two-finger-rotate`
Rotate an entity on the Y axis with a two finger swipe.
**Properties**
| Property | Type | Default | Description |
|----------|--------|---------|-----------------------------------------------------------------|
| Factor | number | 5 | Increase this number to spin more given the same drag distance. |
### `xrextras-pinch-scale`
Scales an entity based on two touch inputs.
**Properties (all optional)**
| Property | Type | Default | Description |
|----------|--------|---------|----------------------------------------------------|
| min | number | 0.33 | The smallest scale user can pinch to. |
| max | number | 3 | The largest scale user can pinch to. |
| scale | number | 0 | Set the initial scale. If set to 0, the object's initial scale is used. |
### `xrextras-hold-drag`
Lift up and drag an entity on one finger down/move. The entity must be set up to receive raycasts.
**Properties (all optional)**
| Property | Type | Default | Description |
|-------------|--------|---------|-------------------------------------------------------------|
| cameraId | string | "camera"| The id of the `<a-camera>`. |
| groundId | string | "ground"| The id of the ground `<a-entity>`. |
| dragDelay | number | 300 | The time required for the user's finger to be down before lifting the object. |
| riseHeight | number | 1 | How high the object is lifted on the y-axis. |
### `xrextras-attach`
Attaches an entity to another entity, so that it will always follow the target entity's position.
**Properties**
| Property | Type | Default | Description |
|----------|--------|---------|---------------------------------------|
| target | string | "" | The ID of the `<a-entity>` element to copy position from. |
| offset | string | "0 0 0" | The relative offset from the target element. |
### `xrextras-play-video`
Displays a thumbnail image and waits for the user tap to begin playback (for videos with sound).
**Properties**
| Property | Type
| Default | Description |
|-------------|--------|---------|-------------------------------------------------|
| video | string | "" | The id of the `<video>` element. |
| thumb | string | "" | The id of the `<img>` element to serve as a thumbnail. |
| canstop | bool | null | Whether the video can be paused on tap. |
### `xrextras-log-to-screen`
Log console messages over the scene.
**Properties**
None.
### `xrextras-pwa-installer`
Displays a PWA install prompt over the scene. See pwainstallermodule for more information.
**Properties**
| Property | Type | Default | Description |
|------------------------|--------|----------------------------|------------------------------------------------------------|
| name | string | On an 8th Wall hosted app, the default is the PWA Name value specified in the settings. On a self-hosted app, the default is null. | The name of the PWA that will appear on the install prompt. |
| iconSrc | string | On an 8th Wall hosted app, the default is the PWA Name value specified in the settings. On a self-hosted app, the default is null. | The name of the PWA that will appear on the install prompt. |
| installTitle | string | "Add to your home screen" | The title to display on the install prompt. This text will appear bolded. |
| installSubtitle | string | "for easy access." | The subtitle to display under the title on the install prompt. |
| installButtonText | string | "Install" | The text on the install button. This text will only be visible on browsers which support the beforeinstallprompt window event. |
| iosInstallText | string | "Tap $ACTION_ICON and then 'Add to Homescreen'" | The text that appears on iOS Safari instructing users how to add the web app to their home screen. The macro, "$ACTION_ICON", will be replaced by an inline SVG which matches the appearance of the iOS action icon. |
| delayAfterDismissalMillis | int | 90 days (in milliseconds) | The amount of time, in milliseconds, that should pass before attempting to display the install prompt to the user after they have previously dismissed it. |
| minNumVisits | int | 2 | The minimum number of times a user must visit the web app before attempting to display the install prompt. |
### `xrextras-pause-on-blur`
Pauses the scene on window blur and resumes on window focus.
**Properties**
None.
### `xrextras-pause-on-hidden`
Pauses and resumes the scene on document visibility change.
**Properties**
None.
### `xrextras-hide-camera-feed`
Draw a solid color instead of drawing the camera feed.
**Properties**
| Property | Type | Default | Description |
|----------|--------|-----------|----------------|
| color | string | "#2D2E43" | Background color. |
### `xrextras-hider-material`
Applies an occluder material to a mesh or primitive. The mesh or primitive appears transparent and blocks rendering behind it.
**Properties**
None.
### `xrextras-spin`
Rotates an object around its y-axis.
**Properties**
| Property | Type | Default | Description |
|----------|------|---------|--------------------------------------------------------------|
| speed | int | 2000 | The speed of one full spin in milliseconds. |
| direction| string| "normal"| Direction of spin. Options include normal, reverse, and alternate. |
## Primitives
### `<xrextras-opaque-background>`
Show or hide children elements if the user has an opaque background session.
**Attributes**
| Attribute | Type | Default | Description |
|-----------|-------|---------|------------------------------------------------------|
| remove | bool | false | Only render children elements on AR-capable devices, such as mobile devices and headsets. |
### `<xrextras-named-image-target>`
Tracks an image target. Children elements inherit transforms from the tracked target.
**Attributes**
| Attribute | Type | Default | Description |
|-----------|--------|---------|----------------------------------------------------------------------------|
| name | string | "" | The name of the image target as it appears on the "Image Targets" page in an 8th Wall project. |
### `<xrextras-faceanchor>`
Inherits the detected face transforms. Entities inside will move with the face. Use the face-id property when xrface maxDetections > 1 to define different face scenes.
**Attributes**
| Attribute | Type | Default | Description |
|-----------|------|---------|--------------------------------------------------------------------------|
| face-id | int | 0 | Attaches the children to the corresponding face id. If not specified, multiple faces will |
### `<xrextras-resource>`
Resource referenced by either xrextras-pbr-material or xrextras-basic-material.
**Attributes**
| Attribute | Type | Default | Description |
|-----------|--------|---------|-------------------------------|
| src | string | "" | The file path. |
### `<xrextras-pbr-material>`
Used to construct a PBR material.
**Attributes**
| Attribute | Type | Default | Description |
|-----------|--------|---------|-----------------------|
| tex | string | "" | Color map. |
| metalness | string | "" | Metalness map. |
| normals | string | "" | Normal map. |
| roughness | string | "" | Roughness map. |
| alpha | string | "" | Alpha map. Activates when opacity is set < 1.0. |
| opacity | number | 1.0 | Overall opacity of material. |
### `<xrextras-basic-material>`
Used to construct a flat material.
**Attributes**
| Attribute | Type | Default | Description |
|-----------|--------|---------|-----------------------|
| tex | string | "" | Color map. |
| alpha | string | "" | Alpha map. Activates when opacity is set < 1.0. |
| opacity | number | 1.0 | Overall opacity of material. |
### `<xrextras-video-material>`
Used to construct a flat video material.
**Attributes**
| Attribute | Type | Default | Description |
|-----------|--------|---------|-----------------------|
| video | string | "" | <video> src id |
| alpha | string | "" | Alpha map. Activates when opacity is set < 1.0. |
| autoplay | bool | true | Autoplay on scene load. If true, <video> must have the muted attribute. |
| opacity | number | 1.0 | Overall opacity of material. |
### `<xrextras-face-mesh>`
Generates a face mesh in your scene.
**Attributes**
| Attribute | Type | Default | Description |
|-----------------|--------|---------|------------------------------------------|
| material-resource | string | "" | HTML Element ID of the xrextras material. |
| material | - | - | Use this instead to set custom shaders or A-Frame material properties. |
### `<xrextras-face-attachment>`
Inherits the detected attachment point transforms. Entities inside will move with the assigned attachment point.
**Attributes**
| Attribute | Type | Default | Description |
|-----------|--------|-----------|------------------|
| point | string | "forehead" | Name of attachment point |
### `<xrextras-capture-button>`
Adds a capture button to the scene.
**Attributes**
| Attribute | Type | Default | Description |
|---------------|--------|-----------|-----------------|
| capture-mode | string | "standard" | Sets the capture mode behavior. Possible values include standard: tap to take photo and tap + hold to record video, fixed: tap to toggle video recording, or photo: tap to take photo. |
### `<xrextras-capture-preview>`
Adds a media preview interface to the scene which allows for viewing, saving, and sharing captured media.
**Attributes**
| Attribute | Type | Default | Description |
|-----------------------|--------|---------|-----------------|
| action-button-share-text | string | "Share" | Sets the text string in the action button when Web Share API 2 is available (iOS 14, Android). |
| action-button-view-text | string | "View" | Sets the text string in the action button when Web Share API 2 is not available in iOS (iOS 13). |
### `<xrextras-capture-config>`
Configures the captured media.
**Attributes**
| Attribute | Type | Default | Description |
|--------------------|--------|---------|-----------------|
| max-duration-ms | int | 15000 | Total video duration (in milliseconds) that the capture button allows. If the end card is disabled, this corresponds to max user record time. |
| max-dimension | int | 1280 | Maximum record dimension for both width and height. |
| enable-end-card | bool | true | Whether the end card is included in the recorded media. |
| cover-image-url | string | project cover image | Image source for end card image. |
| end-card-call-to-action | string | "Try it at:" | Sets the text string for call to action on the end card. |
| short-link | string | project shortlink | Sets the text string for the end card shortlink. |
| footer-image-url | string | Powered by 8th Wall image | Image source for end card footer image. |
| watermark-image-url | string | null | Image source for watermark. |
| watermark-max-width | number | 20 | Max width (%) of watermark image. |
| watermark-max-height | number | 20 | Max height (%) of watermark image. |
| watermark-location | string | "bottomRight" | Location of watermark image. Options include topLeft, topMiddle, topRight, bottomLeft, bottomMiddle, or bottomRight. |
| file-name-prefix | string | "my-capture-" | Sets the text string that prepends the unique timestamp on file name. |
| request-mic | string | "auto" | Determines if you want to set up the microphone during initialization (auto) or during runtime (manual). |
| include-scene-audio | bool | true | If true, the A-Frame sounds in the scene will be part of the recorder output. |
### `<xrextras-curved-target-container>`
Generates a series of curved meshes that form a portal-like container that 3D content can be placed inside. The effect works through a combination of "interior" geometry that is visible to the user and "hider" geometry that blocks rendering outside the interior's opening. The generated cylinder proportions match that of the uploaded target curvature.
**Attributes**
| Attribute | Type | Default | Description |
|-----------|--------|---------|-----------------------|
| color | string | "#464766" | The color of the interior geometry. |
| height | number | 1 | Scales the generated geometry height by this value. |
| width | number | 1 | Scales the generated geometry width by this value. |
### `<xrextras-target-mesh>`
Generates a mesh that matches an image target's curvature properties. Easy way to create accurate 3D label geometry to use in your scene. You can use an A-Frame material to customize.
**Attributes**
| Attribute | Type | Default | Description |
|--------------|--------|---------|-----------------------|
| material-resource (optional) | string | "" | HTML Element ID of the xrextras material. |
| target-geometry | string | "label" | Specify full or label geometry. |
| height | number | 1 | Scales the generated geometry height by this value. |
| width | number | 1 | Scales the generated geometry width by this value. |
### `<xrextras-target-video-fade>`
Automatically fades video in and begins playback (muted only).
**Attributes**
| Attribute | Type | Default | Description |
|-----------|--------|---------|-----------------------|
| video | string | "" | The id of the <video> element used for playback. |
| height | number | 1 | Scales the generated geometry height by this value. |
| width | number | 1 | Scales the generated geometry width by this value. |
### `<xrextras-target-video-sound>`
Displays a thumbnail image and waits for a tap to begin playback (for videos with sound).
**Attributes**
| Attribute | Type | Default | Description |
|-----------|--------|---------|-----------------------|
| video | string | "" | The id of the <video> element used for playback. |
| thumb (optional) | string | "" | The id of the <img> element to serve as a thumbnail. |
| height | number | 1 | Scales the generated geometry height by this value. |
| width | number | 1 | Scales the generated geometry width by this value. |
| 8thwall/web/xrextras/src/aframe/README.md/0 | {
"file_path": "8thwall/web/xrextras/src/aframe/README.md",
"repo_id": "8thwall",
"token_count": 6770
} | 7 |
/* globals XR8:readonly */
import '../fonts/fonts.css'
import './almost-there-module.css'
import html from './almost-there-module.html'
let almostThereModule = null
const AlmostThereFactory = () => {
if (!almostThereModule) {
almostThereModule = create()
}
return almostThereModule
}
function create() {
let rootNode = null
let runConfig_ = null
let customRedirectUrl
const showId = (id) => {
document.getElementById(id).classList.remove('hidden')
}
const hideAlmostThere = () => {
if (!rootNode) {
return
}
rootNode.parentNode.removeChild(rootNode)
rootNode = null
}
const showAlmostThere = (runConfig) => {
const e = document.createElement('template')
e.innerHTML = html.trim()
rootNode = e.content.firstChild
document.getElementsByTagName('body')[0].appendChild(rootNode)
const redirectUrl = customRedirectUrl || window.location.href
const redirectLinks = rootNode.querySelectorAll('.desktop-home-link')
for (let i = 0; i < redirectLinks.length; i++) {
redirectLinks[i].textContent = redirectUrl
}
const reasons = XR8.XrDevice.incompatibleReasons(runConfig)
const details = XR8.XrDevice.incompatibleReasonDetails(runConfig)
const device = XR8.XrDevice.deviceEstimate()
const ogTag = document.querySelector('meta[name="og:image"]')
const headerImgSrc = ogTag && ogTag.content
Array.from(document.querySelectorAll('.app-header-img')).forEach((img) => {
if (headerImgSrc) {
img.src = headerImgSrc
} else {
img.classList.add('foreground-image')
img.src = 'https://cdn.8thwall.com/web/img/almostthere/v2/safari-fallback.png'
}
})
const cBtn = document.getElementById('error_copy_link_btn')
cBtn.addEventListener('click', () => {
const dummy = document.createElement('input')
document.body.appendChild(dummy)
dummy.value = redirectUrl
dummy.select()
document.execCommand('copy')
document.body.removeChild(dummy)
cBtn.innerHTML = 'Copied!'
cBtn.classList.add('error-copy-link-copied')
})
if (reasons.includes(XR8.XrDevice.IncompatibilityReasons.UNSUPPORTED_BROWSER)) {
if (device.os === 'iOS') {
if (details.inAppBrowserType === 'Safari') {
showId('error_msg_open_in_safari')
} else {
switch (details.inAppBrowser) {
case 'Instagram':
case 'Facebook':
case 'WeChat':
case 'LinkedIn':
case 'QQ':
case 'Sino Weibo':
case 'Snapchat':
showId('error_msg_open_in_safari')
showId('error_text_header_top')
showId('top_corner_open_safari')
if (details.inAppBrowser === 'Instagram') {
document.body.classList.add('bottombarbump')
}
break
case 'Facebook Messenger':
case 'Kakao Talk':
case 'Naver':
showId('error_msg_open_in_safari')
showId('error_text_header_bottom')
showId('bottom_corner_open_safari')
break
case 'Line':
case 'Mozilla Firefox Focus':
showId('error_msg_open_in_safari')
showId('error_text_header_top')
showId('top_close_open_safari')
break
default:
showId('error_unknown_webview')
break
}
}
return
}
}
if (reasons.includes(XR8.XrDevice.IncompatibilityReasons.MISSING_WEB_ASSEMBLY)) {
if (device.os === 'iOS') {
showId('error_msg_web_assembly_ios')
return
}
if (device.os === 'Android') {
showId('error_msg_web_assembly_android')
return
}
}
if (device.os === 'iOS') {
showId('error_unknown_webview')
showId('error_text_header_unknown')
return
}
if (device.os === 'Android') {
showId('error_msg_android_almost_there')
if (device.manufacturer === 'Huawei') {
showId('error_msg_detail_huawei_almost_there')
} else {
showId('error_msg_detail_android_almost_there')
}
return
}
// Desktop: help our user with a qr code
showId('error_msg_device')
// NOTE(christoph): Using an SVG here to preserve backwards compatibility with
// CSS rules for ".qrcode svg"
document.getElementById('qrcode').innerHTML = `\
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 250 250"
width="250" height="250"
>
<image
width="250"
height="250"
xlink:href="https://8th.io/qr?v=2&margin=2&url=${encodeURIComponent(redirectUrl)}"
/>
</svg>`
}
const checkCompatibility = (runConfig) => {
if (rootNode) {
return false
}
if (XR8.XrDevice.isDeviceBrowserCompatible(runConfig)) {
// Everything is ok.
return true
}
showAlmostThere(runConfig)
XR8.pause()
XR8.stop()
return false
}
const pipelineModule = () => ({
name: 'almostthere',
onBeforeRun: (args) => {
runConfig_ = args && args.config
},
onCameraStatusChange: () => {
if (!checkCompatibility(runConfig_)) {
// Throwing an error here allows other pipeline modules to react in their onException
// methods.
throw Error('Device or browser incompatible with XR.')
}
},
onRemove: () => {
hideAlmostThere()
},
onException: () => {
checkCompatibility(runConfig_)
},
})
const configure = ({url}) => {
if (url !== undefined) {
customRedirectUrl = url
}
}
return {
pipelineModule,
checkCompatibility,
configure,
hideAlmostThere,
}
}
export {
AlmostThereFactory,
}
| 8thwall/web/xrextras/src/almosttheremodule/almost-there-module.js/0 | {
"file_path": "8thwall/web/xrextras/src/almosttheremodule/almost-there-module.js",
"repo_id": "8thwall",
"token_count": 2567
} | 8 |
.recorder-container {
position: fixed;
width: 25vmin;
height: 25vmin;
max-width: 10em;
max-height: 10em;
bottom: 3vmin;
left: 50%;
transform: translateX(-50%);
z-index: 20;
transition: 0.5s opacity;
}
#recorder-button {
display: block;
border: none;
outline: none;
margin: 0;
padding: 0;
box-shadow: none;
position: absolute;
background: white;
border-radius: 50%;
color: transparent;
top: 0;
left: 0;
transform-origin: 50% 50%;
transform: scale(0.6);
transition: 0.3s border-radius, 0.3s transform;
width: 100%;
height: 100%;
}
.progress-container {
display: block;
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
transform: scale(0.9);
transition: 0.3s transform, 0.3s opacity;
}
.progress-track, .progress-bar, .loading-circle {
fill: transparent;
stroke-width: 3;
}
.progress-track {
stroke: white;
}
.progress-bar {
opacity: 0;
transition: 0;
transform-origin: 50% 50%;
stroke: white;
transform: rotate(-90deg);
stroke-dasharray: 100.531 100.531;
stroke-dashoffset: 100;
}
.recording .progress-container, .loading .progress-container {
opacity: 1;
transform: scale(1);
}
.recording .progress-track, .loading .progress-track {
transition: 0.8s stroke;
stroke: #fff5;
}
.recording .progress-bar {
opacity: 1;
}
.active #recorder-button {
transform: scale(0.5);
}
.active:not(.fixed-mode) #recorder-button {
background: #fff5;
}
.fixed-mode #recorder-button {
border-radius: 15%;
transform: scale(0.42);
}
.flash-element {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: white;
opacity: 0;
transition: 0.6s opacity;
pointer-events: none;
z-index: 40;
}
.flash-element.flashing {
transition: 0s opacity;
opacity: 1;
pointer-events: auto;
z-index: 100;
}
.loading-circle {
stroke-dasharray: 25 25 25 25;
stroke-dashoffset: 0;
stroke: white;
opacity: 0;
transform-origin: 50% 50%;
}
@keyframes record-button-spin {
0% {
transform: rotate(-90deg);
}
100% {
transform: rotate(270deg);
}
}
.loading .loading-circle {
animation: record-button-spin 1.1s linear infinite both;
opacity: 1;
}
.fade-container {
opacity: 0;
pointer-events: none;
}
| 8thwall/web/xrextras/src/mediarecorder/record-button.css/0 | {
"file_path": "8thwall/web/xrextras/src/mediarecorder/record-button.css",
"repo_id": "8thwall",
"token_count": 866
} | 9 |
declare const XR8: any
let runConfig
// data BeforeSessionInitializeInput: input for onBeforeSessionInitialize in camera pipeline
// a function that return false on session with attributes that match a certain filter
type SessionPreventer = (data: any) => boolean
const create = () => {
let sessionPreventer: SessionPreventer
const restartSession = () => {
XR8.reconfigureSession(runConfig)
}
const enableAnyDirection = () => {
XR8.reconfigureSession({
...runConfig,
cameraConfig: {...runConfig.cameraConfig, direction: 'any'},
})
}
const disableVoidSpace = () => {
XR8.reconfigureSession({
...runConfig,
sessionConfiguration: {
...runConfig.sessionConfiguration,
defaultEnvironment: {
...runConfig.sessionConfiguration?.defaultEnvironment,
disabled: true,
},
},
})
}
const enableVoidSpace = () => {
XR8.reconfigureSession({
...runConfig,
sessionConfiguration: {
...runConfig.sessionConfiguration,
defaultEnvironment: {
...runConfig.sessionConfiguration?.defaultEnvironment,
disabled: false,
},
},
})
}
const preventHeadset = (data) => {
if (data.sessionAttributes.usesWebXr) {
return true
}
return false
}
const preventCamera = (data) => {
if (data.sessionAttributes.fillsCameraTexture) {
return true
}
return false
}
const configure = ({skipCameraSession}) => {
if (skipCameraSession) {
sessionPreventer = preventCamera
}
}
const pipelineModule = () => {
let el
return {
name: 'session-reconfigurator',
onRunConfigure: (data) => {
runConfig = data.config
},
onBeforeSessionInitialize: (data) => {
if (sessionPreventer && sessionPreventer(data)) {
throw new Error('Session preventer choose to skip session')
}
},
onAttach: () => {
if (!XR8.reconfigureSession) {
throw new Error('Invalid XR8 version, missing reconfigureSession')
}
el = document.createElement('div')
Object.assign(el.style, {
position: 'fixed',
left: 0,
top: 0,
padding: '1rem',
zIndex: 900000,
})
const options = [
// {name: 'restart same', action: restartSession},
// {name: 'any direction camera', action: enableAnyDirection},
// {name: 'prevent xr', action: restartSession, sessionPreventer: preventHeadset},
{name: 'enable xr', action: restartSession},
// {name: 'disable void', action: disableVoidSpace},
// {name: 'enable void', action: enableVoidSpace},
{name: 'prevent camera', action: restartSession, sessionPreventer: preventCamera},
]
options.forEach((option) => {
const button = document.createElement('button')
button.textContent = option.name
el.appendChild(button)
button.addEventListener('click', () => {
sessionPreventer = option.sessionPreventer
option.action()
})
})
document.body.appendChild(el)
},
onDetach: () => {
if (el) {
document.body.removeChild(el)
el = null
}
},
}
}
return {
pipelineModule,
configure,
restartSession,
enableAnyDirection,
disableVoidSpace,
enableVoidSpace,
preventCamera,
preventHeadset,
}
}
let SessionReconfigureModule = null
const SessionReconfigureFactory = () => {
if (SessionReconfigureModule == null) {
SessionReconfigureModule = create()
}
return SessionReconfigureModule
}
export {
SessionReconfigureFactory,
}
| 8thwall/web/xrextras/src/sessionreconfiguremodule/session-reconfigure-module.ts/0 | {
"file_path": "8thwall/web/xrextras/src/sessionreconfiguremodule/session-reconfigure-module.ts",
"repo_id": "8thwall",
"token_count": 1529
} | 10 |
## 一、拖拽接口
**元素拖拽事件:**
`ondrag ` :应用于拖拽元素,整个拖拽过程都会持续调用;
`ondragstart `:应用于拖拽元素,当拖拽开始时调用;
`ondragleave`:应用于拖拽元素,拖拽过程中,当鼠标离开拖拽元素范围时调用;
`ondragend` :应用于拖拽元素,当拖拽结束时调用。
**目标拖拽事件:**
`ondragenter`:应用于目标元素,当拖拽元素进入时调用;
`ondragover`:应用于目标元素,当停留在目标元素上时调用;
`ondrop`:应用于目标元素,当在目标元素上松开鼠标时调用;
`ondragleave`:应用于目标元素,当鼠标离开目标元素时调用。
示例:**将一个div中的p标签拖拽到另一个p标签中**
```html
<body>
<div class="div1" id="div1">
<!--在h5中,如果想拖拽元素,就必须为元素添加draggable="true". 图片和超链接默认就可以拖拽-->
<p id="pe" draggable="true">试着把我拖过去</p>
</div>
<div class="div2" id="div2"></div>
<script>
/*学习拖拽,主要就是学习拖拽事件*/
var p=document.querySelector("#pe");
var div2=document.querySelector("#div2");
// 应用于被拖拽元素
p.ondragstart=function(){
console.log("ondragstart");
}
p.ondragend=function(){
console.log("ondragend");
}
p.ondragleave=function(){
console.log("被拖拽元素:ondragleave");
}
p.ondrag=function(){
console.log("ondrag");
}
// 应用于目标元素的事件
div2.ondragenter=function(){
console.log("ondragenter");
}
div2.ondragover=function(e){
console.log("ondragover");
/*如果想触发ondrop事件,那么就必须在这个位置阻止浏览器的默认行为*/
e.preventDefault();
}
/*浏览器默认会阻止ondrop事件:我们必须在ondragover中阻止浏览器的默认行为*/
div2.ondrop=function(){
console.log("ondrop");
/*添加被拖拽的元素到当前目标元素*/
div2.appendChild(p);
}
div2.ondragleave=function(){
console.log("目标元素:ondragleave");
}
</script>
</body>
```
> 1、被拖拽的元素必须添加 `draggable="true"` 属性。
>
> 2、浏览器默认会阻止目标元素的 ondrop 事件:我们必须在目标元素的 ondragover 中阻止浏览器的默认行为(使用事件参数对象的 `preventDefault() `方法),才能将拖拽的元素放到目标元素中。
**遗留问题:**如果有多个 div,那么每个 div 都必须写 ondragover 和 ondrop 事件触发的处理函数,也就是只能拖拽指定的元素到指定的元素中,这样代码的可用性就很低了。
**分析问题:**既然有多个被拖拽元素和多个目标元素存在,这些元素都存在于 document 中的,那么可不可以给 document 添加这些事件呢?
答案是可以的。
```html
<body>
<div class="div1" id="div1">
<p id="pe" draggable="true">试着把我拖过去</p>
<p id="pe1" draggable="true">试着也把我拖过去</p>
</div>
<div class="div2" id="div2"></div>
<div class="div3" id="div3"></div>
<script>
var obj=null;//当前被拖拽的地元素
//应用于被拖拽元素的事件
document.ondragstart=function(e){
obj= e.target;
}
//应用于目标元素的事件
document.ondragover=function(e){
/*如果想触发ondrop事件,那么就必须在这个位置阻止浏览器的默认行为*/
e.preventDefault();
}
/*浏览器默认会阻止ondrop事件:我们必须在ondragover中阻止浏览器的默认行为*/
document.ondrop=function(e){
/*添加元素*/
e.target.appendChild(obj);
}
</script>
</body>
```
> 在事件参数对象中有一个 target 属性,其值为被拖拽的元素对象。
问题解决了,但是,又是但是......,但是一般少使用全局变量,全局变量谁都可以修改,容易误操作。
**在事件参数对象中有一个 `dataTransfer` 属性,通过 `dataTransfer` 来实现数据的存储与获取。**
dataTransfer 有两个方法:
`setData(format,data); `用于存储数据;
`getData(format,data); 用于取出数据;`**(取出数据必须在目标元素的 ondrop 事件中,其他事件中无法取到数据)**
format:数据的类型:`text/html` ,` text/uri-list`
Data:数据:一般来说是字符串值
```html
<body>
<div class="div1" id="div1">
<!--在h5中,如果想拖拽元素,就必须为元素添加draggable="true". 图片和超链接默认就可以拖拽-->
<p id="pe" draggable="true">试着把我拖过去</p>
<p id="pe1" draggable="true">试着也把我拖过去</p>
</div>
<div class="div2" id="div2"></div>
<div class="div3" id="div3"></div>
<script>
//应用于被拖拽元素的事件
document.ondragstart=function(e){
// 把拖拽元素的id值存储起来
e.dataTransfer.setData("text/html", e.target.id);
};
//应用于目标元素的事件
document.ondragover=function(e){
/*如果想触发ondrop事件,那么就必须在这个位置阻止浏览器的默认行为*/
e.preventDefault();
};
/*浏览器默认会阻止ondrop事件:我们必须在ondragover中阻止浏览器的默认行为*/
document.ondrop=function(e){
/*添加元素*/
/*通过e.dataTransfer.setData存储的数据,只能在drop事件中获取*/
var id=e.dataTransfer.getData("text/html");
// 通过id方式添加元素
e.target.appendChild(document.getElementById(id));
};
</script>
</body>
```
## 二、Web存储
用户在浏览网页的时候,可能需要存储一些数据在本地,之前是采用 Cookie 的方式存储,但是 Cookie 只能存储大小为 4k 以内的数据,再多的数据就存储不了。并且 Cookie 的解析也是很复杂的。
到了h5阶段,又提供了两种方式来存储 web 数据:sessionStorage 和 localStorage。
### 1、sessionStorage
sessionStorage的使用:将存储数据到本地。存储的容量 **5MB** 左右。
注意:sessionStorage 的存储特点:
- **这个数据本质是存储在当前页面的内存中,意味着其它页面和浏览器无法获取数据。**
- **它的生命周期为关闭当前页面时,数据会自动清除。**
提供的方法:
- **setItem(key,value)** :存储数据,以键值对的方式存储,
- **getItem(key)** :获取数据,通过指定名称的key获取对应的value值,
- **removeItem(key)** :删除数据,通过指定名称key删除对应的值,
- **clear()** :清空所有存储的内容。
- **sessionStorage.length**,获取存储数据的个数,
然后获取其中的key:`var tk = sessionStorage.key(i)`
然后获取其中的value:`sessionStorage.getItem(tk)`
示例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<pre>
sessionStorage的使用
</pre><br>
<input type="text" id="userName"><br>
<input type="button" value="设置数据" id="setData">
<input type="button" value="获取数据" id="getData">
<input type="button" value="删除数据" id="removeData">
<script>
/*存储数据*/
document.querySelector("#setData").onclick=function(){
/*获取用户名*/
var name=document.querySelector("#userName").value;
/*存储数据*/
window.sessionStorage.setItem("userName",name);
};
/*获取数据*/
document.querySelector("#getData").onclick=function(){
/*如果找不到对应名称的key,那么就会获取null*/
var name=window.sessionStorage.getItem("userName");
alert(name);
};
/*删除数据*/
document.querySelector("#removeData").onclick=function(){
/*在删除的时候如果key值错误,不会报错,但是也不会删除数据*/
window.sessionStorage.removeItem("userName");
};
</script>
</body>
</html>
```
> 1、获取数据的时候,如果找不到对应名称的 key,那么获取的值为 null。
>
> 2、删除数据的时候,如果 key 值错误,不会报错,但是也不会删除数据。
### 2、localStorage
localStorage的使用:
- 存储的内容大概 **20MB** 大小
- **不同浏览器不能共享数据。但是在同一个浏览器的不同窗口中可以共享数据;**
- **永久生效,它的数据是存储在硬盘上,并不会随着页面或者浏览器的关闭而清除。如果想清除,必须手动清除**
`setItem(key,value)`:存储数据,以键值对的方式存储
`getItem(key)`:获取数据,通过指定名称的key获取对应的value值
`removeItem(key)`:删除数据,通过指定名称key删除对应的值
`clear()`:清空所有存储的内容
示例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<pre>localStorage的使用:</pre>
<br>
<input type="text" id="userName"><br>
<input type="button" value="设置数据" id="setData">
<input type="button" value="获取数据" id="getData">
<input type="button" value="删除数据" id="removeData">
<script>
document.querySelector("#setData").onclick=function(){
var name=document.querySelector("#userName").value;
/*使用localStorage存储数据*/
window.localStorage.setItem("userName",name);
};
/*获取数据*/
document.querySelector("#getData").onclick=function(){
var name=window.localStorage.getItem("userName");
alert(name);
};
/*清除数据*/
document.querySelector("#removeData").onclick=function(){
window.localStorage.removeItem("userName");
};
</script>
</body>
</html>
```
## 三、自定义播放器
我们知道不同的浏览器的音频视频的播放器控件显示样式有差异,那么我们怎么做一个在任何浏览器下都有相同样式的播放器呢?
**常用方法**:
- `load()` 加载,
- `play()`播放,
- `pause()` 暂停。
> 注意:jQuery中没有提供对视频播放控件的方式,所以如果使用jQuery操作元素,必须将其转为原生 js 的方式来调用这些方法。
**常用属性**:
- `currentTime`:视频播放的当前进度
- `duration`:视频的总时长
- `paused`:视频播放的状态
**常用事件**:
- `oncanplay`:事件在用户可以开始播放视频/音频时出触发
- `ontimeupdate`:通过该事件报告当前的播放进度
- `onended`:播放完时触发
示例代码:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css">
<link rel="stylesheet" href="./css.css">
</head>
<body>
<h3 class="playerTitle">自定义视频播放器</h3>
<div class="player">
<video src="../mp4/2.mp4"></video>
<div class="controls">
<a href="javascript:void(0);" class="switch fa fa-play"></a>
<a href="javascript:void(0);" class="expand fa fa-arrows-alt"></a>
<div class="progress"> <!--总时长-->
<div class="bar"></div> <!--用于点击选择进度-->
<div class="loaded"></div> <!--已经加载的-->
<div class="elapse"></div> <!--已经播放的时长-->
</div>
<div class="time">
<span class="currentTime">00:00:00</span>
\
<span class="totalTime">00:00:00</span>
</div>
</div>
</div>
<script src="./jquery.min.js"></script>
<script>
$(function () {
// 获取播放器文件
var video = $("video")[0];
// 点击播放按钮播放视频文件
$(".switch").click(function () {
if (video.paused) {
video.play();
} else {
video.pause();
}
$(this).toggleClass("fa-play fa-pause");
});
// 全屏操作
$(".expand").click(function () {
if (video.requestFullscreen) {
video.requestFullscreen();
}
else if (video.webkitRequestFullScreen) {
video.webkitRequestFullScreen();
}
else if (video.mozRequestFullScreen) {
video.mozRequestFullScreen();
}
else if (video.msRequestFullScreen) {
video.msRequestFullScreen();
}
});
function getTime(total) {
var hour = Math.floor(total / 3600);
hour = hour > 10 ? hour : "0" + hour;
var min = Math.floor((total % 3600) / 60);
min = min > 10 ? min : "0" + min;
var sec = Math.floor((total % 3600) % 60);
sec = sec > 10 ? sec : "0" + sec;
return hour + ":" + min + ":" + sec;
}
// 当视频加载完成后显示视频
video.oncanplay = function () {
this.style.display = "block";
// 根据视频总时长,获取时分秒
var total = getTime(this.duration);
// 显示总时长
$(".totalTime").html(total);
};
// 视频播放过程中,获取时分秒实时显示
// 如果修改currentTime值也会触发这个事件,也就是只要currentTime值变化,就会触发这个事件
video.ontimeupdate = function () {
var current = getTime(this.currentTime);
$(".currentTime").html(current);
// 设置进度条
var percent = this.currentTime / this.duration * 100 + "%";
$(".elapse").css("width", percent);
};
// 点击进度条跳播
$(".bar").click(function (e) {
video.currentTime = e.offsetX / $(this).width() * video.duration;
});
// 播放完成后回到最初位置
video.onended = function () {
// 位置清零
video.currentTime = 0;
// 播放暂停状态为播放
$(".switch").removeClass("fa fa-pause").addClass("fa fa-play");
};
});
</script>
</body>
</html>
```

> 1、视频控制器中的播放暂停按钮和全屏按钮都是来自在线字体图标 font-awesome。
>
> 2、进度条一栏实际上有4层,处理可以看到的总时长,缓存时长,播放时长外还有一个最顶层的透明层,用于点击进度条实现跳变功能。
| Daotin/Web/01-HTML/02-HTML5/04-拖拽接口,Web存储,自定义播放器.md/0 | {
"file_path": "Daotin/Web/01-HTML/02-HTML5/04-拖拽接口,Web存储,自定义播放器.md",
"repo_id": "Daotin",
"token_count": 8721
} | 11 |
## 1、CSS3简介
CSS3是CSS(层叠样式表)技术的升级版本,主要包括盒子模型、列表模块、超链接方式、语言模块、背景和边框、文字特效、多栏布局等模块。
## 2、新增特性
CSS3的新特征有很多,例如圆角效果、图形化边界、块阴影与文字阴影、使用RGBA实现透明效果、渐变效果、使用@Font-Face实现定制字体、多背景图、文字或图像的变形处理(旋转、缩放、倾斜、移动)、多栏布局、媒体查询等。
## 3、优势
**减少开发成本与维护成本**
在CSS3出现之前,开发人员为了实现一个圆角效果,往往需要添加额外的HTML标签,使用一个或多个图片来完成,而使用CSS3只需要一个标签,利用CSS3中的border-radius属性就能完成。
**提高页面性能**
很多CSS3技术通过提供相同的视觉效果而成为图片的“替代品”,换句话说,在进行Web开发时,减少多余的标签嵌套以及图片的使用数量,意味着用户要下载的内容将会更少,页面加载也会更快。
## 4、兼容问题
浏览器对于CSS3的支持程度比较低,有的时候不同的浏览器需要添加不同的前缀。
Chrome(谷歌浏览器):`-webkit-`
Safari(苹果浏览器):`-webkit-`
Firefox(火狐浏览器):`-moz-`
lE(IE浏览器):`-ms-`
Opera(欧朋浏览器):`-o-`
**渐进增强和优雅降级**
---
## 5、选择器
CSS3新增了许多灵活查找元素的方法,极大的提高了查找元素的效率和精准度。CSS3选择器与jQuery中所提供的绝大部分选择器兼容。
### 5.1、属性选择器
所谓属性选择器就是**根据指定名称的属性的值**来查找元素。
1、`E[attr]`:查找指定的拥有attr属性的E标签。
```css
/*查找拥有style属性的里标签*/
li[style] {}
li[class="red"][type="text"] {}
li[class][type="text"] {}
```
2、`E[attr=value]`:查找拥有指定的attr属性并且属性值为value的E标签。
```css
/*查找拥有class属性并且值为Red的li标签*/
li[class=red] {}
```
3、`E[attr*=value]`:查找拥有指定的attr属性并且属性值中包含**(可以在任意位置**)value的E标签
```css
li[class*=red] {}
```
4、`E[attr^=value]`:查找拥有指定的attr属性并且属性值以value开头的E标签
```css
li[class^=red] {}
```
5、`E[attr$=value]`:查找拥有指定的attr属性并且属性值以value开结束的E标签
```css
li[class$=red] {}
```
**PS:属性可以为自定义属性。**
```
li[name="Daotin"]
```
### 5.2、伪类选择器
之前学过的伪类选择器:`a:hover`,` a:link`, `a:active`, ` a:visited`
伪类选择器:**以某元素相对于其父元素或兄弟元素的位置来获取无素的结构伪类。**
#### 5.2.1、兄弟结构伪类
`+`:获取当前元素的**相邻**的满足条件的元素
`~`:获取当前元素的满足条件的**兄弟元素**(只能往后查找)
```css
/*下面这句样式说明查找 :添加了.first样式的标签的相邻的li元素
要求:
1.必须相邻。2.必须是指定类型的元素
*/
.first + li{
color: blue;
}
/*下面样式查找添加了.first样式的元素的所有兄弟li元素*/
.first ~ li{
color: pink;
}
<li class="first"></li>
<li>1</li>
<li>2</li>
```
#### 5.2.2、相对于父元素的伪类
**5.2.2.1、查找第一个元素和最后一个元素(无过滤)**
`E:first-child`:查找E元素的父级元素中的第一个E元素。
`E:last-child` :查找E元素的父元素中最后一个指定类型的子元素
```css
/*下面这句样式查找:li的父元素中的第一个li元素
1.相对于当前指定元素的父元素
2.查找的类型必须是指定的类型*/
li:first-child{
color: red;
}
li:last-child{
background-color: skyblue;
}
```
> 注意:在查找的时候并不会**限制查找的元素的类型,也就是如果第一个元素不是E元素的话,就查找不到**,查找的时候不会过滤掉E元素之外的元素。
**5.2.2.2、查找第一个元素和最后一个元素(有过滤)**
`E:first-of-type`:查找E元素的父级元素中的第一个E元素。
`E:last-of-type` :查找E元素的父元素中最后一个指定类型的子元素
```css
/*查找的时候限制类型 first-of-type*/
/*1.也是相对于父元素
2.在查找的时候只会查找满足类型条件的元素,过渡掉其它类型的元素*/
li:first-of-type{
color: red;
}
li:last-of-type{
color: orange;
}
```
**5.2.2.3、查找单个元素或多个元素(无过滤)**
`E:nth-child(index)`:查找指定索引位置的元素(从1开始的索引)
`E:nth-child(even)`:查找索引为偶数位置的元素
`E:nth-child(odd)`:查找索引为奇数位置的元素
与上面类似,下面是倒着计算的:
`E:nth-last-child(xxx)`
```css
li:nth-child(5){
background-color: lightblue;
}
li:nth-child(even){
background-color: blue;
}
li:nth-child(odd){
background-color: red;
}
```
**5.2.2.4、查找单个元素或多个元素(有过滤)**
```css
li:nth-of-type(even){
background-color: orange;
}
li:nth-of-type(odd){
background-color: pink;
}
```
**5.2.2.5、查找开头或结尾的多个元素**
无过滤:`E:nth-child(n)` :n 遵循线性变化,其取值0、1、2、3、4、... 但是当参数小于等于0时,选取无效。
有过滤:`E:nth-of-type(n)`
无过滤倒序:`E:nth-last-child(n)`
有过滤倒序:`E:nth-last-of-type(n)`
示例:
```css
/*想为前面的5个元素添加样式*/
/*n:默认取值范围为0~子元素的长度.但是当n<=0时,选取无效
0>>5
1>>4
...
4>>1
5>>0*/
li:nth-of-type(-n+5){
font-size: 30px;
}
li:nth-last-of-type(-n+5){
font-size: 30px;
}
```
> PS:n 可是多种形式:nth-child(2n)、nth-child(2n+1)、nth-child(-n+5)等。
**2.2.6、空值:没有任何的内容,连空格都没有**
```css
li:empty{
background-color: red;
}
```
**2.2.7、锚链接伪类**
`E:target` :可以为锚点目标元素添加样式,当目标元素被触发为当前锚链接的目标时,调用此伪类样式。
```css
/*h2为锚点,在被触发时将h2的字体改为红色*/
h2:target{
color: red;
}
```
### 5.3、伪元素选择器
伪元素之所以被称为伪元素,是因为它不是真正的DOM,但是却可以当成一个DOM元素看待,它的用法和真正的DOM元素的操作是一样的,但是在DOM树中又不会出现。
既然是伪元素,那么**无法使用 JS 的方式来获取**。
css有一系列的伪元素,如`::before`,`::after`,`::first-line`,`::first-letter`等,本文就详述一下:before和:after元素的使用。
#### 5.3.1、E::before,E::after
- 是一个**行内元素**,需要转换成块:`display:block` 或者 `float:left/right` 或者使用 `position` 。
- **必须添加 content** , 哪怕不设置内容,也需要`content:""`,否则不会起作用。
- E:after、E:before 在旧版本里是伪类,在新版本里是伪元素,因为在新版本下E:after、E:before会被自动识别为E::after、E::before,按伪元素来对待,这样做的目的是用来做兼容处理。
- `E::before`:定义在一个元素的内容之前插入 content 属性定义的内容与样式。
- `E::after`:定义在一个元素的内容之后插入 content 属性定义的内容与样式。
> 注意:
>
> - IE6、IE7与IE8(怪异模式Quirks mode)不支持此伪元素
> - CSS2中 E:before或者E:after,是属于伪类的,并且没有伪元素的概念,CSS3中 提出伪元素的概念 E::before和E::after,并且归属到了伪元素当中,伪类里就不再存在E:before或者 E:after伪类
示例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
div:nth-of-type(1){
width: 300px;
height: 200px;
background-color: red;
float: left;
position: relative;
}
div:nth-of-type(2){
width: 100px;
height: 200px;
background-color: blue;
float: left;
}
div:nth-of-type(1)::before {
content: "";
position: absolute;
width: 20px;
height: 20px;
background-color: #fff;
border-radius: 50%;
right: -10px;
top: -10px;
}
div:nth-of-type(1)::after {
content: "";
position: absolute;
width: 20px;
height: 20px;
background-color: #fff;
border-radius: 50%;
right: -10px;
bottom: -10px;
}
</style>
</head>
<body>
<div></div>
<div></div>
</body>
</html>
```

#### 5.3.2、E::first-letter
**选中文本的第一个字母(英文)或者文字(中文)**
```css
/*设置首字下沉*/
p::first-letter {
font-size: 40px;
float: left;
}
```
#### 5.3.3、E::first-line
**选中文本第一行**
> PS:如果同时设置了::first-letter,那么 ::first-line 无法对第一个字母或文字进行设置(颜色除外)。
#### 5.3.4、E::selection
**设置选中文本的样式。**
> 注意:不能改变其大小,但是可以改变颜色。
```css
p::selection {
background-color: orange;
}
```
| Daotin/Web/02-CSS/02-CSS3/01-CSS3概述,选择器.md/0 | {
"file_path": "Daotin/Web/02-CSS/02-CSS3/01-CSS3概述,选择器.md",
"repo_id": "Daotin",
"token_count": 6268
} | 12 |
## 一、流程控制
### switch
> **switch底层用的是 === 比较。**
参考链接:http://www.cnblogs.com/codetker/p/4680996.html
```javascript
switch ("111"){
case 111:
alert(111);
break;
case 222:
alert(222);
break;
case 222:
alert(333);
break;
default :
alert("都不是!");
break;
}
```
**注意:如果switch的判断条件为false的话,case的所有语句都不执行,只执行default的语句。**
## 二、进制转换
十进制转换成其他进制:使用toString
```js
var num = 10;
var num_2 = num.toString(2); // 转换为二进制 1010
var num_2 = num.toString(8); // 转换为八进制 12
var num_2 = num.toString(16); // 转换为十六进制 a
```
其他转换成十进制:使用parseInt
```js
var num = parseInt(1101, 2); // 二进制转换为十进制 13
var num = parseInt(5505, 8); // 八进制转换为十进制 2885
var num = parseInt(0xFA9, 16); // 十六进制转换为十进制 16393
```
| Daotin/Web/03-JavaScript/01-JavaScript基础知识/03-流程控制和进制转换.md/0 | {
"file_path": "Daotin/Web/03-JavaScript/01-JavaScript基础知识/03-流程控制和进制转换.md",
"repo_id": "Daotin",
"token_count": 587
} | 13 |
## 1、正则表达式
正则表达式(regular expression)是一个描述字符规则的对象。
## 2、正则表达式的作用
前端往往有大量的表单数据校验的工作,采用正则表达式会使得数据校验的工作量大大减轻,如邮箱验证,手机号码,等等。比起用字符串的函数来判断简单,易用。
## 3、正则表达式的定义
JS中定义正则表达式有两种方式,一种是通过构造函数,一种是通过`/…/`,也就是两个斜杠。
### 3.1、方式一
```js
// 使用RegExp这个对象(构造函数)
// 语法
// pattern: 模板字符串
// attributes:字符串,可选。包含属性 "g"、"i" 和 "m",分别用于指定全局匹配、区分大小写的匹配和多行匹配。ECMAScript 标准化之前,不支持 m 属性。如果 pattern 是正则表达式,而不是字符串,则必须省略该参数
var reg = new RegExp(pattern, [attributes]);
//例如:
var reg= new RegExp(‘study’); //表示含有study,(默认区分大小写)
var reg = new RegExp('study', 'ig'); // 其中i 表示忽略大小写,g 表示全局匹配
```
### 3.2、方式二
```js
// 使用常量方式直接声明
//语法
var reg = /study/;
//等价于:var reg= new RegExp('study');
//等价于:var reg= new RegExp(/study/);
```
## 4、正则表达式的使用
使用正则表达式来测试某个字符串是否符合正则表达式所规定的规则。
正则表达式可以被用于RegExp的`exec`和`test`方法以及 String的`match`、`replace`、`search`和`split`方法。
`match`:一个在字符串中执行查找匹配的String方法,它返回一个数组或者在未匹配到时返回null。
```js
var s = '_x_x';
var r1 = /x/g;
var r2 = /y/;
s.match(r1) // ["x","x"]
s.match(r2) // null
```
`search`:一个在字符串中测试匹配的String方法,它返回匹配到的位置索引,或者在失败时返回-1。
```js
'_x_x'.search(/x/) // 1
```
`replace`:一个在字符串中执行查找匹配的String方法,并且使用替换字符串替换掉匹配到的子字符串。
```js
'aaa'.replace('a', 'b') // "baa"
'aaa'.replace(/a/, 'b') // "baa"
'aaa'.replace(/a/g, 'b') // "bbb"
// 清除字符串首尾空格
var str = ' #id div.class ';
str.replace(/^\s+|\s+$/g, '')
```
`split`:一个使用正则表达式或者一个固定字符串分隔一个字符串,并将分隔后的子字符串存储到数组中的String方法。
```js
// 非正则分隔
'a, b,c, d'.split(',')
// [ 'a', ' b', 'c', ' d' ]
// 正则分隔,去除多余的空格
'a, b,c, d'.split(/, */)
// [ 'a', 'b', 'c', 'd' ]
// 指定返回数组的最大成员个数为2个
'a, b,c, d'.split(/, */, 2)
[ 'a', 'b' ]
```
## 5、正则表达式属性和方法
### 5.1、实例属性
```js
// 一类是修饰符相关,返回一个布尔值,表示对应的修饰符是否设置。
RegExp.prototype.ignoreCase //返回一个布尔值,表示是否设置了i修饰符。
RegExp.prototype.global //返回一个布尔值,表示是否设置了g修饰符。
RegExp.prototype.multiline //返回一个布尔值,表示是否设置了m修饰符。
//示例
var r = /abc/igm;
r.ignoreCase // true
r.global // true
r.multiline // true
// 另一类是与修饰符无关的属性
RegExp.prototype.lastIndex //返回一个整数,表示下一次开始搜索的位置。该属性可读写,但是只在进行连续搜索时有意义,详细介绍请看后文。
RegExp.prototype.source //返回正则表达式的字符串形式(不包括反斜杠),该属性只读。
//示例
var r = /abc/igm;
r.lastIndex // 0
r.source // "abc"
```
### 5.2、实例方法
#### RegExp.prototype.test()
描述:正则实例对象的test方法返回一个布尔值,表示当前模式是否能匹配参数字符串。
语法:`regexObj.test(str)`
参数:str 用来与正则表达式匹配的字符串
返回值:如果正则表达式与指定的字符串匹配 ,返回`true`;否则`false`。
示例:
```js
/cat/.test('cats and dogs') // true
```
#### RegExp.prototype.exec()
描述:正则实例对象的`exec`方法,用来返回匹配结果。如果发现匹配,就返回一个数组,成员是匹配成功的子字符串,否则返回`null`。
语法:`regexObj.exec(str)`
参数:str 要匹配正则表达式的字符串。
返回值:如果匹配成功,exec() 方法返回一个数组,并更新正则表达式对象的属性。返回的数组将完全匹配成功的文本作为第一项,将正则括号里匹配成功的作为数组填充到后面。如果匹配失败,exec() 方法返回 null。
示例:
```js
var s = '_x_x';
var r1 = /x/;
var r2 = /y/;
r1.exec(s) // ["x"]
r2.exec(s) // null
```
## 6、特殊字符
```js
^ // 匹配一行的开头,/^a/匹配"abc",而不匹配“bca“
$ // 匹配一行的结尾,/a$/匹配“bca",而不匹配"abc"
* // 匹配前面元字符0次或多次,/ba*/将匹配b,ba,baa,baaa ,相当于{0,}
+ // 匹配前面元字符1次或多次,/ba+/将匹配ba,baa,baaa ,相当于 {1,}
? // 匹配前面元字符0次或1次,/ba?/将匹配b,ba ,相当于{0,1}
x|y // 匹配x或y ,/a|b/ 将匹配只要出现a或者b的字符串,不含a与b的不匹配
{n} // 精确匹配n次 ,/d{4}/ 将匹配,出现连续4个d的字符串
{n,} // 匹配n次以上 ,/d{4,}/将匹配,出现连续4个及4个以上的d的字符串
{n,m} // 匹配n-m次,/d{4,8}/将匹配,出现连续4到8个d的字符串
\d //匹配0-9之间的任一数字,相当于[0-9]。
\D //匹配所有0-9以外的字符,相当于[^0-9]。
\w //匹配任意的字母、数字和下划线,相当于[A-Za-z0-9_]。
\W //除所有字母、数字和下划线以外的字符,相当于[^A-Za-z0-9_]。
\s //匹配空格(包括换行符、制表符、空格符等),相等于[ \t\r\n\v\f]。
\S //匹配非空格的字符,相当于[^ \t\r\n\v\f]。
\b //匹配词的边界。
\B //匹配非词边界,即在词的内部。
示例:
// \s 的例子
/\s\w*/.exec('hello world') // [" world"]
// \b 的例子
/\bworld/.test('hello world') // true
/\bworld/.test('hello-world') // true
/\bworld/.test('helloworld') // false
// \B 的例子
/\Bworld/.test('hello-world') // false
/\Bworld/.test('helloworld') // true
```
## 7、转义字符(量字符)
```js
\f 换页符
\n 换行符
\r 回车
\t 制表符
\v 垂直制表符
\/ 一个 / 直接量
\\ 一个 \ 直接量
\. 一个 . 直接量
\* 一个 * 直接量
\+ 一个 + 直接量
\? 一个 ? 直接量
\| 一个 | 直接量
\( 一个 ( 直接量
\) 一个 ) 直接量
\[ 一个 [ 直接量
\] 一个 ] 直接量
\{ 一个 { 直接量
\} 一个 } 直接量
```
## 8、方括号
```js
[abc] //查找abc中的任意一个字符。
[^abc] //查找除abc的一个字符。
[0-9] //查找任何从 0 至 9 的数字。
[a-z] //查找任何从小写 a 到小写 z 的字符。
[adgk] //查找给定集合内的任何一个字符。
(aa|ddd|gg|kkkk) // 同上,选取aa,ddd,gg,kkkk中的一个
```
```js
// 示例:
// [a-z]*表示任意个 a-z 中的字符,[0-9]*表示任意个 0-9 的字符
var pattern = /g[a-zA-Z]*gle/; //[a-z]*表示任意个 a-z 中的字符
var str = 'google';
alert(pattern.test(str));//true
str = 'go12agle';
alert(pattern.test(str));//false
str = 'ggle';
alert(pattern.test(str));//true
var pattern = /g[0-9]*gle/; //[0-9]*表示任意个 0-9 的字符
// 加上^ 表示非(即排除)
var pattern = /g[^0-9]*gle/; //[^0-9]*表示任意个非 0-9 的字符
var str = 'google';
alert(pattern.test(str));//true
str = 'g12gle';
alert(pattern.test(str));//false
str = 'ggle';
alert(pattern.test(str));//true
```
## 9、组匹配
正则表达式的括号表示分组匹配,括号中的模式可以用来匹配分组的内容。
```js
/fred+/.test('fredd') // true
/(fred)+/.test('fredfred') // true
```
上面代码中,第一个模式没有括号,结果`+`只表示重复字母`d`,第二个模式有括号,结果`+`就表示匹配`fred`这个词。
```js
var m = 'abcabc'.match(/(.)b(.)/);
// m = ['abc', 'a', 'c']
```
## 10、常用正则表达式
```js
检查邮政编码//共 6 位数字,第一位不能为 0
/^[1-9]\d{5}$/
检查文件压缩包 //xxx.zip\xxx.gz\xxx.rar
/^\w+\.(zip|gz|rar)$/
删除多余空格 //
str.replace(/\s+/,'');
删除首尾空格
str.replace(/^\s+/,''); //去除开头的空格
str.replace(/\s+$/,''); // 去除结尾的空格
//删除所有的空格
str.replace(/\s/g,'');
//删除前后的空格
str.replace((^\s+)|(\s+$),'')
电子邮件( xxxxx @ xxxx(.xxxx)+)
/^\w+@\w+(\.\w+)+$/
如: 770107@qq.com; 770107@qq.com.cn
手机号(1开头任意数字) 1(3|5|7|8|4)\d{9}
/^1\d{10}$/
身份证
/^\d{17}(\d|X)$/
422422 19660101 5810
421087 19890101 121X
^[1-9]\d{5}[19|20]\d{2}\d{7}(\d|X)$
日期 (合法日期格式:xxxx-xx-xx或 xxxx/xx/xx或xxxx.xx.xx)
/^\d{4}[-\/\.]\d{2}[-\/\.]\d{2}$/
只能输入中文
str.replace(/[^\u4e00-\u9fa5]/g,'');
账户名只能使用数字字母下划线,且数字不能开头,长度在6-15之间
/^[a-zA-Z_]\w{5,14}$/
验证IP
(xxx.)xxx.xxx.xxx|
254.245.255.255
240.196.19.5
/^((25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)$/
将所有的bag、beg、big和bog改为bug
str.replace(/(bag|beg|big|bog)/g,'bug');
将所有方法foo(a,b,c)的实例改为foo(b,a,c)
str.replace(/foo\(([^,]+),([^,]+),([^,]+)\)/g,'foo($2,$1,$3)');
假设有一个多字符的片断重复出现,例如:
Billy tried really hard
Sally tried really really hard
Timmy tried really really really hard
Johnny tried really really really really hard
而你想把"really"、"really really",以及任意数量连续出现的"really"字符串换成一个简单的"very“
str.replace(/(really\s)+/gi,'very');
```
| Daotin/Web/03-JavaScript/02-DOM/10-正则表达式.md/0 | {
"file_path": "Daotin/Web/03-JavaScript/02-DOM/10-正则表达式.md",
"repo_id": "Daotin",
"token_count": 6573
} | 14 |
1、选项卡
要求:点击对应的标签,显示对应的选项卡
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
div {
width: 400px;
margin: 0 auto;
background-color: #ccc;
}
#nav {
width: 400px;
height: 50px;
}
#nav li {
width: 25%;
height: 50px;
line-height: 50px;
text-align: center;
float: left;
border: 1px solid red;
box-sizing: border-box;
cursor: pointer;
}
#nav li:hover {
background-color: yellow;
}
#content {
width: 400px;
height: 400px;
position: relative;
}
#content li {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
#content li img {
width: 100%;
}
.active {
z-index: 10;
}
</style>
</head>
<body>
<div>
<ul id="nav">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
<ul id="content">
<li class="active"><img src="../images/5.jpg"></li>
<li><img src="../images/6.jpg"></li>
<li><img src="../images/7.jpg"></li>
<li><img src="../images/8.jpg"></li>
</ul>
</div>
</body>
<script>
var ulObj1 = document.getElementsByTagName("ul")[0];
var ulObj2 = document.getElementsByTagName("ul")[1];
var liList1 = ulObj1.getElementsByTagName("li");
var liList2 = ulObj2.getElementsByTagName("li");
for (let i = 0; i < liList2.length; i++) {
liList2[i].setAttribute("index", i);
}
for (let i = 0; i < liList1.length; i++) {
liList1[i].onclick = function () {
for (let j = 0; j < liList2.length; j++) {
liList2[j].setAttribute("class", "");
var index = liList2[j].getAttribute("index");
// console.log(i, index);
if (index == i) {
liList2[j].className = "active";
}
}
};
}
</script>
</html>
```

2、购物车
要求:
- 点击全选按钮,选中所有商品
- 点击数量加号,数量加一,出现减号,小计累加
- 减号同理
- 点击删除,删除此行商品
- 选中的商品都会在最后的总金额更新。
```html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>原生JS实现购物车结算功能代码</title>
<link rel="stylesheet" href="../css/style.css" />
</head>
<body>
<div class="catbox">
<table id="cartTable">
<thead>
<tr>
<th><label>
<input class="check-all check" type="checkbox" /> 全选</label></th>
<th>商品</th>
<th>单价</th>
<th>数量</th>
<th>小计</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td class="checkbox"><input class="check-one check" type="checkbox" /></td>
<td class="goods"><img src="../images/1.jpg" alt="" /><span>Casio/卡西欧 EX-TR350</span></td>
<td class="price">5999.88</td>
<td class="count"><span class="reduce"></span>
<input class="count-input" type="text" value="1" />
<span class="add">+</span></td>
<td class="subtotal">5999.88</td>
<td class="operation"><span class="delete">删除</span></td>
</tr>
<tr>
<td class="checkbox"><input class="check-one check" type="checkbox" /></td>
<td class="goods"><img src="../images/2.jpg" alt="" /><span>Canon/佳能 PowerShot SX50 HS</span></td>
<td class="price">3888.50</td>
<td class="count"><span class="reduce"></span>
<input class="count-input" type="text" value="1" />
<span class="add">+</span></td>
<td class="subtotal">3888.50</td>
<td class="operation"><span class="delete">删除</span></td>
</tr>
<tr>
<td class="checkbox"><input class="check-one check" type="checkbox" /></td>
<td class="goods"><img src="../images/3.jpg" alt="" /><span>Sony/索尼 DSC-WX300</span></td>
<td class="price">1428.50</td>
<td class="count"><span class="reduce"></span>
<input class="count-input" type="text" value="1" />
<span class="add">+</span></td>
<td class="subtotal">1428.50</td>
<td class="operation"><span class="delete">删除</span></td>
</tr>
<tr>
<td class="checkbox"><input class="check-one check" type="checkbox" /></td>
<td class="goods"><img src="../images/4.jpg" alt="" /><span>Fujifilm/富士 instax mini 25</span></td>
<td class="price">640.60</td>
<td class="count">
<span class="reduce"></span>
<input class="count-input" type="text" value="1" />
<span class="add">+</span></td>
<td class="subtotal">640.60</td>
<td class="operation"><span class="delete">删除</span></td>
</tr>
</tbody>
</table>
<div class="foot" id="foot">
<label class="fl select-all"><input type="checkbox" class="check-all check" /> 全选</label>
<a class="fl delete" id="deleteAll" href="javascript:;">删除</a>
<div class="fr closing" onclick="getTotal();">结 算</div>
<input type="hidden" id="cartTotalPrice" />
<div class="fr total">合计:¥<span id="priceTotal">0.00</span></div>
<div class="fr selected" id="selected">已选商品<span id="selectedTotal">0</span>件<span class="arrow up">︽</span><span
class="arrow down">︾</span></div>
<div class="selected-view">
<div id="selectedViewList" class="clearfix">
<div><img src="../images/1.jpg"><span>取消选择</span></div>
</div>
<span class="arrow">◆<span>◆</span></span>
</div>
</div>
</div>
</body>
<script src="../js/daotin.js"></script>
<script>
var checkAllList = document.getElementsByClassName("check-all");
var checkOne = document.getElementsByClassName("check-one");
var addList = document.getElementsByClassName("add");
var selectedTotalObj = document.getElementById("selectedTotal");
var subtotalObj = document.getElementsByClassName("subtotal");
var priceTotalObj = document.getElementById("priceTotal");
var countInputObj = document.getElementsByClassName("count-input");
var deleteList = document.getElementsByClassName("delete");
var deleteAll = document.getElementById("deleteAll");
var reduceList = document.getElementsByClassName("reduce");
var choiceArr = [];
var choiceNum = checkOne.length;
var choiceTotalPrice = 0;
function choiceCount() {
choiceNum = checkOne.length;
choiceTotalPrice = 0;
var choiceObj = {};
for (let i = 0; i < checkOne.length; i++) {
if (!checkOne[i].checked) {
choiceNum--;
} else {
choiceTotalPrice += checkOne[i].parentElement.parentElement.getElementsByClassName("subtotal")[0].innerHTML *
1;
}
}
selectedTotalObj.innerHTML = choiceNum;
priceTotalObj.innerHTML = choiceTotalPrice.toFixed(2);
console.log(choiceNum);
console.log(choiceTotalPrice.toFixed(2));
};
var checkCount = 0;
var choiceFlag = false;
for (let i = 0; i < checkAllList.length; i++) {
checkAllList[i].onclick = function () {
if (this.checked) {
checkCount = checkOne.length;
for (let i = 0; i < checkAllList.length; i++) {
checkAllList[i].checked = true;
choiceFlag = true;
}
} else {
checkCount = 0;
for (let i = 0; i < checkAllList.length; i++) {
checkAllList[i].checked = false;
choiceFlag = false;
}
}
if (choiceFlag) {
for (let i = 0; i < checkOne.length; i++) {
checkOne[i].checked = choiceFlag;
}
} else {
for (let i = 0; i < checkOne.length; i++) {
checkOne[i].checked = choiceFlag;
}
}
choiceCount();
};
}
for (let i = 0; i < checkOne.length; i++) {
checkOne[i].onclick = function () {
if (this.checked) {
checkCount++;
} else {
checkCount--;
}
if (checkCount == checkOne.length) {
for (let i = 0; i < checkAllList.length; i++) {
checkAllList[i].checked = true;
}
} else {
for (let i = 0; i < checkAllList.length; i++) {
checkAllList[i].checked = false;
}
}
choiceCount();
};
}
// for (let i = 0; i < countInputObj.length; i++) {
// selectedTotalObj.innerHTML = selectedTotalObj.innerHTML * 1 + countInputObj[i].value * 1;
// }
// selectedTotalObj.innerHTML = choiceCount().num;
// priceTotalObj.innerHTML = choiceCount().price.toFixed(2);
for (let i = 0; i < addList.length; i++) {
addList[i].onclick = function () {
let numObj = this.previousElementSibling || this.previousSibling;
let subObj = numObj.previousElementSibling || numObj.previousSibling;
let addFatherObj = this.parentElement;
let unitPriceObj = addFatherObj.previousElementSibling || addFatherObj.previousSibling;
let totalPriceObj = addFatherObj.nextElementSibling || addFatherObj.nextSibling;
numObj.value = numObj.value * 1 + 1;
totalPriceObj.innerHTML = (unitPriceObj.innerHTML * numObj.value).toFixed(2);
priceTotalObj.innerHTML = (priceTotalObj.innerHTML * 1 + totalPriceObj.innerHTML * 1).toFixed(2);
if (numObj.value > 1) {
subObj.innerHTML = "-";
}
choiceCount();
// subObj.onclick = function () {
// numObj.value = numObj.value * 1 - 1;
// // console.log("subObj.onclick:" + numObj.value);
// if (numObj.value <= 1) {
// numObj.value = 1;
// this.innerHTML = "";
// this.onclick = null;
// }
// totalPriceObj.innerHTML = (unitPriceObj.innerHTML * numObj.value).toFixed(2);
// // priceTotalObj.innerHTML = (priceTotalObj.innerHTML * 1 - totalPriceObj.innerHTML * 1).toFixed(2);
// choiceCount();
// };
};
}
for (let i = 0; i < reduceList.length; i++) {
reduceList[i].onclick = function () {
let numObj = this.nextElementSibling || this.nextSibling;
var unitPriceObj = this.parentElement.previousElementSibling;
var totalPriceObj = this.parentElement.nextElementSibling;
if (numObj.value == 1) {
this.innerHTML = "";
// this.onclick = null;
return;
}
numObj.value = numObj.value * 1 - 1;
totalPriceObj.innerHTML = (unitPriceObj.innerHTML * numObj.value).toFixed(2);
choiceCount();
};
}
for (let i = 0; i < deleteList.length; i++) {
deleteList[i].onclick = function () {
this.parentElement.parentElement.remove();
choiceCount();
};
}
</script>
</html>
```

3、动态留言板
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>作业</title>
<style>
html,
body {
width: 100%;
height: 100%;
position: relative;
/* background-color: #ccc; */
}
.tr {
width: 400px;
/* padding: 20px; */
/* height: 100px; */
border: 1px solid red;
box-sizing: border-box;
margin: 10px 0;
}
.tr p:first-child {
color: blue;
}
.tr p:last-child {
background-color: yellow;
}
.tr button {
float: right;
}
.shadow {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(123, 123, 123, 0.5);
display: table;
display: none;
}
#reply {
width: 400px;
height: 400px;
display: table-cell;
vertical-align: middle;
text-align: center;
}
</style>
</head>
<body>
<div id="header">
<input id="msg" placeholder="请输入留言">
<button id="btn">留言</button>
</div>
<div id="content">
</div>
<div class="shadow">
<div id="reply">
<textarea cols="30" rows="10"></textarea><br>
<button>回复</button>
</div>
</div>
</body>
<script src="../js/daotin.js"></script>
<script>
var inpObj = $("#msg");
var btn = $("#btn");
var content = $("#content");
var childBtn = content.getElementsByTagName("button");
// console.log(childBtn);
var shadowObj = $(".shadow");
var replyInp = $("textarea", shadowObj);
var replyBtn = $("button", shadowObj);
btn.onclick = function () {
if (inpObj.value != "") {
var newDiv = document.createElement("div");
newDiv.className = "tr";
content.appendChild(newDiv);
var newPtime = document.createElement("p");
var newPcon = document.createElement("p");
newPtime.innerHTML = dateFormat(new Date(), "yyyy-mm-dd hh:mm:ss");
newPcon.innerHTML = inpObj.value + "<button>回复</button>";
newDiv.appendChild(newPtime);
newDiv.appendChild(newPcon);
inpObj.value = "";
this.disabled = true;
this.innerHTML = "还有 3s 可以点击";
var count = 3;
btn.timer = setInterval(function () {
// console.log(btn.value);
count--;
btn.innerHTML = "还有 " + count + "s 可以点击";
if (count == 0) {
clearInterval(btn.timer);
count = 5;
btn.disabled = false;
btn.innerHTML = "回复";
}
}, 1000);
}
for (var i = 0; i < childBtn.length; i++) {
let item = childBtn[i];
item.onclick = function () {
shadowObj.style.display = "table";
document.body.style.backgroundColor = "#ccc";
replyBtn.onclick = function () {
if (replyInp.value != "") {
var newP = document.createElement("p");
newP.innerHTML = replyInp.value;
// console.log(item);
item.parentNode.appendChild(newP);
shadowObj.style.display = "none";
document.body.style.backgroundColor = "";
replyInp.value = "";
}
};
};
}
};
</script>
</html>
```
 | Daotin/Web/03-JavaScript/02-DOM/案例03:选项卡,购物车.md/0 | {
"file_path": "Daotin/Web/03-JavaScript/02-DOM/案例03:选项卡,购物车.md",
"repo_id": "Daotin",
"token_count": 9097
} | 15 |
function my$(id) {
return document.getElementById(id);
}
// 设置任意标签的文本内容为任意内容
function setInnerText(element, text) {
(typeof element.TextContent === "undefined") ? (element.innerText = text) : (element.textContent = text);
}
// 获取任意标签的文本内容
function getInnerText(element) {
return typeof element.TextContent === "undefined" ? element.innerText : element.textContent;
}
// 获取任意一个父元素的第一个子元素
function getFirstElement(element) {
if(element.firstElementChild) {
return element.firstElementChild;
} else { // 主要考虑到多个文本节点的影响
var node = element.firstChild;
while((node) && (node.nodeType !== 1)) {
node = node.nextSibling;
}
return node;
}
}
// 获取任意一个父元素的最后一个子元素
function getLastElement(element) {
if(element.lastElementChild) {
return element.lastElementChild;
} else { // 主要考虑到多个文本节点的影响
var node = element.lastChild;
while((node) && (node.nodeType !== 1)) {
node = node.previousSibling;
}
return node;
}
}
// 获取任意一个元素的前一个兄弟元素
function getPreviousElement(element) {
if(element.previousElementSibling) {
return element.previousElementSibling;
} else { // 主要考虑到多个文本节点的影响
var node = element.previousSibling;
while((node) && (node.nodeType !== 1)) {
node = node.previousSibling;
}
return node;
}
}
// 获取任意一个元素的后一个兄弟元素
function getNextElement(element) {
if(element.nextElementSibling) {
return element.nextElementSibling;
} else { // 主要考虑到多个文本节点的影响
var node = element.nextSibling;
while((node) && (node.nodeType !== 1)) {
node = node.nextSibling;
}
return node;
}
}
// 为任意元素绑定任意事件
function addAnyEventListener(element, type, func) {
if(element.addEventListener) {
element.addEventListener(type, func, false);
} else if(element.attachEvent) {
element.attachEvent("on"+type, func);
} else {
element["on"+type] = func;
}
}
// 为任意元素解绑任意事件
function removeAnyEventListener(element, type, funcName) {
if(element.removeEventListener) {
element.removeEventListener(type, funcName, false);
} else if(element.detachEvent) {
element.detachEvent("on"+type, funcName);
} else {
element["on"+type] = null;
}
}
// 获取浏览器滑动栏向上向左卷曲的距离
function getScroll() {
return {
left: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0,
top: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0
};
}
// // 封装动画移动函数
// function animation(element, target) {
// clearInterval(element.timeId); // 每次调用函数就清理之前的timeId
// // 判断当前的位置
// var current = element.offsetLeft;
// var onestep = 7;
// element.timeId = setInterval(function () {
// current += current < target ? onestep : -onestep;
// if (Math.abs(current - target) >= onestep) {
// element.style.left = current + "px";
// } else {
// clearInterval(element.timeId);
// element.style.left = target + "px";
// }
// // 测试代码
// console.log("target="+target+", current="+current+", step="+onestep);
// }, 10);
// }
// 获取任意元素的任意一个属性值
function getStyle(element, attr) {
return window.getComputedStyle ?
window.getComputedStyle(element, null)[attr] :
element.currentStyle[attr];
}
// element --- 任意元素
// attr ---- 任意属性名字
// target ---目标位置
function animation(element, json, fn) {
clearInterval(element.timeId); // 每次调用函数就清理之前的timeId
// 判断当前的位置
element.timeId = setInterval(function () {
var flag = true;
for (var attr in json) {
// 判断attr是不是层级zIndex
if (attr === "zIndex") {
element.style[attr] = json[attr];
} else if (attr === "opacity") { // 判断attr是不是透明度opacity
// 获取当前透明度*100,方便计算
var current = getStyle(element, attr) * 100;
// 目标透明度也*100
var target = json[attr] * 100;
var onestep = (target - current) / 10;
onestep = onestep > 0 ? Math.ceil(onestep) : Math.floor(onestep);
current += onestep;
element.style[attr] = current / 100;
} else { // 其他属性
var current = parseInt(getStyle(element, attr)); // 获取任意元素的任意一个属性值
var target = json[attr];
var onestep = (target - current) / 10;
onestep = onestep > 0 ? Math.ceil(onestep) : Math.floor(onestep);
current += onestep;
element.style[attr] = current + "px";
}
// 保证所有属性都达到目标才清理定时器
if (target !== current) {
flag = false;
}
}
if (flag) {
clearInterval(element.timeId);
if (fn) {
fn();
}
}
// 测试代码
console.log("target="+target+", current="+current+", step="+onestep);
}, 20);
}
// 封装通用事件位置相关对象
var evt = {
// 获取通用事件对象
getEvent: function (e) {
return window.event||e;
},
// 获取通用 ClientX
getClientX: function (e) {
return this.getEvent(e).clientX;
},
// 获取通用 ClientY
getClientY: function (e) {
return this.getEvent(e).clientY;
},
// 获取通用 scrollLeft
getScrollLeft: function () {
return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
},
// 获取通用 scrollTop
getScrollTop: function () {
return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
},
// 获取通用 pageX
getPageX: function (e) {
return this.getEvent(e).pageX?this.getEvent(e).pageX:this.getClientX(e)+this.getScrollLeft();
},
// 获取通用 pageY
getPageY: function (e) {
return this.getEvent(e).pageY?this.getEvent(e).pageY:this.getClientY(e)+this.getScrollTop();
}
};
| Daotin/Web/03-JavaScript/04-JavaScript高级知识/案例源码/贪吃蛇/common.js/0 | {
"file_path": "Daotin/Web/03-JavaScript/04-JavaScript高级知识/案例源码/贪吃蛇/common.js",
"repo_id": "Daotin",
"token_count": 3364
} | 16 |
## 1、基本结构
- 所有PHP代码都要写到 `<?php ... ?>` 里面。
- 在PHP代码开头写上`@header("content-type:text/html;charset=utf8");` 可以支持中文格式。
- PHP文件可以和 HTML 文件结合进行使用。
- PHP文件的默认扩展名是 ".php"。
- **PHP代码必须在服务器上执行。**
- PHP可以引入其他的PHP代码:`@require_once("其他php文件的路径")` // @ 可加可不加。
- `@header("Access-Control-Allow-Origin:*");`// 允许所有网站访问此php文件
- `@header("Access-Control-Allow-Origin:http://localhost:63342");`//允许http://localhost:63342网站访问此php文件
## 2、打印语句
**echo**: 的作用在页面中输出字符串(只能打印字符串,数字等简单类型)
**print_r** :输出复杂类型
**var_dump** :输出复杂类型
```php
<?php
echo "hello Daotin.";
echo "<br>";
echo 123;
echo "<br>";
print_r([1,2,3,4,5]);
echo "<br>";
var_dump([1,2,3,4,5]);
?>
```
打印结果:
```
hello Daotin.
123
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )
array (size=5)
0 => int 1
1 => int 2
2 => int 3
3 => int 4
4 => int 5
```
## 3、变量的声明和使用
变量的声明和使用都需要加 "$" 符号。
```php
// 声明一个字符串
$str = "Hello";
echo $str;
// 声明一个数组
$arr = array("a", "b", "b");
// 声明一个字符界(类似块字符串的赶脚)
// 1)在变量后面的等号写三个小于号(<<<)。
// 2)然后在<<<后面写上字符(建议英文大写字符)。如下例中的:ABC
// 3)然后换行写上任意想写的字符
// 4)写完后,顶行。在行最开始处,再写上<<<后面的字符和分号。如下例中的:ABC;
$str1 = <<< ABC
我愿变成童话里,
你爱的那个天使。
ABC;
echo "$str1";
```
> **单引号和双引号你的区别:**
>
> - 双引号解析变量,但是单引号不解析。
> - 在双引号里面插入变量,变量后面如果有英文或中文字符,它会把这个字符和变量拼接起来,视为一
> 整个变量。一定要在变量后面接上特殊字符,例如空格等分开。
> - 如果在双引号里面插变量的时候,后面不想有空格,可以**拿大括号将变量包起来**。
> - 双引号解析转义字符,单引号不解析转义字符。但,单引号能解析\\' 和\
> - 单引号效率高于双引号,尽可能使用单引号(双引号需要解析变量,因此双引号的效率没有单引号高)。
> - 双引号和单引号可以互插!!!双引号当中插入单引号,单引号当中插入变量,这个变量会被解析,但是单引号也会显示出来。
> - 字符界声明字符串将被视为双引号一样的功能来看待。
## 4、字符串的拼接
字符串的拼接不是使用 "+",而是使用 "."
```php
$str1 = "Hello";
$str2 = "World";
echo $str1 . " " . $str2;
```
## 5、PHP的执行原理
浏览器是不识别 PHP 文件的,用浏览器发开 PHP 文件,只会显示 PHP 的源代码,所以 PHP 文件必须在服务器中执行。其实 apache 服务器也识别不了 PHP 文件,是 apache 将 PHP 文件再交给 PHP 模块处理的,最后 apache 将处理之后的网页内容返回。
## 6、数组
**一维数组的定义:**
```php
$arr = array();
$arr[0] = "10";
$arr[1] = "20";
$arr[2] = "30";
// 数组定义后赋值的时候可以不写下标,那么默认下标从0开始递增。
$arr = array();
$arr[] = "1";
$arr[] = "2";
$arr[] = "3";
print_r($arr); // Array ( [0] => "1" [1] => "2" [2] => "3" )
```
或者
```php
$arr = array("10", "20", "30");
```
注意:数组是复杂类型,不能使用 echo 直接打印,只能打印其中的某个元素,复杂类型使用 print_r 或者 var_dump。
示例:
```php
$arr1 = array();
$arr1[0] = "10";
$arr1[1] = "20";
$arr1[2] = "30";
$arr2 = array("40", "50", "60");
// echo $arr1; // 不能直接打印数组
print_r($arr1);
var_dump($arr2);
echo json_encode($arr1); // 将数组转化成 json 格式打印,转化后是 字符串格式,可以使用echo。
```
打印结果:
```
Array ( [0] => 10 [1] => 20 [2] => 30 )
array (size=3)
0 => string '40' (length=2)
1 => string '50' (length=2)
2 => string '60' (length=2)
["10","20","30"]
```
**数组的下标索引自定义**
```php
$arr = array("index1"=>"40", "index2"=>"50", "index3"=>"60");
print_r($arr);
```
或者只自定义其中几个:
```php
$arr = array("40", "index"=>"50", "60");
print_r($arr);
```
此时 "40" 的下标为 0, "60" 的下标为1。
自定义所以的方式不可以使用 for 循环遍历数组,因为其下标已经不是 0,1,2 了。
要使用 foreach 的方式。(key 为索引,value 为索引对应的值)
```php
foreach($arr as $key => $value) {
echo $key . "---" . $value . "<br>";
}
```
**数组转对象:**
只需要将数组的小标改为字符串即可。
```php
$arr = array();
$arr["name"] = "daotin";
$arr["age"] = 18;
echo json_encode($arr); // {"name":"daotin","age":18}
```
**二维数组的定义:**
```php
$arr = array();
$arr[0] = array("1", "2", "3");
$arr[1] = array("4", "5", "6");
var_dump($arr);
echo json_encode($arr);
```
打印结果:
```
array (size=2)
0 =>
array (size=3)
0 => string '1' (length=1)
1 => string '2' (length=1)
2 => string '3' (length=1)
1 =>
array (size=3)
0 => string '4' (length=1)
1 => string '5' (length=1)
2 => string '6' (length=1)
[["1","2","3"],["4","5","6"]]
```
## 7、函数
系统函数:比如:
`json_encode`:PHP中将数组转化为 json 格式的字符串。
`var_dump`:输出复杂的数据类型
`print_r`:输出复杂的数据类型
`count`:得到数组的长度
`rand` :得到随机数。例如得到0-100的随机数:rand(0,100);
自定义函数:
和 js 类似,以 function 进行声明。
```php
function add($num1, $num2) {
return $num1 + $num2;
}
```
## 8、预定义变量
我们知道,动态网页会根据不同的需求展示不同的界面,那么是怎么做到的呢?
**请求类型**
请求的时候是需要携带参数的,用来表示不同的要求,根据参数的不同,而展示不同的界面。
根据参数携带的位置不同,可以简单把请求分为 Get 请求 和 Post 请求。
get 请求:跟在 URL 后面,用问号 "?" 连接,多个参数之间用 & 连接。
post 请求:参数在请求体中。
**获取请求参数的值**
`$_GET["属性名字"]` :获取 get 请求的属性的值。
`$_POST["属性名字"]` :获取 post 请求的属性的值。
### 8.1、get请求
示例:php 获取用户登录名和密码进行校验
```html
<!--html代码-->
<!--省略代码-->
<body>
<h1>登录界面</h1>
<form action="check.php" method="GET">
用户名:<input type="text" name="username"> <br>
密 码:<input type="password" name="passwd"> <br>
<input type="submit" value="提交">
</form>
</body>
```
```php
// php代码
<?php
$username = $_GET["username"];
$password = $_GET["passwd"];
if(($username == "Daotin") && ($password == "123")) {
echo "Login Success!";
} else {
echo "Login Failed!";
}
?>
```
> 0、在 form 表单中可以进行 get请求和 post 请求。
>
> 1、我们在输入账号密码,点击提交后,在地址栏卡可以看到:http://localhost/Login/check.php?username=Daotin&passwd=123,参数确实跟在地址之后,用? 连接,参数之间用 & 连接。
>
> 2、通过` $_GET[“参数名称” ] `可以获得请求参数的值。
### 8.2、post 请求
```html
<!--HTML主要代码-->
<h1>登录界面</h1>
<form action="check.php" method="POST">
用户名:<input type="text" name="username"> <br>
密 码:<input type="password" name="passwd"> <br>
<input type="submit" value="提交">
</form>
```
```php
<?php
$username = $_POST["username"];
$password = $_POST["passwd"];
if(($username == "Daotin") && ($password == "123")) {
echo "Login Success!";
} else {
echo "Login Failed!";
}
?>
```
> 我们在输入账号密码,点击提交后,在地址栏卡可以看到:http://localhost/Login/check.php ,不再显示请求参数。
**get 请求和 post 请求的区别:**
1、get 请求会把请求参数放在 URL 中,而 post 请求则放在请求体中,post 请求更安全。
2、所以,一般get请求是获取服务器的数据,post 请求是向服务器提交一些数据。
| Daotin/Web/05-PHP&数据库/03-PHP基础语法.md/0 | {
"file_path": "Daotin/Web/05-PHP&数据库/03-PHP基础语法.md",
"repo_id": "Daotin",
"token_count": 5364
} | 17 |
## 一、单位em与rem
`em`:就是一种长度单位,它是**参照当前元素的字号,如果没有设置,就参照父容器,一直到当前浏览器的默认字号。**
比如:当前浏览器默认字体大小为 16px,则 1em = 16px;
`rem`:css3新增的一种长度单位,它是**参照根元素(html)的字号**。
比如:当前浏览器默认字体大小为 16px,而 html 的字号为 20px,则 1rem = 20px;
**em 是相对长度单位(参照父元素)**,其参照当前元素字号大小,如果当前元素未设置字号则会继承其祖先元素字号大小。
例如:` .box {font-size: 16px;}` 则 1em = 16px
`.box {font-size: 32px;} `则 1em = 32px,0.5em = 16px
**rem 相对长度单位(参照 html 元素)**,其参照根元素(html)字号大小。
例如 :`html {font-size: 16px;}` 则 1rem = 16px
`html {font-size: 32px;}` 则 1rem = 32px,0.5rem = 16px.
**vw:viewport width,视口宽度** (1vw = 1%视口宽度)
**vh:viewport height 视口高度** (1vh = 1%视口高度)
## 二、rem 的使用
一般情况下,美工给前端的移动端 UI 图的尺寸一般为 **640px** 和 **750px**。之后我们要设计的移动端的大小可能是 320px(iPhone5),375px(iPhone6),414px(iPhone6plus)等。
那么如何等比例的在这些移动端上进行一些元素布局的设计呢?
可以使用 em 吗?不好,不同浏览器可能默认字号大小不同,如果使用者对元素没有设置字号大小的话,就会参考父元素,可能一直到浏览器的默认字号大小。这样的话,可能不同的浏览器 1em 的大小不同。
所以,一般来说在移动端大多使用 rem 作为单位。
如何使用呢?
我们以 640px 的 UI 为例。**一般我们把 640px 的 UI 分成 20份,那么每一份的大小为 32px。**
那么 **750px 的 UI 分成 20份,那么每一份的大小为 37.5px。**
如何我们要在 320px 的屏幕上进行缩放的话,我们也将 320px 分成 20 份,每一份为 16px。
这时,我们想把 UI 上面一个 160px*160px 的矩形,缩放到 320px 的屏幕上的话,160 是占 UI 的5份,那么在 320px 上的矩形也应该占 16px 的 5 份。

所以,这个矩形在 320px 上的长度应该为:`160/32 * 16px `,如何把 16px 换成 rem ?
rem 是按照 html 的字号决定的,那么我们可以这样做,我们先根据屏幕的大小,设置 html 的字号:
```css
@media screen and (device-width: 320px) {
html {
font-size: 16px;
}
}
@media screen and (device-width: 360px) {
html {
font-size: 18px;
}
}
@media screen and (device-width: 375px) {
html {
font-size: 18.75px;
}
}
@media screen and (device-width: 414px) {
html {
font-size: 20.07px;
}
}
```
之后,我们的代码可以改为:`160/32 rem` ,那么这份代码在不同屏幕的浏览器下,就有相应的大小,以保持不同屏幕下的不同缩放尺寸。
> 常见手机屏幕尺寸大全:https://strerr.com/screen.html
## 三、通用使用步骤
**1、设置各种屏幕尺寸下的 HTML 的字号大小。**
```css
@media screen and (device-width: 320px) {
html {
font-size: 16px;
}
}
@media screen and (device-width: 360px) {
html {
font-size: 18px;
}
}
@media screen and (device-width: 375px) {
html {
font-size: 18.75px;
}
}
@media screen and (device-width: 414px) {
html {
font-size: 20.07px;
}
}
```
**2、将 UI 下各个元素,不论是元素还是边距,边框等值全部除以每一份的大小,单位为 rem 即可得到在不同屏幕下的不同缩放大小。**
比如:640px 的 UI,设置为:`元素等/32 rem;`
750px 的 UI,设置为:`元素等/37.5 rem;`
示例:
```less
// UI稿件为640px
.item{
height:218/32rem;
border: 3/32rem dashed #dedede;
background-color: #fff;
padding-top:36/32rem;
font-size: 104/32rem;
box-sizing: border-box;
a{
color: #aeaeae;
text-align: center;
}
span{
font-size: 26/32rem;
display: block;
margin-top:16/32rem;
}
}
```
> Tips:把 rem 理解成`份` 的意思更好理解,你在640px上占多少份,在实际的屏幕上就占多少份。
## 移动端适配补充(2021-07-22)
我们可以看到,我们在书写的时候每次这样除以一个32或者37.5还挺难看的,而且css还不能使用,在less或者sass这种css处理器上才可以使用除号:
```less
{
height:218/32rem;
border: 3/32rem dashed #dedede;
padding-top:36/32rem;
font-size: 104/32rem;
}
```
```less
{
height:218/37.5rem;
border: 3/37.5rem dashed #dedede;
padding-top:36/37.5rem;
font-size: 104/37.5rem;
}
```
所以,为了兼容css,也为了好看,我们就不要分成20份了,我们可以把640px的UI分成`6.4`份,把750px的UI分成`7.5`份,这样每一份的大小都是`100px`。
以后就不需要写成`36/37.5rem;` 的形式,而是 `0.36rem` 的形式,是不是好看多了。
但是要注意,媒体查询需要变一下:
```css
// 对于640px的UI
@media screen and (device-width: 320px) {
html {
font-size: 50px; // 320÷6.4
}
}
@media screen and (device-width: 360px) {
html {
font-size: 56.25px; // 360÷6.4
}
}
// 对于750px的UI
@media screen and (device-width: 320px) {
html {
font-size: 42.67px; // 320÷7.5
}
}
@media screen and (device-width: 360px) {
html {
font-size: 48px; // 360÷7.5
}
}
```
**继续改进:**
从上文看出,为了适配320px,360px,375px等等尺寸的屏幕,我们需要写多个媒体查询,而且还没有做到连续,只是挑选出了几个经典的尺寸进行媒体查询设置html的font-size大小,如果出现一个350px的,我们就只能使用320px的适配了。
于是,我们需要通过js动态设置不同尺寸html的font-size大小。
我们已750px的UI为例,把它分成7.5份,每一份100(100的话是为了好算)。
如果UI中有一个300px的元素的话,我们在320px的设备中应该显示多少呢?
**计算过程:**
- 300px在UI中占(300/100=3)份
- 那么在320px中也应该占3份,320px因为也是分成7.5份的,那么就应该是(320/7.5)× 3 = 128px
**写出rem形式的通用公式就是:**
- 设置 html 的 font-size: `deviceWidth/7.5`
- 在使用的时候在UI上是300px占了3份,所以320px也占3份就是:`3rem`,类比在UI上是320px就是`3.2rem` 。。。
所以,我们发现只要设置好了html的font-size后,我们只需要在使用的时候把图形**在原UI尺寸的基础上除以100,然后加上rem即可**。
那么回到上面的问题,**如何使用js动态设置 html的font-size?**
在脚本开始的时候,获取设备宽度`deviceWidth`,然后设置html的font-size大小。这样就不必写很多媒体查询了。
```js
<script type="text/javascript">
(function() {
var deviceWidth = document.documentElement.clientWidth;
deviceWidth = deviceWidth < 320 ? 320 : deviceWidth > 640 ? 640 : deviceWidth;
document.documentElement.style.fontSize = deviceWidth / 7.5 + 'px'; // 设计稿是750px
// document.documentElement.style.fontSize = deviceWidth / 6.4 + 'px'; // 设计稿是640px
})();
</script>
```
**参考链接:**
- https://juejin.cn/post/6844903721697017864
- https://www.manster.me/?p=311
| Daotin/Web/07-移动Web开发/09-em和rem.md/0 | {
"file_path": "Daotin/Web/07-移动Web开发/09-em和rem.md",
"repo_id": "Daotin",
"token_count": 4518
} | 18 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="./css/360Page.css">
<script src="./js/jquery.min.js"></script>
<script src="./js/jquery.fullPage.min.js"></script>
</head>
<body>
<div id="360Page">
<div class="section first">
<div class="logo"></div>
<div class="text">
<img src="./images/text_1.png" alt="">
<img src="./images/text_2.png" alt="">
<img src="./images/text_3.png" alt="">
<img src="./images/text_4.png" alt="">
<img src="./images/text_5.png" alt="">
<img src="./images/text_6.png" alt="">
<img src="./images/text_7.png" alt="">
<img src="./images/text_8.png" alt="">
</div>
<div class="info1"></div>
</div>
<div class="section second">
<div class="shield">
<img src="./images/shield_1.png" alt="">
<img src="./images/shield_2.png" alt="">
<img src="./images/shield_3.png" alt="">
<img src="./images/shield_4.png" alt="">
<img src="./images/shield_5.png" alt="">
<img src="./images/shield_6.png" alt="">
<img src="./images/shield_7.png" alt="">
<img src="./images/shield_8.png" alt="">
<img src="./images/shield_9.png" alt="">
</div>
<div class="info2"></div>
</div>
<div class="section third">
<div class="info3"></div>
<div class="circle">
<div class="rocket"></div>
</div>
</div>
<div class="section fourth">
<div class="search">
<div class="search-bar"></div>
<div class="search-text"></div>
<div class="search-content"></div>
</div>
<div class="info4"></div>
</div>
<!-- <div class="section fifth">
<h3>第五屏</h3>
</div> -->
</div>
</body>
<script>
$(function () {
$('#360Page').fullpage({
sectionsColor: ['#0da5d6', '#2AB561', '#DE8910', '#16BA9D', '#0DA5D6'],
afterLoad: function (anchorLink, index) {
$(".section").removeClass("current");
$(".section:eq(" + (index - 1) + ")").addClass("current");
}
});
});
</script>
</html> | Daotin/Web/07-移动Web开发/案例源码/01-仿360浏览器全屏首页/index.html/0 | {
"file_path": "Daotin/Web/07-移动Web开发/案例源码/01-仿360浏览器全屏首页/index.html",
"repo_id": "Daotin",
"token_count": 1404
} | 19 |
// Screen Readers
// -------------------------
.sr-only { .sr-only(); }
.sr-only-focusable { .sr-only-focusable(); }
| Daotin/Web/07-移动Web开发/案例源码/03-微金所/lib/font-awesome-4.7.0/less/screen-reader.less/0 | {
"file_path": "Daotin/Web/07-移动Web开发/案例源码/03-微金所/lib/font-awesome-4.7.0/less/screen-reader.less",
"repo_id": "Daotin",
"token_count": 40
} | 20 |
/*!
* Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
@import "variables";
@import "mixins";
@import "path";
@import "core";
@import "larger";
@import "fixed-width";
@import "list";
@import "bordered-pulled";
@import "animated";
@import "rotated-flipped";
@import "stacked";
@import "icons";
@import "screen-reader";
| Daotin/Web/07-移动Web开发/案例源码/03-微金所/lib/font-awesome-4.7.0/scss/font-awesome.scss/0 | {
"file_path": "Daotin/Web/07-移动Web开发/案例源码/03-微金所/lib/font-awesome-4.7.0/scss/font-awesome.scss",
"repo_id": "Daotin",
"token_count": 159
} | 21 |
## 一、json对象扩展
- 把一个Json对象转换成字符串
```js
JSON.stringify(js对象/数组);
```
- 把一个json格式的字符串转换成Json对象
```js
JSON.parse(json对象/数组);
```
示例:
```html
<script type="text/javascript">
var obj = {
name : 'Daotin',
age : 18
};
obj = JSON.stringify(obj);
console.log( typeof obj); // string
obj = JSON.parse(obj);
console.log(obj);
</script>
```
## 二、Object对象扩展
### 1、方法一
**以指定原型对象创建新的对象。**
```
Object.create(prototype, [descriptors])
```
`prototype`:指定原型对象
`descriptors`:(可选)设置创建的新的对象的新属性。
示例:
```html
<script type="text/javascript">
var Obj1 = {
userName: "Daotin"
};
var Obj2 = Object.create(Obj1);
console.log(Obj2);
</script>
```
打印结果:Obj2下面的`__proto__ `指向的原型对象中有Obj1的属性,**相当于继承了Obj1属性。**

当**为新创建的对象添加新属性**的时候:
添加的新属性要以对象的方式来添加,这个对象其中有四个属性来描述当前属性对象:
- `value` : 指定属性的值
- `writable` : 标识当前属性值是否是可修改的, 默认为false
- `configurable`: 标识当前属性是否可以被删除 默认为false
- `enumerable`: 标识当前属性是否能用for in 枚举 默认为false
```html
<script type="text/javascript">
var Obj1 = {
userName: "Daotin"
};
var Obj2 = Object.create(Obj1, {
age: {
value: 18,
writable: true,
configurable: true,
enumerable: true
}
});
console.log(Obj2);
Obj2.age = 19;
console.log(Obj2);
delete Obj2.age;
console.log(Obj2);
for (var i in Obj2) {
console.log(i);
}
</script>
```
打印结果:

### 2、方法二
```
Object.defineProperties(object, descriptors)
```
**为指定对象定义扩展多个属性.**
- `object `:指定对象
- `descriptors`:需要扩展的属性(是一个对象)。
这个属性对象同样有:value, writable,configurable,enumerable 属性。

除了这4个属性外。还有:
- `get` :用来获取当前属性的回调函数。
- `set` :修改当前属性值得触发的回调函数,并且实参即为修改后的值。

由上图可知,**直接修改对象的值是不可以的,必须设置set属性,这样在修当前属性值的时候,会自动调用 set 。类似的,在访问当前属性的时候,会自动调用 get**
### 3、方法三
对象本身的两个方法:
- `get propertyName(){}` :用来得到当前属性值的回调函数
- `set propertyName(){}` :用来监视当前属性值变化的回调函数

## 三、数组的扩展
这些扩展的方法都在 Array 的原型对象中。
```
1. Array.prototype.indexOf(value) : 得到值在数组中的第一个下标
2. Array.prototype.lastIndexOf(value) : 得到值在数组中的最后一个下标
3. Array.prototype.forEach(function(item, index){}) : 遍历数组
4. Array.prototype.map(function(item, index){}) : 遍历数组返回一个新的数组,返回加工之后的值
5. Array.prototype.filter(function(item, index){}) : 遍历过滤出一个新的子数组, 返回条件为true的值
```

| Daotin/Web/08-ES6语法/02-json对象扩展,Object对象扩展,数组扩展.md/0 | {
"file_path": "Daotin/Web/08-ES6语法/02-json对象扩展,Object对象扩展,数组扩展.md",
"repo_id": "Daotin",
"token_count": 2074
} | 22 |
## 1、Nodejs连接MongoDB数据库
Nodejs连接MongoDB数据库需要引入一个专门的模块,叫做“mongodb”。
所以先在项目引入这个模块:
```js
npm i mongodb@2.2.36 -S
```
> 这里使用mongodb模块的2.2.36版本,可能是比较稳定吧。
>
> PS:2018.12.20
>
> **不是比较稳定,而是不用这个版本,直接服务器报错,搞了一个多小时才发现。。。**
>
> `POST http://localhost:3000/xxx 500 (Internal Server Error)`
之后创建一个nodejs文件来连接mongodb,然后就可以进行数据的增删改查。
> 在此之前,首先MongoDB的服务要先启动起来。
```js
// main.js
// 引入mongodb模块,使用其中的MongoClient来连接mongodb服务器
const mc = require("mongodb").MongoClient;
//"mongodb://localhost:27017/test"
// mongodb:// :表示mongodb的协议
// localhost:27017/test:当前主机下的27017端口下的test数据库
// db:数据库对象
mc.connect("mongodb://localhost:27017/test", (err, db) => {
if (!err) {
// 通过数据库对象获取需要操作的集合
let users = db.collection("users");
// 查询数据(获取到的data是对象的集合)
users.find().toArray((error, data) => {
if (!error) {
// console.log(data);
} else {
console.log("获取users失败,原因如下:");
console.log(err);
}
});
// 计数
users.count({age: {$gt: 35}}, (err, data) => {
console.log(data);
});
// 插入数据
users.insert({user: "fengdaoting",age: 18}, (err, info) => {
if (err) {
console.log("插入数据失败");
}
});
// 修改数据
users.update({user: "daotin"}, {$set: {age: 19}}, (err, info) => {
if (err) {
console.log("修改数据失败");
}
});
// 删除数据
users.remove({user: "fengdaoting"}, (err, info) => {
if (err) {
console.log("删除数据失败");
}
})
} else {
console.log("连接数据库失败,原因如下:");
console.log(err);
}
})
```
### 2、案例:
需求:一个页面用于将商品写入数据库,另一个页面用于展示写入的商品数据,并且实现商品的分页和排序。
首先有一个商品信息登录界面:
```html
// index.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>
<div>
<form action="" id="box">
<div>
<label for="">
商品名称:<input type="text">
</label>
</div>
<div>
<label for="">
商品价格:<input type="text">
</label>
</div>
<div>
<label for="">
商品数量:<input type="text">
</label>
</div>
<input type="submit" value="录入数据">
</form>
</div>
</body>
<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$("#box").submit((e) => {
e.preventDefault();
$.ajax({
type: "get",
url: "/loadGoods",
data: {
name: $("input")[0].value,
price: $("input")[1].value,
num: $("input")[2].value
},
dataType: "json",
success: function (response) {
console.log(response);
}
});
})
</script>
</html>
```
需要一个本地服务器显示这个文件:
```js
// main.js
const http = require("http");
const url = require("url");
const router = require("./router");
http.createServer((req, res) => {
let path = url.parse(req.url, true).pathname;
path = path.substring(1);
if (router[path]) {
router[path](req, res);
} else {
if (path === "") {
res.writeHead(301, {
"Location": "/home"
})
res.end();
} else {
router["err"](req, res);
}
}
}).listen(3000, () => {
console.log("server running at http://localhost:3000");
})
```
然后用到路由 `router.js` 和`readFile.js`
```js
// router.js
const rf = require("./readFile");
const url = require("url");
const qs = require("querystring");
const cdb = require("./connectDB");
const mix = require("./mixture");
module.exports = {
home(req, res) {
out("public/index.html", req, res);
},
err(req, res) {
out("public/error.html", req, res);
},
loadGoods(req, res) {
let reqData = url.parse(req.url, true).query; //{ name: '11', price: '22', num: '33' }
// goods
let goods = cdb("goods");
goods.insert(reqData, (err, info) => {
res.writeHead(200, {
"Content-Type": "text/html; charset=utf-8"
});
if (!err) {
res.end(JSON.stringify({
code: 200,
msg: "录入成功!"
}));
} else {
res.end(JSON.stringify({
code: 500,
msg: "录入失败!"
}));
}
});
console.log("录入一件商品成功!");
},
goodslist(req, res) {
let goods = cdb("goods");
let data = url.parse(req.url, true).query;
let {
page = 1, pageSize = 5, upOrDown = 1, sortBy = "price"
} = data;
goods.find().limit(pageSize * 1).skip((page - 1) * pageSize).sort({
sortBy: upOrDown * 1
}).toArray((err, data) => {
if (!err) {
rf("public/goodslist.html", html => {
let newHtml = mix(html, data);
res.end(newHtml);
})
}
});
}
}
function out(url, req, res) {
res.writeHead(200, {
"Content-Type": "text/html; charset=utf-8"
});
rf(url, data => {
res.end(data);
});
}
```
```js
// readFile.js
const fs = require("fs");
module.exports = (url, cb, ecode = "utf-8") => {
fs.readFile(url, ecode, (err, data) => {
if (!err) {
cb(data)
}
});
}
```
既然需要录入数据,那么就需要链接MongoDB:
```js
const mc = require("mongodb").MongoClient;
let urlDB = "mongodb://localhost:27017/goodslist";
let db_g = null;
mc.connect(urlDB, (err, db) => {
if (!err) {
db_g = db;
} else {
console.log("数据库连接失败,原因如下:");
console.log(err);
}
})
// 导出db模块
module.exports = (collName) => {
return db_g.collection(collName);
}
```
然后index.html发出ajax请求录入数据,返回给前端录入成功或失败的结果。
数据要在商品列表展示,需要个商品列表:
```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>
<div>
<a href="/goodslist?page=1">第一页</a>
<a href="/goodslist?page=2">第二页</a>
<a href="/goodslist?page=3">第三页</a>
<a href="/goodslist?page=4">第四页</a>
</div>
<div>
<a href="/goodslist?sort=price&upOrDown=1">按价格升序</a>
<a href="/goodslist?sort=price&upOrDown=-1">按价格降序</a>
<a href="/goodslist?sort=num&upOrDown=1">按数量升序</a>
<a href="/goodslist?sort=name&upOrDown=1">按姓名升序</a>
</div>
<div id="box">
<div class="good">
<h3>商品名称:<span></span></h3>
<ul>
<li>商品价格:<span class="price"></span></li>
<li>商品数量:<span class="num"></span></li>
</ul>
</div>
</div>
</body>
<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
</html>
```
在路由里面访问的时候,获取其html地址和data数据,然后融合,需要`mixture.js`
```js
// mixture.js
const cheerio = require("cheerio");
module.exports = (html, data) => {
let $ = cheerio.load(html);
let box = $("#box");
let div = box.find("div");
box.empty();
data.map((item) => {
let newDiv = div.clone(false);
newDiv.find("h3 span").text(item.name);
newDiv.find(".price").text(item.price);
newDiv.find(".num").text(item.num);
box.append(newDiv);
});
return $.html();
}
```
最后加入分页,排序功能。
| Daotin/Web/10-Node.js/05-Nodejs连接MongoDB.md/0 | {
"file_path": "Daotin/Web/10-Node.js/05-Nodejs连接MongoDB.md",
"repo_id": "Daotin",
"token_count": 5238
} | 23 |
## 一、react的路由
> Tips:
>
> `import ReactDOM from 'react-dom';`
>
> `ReactDOM.render(<MyRouter />, document.getElementById('app'));`
>
> 可以直接写成下面的方式:
>
> `import { render } from 'react-dom';`
>
> `render(<MyRouter />, document.getElementById('app'));`
好了,言归正传。我们先创建Home和Goods页面。
然后再创建一个`AppRouter.js`文件。
由于用到路由,所以还需要安装路由插件:
```
npm i react-router-dom -S
```
然后在AppRouter.js中引入:
```jsx
import { BrowserRouter as Router, HashRouter, Route } from 'react-router-dom';
// 给BrowserRouter起个别名Router
```
> `BrowserRouter`:表示正常斜杠跳转的路由
>
> `HashRouter`:类似vue的带#的路由跳转
>
> `Route`:配置路由的跳转地址
如果使用HashRouter可以不做任何配置,但是如果使用正常跳转需要在在config中进行配置:
```json
devServer: {
historyApiFallback: true,
disableHostCheck: true,
},
```
上面两句话的意思是:**不管跳转的理由路径是什么,始终加载index.html文件,保证单页面应用。**
然后在AppRouter.js中进行路由跳转配置:
```jsx
import { BrowserRouter as Router, HashRouter, Route } from 'react-router-dom';
import { Home } from './Pages/Home';
import { Goods } from './Pages/Goods';
export class Router extends React.Component {
constructor() {
super();
}
render() {
return (
// BrowserRouter下面只能有一个子元素,所以用div包裹起来
// 使用Route进行路由配置。
<Router>
<div>
<Route path="/home" component={Home}></Route>
<Route path="/goods" component={Goods}></Route>
</div>
</Router>
);
}
}
```
### 1、设置dist生成的App.js为绝对路径
当我们把`<Route path="/goods" component={Goods}></Route>` 改为`<Route path="/home/goods" component={Goods}></Route>` 的时候,会报错,找不到app.js文件:
```
GET http://localhost:3000/home/app.js net::ERR_ABORTED 404 (Not Found)
```
这是因为在配置文件中设置的App.js是相对路径,我们需要把它改为绝对路径:
```json
output: {
path: __dirname + "/dist/",
filename: "app.js",
publicPath: "/"
},
devServer: {
publicPath: "/"
},
```
### 2、设置只加载一个组件
此时我们发现,Home和Goods同时加载出来了,怎么设置同时只加载一个组件呢?
添加`Switch`组件。
```jsx
import { BrowserRouter as Router, HashRouter, Route, Switch } from 'react-router-dom';
export class MyRouter extends React.Component {
constructor() {
super();
}
render() {
return (
<Router>
{/* 用 Switch 包裹需要显示的路由即可*/}
<Switch>
<Route path="/home" component={Home} />
<Route path="/home/goods" component={Goods} />
</Switch>
</Router>
);
}
}
```
### 3、设置严格匹配
此时不管是`/home`还是`/home/goods`都只加载的Home组件,原因是路由匹配默认是只要开头匹配到就显示,不再往后面匹配,如何设置严格匹配?
使用`exact={true}`设置严格匹配模式。
```jsx
<Route path="/home" exact={true} component={Home} />
<Route path="/home/goods" exact={true} component={Goods} />
```
### 4、设置自动跳转
刚开启服务打开浏览器的时候,默认不会显示任何东西,我们希望自动跳转到/home路由如何设置?
```jsx
import { BrowserRouter as Router, HashRouter, Route, Switch, Redirect} from 'react-router-dom';
<Switch>
{/* 在根路径下自动跳转到home页 */}
<Redirect path="/" exact={true} to="/home" />
<Route path="/home" exact={true} component={Home} />
<Route path="/home/goods" exact={true} component={Goods} />
</Switch>
```
### 5、设置link跳转
设置类似vue的router-link点击后跳转的方式:
```jsx
import { Link } from "react-router-dom";
<Link to="/home/goods" >跳转到goods页</Link>
```
也可以写成对象的方式:
```jsx
<Link to={{ pathname: '/home/goods', search: '?goodsid=8' }} >跳转到goods页</Link>
<Link to={{ pathname: '/home/goods?goodsid=8' }} >跳转到goods页</Link>
```
如果想让Link跳转之后不能后退的话,可以加一个`replace={true}`
```jsx
<Link replace={true} to={{ pathname: '/home/goods?goodsid=8' }} >跳转到goods页</Link>
```
**实现Link选中样式效果:**
react不能像vue那样,直接加class属性,react需要注意两点:
> 1、不能在Link上面添加,只能在`NavLink`上面添加类样式。
>
> 2、类样式名不叫 active-class,而是 `activeClassName`.
```jsx
import { Link, Route, Switch, NavLink } from "react-router-dom";
<NavLink activeClassName="active" to="/goods" >跳转到goods页</NavLink>
```
### 6、多视图路由
react的路由匹配采用分布式路由,即**不需要一个单独的文件来书写路由匹配规则,而是直接写在路由上。**
多视图路由就是:一次显示多个路由匹配的组件。
其实不加`Switch`的方式就是多视图路由,所有的Route路由匹配到的都会显示出来。
而严格模式只是确定多视图路由中视图是否显示而已。匹配不到就不显示,但是那个坑还在的。
### 7、路由嵌套
只需要在组件中继续写`Route`即可,这个路由就是子路由。
如我们在Home下嵌套A.js。
```jsx
import { Link, Route } from "react-router-dom";
import { A } from './A'
export class Home extends React.Component {
constructor() {
super();
}
render() {
return (
<div>
<h4>首页</h4>
<Link to={{ pathname: '/home/goods', search: '?goodsid=8' }} >跳转到goods页</Link>
{/* 添加子路由A */}
<Route pathname="/home/a" component={A} />
</div>
);
}
}
```
> 需要注意的是:子路由的 pathname 一定是绝对路径。
### 8、编程式导航
什么是编程式导航?说人话就是js代码触发路由跳转,而不是在标签中设置路由跳转。
举例:在Home页点击按钮,跳转到Goods页。
```jsx
// Home.js
export class Home extends React.Component {
constructor() {
super();
this.goGoods = this.goGoods.bind(this);
}
goGoods() {
// 使用push或者replace跳转
this.props.history.push('/goods');
}
render() {
return (
<div>
<button onClick={this.goGoods}>跳转到Goods</button>
</div>
);
}
}
```
> 注意:
>
> 1、并不是所有组件的`this.props`所有history属性。只有当前的组件是**通过路由加载出来**的(也就是通过`<Route path="/home" exact={true} component={Home} />`加载出来)才会有history属性。
>
> 2、如果不是通过路由加载出来的组件,但是想要编程式导航怎么办?**可以由它的父组件传递`this.props.history`过来。如果它父组件有的话**。
>
> 比如:Home组件下加载Box组件,Home组件给Box组件传递参数。
>
> `<Box history={this.props.history}>`
>
> 此时,Box的`this.props`就有了history属性了。
### 9、路由传参
示例:点击goods列表,传递id给detail组件。
#### 9.1、问号传参
```jsx
//goods.js
import { Link } from 'react-router-dom'
export class Goods extends React.Component {
constructor() {
super();
this.state = {
goodsList: [
{ goodsId: 1, name: 'AAA', price: 12 },
{ goodsId: 2, name: 'BBB', price: 42 },
{ goodsId: 3, name: 'CCC', price: 54 },
]
}
}
render() {
let list = this.state.goodsList.map(item => {
return (
// 问号传参
<Link to={`/detail?id=${item.goodsId}`} key={item.goodsId}>
<h3>名称:{item.name}</h3>
<p>价格:{item.price}</p>
</Link>
);
});
return (
<div>
{list}
</div >
);
}
}
```
在detail组件,在组件加载完毕后接收:
> 问号传参传递过来的数据存放在:`this.props.location.search`
```jsx
// detail.js
import url from 'url';
componentDidMount() {
// 问号传参:获取传递过来的id
let { id } = url.parse(this.props.location.search, true).query;
console.log(id);
}
```
> 由于在webpack可以使用node的一些插件,比如url,可以方便获取到`this.props.location.search`中的id值,而不需要自己解析。
#### 9.2、路径传参
首先要在路由配置:
```jsx
<Route path="/detail/:goodsid" exact={true} component={Detail} />
```
然后在goods.js里面和问号传参基本一致,只是问号改成了路径。
```jsx
<Link to={`/detail/${item.goodsId}`} key={item.goodsId}>
<h3>名称:{item.name}</h3>
<p>价格:{item.price}</p>
</Link>
```
在detail.js加载完成接收:
> 路径传参传递的数据存放在:`this.props.match.params`
```jsx
componentDidMount() {
// 路径传参:获取传递过来的id
console.log(this.props.match.params);
}
```
#### 9.3、state传参
如果要传递大量数据,使用`state`进行传递,这种传递的方式**不会在地址栏显示。**
```
{ pathname: `/detail/${item.goodsId}`, state: { name: item.name, price: item.price } }
```
> 这种state传参的写法,需要注意to的值不再是字符串拼接,而是一个对象。
接收还是在detail加载后接收:
其state内容存在于:`this.props.location.state`
```jsx
componentDidMount() {
// state大量数据传递
console.log(this.props.location.state);
}
```
> 注意:state传参不适合详情页,因为无法分享给别人查看相同的内容。
| Daotin/Web/13-React/04-react路由.md/0 | {
"file_path": "Daotin/Web/13-React/04-react路由.md",
"repo_id": "Daotin",
"token_count": 5883
} | 24 |
## 一、Angular中的路由
在创建项目的时候使用`--routing`参数可以使得项目自带路由模块。
```
ng new angularRouter --routing
```
生成的项目中有一个`app-routing.module.ts` 文件就是路由配置文件。
为了测试方便,创建Home和Goods,Detail页面:
```
ng g c pages/Home
ng g c pages/Goods
ng g c pages/Detail
```
路由配置:
```typescript
import { HomeComponent } from './pages/home/home.component';
import { GoodsComponent } from './pages/goods/goods.component';
import { DetailComponent } from './pages/detail/detail.component';
const routes: Routes = [
{
path: '',
redirectTo: '/home',
pathMatch: 'full'
},
{
path: 'home',
component: HomeComponent,
children : [
{
path : "a",
component : AComponent
}
]
},
{
path: 'goods',
component: GoodsComponent
},
{
path: 'detail',
component: DetailComponent
},
// 路由不存在时匹配
{
path: '**',
component: PageNotFoundComponent
}
];
```
> 注意:
>
> 1、路径不加 `/`
>
> 2、路由不存在时匹配`**` 跳转到404页面。
>
> 3、重定位`redirectTo: '/home',`
>
> 4、pathmatch中的“full”,代表的是当path中是空时,redirectTo会转向主页的路径上
## 二、路由跳转
### 1、标签跳转
在主组件中点击a标签跳转到Home组件和Goods组件。
```html
<!-- app.component.html -->
<a [routerLink]="[ '/' ]">首页</a>
<a [routerLink]="[ '/goods' ]">商品详情页</a>
```
> 路由跳转:`[routerLink]="[ '/' ]`
>
> 第一个[]表示routerLink是可变的,路由也是数组,是为了在数组的第二个参数添加参数,比如跳转到详情页需要传入商品id。
### 2、编程式导航
在控制器(ts文件的类中)中,通过js跳转需要进行两步:
第一步: 在构造函数中声明 Router实例
例如: constructor(private xxx:Router){}
第二部 调用Router实例的navigate()方法即可(注意,该方法接收的参数为数组类型)
例如: this.xxx.navigate(["/home"]) 跳转到首页
示例:
```typescript
/*app.component.html*/
<button (click)="goPage('/')">首页</button>
<button (click)="goPage('/goods')">商品列表</button>
/*app.component.ts*/
import { Router } from "@angular/router";
constructor(private router: Router) { } // 注意导入Router
goPage(path) {
this.router.navigate([path]); // 是个数组
}
```
## 三、路由传参
### 1、问号传参
goods页点击商品跳转到detail页面,商品id由地址栏传递:
```html
<!-- goods.component.html -->
<div>
<ul>
<li
*ngFor="let goods of list"
[routerLink]="[ '/detail']"
[queryParams]="{goodsID:goods.id}"
>
<p>商品名:{{goods.name}}</p>
<p>价格:{{goods.price}}</p>
</li>
</ul>
</div>
```
> 给元素添加属性 queryParams即可传递想要的数据
详情页detail从地址栏获取id:
```typescript
import { ActivatedRoute } from '@angular/router';
export class DetailComponent implements OnInit {
constructor(
private ar: ActivatedRoute
) { }
ngOnInit() {
let id = this.ar.snapshot.queryParams['goodsID'];
console.log(id);
}
}
```
> 给当前组件注入 ActivatedRoute,通过注入的服务实例来获取参数
>
> 注意:直接打印 this.ar.snapshot.queryParams 是一个对象,但是只能使用数组的方式获取。
### 2、路径传参
首先需要修改路由配置:
```json
{
path: 'detail/:goodsID',
component: DetailComponent
}
```
```html
<!-- goods.component.html -->
<div>
<ul>
<li
*ngFor="let goods of list"
[routerLink]="[ '/detail', goods.id]">
<p>商品名:{{goods.name}}</p>
<p>价格:{{goods.price}}</p>
</li>
</ul>
</div>
```
> 参数通过routerLink属性值的数组第二个元素进行传参
详情页获取id:
```typescript
import { ActivatedRoute } from '@angular/router';
export class DetailComponent implements OnInit {
constructor(
private ar: ActivatedRoute
) { }
ngOnInit() {
let id = this.ar.snapshot.params['goodsID'];
console.log(id);
}
}
```
> 获取的方式和问号传参唯一的区别:
>
> 需要通过 this.xxx.snapshot.params['goodsID']来获取数据。
**当从详情页跳转到详情页的时候,由于详情页组件没有进行组件的卸载和加载,所以不能使用上面参数快照的方式进行,而需要采用参数订阅的方式:**
```js
ngOnInit() {
// let id = this.ar.snapshot.params['goodsID'];
this.ar.params.subscribe(params => {
console.log(params['goodsID']);
})
}
```
## 四、辅助路由(多视图路由)
与vue等框架的区别在于,angular的对视图路由互相是独立的,A视图更换路由不会改变B视图的显示,反之亦然。
在主组件的html设置显示主路由和辅助路由。
```html
<!--app.component.html-->
<button (click)="goPage('/home')">首页</button>
<button (click)="goPage('/goods')">商品列表</button>
<a [routerLink]="[ {outlets:{box:'a'}} ]">辅助路由 1</a>
<a [routerLink]="[ {outlets:{box:'b'}} ]">辅助路由 2</a>
<div class="panel">
<div class="main">
<router-outlet></router-outlet>
</div>
<div class="box">
<router-outlet name="box"></router-outlet>
</div>
</div>
```
> 辅助路由定义一个name属性box。
修改路由:
```typescript
import { AComponent } from './components/a/a.component';
import { BComponent } from './components/b/b.component';
const routes: Routes = [
//...
{
path: 'a',
component: AComponent,
outlet: 'box'
},
{
path: 'b',
component: BComponent,
outlet: 'box'
},
//...
];
```
> 注意属性 `outlet: 'box'` 表示组件渲染的是名字为box的路由。
然后点击a标签进行辅助路由跳转:
```html
<a [routerLink]="[ {outlets:{box:'a'}} ]">辅助路由 1</a>
<a [routerLink]="[ {outlets:{box:'b'}} ]">辅助路由 2</a>
```
当点击a标签的时候,将box替换为a组件或者b组件。

可以看到:当点击主路由时不影响辅助路由的跳转,点击辅助路由时不影响主路由的跳转。并且辅助路由会以括号的形式显示在地址栏上。
## 五、路由守卫
常见的由进入的路由守卫和离开的路由守卫。**本质上来说,路由守卫就是类。**
在guards目录下新建一个进入路由守卫和一个离开路由守卫。**路由守卫其实就是一个类**,所以:
```
ng g cl guards/Enter
ng g cl guards/Leave
```
### 1、编写进入守卫模块
```typescript
import { CanActivate } from "@angular/router";
export class Enter implements CanActivate {
canActivate(): boolean {
// 返回true运行跳转,返回false禁止跳转
return confirm('确认进入?');
}
}
```
> 进入的路由守卫需要实现接口: CanActivate
### 2、将其注入到路由模块的providers属性中
```
providers: [Enter]
```
### 3、在需要监控的路由配置上添加对应的路由守卫。
```js
{
path: 'home',
component: HomeComponent,
canActivate: [Enter]
},
{
path: 'goods',
component: GoodsComponent,
canActivate: [Enter]
},
```
如果有多个路由守卫的话,路由守卫会依次验证。
离开守卫:
离开的路由守卫需要实现接口 :CanDeactivate (除了要实现接口,还得定义泛型),其他都是相同的。
```js
import { CanDeactivate } from "@angular/router";
import { GoodsComponent } from "app/pages/goods/goods.component";
export class Leave implements CanDeactivate<GoodsComponent> {
canDeactivate(): boolean {
return confirm("你确定要离开吗?")
}
}
```
> 注意:进入守卫和离开守卫的区别:
>
> **离开守卫除了要实现接口,还得定义泛型。**
注入:
```js
providers: [Enter,Leave]
```
添加相应的路由守卫:
```js
{
path: 'home',
component: HomeComponent,
canActivate: [Enter],
canDeactivate: [Leave]
},
{
path: 'goods',
component: GoodsComponent,
canActivate: [Enter],
canDeactivate: [Leave]
},
```

| Daotin/Web/14-Angular/03-路由.md/0 | {
"file_path": "Daotin/Web/14-Angular/03-路由.md",
"repo_id": "Daotin",
"token_count": 4738
} | 25 |
## H5 新特性
新增标签
本地存储 webStorage websocket webworkers
新增地理位置 对css3的支持
canvas
多媒体标签
新增表单元素类型
结构标签:header nav article aside footer
表单标签:email url range date
媒体标签:video audio
```
navigator.geolocation.getCurrentPosition(success,error,option);
```
## css3 新特性
圆角
阴影
背景渐变
弹性盒布局
过渡
动画
2D/3D转换
媒体查询 border-image
```
background: linear-gradient(direction, color1, color2 [stop], color3...);
background: radial-gradient(shape size at position, start-color, ..., color [stop] ..., last-color);
transition 需要触发条件,而且只有开始和结束之间的过渡。
animation:不需要触发,中间可以插入无数关键帧。
transform: translate3d(0px,0px,400px);
```
## webstorage 和cookie的区别
容量 cookie 4k
webStorage 5M
存储时长 localStorage 长期存储
sessionStorage 基于单次会话存储
cookie 必须设定存储时长
和服务器交互
cookie信息会在和服务器做交互时 默认发送到服务端
webStorage 只会存储在本地
## 实现响应式布局几种方式
原生代码 媒体查询
bootstrap等框架
## jsonp原理
允许用户传递一个callback参数给服务端,然后服务端返回数据时会将这个callback参数作为函数名来包裹住JSON数据,这样客户端就可以随意定制自己的函数来自动处理返回数据了。
## 闭包
一个可以访问另一个函数中的变量的函数。当一个函数的返回值是另外一个函数,而返回的那个函数如果调用了其父函数内部的变量,且返回的这个函数在外部被执行就产生了闭包。
## js的垃圾回收机制
标记清除
引用计数
## 浏览器缓存机制
在 Header 内的字段用于控制缓存机制 老方法 Expires,记录的绝对值 新方法 Cache-Control 多了一堆选项,记录的时间是相对值 获取缓存检测缓存是否过期,如果没过期取缓存,优先从内存,其次硬盘,如果过期,则与服务器协商缓存是否仍然可用,如果不可用则获取,可用取缓存
https://juejin.im/entry/5ad86c16f265da505a77dca4
## js 本地对象,内置对象和宿主对象
本地对象包括如下内容:Object、Function、String、Array、Boolean、Number
内置对象:Math
宿主对象:BOM/DOM对象
## http 请求流程
建立tcp连接的三次握手过程
## vue与react区别,优缺点。
https://segmentfault.com/a/1190000016344599
## vue双向绑定原理
已经了解到vue是通过数据劫持的方式来做数据绑定的,其中最核心的方法便是通过Object.defineProperty()来实现对属性的劫持,达到监听数据变动的目的,无疑这个方法是本文中最重要、最基础的内容之一,如果不熟悉defineProperty,猛戳[这里](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) 整理了一下,要实现mvvm的双向绑定,就必须要实现以下几点: 1、实现一个数据监听器Observer,能够对数据对象的所有属性进行监听,如有变动可拿到最新值并通知订阅者 2、实现一个指令解析器Compile,对每个元素节点的指令进行扫描和解析,根据指令模板替换数据,以及绑定相应的更新函数 3、实现一个Watcher,作为连接Observer和Compile的桥梁,能够订阅并收到每个属性变动的通知,执行指令绑定的相应回调函数,从而更新视图 4、mvvm入口函数,整合以上三者
## http常见状态码
| 1** | 信息,服务器收到请求,需要请求者继续执行操作 |
| ---- | ---------------------------------------------- |
| 2** | 成功,操作被成功接收并处理 |
| 3** | 重定向,需要进一步的操作以完成请求 |
| 4** | 客户端错误,请求包含语法错误或无法完成请求 |
| 5** | 服务器错误,服务器在处理请求的过程中发生了错误 |
## vue路由机制
不会把你相关的会的说出来就好了,怎么配的路由等
主要是`<router-link>`和`<router-view>`两个标签
`<router-link>`执行时会转换成`<a>`,并根据自己的to属性将路由地址转变成href的值,然后渲染在`<router-view>`标签中。
## js继承类的方式
5种继承
## this有哪几种指向
this的四种指向。window 对象 构造函数 call/apply
## es6有哪些新特性
let const 箭头函数 展开符 解构赋值 对象语法糖 字符串模板
## webpack相关配置属性
入口出口文件:
```js
entry: {
index: __dirname + '/src/main.js', // __dirname表示当前项目的根路径。
goods: __dirname + '/src/goods.js'
},
output: {
path: __dirname + '/dist',
filename: '[name].js'
},
```
http代理:
```js
devServer: {
contentBase: __dirname + '/dist',
port: 3000,
inline: true,
// 每当我们访问/zhuiszhu地址的时候,就把请求转发给target地址的服务器。
proxy: {
'/zhuiszhu': {
target: 'http://39.105.136.190:3000',
secure: false,
changeOrigin: true
}
}
}
```
资源地图:devtool: 'source-map'
本地web服务配置:
```js
npm i webpack-dev-server@2.9.7 -g
// 安装的webpack-dev-server模块配置信息
devServer: {
contentBase: __dirname + '/dist', // 指定本地web服务器根路径
port: 3000,
inline: true // 当源文件改变后,自动在浏览器页面刷新
}
```
提取css 文件:
```js
npm i extract-text-webpack-plugin -D
// webpack.config.js
let Ext = require('extract-text-webpack-plugin');
module: {
rules: [
{ test: /\.css$/, loader: Ext.extract('css-loader') },
{ test: /\.less$/, loader: Ext.extract('css-loader!less-loader') }
]
},
plugins: [
new Ext('index.css')
],
```
webpack配置别名
```js
resolve:{
//配置别名,在项目中可缩减引用路径
alias: {
vue$: 'vue/dist/vue.esm.js',
'@': resolve('src'),
'&': resolve('src/components'),
'api': resolve('src/api'),
'assets': resolve('src/assets')
}
}
```
## 模块化
```
nodejs使用的是commonjs规范
注意: nodejs虽然原生支持es6 但它并不支持 es6的import规范
导入:
let xx = require("xxx")
导出:
//一个文件内只能使用一次
module.exports = Object | Function | Array | String | Number | Boolean
//一个文件可以使用多次
exports.xxx = Object | Function | Array | String | Number | Boolean
下列写法不被允许 它会改变exports对象的引用导致程序运行出错
exports = {
xxx : "text"
}
es6的import规范
方式1
导入:
import XXX from "xxx"
导出:
export default xxx
该种方式一个文件内只能使用一次
方式2
导入:
import {XXX} from "xxx"
import {XXX as YYY} from "xxx" //将模块XXX给个别名为YYY
导出:
export let | const | var | function | class | interface XXX = ....
或者
let(可以是其他声明符) XXX = ....
export {XXX}
上述导出方式可以在同一个文件内使用多次
还有
AMD规范 和CMD规范
```
## 什么是观察者模式
也称:发布订阅模式。
当对象间存在一对多关系时,这个对象的状态发生改变,则会自动通知它的依赖对象,进行广播通知。
比如:vue中子组件向父组件传值,子组件使用$emit自定义一个事件名称,父组件接收这个事件即可。
还有中央事件总线 emit on
## 什么是mvc mvp mvvm
**M 为数据层,V 视图层,C 逻辑层。**
**MVP**(Model-View-Presenter)是**MVC的改良模式**,由IBM的子公司Taligent提出。和MVC的相同之处在于:Controller/Presenter负责业务逻辑,Model管理数据,View负责显示只不过是将 Controller 改名为 Presenter,同时改变了通信方向。
在**MVP**中,View并不直接使用Model,它们之间的通信是通过Presenter (MVC中的Controller)来进行的,所有的交互都发生在Presenter内部。
MVVM = MVP + 新特性(bind等)
## 平时怎么解决浏览器兼容问题(具体问题的解决方案)
```css
1、默认padding,margin不同
解决:自定义初始化css
2、在一个div中放一个img,但是img的下方和div之间有3px的间隔。
这是浏览器的解析问题,不同的浏览器间隔的还不同。
foxfire是5px,chrome是3px。
解决:/*方式一*/
div {font-size: 0;}
/*方式二*/
img{display: block;}
/*方式三*/
img{vertical-align: top;}
3、几个img标签放在一起的时候,有些浏览器会有默认的间距
解决:使用float属性为img布局
4、解决 ie9 以下浏览器对 html5 新增标签不识别的问题。
引入html5shiv.js文件
5、针对IE属性 css hack
6、-ms- -o- -webkit- -moz-
7、清除浮动 clearfix
8、边距重叠
解决:加一个父元素,父元素使用overflow: hidden;
9、IE9不能使用opacity
opacity: 0.5;
filter: alpha(opacity = 50);
filter: progid:DXImageTransform.Microsoft.Alpha(style = 0, opacity = 50);
```
## 数组的操作方法
`join,push,pop,map,forEach,every,some,filter,concat,splice`
## 如何进行性能优化 缩短页面加载时间
1、减少http请求
2、使用cdn加速
3、添加Expires头
4、将样式css放在头部,脚本script放在底部
5、使用外部的JavaScript和CSS
## 实现原生ajax的步骤
```js
let xhr = new XMLHTTPRequest();
xhr.open('get', 'xxx.php?id=1',true);
xhr.send()
xhr.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200) {
console.log(this.response)
}
}
```
## Vue
- 如何创建全局组件和局部组件
- 如何定义props
- 如何对props进行类型验证
- 什么是计算属性
- 数据监听(watch)
- 常用指令 v-if v-show 循环迭代
- 定义过滤器 (局部 全局)
- 进行组件间通信的方式
- slot 内容插槽
- v-for的key作用
v-for渲染的列表的结构采用“就地复用”的策略,也就说当数据重新排列数据时,会复用已在页面渲染好的元素,不会移动 DOM 元素来匹配数据项的顺序,这种模式是高效的,改变现有位置的结构的数据即可
- 如何配置使用路由
- 路由守卫 `beforeEach beforeEnter beforeRouteEnter/Leave/Update `
- 多视图路由
- vuex的几个核心概念 `store state getter mutation action `
- 如何对store进行模块化拆分
- 如何开启命名空间
- 组件的生命周期函数
## React
- 如何定义组件?
- 如何接受props
- 如何进行props类型验证
- 组件的生命周期函数
- 三大周期 7个生命周期函数
- 修改组件状态
- 进行数据双向绑定
- ref的使用方式
- 路由的使用方式
- 路由守卫
- flux架构 `view action dispatcher store`
- redux 框架 `view store reducer`
- 异步action
- 如何进行性能优化
- 虚拟dom
- react和vue中的diff算法
## angular
- 模块 组件 服务 管道
- 什么是依赖注入
- 如何使用路由
- 参数快照 参数订阅
- 响应式编程
- angular中的模板式表单和响应式表单
- 如何做表单验证
- angular-cli的使用方式
- 如何创建组件 创建服务 创建类 创建管道
- 网格系统 如何同bootstrap实现响应式布局
```
col-lg-6
col-md-6
col-sm-6
col-xs-6
<div class="col-md-6 col-xs-12"></div>
```
| Daotin/Web/15-前端面试/01-前端面试知识点总结.md/0 | {
"file_path": "Daotin/Web/15-前端面试/01-前端面试知识点总结.md",
"repo_id": "Daotin",
"token_count": 7099
} | 26 |
package pers.husen.web.common.constants;
/**
* 通用常量
*
* @author 何明胜
*
* 2017年10月20日
*/
public class CommonConstants {
/******************************************************************************
* 路径常量
******************************************************************************/
/** 配置文件相对于工程根目录的路径 */
public static final String CONFIG_FILE_RELATIVE_PATH = "/config";
/** 数据库连接信息文件相对工程根目录的路径 **/
public static final String DB_CONNECT_INFO_FILE_RELATIVE_PATH = CONFIG_FILE_RELATIVE_PATH + "/mysql_connect_info.properties";
public static final String COMMON_CONFIG_FILE_RELATIVE_PATH = CONFIG_FILE_RELATIVE_PATH + "/config.properties";
/** log4j2配置文件相对于工程根目录的路径 **/
public static final String LOG4J2_CONFIG_FILE_RELATIVE_PATH = CONFIG_FILE_RELATIVE_PATH + "/log4j2.xml";
/** 下载文件相对工程根目录的路径 **/
public static final String DOWNLOAD_FILE_RELATIVE_PATH = "/download";
/** 图片文件相对工程根目录的路径 */
public static final String IMAGE_UPLOAD_FILE_PATH = "/images";
/** 日志文件相对于工程根目录的路径 **/
public static final String LOG_OUT_FILE_RELATIVE_PATH = "/logs";
/******************************************************************************
* 系统常量
******************************************************************************/
/** linux系统根目录路径 **/
public static final String OS_LINUX = "Linux";
/** windows 默认系统盘盘符 **/
public static final String OS_WINDOWS = "Windows";
/** 中文逗号 */
public static final char CHINESE_COMMA = ',';
/** 英文逗号 */
public static final char ENGLISH_COMMA = ',';
} | Humsen/web/web-core/src/pers/husen/web/common/constants/CommonConstants.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/common/constants/CommonConstants.java",
"repo_id": "Humsen",
"token_count": 693
} | 27 |
package pers.husen.web.common.helper;
import net.sf.ezmorph.object.DateMorpher;
import net.sf.json.JSONObject;
import net.sf.json.util.JSONUtils;
import pers.husen.web.bean.vo.BlogArticleVo;
import pers.husen.web.bean.vo.CodeLibraryVo;
import pers.husen.web.bean.vo.MessageAreaVo;
import pers.husen.web.bean.vo.ReleaseFeatureVo;
/**
* 类型转换助手
*
* @author 何明胜
*
* 2017年10月21日
*/
public class TypeConvertHelper {
/******************************************************
* JSON -> Bean 主要是日期转换问题
******************************************************/
/**
* 前端传过来的新博客参数转化成json后再转换成Bean
*
* @param jsonObject
* @return
*/
public static BlogArticleVo jsonObj2BlogBean(JSONObject jsonObject) {
// 转换时间格式 String -> Date
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[] { "yyyy-MM-dd HH:mm:ss" }));
return (BlogArticleVo) JSONObject.toBean(jsonObject, BlogArticleVo.class);
}
/**
* 前端传过来的新评论参数转化成json后再转换成Bean
*
* @param jsonObject
* @return
*/
public static MessageAreaVo jsonObj2MessageBean(JSONObject jsonObject) {
// 转换时间格式 String->Date
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[] { "yyyy-MM-dd HH:mm:ss" }));
return (MessageAreaVo) JSONObject.toBean(jsonObject, MessageAreaVo.class);
}
/**
* 前端传过来的代码参数转化成json后再转换成Bean
*
* @param jsonObject
* @return
*/
public static CodeLibraryVo jsonObj2CodeBean(JSONObject jsonObject) {
// 转换时间格式 String->Date
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[] { "yyyy-MM-dd HH:mm:ss" }));
return (CodeLibraryVo) JSONObject.toBean(jsonObject, CodeLibraryVo.class);
}
/**
* 前端传过来的版本特性参数转换成json后再转换成Bean
*
* @param jsonObject
* @return
*/
public static ReleaseFeatureVo jsonObj2ReleaseBean(JSONObject jsonObject) {
// 转换时间格式 String->Date
JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[] { "yyyy-MM-dd HH:mm:ss" }));
return (ReleaseFeatureVo) JSONObject.toBean(jsonObject, ReleaseFeatureVo.class);
}
} | Humsen/web/web-core/src/pers/husen/web/common/helper/TypeConvertHelper.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/common/helper/TypeConvertHelper.java",
"repo_id": "Humsen",
"token_count": 966
} | 28 |
package pers.husen.web.dao;
import java.util.ArrayList;
import pers.husen.web.bean.vo.UserInfoVo;
/**
* 用户信息接口
*
* @author 何明胜
*
* 2017年9月17日
*/
public interface UserInfoDao {
/* 增 */
/**
* 插入新注册的用户信息
* @param userInfoVo
* @return
*/
public int insertUserInfo(UserInfoVo userInfoVo);
/* 改 */
/**
* 根据id更新用户信息
* @param uVo
* @return
*/
public int updateUserInfoById(UserInfoVo uVo);
/**
* 根据用户名改密码
* @param uVo
* @return
*/
public int updateUserPwdByName(UserInfoVo uVo);
/**
* 根据用户名和邮箱修改密码
* @param uVo
* @return
*/
public int updateUserPwdByNameAndEmail(UserInfoVo uVo);
/**
* 根据用户名修改用户邮箱
* @param uVo
* @return
*/
public int updateUserEmailByName(UserInfoVo uVo);
/* 查 */
/**
* 根据用户名查询密码
* @param userName
* @return
*/
public String queryPasswordByUserName(String userName);
/**
* 根据用户名查询用户信息
* @param userName
* @return
*/
public UserInfoVo queryUserInfoByName(String userName);
/**
* 根据条件查询总的有效用户数量
* @param uVo
* @return
*/
public int queryUserTotalCount(UserInfoVo uVo);
/**
* 根据页面大小和页码查询一页的用户
* @param uVo
* @param pageSize
* @param pageNo
* @return
*/
public ArrayList<UserInfoVo> queryUserPerPage(UserInfoVo uVo, int pageSize, int pageNo);
} | Humsen/web/web-core/src/pers/husen/web/dao/UserInfoDao.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/dao/UserInfoDao.java",
"repo_id": "Humsen",
"token_count": 748
} | 29 |
/**
* 数据库辅助类
*
* @author 何明胜
*
* 2017年10月21日
*/
package pers.husen.web.dbutil.assist; | Humsen/web/web-core/src/pers/husen/web/dbutil/assist/package-info.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/dbutil/assist/package-info.java",
"repo_id": "Humsen",
"token_count": 63
} | 30 |
package pers.husen.web.service;
import pers.husen.web.bean.vo.ImageUploadVo;
import pers.husen.web.dao.ImageUploadDao;
import pers.husen.web.dao.impl.ImageUploadDaoImpl;
/**
* @author 何明胜
*
* 2017年10月20日
*/
public class ImageUploadSvc implements ImageUploadDao{
private static final ImageUploadDaoImpl imageUploadDaoImpl = new ImageUploadDaoImpl();
@Override
public int insertImageUpload(ImageUploadVo iVo) {
return imageUploadDaoImpl.insertImageUpload(iVo);
}
} | Humsen/web/web-core/src/pers/husen/web/service/ImageUploadSvc.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/service/ImageUploadSvc.java",
"repo_id": "Humsen",
"token_count": 173
} | 31 |
package pers.husen.web.servlet.download;
import java.io.IOException;
import java.util.Date;
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.bean.vo.FileDownloadVo;
import pers.husen.web.common.handler.FileUploadHandler;
import pers.husen.web.service.FileDownloadSvc;
/**
* 上传文件
*
* @author 何明胜
*
* 2017年10月20日
*/
@WebServlet(urlPatterns="/fileUpload.hms")
public class FileUploadSvt extends HttpServlet {
private static final long serialVersionUID = 1L;
public FileUploadSvt() {
super();
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
FileUploadHandler fileUploadHandler = new FileUploadHandler();
String fileName = fileUploadHandler.fileUploadHandler(request);
//int insertResult = 0;
//不为null则上传成功
if(fileName != null) {
FileDownloadVo fVo = new FileDownloadVo();
fVo.setFileName(fileName);
fVo.setFileUrl(fileName);
fVo.setFileUploadDate(new Date());
fVo.setFileDownloadCount(0);
FileDownloadSvc fSvc = new FileDownloadSvc();
fSvc.insertFileDownload(fVo);
}
response.sendRedirect("/personal_center/mycenter.jsp");
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
} | Humsen/web/web-core/src/pers/husen/web/servlet/download/FileUploadSvt.java/0 | {
"file_path": "Humsen/web/web-core/src/pers/husen/web/servlet/download/FileUploadSvt.java",
"repo_id": "Humsen",
"token_count": 576
} | 32 |
@charset "UTF-8";
#rightBar {
float: right;
width: 18%;
margin-right: 2%;
position: fixed;
margin-left: 80%;
}
.sidebar-module {
padding: 15px;
background-color: #f5f5f5;
border-radius: 4px;
margin: 0 -15px 15px;
font-size: 14px;
}
.list-unstyled {
padding-left: 0;
list-style: none;
}
.sidebar-module h4 {
font-family: NSimSun;
} | Humsen/web/web-mobile/WebContent/css/navigation/rightbar.css/0 | {
"file_path": "Humsen/web/web-mobile/WebContent/css/navigation/rightbar.css",
"repo_id": "Humsen",
"token_count": 160
} | 33 |
# Defaults for all prettier-supported languages.
# Prettier will complete this with settings from .editorconfig file.
bracketSpacing: false
printWidth: 88
proseWrap: always
semi: true
trailingComma: "es5"
xmlWhitespaceSensitivity: "strict"
| OCA/web/.prettierrc.yml/0 | {
"file_path": "OCA/web/.prettierrc.yml",
"repo_id": "OCA",
"token_count": 74
} | 34 |
# Copyright 2015 Therp BV <http://therp.nl>
# Copyright 2017 Tecnativa - Vicent Cubells
# Copyright 2018 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Advanced search",
"summary": "Easier and more powerful searching tools",
"version": "16.0.1.0.4",
"author": "Therp BV, Tecnativa, Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"maintainers": ["ivantodorovich"],
"license": "AGPL-3",
"category": "Usability",
"depends": ["web"],
"assets": {
"web.assets_backend": [
"web_advanced_search/static/src/js/**/*",
"web_advanced_search/static/src/legacy/**/*",
"web_advanced_search/static/src/search/**/*",
]
},
}
| OCA/web/web_advanced_search/__manifest__.py/0 | {
"file_path": "OCA/web/web_advanced_search/__manifest__.py",
"repo_id": "OCA",
"token_count": 341
} | 35 |
11.0.1.0.2 (2018-10-31)
~~~~~~~~~~~~~~~~~~~~~~~
* Fix initialization of 1st domain node
Sometime the dialog is not ready yet, like on EE version.
Hence when you inject the 1st domain node
the dialog must be already opened.
[simahawk]
11.0.1.0.1 (2018-09-18)
~~~~~~~~~~~~~~~~~~~~~~~
* Fix `undefined` in x2m fields
Before this patch, when searching with the "equals to" operator in any
x2many field, the searched parameter was always `undefined`.
The problem was that the underlying field manager implementation was
treating those fields as x2many, while the widget used was the `one2many`
one.
This patch simply mocks the underlying fake record to make think that
any relational field is always a `one2many`. This sets all pieces in
place and makes the field manager work as expected, and thus you can
search as expected too.
* Make linter happy
[Yajo]
11.0.1.0.0 (2018-07-20)
~~~~~~~~~~~~~~~~~~~~~~~
* Rename, refactor, migrate to v11
[Yajo]
| OCA/web/web_advanced_search/readme/HISTORY.rst/0 | {
"file_path": "OCA/web/web_advanced_search/readme/HISTORY.rst",
"repo_id": "OCA",
"token_count": 293
} | 36 |
/** @odoo-module **/
import AdvancedFilterItem from "./advanced_filter_item.esm";
import {FilterMenu} from "@web/search/filter_menu/filter_menu";
import {patch} from "@web/core/utils/patch";
/**
* Patches the FilterMenu for owl widgets.
*/
patch(FilterMenu, "web_advanced_search.FilterMenu", {
components: {
...FilterMenu.components,
AdvancedFilterItem,
},
});
export default FilterMenu;
| OCA/web/web_advanced_search/static/src/search/filter_menu/filter_menu.esm.js/0 | {
"file_path": "OCA/web/web_advanced_search/static/src/search/filter_menu/filter_menu.esm.js",
"repo_id": "OCA",
"token_count": 143
} | 37 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_chatter_position
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: web_chatter_position
#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__bottom
msgid "Bottom"
msgstr ""
#. module: web_chatter_position
#: model:ir.model.fields,field_description:web_chatter_position.field_res_users__chatter_position
msgid "Chatter Position"
msgstr ""
#. module: web_chatter_position
#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__auto
msgid "Responsive"
msgstr ""
#. module: web_chatter_position
#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__sided
msgid "Sided"
msgstr ""
#. module: web_chatter_position
#: model:ir.model,name:web_chatter_position.model_res_users
msgid "User"
msgstr ""
| OCA/web/web_chatter_position/i18n/web_chatter_position.pot/0 | {
"file_path": "OCA/web/web_chatter_position/i18n/web_chatter_position.pot",
"repo_id": "OCA",
"token_count": 419
} | 38 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_company_color
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-06-20 11:09+0000\n"
"Last-Translator: Nils Coenen <nils.coenen@nico-solutions.de>\n"
"Language-Team: none\n"
"Language: de\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"
" Damit die Änderungen wirksam werden, aktualisieren "
"Sie bitte\n"
" die Seite."
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_button_bg
msgid "Button Background Color"
msgstr ""
#. 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 ""
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_button_text
msgid "Button Text Color"
msgstr ""
#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Colors"
msgstr ""
#. module: web_company_color
#: model:ir.model,name:web_company_color.model_res_company
msgid "Companies"
msgstr "Unternehmen"
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__company_colors
msgid "Company Colors"
msgstr "Unternehmensfarben"
#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Company Styles"
msgstr "Unternehmensstile"
#. module: web_company_color
#: model_terms:ir.ui.view,arch_db:web_company_color.view_company_form
msgid "Compute colors from logo"
msgstr "Farben aus Logo generieren"
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_link_text
msgid "Link Text Color"
msgstr ""
#. 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 ""
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_bg
msgid "Navbar Background Color"
msgstr "Navbar-Hintergrundfarbe"
#. 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 "Navbar Hintergrundfarbe Hover"
#. module: web_company_color
#: model:ir.model.fields,field_description:web_company_color.field_res_company__color_navbar_text
msgid "Navbar Text Color"
msgstr "Navbar Textfarbe"
#. 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 ""
#~ msgid "Navbar Colors"
#~ msgstr "Navbar-Farben"
#~ msgid ""
#~ "<span class=\"fa fa-info fa-2x\"/>\n"
#~ " In order for the changes to take effect, please "
#~ "refresh\n"
#~ " the page."
#~ msgstr ""
#~ "<span class=\"fa fa-info fa-2x\"/>\n"
#~ " Damit die Änderungen wirksam werden, "
#~ "aktualisieren Sie bitte\n"
#~ " Sie die Seite."
#~ msgid "Display Name"
#~ msgstr "Anzeigename"
#~ msgid "ID"
#~ msgstr "ID"
#~ msgid "Last Modified on"
#~ msgstr "Zuletzt bearbeitet am"
| OCA/web/web_company_color/i18n/de.po/0 | {
"file_path": "OCA/web/web_company_color/i18n/de.po",
"repo_id": "OCA",
"token_count": 1656
} | 39 |
Go to company record and set a logo. Can see/modify applied colors on the "Navbar" section.
For optimal results use images with alpha channel.
| OCA/web/web_company_color/readme/USAGE.rst/0 | {
"file_path": "OCA/web/web_company_color/readme/USAGE.rst",
"repo_id": "OCA",
"token_count": 36
} | 40 |
14.0.1.0.0 (2020-01-04)
~~~~~~~~~~~~~~~~~~~~~~~
* [PORT] Ported to V14
| OCA/web/web_copy_confirm/readme/HISTORY.rst/0 | {
"file_path": "OCA/web/web_copy_confirm/readme/HISTORY.rst",
"repo_id": "OCA",
"token_count": 32
} | 41 |
# © 2022 Florian Kantelberg - initOS GmbH
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import ir_http, res_users
| OCA/web/web_dark_mode/models/__init__.py/0 | {
"file_path": "OCA/web/web_dark_mode/models/__init__.py",
"repo_id": "OCA",
"token_count": 53
} | 42 |
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="category_module" model="tile.category">
<field name="name">Modules</field>
<field name="sequence">1</field>
<field name="active" eval="True" />
</record>
<record id="category_currency" model="tile.category">
<field name="name">Currencies</field>
<field name="sequence">2</field>
<field name="active" eval="True" />
</record>
</odoo>
| OCA/web/web_dashboard_tile/demo/tile_category.xml/0 | {
"file_path": "OCA/web/web_dashboard_tile/demo/tile_category.xml",
"repo_id": "OCA",
"token_count": 190
} | 43 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_dialog_size
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-05-25 11:47+0000\n"
"Last-Translator: Valentin Vinagre <valentin.vinagre@sygel.es>\n"
"Language-Team: none\n"
"Language: es\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.3.2\n"
#. module: web_dialog_size
#: model:ir.model,name:web_dialog_size.model_ir_config_parameter
msgid "System Parameter"
msgstr "Parámetro del sistema"
#~ msgid "ID"
#~ msgstr "ID"
| OCA/web/web_dialog_size/i18n/es.po/0 | {
"file_path": "OCA/web/web_dialog_size/i18n/es.po",
"repo_id": "OCA",
"token_count": 303
} | 44 |
odoo.define("web_dialog_size.web_dialog_size", function (require) {
"use strict";
var rpc = require("web.rpc");
var Dialog = require("web.Dialog");
var config = rpc.query({
model: "ir.config_parameter",
method: "get_web_dialog_size_config",
});
Dialog.include({
willStart: function () {
var self = this;
return this._super.apply(this, arguments).then(function () {
self.$modal
.find(".dialog_button_extend")
.on("click", self.proxy("_extending"));
self.$modal
.find(".dialog_button_restore")
.on("click", self.proxy("_restore"));
return config.then(function (r) {
if (r.default_maximize) {
self._extending();
} else {
self._restore();
}
});
});
},
opened: function () {
return this._super.apply(this, arguments).then(
function () {
if (this.$modal) {
this.$modal.find(">:first-child").draggable({
handle: ".modal-header",
helper: false,
});
}
}.bind(this)
);
},
close: function () {
if (this.$modal) {
var draggable = this.$modal.find(">:first-child").draggable("instance");
if (draggable) {
this.$modal.find(">:first-child").draggable("destroy");
}
}
return this._super.apply(this, arguments);
},
_extending: function () {
var dialog = this.$modal.find(".modal-dialog");
dialog.addClass("dialog_full_screen");
dialog.find(".dialog_button_extend").hide();
dialog.find(".dialog_button_restore").show();
},
_restore: function () {
var dialog = this.$modal.find(".modal-dialog");
dialog.removeClass("dialog_full_screen");
dialog.find(".dialog_button_restore").hide();
dialog.find(".dialog_button_extend").show();
},
});
});
| OCA/web/web_dialog_size/static/src/js/web_dialog_size.js/0 | {
"file_path": "OCA/web/web_dialog_size/static/src/js/web_dialog_size.js",
"repo_id": "OCA",
"token_count": 1306
} | 45 |
from . import ir_http
from . import models
| OCA/web/web_disable_export_group/models/__init__.py/0 | {
"file_path": "OCA/web/web_disable_export_group/models/__init__.py",
"repo_id": "OCA",
"token_count": 12
} | 46 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# Copyright 2020 Tecnativa - João Marques
# Copyright 2022 Tecnativa - Víctor Martínez
import odoo.tests
from odoo.tests import new_test_user
@odoo.tests.tagged("post_install", "-at_install")
class TestTour(odoo.tests.HttpCase):
def setUp(self):
super().setUp()
new_test_user(
self.env,
login="user_not_export",
password="user_not_export",
groups="base.group_user,base.group_system",
)
new_test_user(
self.env,
login="user_export_xlsx",
password="user_export_xlsx",
groups=(
"base.group_user,base.group_system,"
"web_disable_export_group.group_export_xlsx_data"
),
)
def test_admin(self):
self.start_tour("/web", "export_tour_xlsx_button_ok", login="admin")
def test_user_not_export(self):
self.start_tour("/web", "export_tour_xlsx_button_ko", login="user_not_export")
def test_user_export_xlsx(self):
self.start_tour("/web", "export_tour_xlsx_button_ok", login="user_export_xlsx")
| OCA/web/web_disable_export_group/tests/test_tour.py/0 | {
"file_path": "OCA/web/web_disable_export_group/tests/test_tour.py",
"repo_id": "OCA",
"token_count": 567
} | 47 |
from . import models
| OCA/web/web_environment_ribbon/__init__.py/0 | {
"file_path": "OCA/web/web_environment_ribbon/__init__.py",
"repo_id": "OCA",
"token_count": 5
} | 48 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_environment_ribbon
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-09-01 12:52+0000\n"
"Last-Translator: 黎伟杰 <674416404@qq.com>\n"
"Language-Team: none\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 3.8\n"
#. module: web_environment_ribbon
#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend
msgid "Web Environment Ribbon Backend"
msgstr "Web环境功能区后台"
#~ msgid "Display Name"
#~ msgstr "显示名称"
#~ msgid "ID"
#~ msgstr "ID"
#~ msgid "Last Modified on"
#~ msgstr "最后修改时间"
| OCA/web/web_environment_ribbon/i18n/zh_CN.po/0 | {
"file_path": "OCA/web/web_environment_ribbon/i18n/zh_CN.po",
"repo_id": "OCA",
"token_count": 373
} | 49 |
# Copyright 2023 Odoo S.A.
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0)
{
"name": "Web Numeric Field Formatting",
"summary": "Allow to render float and integer fields without thousands separator",
"category": "web",
"version": "16.0.1.0.0",
"author": "Opener B.V., Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"assets": {
"web.assets_backend": [
"web_field_numeric_formatting/static/src/components/float_field.esm.js",
"web_field_numeric_formatting/static/src/components/integer_field.esm.js",
"web_field_numeric_formatting/static/src/components/list_renderer.esm.js",
],
"web.qunit_suite_tests": [
"web_field_numeric_formatting/static/tests/field_tests.esm.js",
],
},
"license": "LGPL-3",
"auto_install": False,
"installable": True,
}
| OCA/web/web_field_numeric_formatting/__manifest__.py/0 | {
"file_path": "OCA/web/web_field_numeric_formatting/__manifest__.py",
"repo_id": "OCA",
"token_count": 412
} | 50 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_group_expand
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-10-08 23:01+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\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_group_expand
#. odoo-javascript
#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0
#, python-format
msgid "Compress"
msgstr "Comprimir"
#. module: web_group_expand
#. odoo-javascript
#: code:addons/web_group_expand/static/src/xml/list_controller.xml:0
#, python-format
msgid "Expand"
msgstr "Ampliar"
#, python-format
#~ msgid "Collapse groups"
#~ msgstr "Colapsar grupos"
#, python-format
#~ msgid "Expand groups"
#~ msgstr "Expandir grupos"
| OCA/web/web_group_expand/i18n/es.po/0 | {
"file_path": "OCA/web/web_group_expand/i18n/es.po",
"repo_id": "OCA",
"token_count": 416
} | 51 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_help
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-27 11:34+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_help
#. odoo-javascript
#: code:addons/web_help/static/src/user_trip.esm.js:0
#, python-format
msgid "Cancel"
msgstr "Annulla"
#. module: web_help
#. odoo-javascript
#: code:addons/web_help/static/src/change_password_trip.esm.js:0
#, python-format
msgid "Change the password here, make sure it's secure."
msgstr "Modificare qui la password, controllando che sia sicura."
#. module: web_help
#. odoo-javascript
#: code:addons/web_help/static/src/change_password_trip.esm.js:0
#, python-format
msgid "Click here to confirm it."
msgstr "Fare clic qui per confermarla."
#. module: web_help
#. odoo-javascript
#: code:addons/web_help/static/src/trip.esm.js:0
#, python-format
msgid "Close"
msgstr "Chiudi"
#. module: web_help
#. odoo-javascript
#: code:addons/web_help/static/src/trip.esm.js:0
#, python-format
msgid "Finish"
msgstr "Chiudi"
#. module: web_help
#. odoo-javascript
#: code:addons/web_help/static/src/trip.esm.js:0
#, python-format
msgid "Got it"
msgstr "Capito"
#. module: web_help
#. odoo-javascript
#: code:addons/web_help/static/src/user_trip.esm.js:0
#, python-format
msgid "Next"
msgstr "Successivo"
#. module: web_help
#. odoo-javascript
#: code:addons/web_help/static/src/user_trip.esm.js:0
#, python-format
msgid "To create a new user click here."
msgstr "Per creare un nuovo utente fare clic qui."
#. module: web_help
#. odoo-javascript
#: code:addons/web_help/static/src/user_trip.esm.js:0
#, python-format
msgid "Use the searchbar to find specific users."
msgstr "Utilizzare la barra ricerca per trovare utenti specifici."
#. module: web_help
#. odoo-javascript
#: code:addons/web_help/static/src/user_trip.esm.js:0
#, python-format
msgid "You can switch to different views here."
msgstr "Qui si possono scegliere diverse viste."
| OCA/web/web_help/i18n/it.po/0 | {
"file_path": "OCA/web/web_help/i18n/it.po",
"repo_id": "OCA",
"token_count": 904
} | 52 |
<?xml version="1.0" encoding="UTF-8" ?>
<templates>
<t t-name="web_help.Highlighter" owl="1">
<div class="web_help_highlighter">
<div
class="web_help_overlay"
t-att-class="{'d-none': !state.visible}"
t-ref="overlay"
>
<div class="web_help_highlight" t-ref="highlightRef" />
</div>
</div>
</t>
</templates>
| OCA/web/web_help/static/src/components/highlighter/highlighter.xml/0 | {
"file_path": "OCA/web/web_help/static/src/components/highlighter/highlighter.xml",
"repo_id": "OCA",
"token_count": 246
} | 53 |
from . import models
| OCA/web/web_ir_actions_act_multi/__init__.py/0 | {
"file_path": "OCA/web/web_ir_actions_act_multi/__init__.py",
"repo_id": "OCA",
"token_count": 5
} | 54 |
from . import models
| OCA/web/web_ir_actions_act_window_message/__init__.py/0 | {
"file_path": "OCA/web/web_ir_actions_act_window_message/__init__.py",
"repo_id": "OCA",
"token_count": 5
} | 55 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_ir_actions_act_window_message
#
# Translators:
# 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: 2017-06-02 09:52+0000\n"
"PO-Revision-Date: 2017-06-02 09:52+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Turkish (https://www.transifex.com/oca/teams/23907/tr/)\n"
"Language: tr\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_ir_actions_act_window_message
#. openerp-web
#: code:addons/web_ir_actions_act_window_message/static/src/js/web_ir_actions_act_window_message.js:0
#, python-format
msgid "Close"
msgstr "Kapat"
| OCA/web/web_ir_actions_act_window_message/i18n/tr.po/0 | {
"file_path": "OCA/web/web_ir_actions_act_window_message/i18n/tr.po",
"repo_id": "OCA",
"token_count": 362
} | 56 |
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record model="ir.actions.server" id="demo_pager_previous">
<field name="name">Previous partner</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="state">code</field>
<field name="code">action = {"type": "ir.actions.act_window.page.prev"}</field>
</record>
<record model="ir.actions.server" id="demo_pager_next">
<field name="name">Next partner</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="state">code</field>
<field name="code">action = {"type": "ir.actions.act_window.page.next"}</field>
</record>
<!-- Adding some redundant buttons to the partner form so that this module can be tested on runbot.
You might be more interested in returning this action type from a method in your code. -->
<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<div class="oe_button_box" position="inside">
<button
name="%(web_ir_actions_act_window_page.demo_pager_previous)d"
type="action"
string="Previous Partner"
icon="fa-arrow-left"
class="oe_stat_button"
/>
<button
name="%(web_ir_actions_act_window_page.demo_pager_next)d"
type="action"
string="Next Partner"
icon="fa-arrow-right"
class="oe_stat_button"
/>
</div>
</field>
</record>
</odoo>
| OCA/web/web_ir_actions_act_window_page/demo/demo_action.xml/0 | {
"file_path": "OCA/web/web_ir_actions_act_window_page/demo/demo_action.xml",
"repo_id": "OCA",
"token_count": 861
} | 57 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_m2x_options
#
# Translators:
# 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: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\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 ""
#. 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 "البحث عن المزيد ..."
#. 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 "إلغاء"
#, python-format
#~ msgid "Create \"<strong>%s</strong>\""
#~ msgstr "إنشاء \"<strong>%s</strong>\""
#, python-format
#~ msgid "Create and Edit..."
#~ msgstr "إنشاء وتحرير ..."
| OCA/web/web_m2x_options/i18n/ar.po/0 | {
"file_path": "OCA/web/web_m2x_options/i18n/ar.po",
"repo_id": "OCA",
"token_count": 1436
} | 58 |
from odoo import api, models
class IrConfigParameter(models.Model):
_inherit = "ir.config_parameter"
@api.model
def get_web_m2x_options(self):
opts = [
"web_m2x_options.create",
"web_m2x_options.create_edit",
"web_m2x_options.limit",
"web_m2x_options.search_more",
"web_m2x_options.m2o_dialog",
"web_m2x_options.field_limit_entries",
]
values = self.sudo().search_read([["key", "in", opts]], ["key", "value"])
return {res["key"]: res["value"] for res in values}
| OCA/web/web_m2x_options/models/ir_config_parameter.py/0 | {
"file_path": "OCA/web/web_m2x_options/models/ir_config_parameter.py",
"repo_id": "OCA",
"token_count": 293
} | 59 |
# Copyright 2016 Savoir-faire Linux
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Web No Bubble",
"version": "16.0.1.0.0",
"author": "Savoir-faire Linux, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
"category": "Web",
"summary": "Remove the bubbles from the web interface",
"depends": ["web"],
"installable": True,
"application": False,
"assets": {
"web.assets_backend": ["web_no_bubble/static/src/css/web_no_bubble.scss"],
"web.assets_frontend": ["web_no_bubble/static/src/css/web_no_bubble.scss"],
},
}
| OCA/web/web_no_bubble/__manifest__.py/0 | {
"file_path": "OCA/web/web_no_bubble/__manifest__.py",
"repo_id": "OCA",
"token_count": 280
} | 60 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_notify
#
# Translators:
# Niki Waibel <niki.waibel@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-03 01:37+0000\n"
"PO-Revision-Date: 2023-06-20 11:09+0000\n"
"Last-Translator: Nils Coenen <nils.coenen@nico-solutions.de>\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\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 "Gefahr"
#. module: web_notify
#. odoo-python
#: code:addons/web_notify/models/res_users.py:0
#, python-format
msgid "Default"
msgstr "Standard"
#. module: web_notify
#. odoo-python
#: code:addons/web_notify/models/res_users.py:0
#, python-format
msgid "Information"
msgstr "Information"
#. module: web_notify
#: model:ir.model.fields,field_description:web_notify.field_res_users__notify_danger_channel_name
msgid "Notify Danger Channel Name"
msgstr "Name Gefahrenkanal Benachritigung"
#. module: web_notify
#: model:ir.model.fields,field_description:web_notify.field_res_users__notify_default_channel_name
msgid "Notify Default Channel Name"
msgstr "Name Standardkanal Benachritigung"
#. module: web_notify
#: model:ir.model.fields,field_description:web_notify.field_res_users__notify_info_channel_name
msgid "Notify Info Channel Name"
msgstr "Name Informationskanal Benachritigung"
#. module: web_notify
#: model:ir.model.fields,field_description:web_notify.field_res_users__notify_success_channel_name
msgid "Notify Success Channel Name"
msgstr "Name Erfolgskanal Benachrichtigung"
#. module: web_notify
#: model:ir.model.fields,field_description:web_notify.field_res_users__notify_warning_channel_name
msgid "Notify Warning Channel Name"
msgstr "Name Warnungskanal Benachritigung"
#. 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 "Es ist verboten eine Nachricht an einem anderen Benutzer zu senden."
#. module: web_notify
#. odoo-python
#: code:addons/web_notify/models/res_users.py:0
#, python-format
msgid "Success"
msgstr "Erfolg"
#. module: web_notify
#: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit
msgid "Test danger notification"
msgstr "Test Gefahrenmeldung"
#. module: web_notify
#: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit
msgid "Test default notification"
msgstr "Standardbenachrichtigung testen"
#. module: web_notify
#: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit
msgid "Test info notification"
msgstr "Test Info Benachrichtigung"
#. module: web_notify
#: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit
msgid "Test success notification"
msgstr "Test Erfolgsbenarichtigung"
#. module: web_notify
#: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit
msgid "Test warning notification"
msgstr "Test Warnungsbenachritigung"
#. module: web_notify
#: model_terms:ir.ui.view,arch_db:web_notify.view_users_form_simple_modif_inherit
msgid "Test web notify"
msgstr "Test Webbenachrichtigung"
#. module: web_notify
#: model:ir.model,name:web_notify.model_res_users
msgid "User"
msgstr "Benutzer"
#. module: web_notify
#. odoo-python
#: code:addons/web_notify/models/res_users.py:0
#, python-format
msgid "Warning"
msgstr "Warnung"
#~ msgid "Users"
#~ msgstr "Benutzer"
| OCA/web/web_notify/i18n/de.po/0 | {
"file_path": "OCA/web/web_notify/i18n/de.po",
"repo_id": "OCA",
"token_count": 1487
} | 61 |
# pylint: disable=missing-docstring
# Copyright 2016 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, models
class MailChannel(models.Model):
_inherit = "mail.channel"
def message_post(self, *, message_type="notification", **kwargs):
message = super().message_post(message_type=message_type, **kwargs)
for partner in self.channel_partner_ids:
users = partner.user_ids
for user in users:
if user in message.author_id.user_ids:
continue
user.notify_info(
message=_("You have a new message in channel %s") % self.name
)
return message
| OCA/web/web_notify_channel_message/models/mail_channel.py/0 | {
"file_path": "OCA/web/web_notify_channel_message/models/mail_channel.py",
"repo_id": "OCA",
"token_count": 326
} | 62 |
#. Add support to define a style for a computed measure (ex. colored)
#. Use t-model to data-binding instead of jquery selectors
| OCA/web/web_pivot_computed_measure/readme/ROADMAP.rst/0 | {
"file_path": "OCA/web/web_pivot_computed_measure/readme/ROADMAP.rst",
"repo_id": "OCA",
"token_count": 35
} | 63 |
# Copyright 2022 Tecnativa - Carlos Roca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from odoo_test_helper import FakeModelLoader
from odoo.tests import common, tagged
@tagged("post_install", "-at_install")
class TestUIPivot(common.HttpCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.loader = FakeModelLoader(cls.env, cls.__module__)
cls.loader.backup_registry()
from .res_users_fake import ResUsersFake
cls.loader.update_registry((ResUsersFake,))
cls.env["res.users"].create(
{
"name": "User 1",
"login": "us_1",
# Fake fields
"user_year_born": 1998,
"user_year_now": 2022,
}
)
# Set pivot view to company action
action = cls.env.ref("base.action_res_users")
action.view_mode += ",pivot"
def test_ui(self):
self.start_tour(
"/web",
"web_pivot_computed_measure_tour",
login="admin",
step_delay=100,
)
| OCA/web/web_pivot_computed_measure/tests/test_ui_pivot.py/0 | {
"file_path": "OCA/web/web_pivot_computed_measure/tests/test_ui_pivot.py",
"repo_id": "OCA",
"token_count": 553
} | 64 |
Make Odoo an installable Progressive Web Application.
Progressive Web Apps provide an installable, app-like experience on desktop and mobile that are built and delivered directly via the web.
They're web apps that are fast and reliable. And most importantly, they're web apps that work in any browser.
If you're building a web app today, you're already on the path towards building a Progressive Web App.
+ Developers Info.
The service worker is contructed using 'Odoo Class' to have the same class inheritance behaviour that in the 'user pages'. Be noticed
that 'Odoo Bootstrap' is not supported so, you can't use 'require' here.
All service worker content can be found in 'static/src/js/worker'. The management between 'user pages' and service worker is done in
'pwa_manager.js'.
The purpose of this module is give a base to make PWA applications.
| OCA/web/web_pwa_oca/readme/DESCRIPTION.rst/0 | {
"file_path": "OCA/web/web_pwa_oca/readme/DESCRIPTION.rst",
"repo_id": "OCA",
"token_count": 207
} | 65 |
/* Copyright 2020 Tecnativa - Alexandre D. Díaz
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
// Compatibility layer to load some Odoo modules
// This is a hack, not a complete implementation!
// only expected to be used by boot.js
(function () {
"use strict";
function JQuery(selector, context) {
return new JQuery.prototype.init(selector, context);
}
JQuery.prototype = {
init: function (selector) {
if (typeof selector === "function") {
selector();
}
},
deparam: function (data) {
const params = data.split(",");
const res = [];
for (const param of params) {
res.push(param.split("="));
}
return _.object(res);
},
param: {
querystring: function () {
return "debug=1";
},
},
when: function (tasks) {
return Promise.all(tasks instanceof Array ? tasks : [tasks]).then(
(results) => {
return results.length === 1 ? results[0] : results;
}
);
},
};
class Deferred {
constructor() {
this.promise = new Promise((resolve, reject) => {
this.reject = reject;
this.resolve = resolve;
});
}
}
JQuery.prototype.Deferred = () => new Deferred();
self.$ = JQuery;
self.$.deparam = JQuery.prototype.deparam;
self.$.param = JQuery.prototype.param;
self.$.Deferred = JQuery.prototype.Deferred;
self.$.when = JQuery.prototype.when;
self.window = self;
})();
| OCA/web/web_pwa_oca/static/src/js/worker/jquery-sw-compat.js/0 | {
"file_path": "OCA/web/web_pwa_oca/static/src/js/worker/jquery-sw-compat.js",
"repo_id": "OCA",
"token_count": 807
} | 66 |
* Samuel Fringeli
* `Tecnativa <https://www.tecnativa.com>`__:
* João Marques
* Alexandre D. Díaz
* Carlos Roca
* Thanakrit Pintana
* `Factorlibre <https://www.factorlibre.com>`__:
* Hugo Santos
| OCA/web/web_refresher/readme/CONTRIBUTORS.rst/0 | {
"file_path": "OCA/web/web_refresher/readme/CONTRIBUTORS.rst",
"repo_id": "OCA",
"token_count": 85
} | 67 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_responsive
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-03-13 14:23+0000\n"
"Last-Translator: Rémi <remi@le-filament.com>\n"
"Language-Team: none\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"
"X-Generator: Weblate 4.14.1\n"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Activities"
msgstr "Activités"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/search_panel/search_panel.xml:0
#, python-format
msgid "All"
msgstr "Tout"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Attachment counter loading..."
msgstr "Chargement du compteur de pièces jointes..."
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Attachments"
msgstr "Pièces Jointes"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#, python-format
msgid "CLEAR"
msgstr "NETTOYER"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#, python-format
msgid "Discard"
msgstr "Annuler"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/search_panel/search_panel.xml:0
#, python-format
msgid "FILTER"
msgstr "FILTRER"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/apps_menu/apps_menu.xml:0
#, python-format
msgid "Home Menu"
msgstr "Menu d’accueil"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Log note"
msgstr "Enregistrer une note"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml:0
#, python-format
msgid "Maximize"
msgstr "Maximiser"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml:0
#, python-format
msgid "Minimize"
msgstr "Minimiser"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#, python-format
msgid "New"
msgstr ""
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#: code:addons/web_responsive/static/src/components/search_panel/search_panel.xml:0
#, python-format
msgid "SEE RESULT"
msgstr "VOIR RÉSULTAT"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/legacy/xml/form_buttons.xml:0
#, python-format
msgid "Save"
msgstr "Enregistrer"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/apps_menu/apps_menu.xml:0
#, python-format
msgid "Search menus..."
msgstr "Rechercher dans les menus..."
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#, python-format
msgid "Search..."
msgstr "Rechercher…"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/chatter_topbar/chatter_topbar.xml:0
#, python-format
msgid "Send message"
msgstr "Envoyer un message"
#. module: web_responsive
#. odoo-javascript
#: code:addons/web_responsive/static/src/components/control_panel/control_panel.xml:0
#, python-format
msgid "View switcher"
msgstr "Bascule de vue"
#, python-format
#~ msgid "Create"
#~ msgstr "Créer"
#~ msgid "Chatter Position"
#~ msgstr "Position de la messagerie"
#, python-format
#~ msgid "Clear"
#~ msgstr "Nettoyer"
#, python-format
#~ msgid "Edit"
#~ msgstr "Editer"
#~ msgid "Normal"
#~ msgstr "Normal"
#, python-format
#~ msgid "Quick actions"
#~ msgstr "Actions rapides"
#~ msgid "Sided"
#~ msgstr "À coté"
#, python-format
#~ msgid "Today"
#~ msgstr "Aujourd’hui"
#, python-format
#~ msgid "Undefined"
#~ msgstr "Non défini"
#~ msgid "Users"
#~ msgstr "Utilisateurs"
#, python-format
#~ msgid "props.withAccessKey ? 'x' : false"
#~ msgstr "props.withAccessKey ? 'x' : false"
#, python-format
#~ msgid "props.withAccessKey ? 'z' : false"
#~ msgstr "props.withAccessKey ? 'z' : false"
#~ msgid "#menu_id=#{app.menuID}&action_id=#{app.actionID}"
#~ msgstr "#menu_id=#{app.menuID}&action_id=#{app.actionID}"
#~ msgid "Close"
#~ msgstr "Fermer"
| OCA/web/web_responsive/i18n/fr.po/0 | {
"file_path": "OCA/web/web_responsive/i18n/fr.po",
"repo_id": "OCA",
"token_count": 1922
} | 68 |
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2019 Tecnativa - Alexandre Díaz
Copyright 2021 Sergey Shebanin
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<template>
<t t-inherit="mail.AttachmentViewer" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('o_AttachmentViewer')]" position="attributes">
<attribute
name="t-att-class"
t-translation="off"
>state.maximized ? 'o_AttachmentViewer_maximized' : ''</attribute>
</xpath>
<xpath
expr="//div[hasclass('o_AttachmentViewer_headerItemButtonClose')]"
position="before"
>
<div
t-if="!state.maximized"
class="o_AttachmentViewer_headerItem o_AttachmentViewer_headerItemButton o_AttachmentViewer_headerItemButtonMaximize d-flex align-items-center mb-0 px-3 h4 text-reset cursor-pointer"
t-on-click="() => { state.maximized = true }"
role="button"
title="Maximize"
aria-label="Maximize"
>
<i class="fa fa-fw fa-window-maximize" role="img" />
</div>
<div
t-if="state.maximized"
class="o_AttachmentViewer_headerItem o_AttachmentViewer_headerItemButton o_AttachmentViewer_headerItemButtonMinimize d-flex align-items-center mb-0 px-3 h4 text-reset cursor-pointer"
t-on-click="() => { state.maximized = false }"
role="button"
title="Minimize"
aria-label="Minimize"
>
<i class="fa fa-fw fa-window-minimize" role="img" />
</div>
</xpath>
</t>
</template>
| OCA/web/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml/0 | {
"file_path": "OCA/web/web_responsive/static/src/components/attachment_viewer/attachment_viewer.xml",
"repo_id": "OCA",
"token_count": 898
} | 69 |
/** @odoo-module */
/* Copyright 2023 Onestein - Anjeel Haria
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
import {patch} from "@web/core/utils/patch";
import {FormController} from "@web/views/form/form_controller";
// Patch FormController to always load attachment alongwith the chatter on the side bar
patch(FormController.prototype, "web_responsive.FormController", {
setup() {
this._super();
this.hasAttachmentViewerInArch = false;
},
});
| OCA/web/web_responsive/static/src/views/form/form_controller.esm.js/0 | {
"file_path": "OCA/web/web_responsive/static/src/views/form/form_controller.esm.js",
"repo_id": "OCA",
"token_count": 165
} | 70 |
.all-companies-item {
font-size: 16px;
font-weight: bold;
}
| OCA/web/web_select_all_companies/static/src/scss/switch_all_company_menu.scss/0 | {
"file_path": "OCA/web/web_select_all_companies/static/src/scss/switch_all_company_menu.scss",
"repo_id": "OCA",
"token_count": 32
} | 71 |
* For the time being, the module improves form and search view. Some other improvement could
be done on other part of the UI.
| OCA/web/web_theme_classic/readme/ROADMAP.rst/0 | {
"file_path": "OCA/web/web_theme_classic/readme/ROADMAP.rst",
"repo_id": "OCA",
"token_count": 30
} | 72 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_timeline
#
# Translators:
# Peter Hageman <hageman.p@gmail.com>, 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: 2020-12-10 13:36+0000\n"
"Last-Translator: Dennis Sluijk <d.sluijk@onestein.nl>\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/"
"teams/23907/nl_NL/)\n"
"Language: nl_NL\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 3.10\n"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_renderer.js:0
#, python-format
msgid "<b>UNASSIGNED</b>"
msgstr "<b>NIET TOEGEWEZEN</b>"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_controller.esm.js:0
#, python-format
msgid "Are you sure you want to delete this record?"
msgstr "Weet je zeker dat je dit record wilt verwijderen?"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Day"
msgstr "Dag"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Month"
msgstr "Maand"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_renderer.js:0
#, python-format
msgid "Template \"timeline-item\" not present in timeline view definition."
msgstr ""
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_view.js:0
#: model:ir.model.fields.selection,name:web_timeline.selection__ir_ui_view__type__timeline
#, python-format
msgid "Timeline"
msgstr "Tijdlijn"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_renderer.js:0
#, python-format
msgid "Timeline view has not defined 'date_start' attribute."
msgstr "Tijdlijn heeft geen 'date_start' eigenschap."
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Today"
msgstr "Vandaag"
#. module: web_timeline
#: model:ir.model,name:web_timeline.model_ir_ui_view
msgid "View"
msgstr "Weergave"
#. module: web_timeline
#: model:ir.model.fields,field_description:web_timeline.field_ir_ui_view__type
msgid "View Type"
msgstr "Soort weergave"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/js/timeline_controller.esm.js:0
#, python-format
msgid "Warning"
msgstr "Waarschuwing"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Week"
msgstr "Week"
#. module: web_timeline
#. odoo-javascript
#: code:addons/web_timeline/static/src/xml/web_timeline.xml:0
#, python-format
msgid "Year"
msgstr "Jaar"
#~ msgid "ir.ui.view"
#~ msgstr "ir.ui.view"
| OCA/web/web_timeline/i18n/nl_NL.po/0 | {
"file_path": "OCA/web/web_timeline/i18n/nl_NL.po",
"repo_id": "OCA",
"token_count": 1230
} | 73 |
This module prefers kanban sub-form views when using a tablet, or any other
device with a touch screen, no matter its size.
For example, these screenshots showcase a sale order in a tablet:
| Without this module | With this module |
| --------------------- | ------------------- |
| [![Before][]][Before] | [![After][]][After] |
[Before]: https://github.com/OCA/web/assets/973709/caa0be55-ec6b-45e8-af94-7492df08dfcc
[After]: https://github.com/OCA/web/assets/973709/345c1139-879d-4eb5-a828-786b1e3bc7b8
| OCA/web/web_touchscreen/readme/DESCRIPTION.md/0 | {
"file_path": "OCA/web/web_touchscreen/readme/DESCRIPTION.md",
"repo_id": "OCA",
"token_count": 183
} | 74 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_tree_duplicate
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: web_tree_duplicate
#. odoo-javascript
#: code:addons/web_tree_duplicate/static/src/web_tree_duplicate.esm.js:0
#, python-format
msgid "Duplicate"
msgstr ""
#. module: web_tree_duplicate
#. odoo-javascript
#: code:addons/web_tree_duplicate/static/src/web_tree_duplicate.esm.js:0
#, python-format
msgid "Duplicated Records"
msgstr ""
| OCA/web/web_tree_duplicate/i18n/web_tree_duplicate.pot/0 | {
"file_path": "OCA/web/web_tree_duplicate/i18n/web_tree_duplicate.pot",
"repo_id": "OCA",
"token_count": 289
} | 75 |
After installation, all many2one and reference fields will be clickable by default.
| OCA/web/web_tree_many2one_clickable/readme/CONFIGURATION.rst/0 | {
"file_path": "OCA/web/web_tree_many2one_clickable/readme/CONFIGURATION.rst",
"repo_id": "OCA",
"token_count": 18
} | 76 |
# Copyright 2019-2020 Brainbean Apps (https://brainbeanapps.com)
# Copyright 2020 CorporateHub (https://corporatehub.eu)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Dynamic Dropdown Widget",
"summary": "This module adds support for dynamic dropdown widget",
"category": "Web",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "CorporateHub, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"installable": True,
"assets": {
"web.assets_backend": [
"web_widget_dropdown_dynamic/**/*",
],
},
}
| OCA/web/web_widget_dropdown_dynamic/__manifest__.py/0 | {
"file_path": "OCA/web/web_widget_dropdown_dynamic/__manifest__.py",
"repo_id": "OCA",
"token_count": 263
} | 77 |
# Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
# Copyright (C) 2019-Today: Druidoo (<https://www.druidoo.io>)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Web Widget - Image WebCam",
"summary": "Allows to take image with WebCam",
"version": "16.0.1.0.0",
"category": "web",
"website": "https://github.com/OCA/web",
"author": "Tech Receptives, "
"Kaushal Prajapati, "
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"depends": ["web"],
"assets": {
"web.assets_backend": [
"web_widget_image_webcam/static/src/lib/webcam.js",
"web_widget_image_webcam/static/src/js/webcam_widget.js",
"web_widget_image_webcam/static/src/css/web_widget_image_webcam.css",
"web_widget_image_webcam/static/src/xml/web_widget_image_webcam.xml",
]
},
"installable": True,
}
| OCA/web/web_widget_image_webcam/__manifest__.py/0 | {
"file_path": "OCA/web/web_widget_image_webcam/__manifest__.py",
"repo_id": "OCA",
"token_count": 420
} | 78 |
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
Copyright 2019-Today: Druidoo (<https://www.druidoo.io>)
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<template>
<t
t-name="web_widget_image_webcam.ImageField"
t-inherit="web.ImageField"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//button[hasclass('o_clear_file_button')]" position="before">
<button
class="o_form_binary_file_web_cam btn btn-light border-0 rounded-circle m-1 p-1"
data-tooltip="WebCam"
aria-label="WebCam"
>
<i class="fa fa-eye" t-on-click="onWebcamClicked" />
</button>
</xpath>
</t>
<div t-name="WebCamDialog" id="WebCamModal">
<div class="container-fluid">
<div class="row">
<div class="col-md-5 live_webcam_outer_div">
<div id="live_webcam" />
</div>
<div class="col-md-2 mt64 direction_icon fa fa-angle-right fa-8x" />
<div class="col-md-5 webcam_result_outer_div">
<div id="webcam_result" />
</div>
</div>
</div>
</div>
</template>
| OCA/web/web_widget_image_webcam/static/src/xml/web_widget_image_webcam.xml/0 | {
"file_path": "OCA/web/web_widget_image_webcam/static/src/xml/web_widget_image_webcam.xml",
"repo_id": "OCA",
"token_count": 713
} | 79 |
/** @odoo-module **/
import {loadBundle} from "@web/core/assets";
import {registry} from "@web/core/registry";
const {onWillStart, markup, Component, onMounted, onPatched, useRef} = owl;
class Mpld3ChartJsonWidget extends Component {
setup() {
this.widget = useRef("widget");
onPatched(() => {
var script = document.createElement("script");
script.text = this.props.value.script;
this.widget.el.append(script);
});
onMounted(() => {
var script = document.createElement("script");
script.text = this.props.value.script;
this.widget.el.append(script);
});
onWillStart(() =>
loadBundle({
jsLibs: [
"/web_widget_mpld3_chart/static/src/lib/d3/d3.v5.js",
"/web_widget_mpld3_chart/static/src/lib/mpld3/mpld3.v0.5.9.js",
],
})
);
}
markup(value) {
console.log("Marking up...");
return markup(value);
}
}
Mpld3ChartJsonWidget.template = "web_widget_mpld3_chart.Mpld3ChartJsonWidget";
registry.category("fields").add("mpld3_chart", Mpld3ChartJsonWidget);
export default Mpld3ChartJsonWidget;
| OCA/web/web_widget_mpld3_chart/static/src/js/web_widget_mpld3_chart.esm.js/0 | {
"file_path": "OCA/web/web_widget_mpld3_chart/static/src/js/web_widget_mpld3_chart.esm.js",
"repo_id": "OCA",
"token_count": 600
} | 80 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_open_tab
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\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"
#. module: web_widget_open_tab
#: model:ir.model.fields,field_description:web_widget_open_tab.field_ir_model__add_open_tab_field
msgid "Add Open Tab Field"
msgstr ""
#. module: web_widget_open_tab
#: model:ir.model.fields,help:web_widget_open_tab.field_ir_model__add_open_tab_field
msgid "Adds open-tab field in list views."
msgstr ""
#. module: web_widget_open_tab
#: model:ir.model,name:web_widget_open_tab.model_base
msgid "Base"
msgstr ""
#. module: web_widget_open_tab
#. odoo-javascript
#: code:addons/web_widget_open_tab/static/src/js/open_tab_widget.esm.js:0
#, python-format
msgid "Click to open on new tab"
msgstr ""
#. module: web_widget_open_tab
#: model:ir.model,name:web_widget_open_tab.model_ir_model
msgid "Models"
msgstr ""
#. module: web_widget_open_tab
#. odoo-javascript
#: code:addons/web_widget_open_tab/static/src/js/open_tab_widget.esm.js:0
#, python-format
msgid "Open Tab"
msgstr ""
| OCA/web/web_widget_open_tab/i18n/pt_BR.po/0 | {
"file_path": "OCA/web/web_widget_open_tab/i18n/pt_BR.po",
"repo_id": "OCA",
"token_count": 536
} | 81 |
{
"name": "Web Widget Plotly",
"summary": """Allow to draw plotly charts.""",
"author": "LevelPrime srl, Odoo Community Association (OCA)",
"maintainers": ["robyf70"],
"website": "https://github.com/OCA/web",
"category": "Web",
"version": "16.0.1.0.0",
"depends": ["web"],
"data": [],
"external_dependencies": {
"python": ["plotly==5.13.1"],
},
"assets": {
"web.assets_backend": [
"web_widget_plotly_chart/static/src/js/widget_plotly.esm.js",
"web_widget_plotly_chart/static/src/js/widget_plotly.xml",
],
},
"license": "LGPL-3",
}
| OCA/web/web_widget_plotly_chart/__manifest__.py/0 | {
"file_path": "OCA/web/web_widget_plotly_chart/__manifest__.py",
"repo_id": "OCA",
"token_count": 299
} | 82 |
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="web_widget_plotly_chart.PlotlyChartWidgetField" owl="1">
<div t-ref="plotly" />
</t>
</templates>
| OCA/web/web_widget_plotly_chart/static/src/js/widget_plotly.xml/0 | {
"file_path": "OCA/web/web_widget_plotly_chart/static/src/js/widget_plotly.xml",
"repo_id": "OCA",
"token_count": 88
} | 83 |
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_widget_x2many_2d_matrix
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: web (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-23 13:46+0000\n"
"PO-Revision-Date: 2015-11-08 05:48+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-web-8-0/language/"
"sl/)\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"
#. module: web_widget_x2many_2d_matrix
#. odoo-javascript
#: code:addons/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.xml:0
#, python-format
msgid "Nothing to display."
msgstr ""
#, fuzzy, python-format
#~ msgid "Sum Total"
#~ msgstr "Skupaj"
| OCA/web/web_widget_x2many_2d_matrix/i18n/sl.po/0 | {
"file_path": "OCA/web/web_widget_x2many_2d_matrix/i18n/sl.po",
"repo_id": "OCA",
"token_count": 434
} | 84 |
<?xml version="1.0" encoding="UTF-8" ?>
<templates>
<t t-name="web_widget_x2many_2d_matrix.X2Many2DMatrixRenderer" owl="1">
<table
class="o_list_table table table-responsive table-sm table-hover position-relative mb-0 o_list_table_ungrouped table-striped"
t-if="rows.length > 0"
>
<thead>
<tr>
<th />
<th
t-foreach="columns"
t-as="column"
t-key="column.value"
class="text-center"
>
<t t-esc="column.text" />
</th>
<th t-if="props.showRowTotals" />
</tr>
</thead>
<tbody>
<tr t-foreach="rows" t-as="row" t-key="row.value">
<td>
<t t-esc="row.text" />
</td>
<td t-foreach="columns" t-as="column" t-key="column.value">
<t
t-component="ValueFieldComponent"
t-props="getValueFieldProps(column.value, row.value)"
/>
</td>
<td
t-if="props.showRowTotals and _canAggregate()"
class="row-total"
>
<t
t-component="ValueFieldComponent"
readonly="true"
value="_aggregateRow(row.value)"
/>
</td>
</tr>
</tbody>
<tfoot>
<tr t-if="props.showColumnTotals and _canAggregate()">
<th />
<th t-foreach="columns" t-as="column" t-key="column.value">
<t
t-component="ValueFieldComponent"
readonly="true"
value="_aggregateColumn(column.value)"
/>
</th>
<th t-if="props.showRowTotals" class="col-total">
<t
t-component="ValueFieldComponent"
readonly="true"
value="_aggregateAll()"
/>
</th>
</tr>
</tfoot>
</table>
<div t-else="" class="alert alert-info">
Nothing to display.
</div>
</t>
</templates>
| OCA/web/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.xml/0 | {
"file_path": "OCA/web/web_widget_x2many_2d_matrix/static/src/components/x2many_2d_matrix_renderer/x2many_2d_matrix_renderer.xml",
"repo_id": "OCA",
"token_count": 1803
} | 85 |
2.3.0
| SquareSquash/web/.ruby-version/0 | {
"file_path": "SquareSquash/web/.ruby-version",
"repo_id": "SquareSquash",
"token_count": 6
} | 86 |
@import "vars";
#breadcrumbs-container .container {
display: -webkit-box;
display: -moz-box;
display: box;
}
ul.breadcrumb {
background-color: white;
padding: 0 20px;
line-height: $nav-height;
-webkit-box-flex: 1;
-moz-box-flex: 1;
box-flex: 1;
li {
display: inline;
a { text-decoration: none; }
&:last-child {
font-size: 14px;
font-weight: bold;
}
&.divider {
color: $gray4;
padding: 0 5px;
}
}
}
div#breadcrumbs-stats {
display: -webkit-box;
display: -moz-box;
display: box;
div {
margin: 13px 5px;
background-color: $gray5;
padding: 4px 10px;
border-radius: $radius-size;
strong {
font-size: 14px;
font-weight: bold;
margin: 0;
}
span {
font-size: 14px;
display: none;
}
&.shown span { display: inline; }
}
}
| SquareSquash/web/app/assets/stylesheets/_breadcrumbs.scss/0 | {
"file_path": "SquareSquash/web/app/assets/stylesheets/_breadcrumbs.scss",
"repo_id": "SquareSquash",
"token_count": 405
} | 87 |
body#membership-edit {
.row { padding-bottom: 30px; }
form {
padding-top: 0;
padding-bottom: 0;
}
#project-owner img {
float: left;
margin-right: 10px;
}
}
#email-aliases {
input[type=search] { margin-bottom: 10px; }
}
| SquareSquash/web/app/assets/stylesheets/membership.css.scss/0 | {
"file_path": "SquareSquash/web/app/assets/stylesheets/membership.css.scss",
"repo_id": "SquareSquash",
"token_count": 107
} | 88 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# @abstract
#
# Abstract superclass of all controllers in the application. Unless otherwise
# noted in the controller documentation, all controllers follow the RESTful
# resource format as implemented in Rails.
#
# Supported Formats
# =================
#
# In general, the following formats are supported: HTML (`text/html`), JSON
# (`application/json`), and Atom (`application/atom+xml`). JSON requests are
# considered "API requests."
#
# Formats are indicated by the extension portion of the URL (e.g., ".json"), or
# the `Accepts` header. If no extension or header is given, HTML is assumed.
#
# Typical Responses
# =================
#
# Unless otherwise indicated by individual action method documentation, any
# RESTful request and response will follow the form shown below:
#
# All Actions
# -----------
#
# ### Record was successfully created
#
# If a record passes validation and is created, then...
#
# * for HTML requests, the response is a 302 Found redirect to the record's
# `show` page.
# * for API requests, the status code 201 Created is returned. The body is a
# representation of the resource in the API format.
#
# ### Record successfully updated
#
# If a record passes validation and is updated, then...
#
# * for HTML requests, the response is a 302 Found redirect to the record's
# `show` page.
# * for API requests, the status code 200 OK is returned. The body is a
# representation of the resource in the API format.
#
# ### Record destroyed
#
# If a record is destroyed, then...
#
# * for HTML requests, the response is a 302 Found redirect to some relevant
# destination.
# * for API requests, the status code 204 No Content is returned. The body is
# empty.
#
# ### Record not found
#
# If a record cannot be found, the status code 404 Not Found is returned. For
# HTML requests, a 404 page is rendered; for all other requests, no content is
# returned.
#
# ### Invalid field provided
#
# If an unknown or a protected field is included in a `create` or `update`
# request, then...
#
# * for HTML requests, the response is a 302 Found redirect to the root URL. A
# flash alert is added indicating that the request was malformed.
# * for API requests, the status code 400 Bad Request is returned. The body is
# empty.
#
# ### Record failed to validate
#
# If a record fails to validate during a `create` or `update` request, then...
#
# * for HTML requests, the form is re-rendered (without a redirect), and the
# HTML is updated to indicate which fields are in error (status 200 OK).
# * for API requests, the status code 422 Unprocessable Entity is returned. The
# body is a hash mapping model names (such as `project`) to a hash mapping
# field names (such as `name`) to an array of error description fragments
# (such as `is required`). Example:
#
# ```` json
# {
# "project":{
# "name":["is required"],
# "repository_url":["is too long", "is not a valid URL"]
# },
# "user":{
# "username":["is taken"]
# }
# }
# ````
#
# ### Authentication required
#
# See the {AuthenticationHelpers#login_required} method for more information.
#
# CSRF Protection
# ===============
#
# All non-`GET` requests (HTML and API) must contain a correct authenticity
# token parameter. If your form is generated prior to the time of request, you
# can use the CSRF meta tags generated by the `csrf_meta_tags` function in
# Rails.
class ApplicationController < ActionController::Base
include AuthenticationHelpers
include "#{Squash::Configuration.authentication.strategy}_authentication_helpers".camelize.constantize
include Squash::Ruby::ControllerMethods
enable_squash_client
if Rails.env.development?
SQLOrigin::LIBRARY_PATHS << 'config/initializers/jdbc_fixes.rb'
before_filter { SQLOrigin.append_to_log }
end
# Valid sort directions for a sort parameter.
SORT_DIRECTIONS = %w(ASC DESC)
layout false # handled by view class inheritance
protect_from_forgery
self.responder = JsonDetailResponder
rescue_from(ActiveRecord::RecordNotFound) do
respond_to do |format|
format.html { render file: File.join(Rails.public_path, '404'), format: :html, status: :not_found }
format.json { head :not_found }
format.atom { head :not_found }
end
end
rescue_from(ActionController::UnpermittedParameters) do |error|
respond_to do |format|
format.html { render file: File.join(Rails.public_path, '400'), format: :html, status: :bad_request }
format.json do
render json: {error: "The following parameters cannot be modified: #{error.params.join(', ')}" }, status: :bad_request
end
format.atom { head :bad_request }
end
end
before_filter :login_required
protected
# Generates a SQL `WHERE` clause to load the next page of rows for an infinite
# scrolling implementation. It is assumed that the controller can load the
# last object of the previous page.
#
# @param [String] column The column that the rows are sorted by.
# @param [String] dir The sort direction ("ASC" or "DESC").
# @param [ActiveRecord::Base] last The last object of the last page.
# @param [String] key The column that is used to identify the last object of a
# page (by default equal to `column`). You would typically set this
# parameter to a globally unique column when your sort column is not
# guaranteed to be globally unique (to ensure that edge records are not
# loaded in two different pages).
# @return [String] A SQL `WHERE` clause to load the next page of rows.
#
# @example Sorting by `created_at` but keying by `id`
# last = Model.find_by_id(params[:last])
# if last
# @records = Model.where(infinite_scroll_clause('created_at', 'DESC', last, 'id')).order('created_at DESC').limit(50)
# else
# @records = Model.order('created_at DESC').limit(50)
# end
def infinite_scroll_clause(column, dir, last, key=nil)
field = column.split('.').last
last_value = last.send(field)
if key
key_field = key.split('.').last
last_key = last.send(key_field)
end
case dir.upcase
when 'ASC'
if key
["#{column} > ? OR (#{column} = ? AND #{key} > ?)", last_value, last_value, last_key]
else
["#{column} > ?", last_value]
end
when 'DESC'
if key
["#{column} < ? OR (#{column} = ? AND #{key} < ?)", last_value, last_value, last_key]
else
["#{column} < ?", last_value]
end
else
'TRUE'
end
end
# @return [Kramdown::Document] A Markdown renderer that can be used to render
# comment bodies. Also available in views.
def markdown
$markdown ||= ->(text) { Kramdown::Document.new(text).to_html }
end
helper_method :markdown
private
def find_project
@project = Project.find_from_slug!(params[:project_id])
end
def find_environment
@environment = @project.environments.with_name(params[:environment_id]).first!
end
def find_bug
@bug = @environment.bugs.find_by_number!(params[:bug_id])
end
def membership_required
if current_user.role(@project)
return true
else
respond_to do |format|
format.json { head :forbidden }
format.html { redirect_to root_url }
end
end
end
def admin_login_required
if [:owner, :admin].include? current_user.role(@project)
return true
else
respond_to do |format|
format.json { head :forbidden }
format.html { redirect_to root_url }
end
end
end
def owner_login_required
if current_user.role(@project) == :owner then
return true
else
respond_to do |format|
format.html { redirect_to root_url }
format.json { head :forbidden }
end
return false
end
end
end
| SquareSquash/web/app/controllers/application_controller.rb/0 | {
"file_path": "SquareSquash/web/app/controllers/application_controller.rb",
"repo_id": "SquareSquash",
"token_count": 2753
} | 89 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Controller for logging in and logging out of the application. See
# {AuthenticationHelpers} for more information on how authentication works.
class SessionsController < ApplicationController
skip_before_filter :login_required, only: [:new, :create]
before_filter :must_be_unauthenticated, except: :destroy
respond_to :html
# Displays a page where the user can enter his/her credentials to log in.
#
# Routes
# ------
#
# * `GET /login`
def new
end
# Attempts to log a user in. If login fails, or the LDAP server is
# unreachable, renders the `new` page with a flash alert.
#
# If the login is successful, takes the user to the next URL stored in the
# params; or, if none is set, the root URL.
#
# Routes
# ------
#
# * `POST /login`
#
# Request Parameters
# ------------------
#
# | | |
# |:-------|:------------------------------------------------|
# | `next` | A URL to redirect to after login is successful. |
#
# Body Parameters
# ---------------
#
# | | |
# |:-----------|:-----------------------|
# | `username` | The {User}'s username. |
# | `password` | The User's password. |
def create
if params[:username].blank? || params[:password].blank?
return respond_to do |format|
format.html do
flash.now[:alert] = t('controllers.sessions.create.missing_field')
render 'new'
end
end
end
if log_in(params[:username], params[:password])
respond_to do |format|
format.html do
flash[:success] = t('controllers.sessions.create.logged_in', name: current_user.first_name || current_user.username)
redirect_to(params[:next].presence || root_url)
end
end
else
respond_to do |format|
format.html do
flash.now[:alert] ||= t('controllers.sessions.create.incorrect_login')
render 'new'
end
end
end
end
# Logs a user out and clears his/her session. Redirects to the login URL.
#
# Routes
# ------
#
# * `GET /logout`
def destroy
log_out
redirect_to login_url, notice: t('controllers.sessions.destroy.logged_out')
end
end
| SquareSquash/web/app/controllers/sessions_controller.rb/0 | {
"file_path": "SquareSquash/web/app/controllers/sessions_controller.rb",
"repo_id": "SquareSquash",
"token_count": 1062
} | 90 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# An email address for a {User}. These records are principally used to ensure
# that correct user is notified when the VCS blame function gives us an email
# address (that may not be the User's corporate email address).
#
# This model can also be used to give "ownership" of a (presumably former)
# User's email notifications to a different User. For example, if bob@acme.com
# has left the company, and jeff@acme.com has been tasked to take over Bob's
# code, Jeff can add bob@acme.com to his account. Then, any bugs for which
# bob@acme.com is to blame will be rerouted to jeff@acme.com.
#
# This behavior chains, as well -- if Jeff then leaves the company, and
# jan@acme.com takes over for jeff@acme.com, she'll also get Bob's emails.
#
# In order for this to work, there is a uniqueness constraint on `email` and
# `primary`. That is, only Jeff can have jeff@acme.com be his primary address,
# and only Bob can have jeff@acme.com as a non-primary (redirecting) address.
# If Bob changed teams and Mel was to take over Bob's old exceptions, Bob
# would have to relinquish jeff@acme.com before Mel could add it.
#
# When a user signs up, a "primary" Email record is automatically created for
# them with their corporate email address. This email will be used by Squash
# for any email notifications, regardless of the VCS-blamed email.
#
# Associations
# ------------
#
# | | |
# |:----------|:-------------------------------------------------------------------------|
# | `user` | The {User} who should be notified when this email is blamed. |
# | `project` | If set, the email will only apply for emails relating to this {Project}. |
#
# Properties
# ----------
#
#
# | | |
# |:----------|:--------------------------------------------------------------------------|
# | `email` | The email address. |
# | `primary` | If `true`, this is the email address Squash will use to contact the User. |
class Email < ActiveRecord::Base
belongs_to :user, inverse_of: :emails
belongs_to :project, inverse_of: :emails
validates :email,
presence: true,
email: true,
uniqueness: {case_sensitive: false, scope: [:project_id, :primary]}
validates :user,
presence: true
validate :one_primary_email
validate :cant_redirect_your_own_email
validate :project_emails_cant_be_primary
validate :cannot_locally_redirect_gobally_redirected_email
validate :user_must_be_member_of_project
after_save :one_primary_email_per_user
after_save :delete_locally_redirected_emails, if: :global?
attr_readonly :email
scope :by_email, ->(email) { email ? where('LOWER(email) = ?', email.downcase) : where('FALSE') }
scope :global, -> { where(project_id: nil) }
scope :project_specific, -> { where('project_id IS NOT NULL') }
scope :primary, -> { where(primary: true) }
scope :redirected, -> { where(primary: false) }
# @return [User, nil] The User whose primary email is this email address, or
# `nil` if this is a primary email, or if no User has this email as his/her
# primary.
def source
return nil if primary?
return Email.primary.by_email(email).first.try!(:user)
end
# @return [true, false] `true` if this is a global email redirection, or
# `false` if this is a project-specific redirection or a primary email.
def global?() !primary? && project_id.nil? end
# @private
def to_param() email end
# @private
def as_json(options=nil)
options ||= {}
options[:except] = Array.wrap(options[:except])
options[:except] << :id << :user_id
options[:methods] = Array.wrap(options[:methods])
options[:methods] << :source
super options
end
private
def one_primary_email
errors.add(:primary, :must_be_set) if primary_changed? && !primary?
end
def one_primary_email_per_user
return unless primary && primary_changed?
user.emails.where('id != ?', id).update_all(primary: false)
end
def cant_redirect_your_own_email
errors.add(:email, :is_your_primary) if !primary? && email == user.email
end
def project_emails_cant_be_primary
errors.add(:primary, :not_allowed) if primary? && project_id
end
def cannot_locally_redirect_gobally_redirected_email
errors.add(:email, :has_global_redirect) if user.emails.redirected.global.by_email(email).any?
end
def user_must_be_member_of_project
errors.add(:project_id, :not_a_member) if project_id && Membership.for(user_id, project_id).empty?
end
def delete_locally_redirected_emails
user.emails.project_specific.by_email(email).delete_all
end
end
| SquareSquash/web/app/models/email.rb/0 | {
"file_path": "SquareSquash/web/app/models/email.rb",
"repo_id": "SquareSquash",
"token_count": 1902
} | 91 |
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'zlib'
require 'base64'
# Symbolication information for a project. This model stores an array of address
# ranges and the file, line, and method information for each of those ranges.
# Symbolication can then be done by finding the information corresponding to a
# range that includes a particular program counter address.
#
# Symbolication objects are uniquely referenced by UUID. This is because Xcode
# generates a UUID for each new build and architecture of a project. The UUID is
# then distributed with the project, and used to look up the correct
# Symbolication to use.
#
# For projects in compiled languages that do not attach a UUID to their debug
# data, the Squash client library for that language will need to generate its
# own UUID, to be distributed with the project.
#
# For more information on symbolication generally, see the README.
#
# ### Symbol Data
#
# Symbol data is generated using the "squash_ios_symbolicator" gem. The gem
# produces data structures that can be compactly serialized. The gem is also
# included in this project to support deserializing the resulting data.
#
# Serialization is accomplished by YAML-serializing the `Symbols` or `Lines`
# object, zlib-encoding the result, and then base-64-encoding the compressed
# output. This is also how the `symbols` and `lines` properties are transmitted
# over the wire.
#
# No support is given for modifying these objects after they have been
# deserialized from YAML.
#
# Properties
# ----------
#
# | | |
# |:----------|:------------------------------------------------------------------------|
# | `uuid` | A universally-unique identifier associated with the symbolication data. |
# | `symbols` | A serialized `Symbolication::Symbols` object with debug_info data. |
# | `lines` | A serialized `Symbolication::Lines` object with debug_lines data. |
class Symbolication < ActiveRecord::Base
# internal use only
has_many :occurrences, inverse_of: :symbolication, primary_key: 'uuid', dependent: :restrict_with_exception
self.primary_key = 'uuid'
validates :uuid,
presence: true,
uniqueness: true,
format: {with: /\A[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\z/i}
after_commit(on: :create) do |sym|
BackgroundRunner.run SymbolicationWorker, sym.id
end
attr_readonly :uuid
# @private
def symbols
@symbols ||= begin
syms = YAML.load(Zlib::Inflate.inflate(Base64.decode64(read_attribute(:symbols))))
raise TypeError, "expected Squash::Symbolicator::Symbols, got #{syms.class}" unless syms.kind_of?(Squash::Symbolicator::Symbols)
syms
end
end
# @private
def symbols=(syms)
raise TypeError, "expected Squash::Symbolicator::Symbols, got #{syms.class}" unless syms.kind_of?(Squash::Symbolicator::Symbols)
write_attribute :symbols, Base64.encode64(Zlib::Deflate.deflate(syms.to_yaml))
@symbols = syms
end
# @private
def lines
@lines ||= begin
lns = YAML.load(Zlib::Inflate.inflate(Base64.decode64(read_attribute(:lines))))
raise TypeError, "expected Squash::Symbolicator::Lines, got #{lns.class}" unless lns.kind_of?(Squash::Symbolicator::Lines)
lns
end
end
# @private
def lines=(lns)
raise TypeError, "expected Squash::Symbolicator::Lines, got #{lns.class}" unless lns.kind_of?(Squash::Symbolicator::Lines)
write_attribute :lines, Base64.encode64(Zlib::Deflate.deflate(lns.to_yaml))
@lines = lns
end
# Returns the file path, line number, and method name corresponding to a
# program counter address. The result is formatted for use as part of an
# {Occurrence}'s backtrace element.
#
# If `lines` is provided, the line number will be the specific corresponding
# line number within the method. Otherwise it will be the line number of the
# method declaration.
#
# @param [Fixnum] address A stack return address (decimal number).
# @return [Hash, nil] The file path, line number, and method name containing
# that address, or `nil` if that address could not be symbolicated.
def symbolicate(address)
line = lines.for(address) if lines
symbol = symbols.for(address)
if line && symbol
{
'file' => line.file,
'line' => line.line,
'symbol' => symbol.ios_method
}
elsif line
{
'file' => line.file,
'line' => line.line
}
elsif symbol
{
'file' => symbol.file,
'line' => symbol.line,
'symbol' => symbol.ios_method
}
else
nil
end
end
end
| SquareSquash/web/app/models/symbolication.rb/0 | {
"file_path": "SquareSquash/web/app/models/symbolication.rb",
"repo_id": "SquareSquash",
"token_count": 1873
} | 92 |
A new exception has occurred on <%= @bug.environment.project.name %>, and Squash
suspects that it's your fault.
<%= project_environment_bug_url @bug.environment.project, @bug.environment, @bug %>
Project: <%= @bug.environment.project.name %>
Environment: <%= @bug.environment.name %>
Revision: <%= @bug.revision %>
Blamed Commit: <%= @bug.blamed_revision %>
<%= @bug.class_name %>
<% if @bug.special_file? %>
in <%= @bug.file %>
<% else %>
in <%= @bug.file %>:<%= @bug.line %>
<% end %>
<%= @bug.message_template %>
----
Is it your fault?
Under "Management," assign it to yourself, then commit the fix. Mark the bug
as fixed when the fix is pushed.
Is it someone else's fault?
Under "Management," assign it to that person -- they will receive an email
notification.
Is this not really a bug?
Under "Management," mark the bug as "no one will fix this." You will no
longer receive notifications about this non-bug. You can also simply delete
the bug if it was a one-time test.
You should take one of the above three actions -- don't just let the bug sit
there!
----
<% if @bug.occurrences.first %>
Stack trace of initial occurrence:
<%= render_backtrace(@bug.occurrences.first.faulted_backtrace).indent(2) %>
----
<% end %>
Yours truly,
Squash
| SquareSquash/web/app/views/notification_mailer/blame.text.erb/0 | {
"file_path": "SquareSquash/web/app/views/notification_mailer/blame.text.erb",
"repo_id": "SquareSquash",
"token_count": 472
} | 93 |
# encoding: utf-8
# Copyright 2014 Square Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require Rails.root.join('app', 'views', 'layouts', 'application.html.rb')
module Views
module Projects
# @private
class Index < Views::Layouts::Application
protected
def tabbed?() true end
def body_content
full_width_section do
h1 "Welcome, #{current_user.first_name}"
end
tabbed_section -> { tab_header }, -> { tab_content }
end
private
def tab_header
ul(class: 'tab-header') do
li(class: 'active') { a "My Feed", href: '#feed', rel: 'tab' }
li(class: 'with-table') { a "Watched Bugs", href: '#watched', rel: 'tab' }
li(class: 'with-table') { a "Assigned Bugs", href: '#assigned', rel: 'tab' }
li { a "All Projects", href: '#find', rel: 'tab' }
end
end
def tab_content
div(class: 'tab-content tab-primary') do
div(class: 'active', id: 'feed') { my_feed }
div(id: 'watched', class: 'with-table') { watched_bugs }
div(id: 'assigned', class: 'with-table') { assigned_bugs }
div(id: 'find') { find_project }
end
end
def my_feed
h3 "Recent Activity"
ul id: 'events'
end
def watched_bugs
table id: 'watched-bugs'
end
def assigned_bugs
table id: 'assigned-bugs'
end
def find_project
div(class: 'inset-content') do
p do
text "To change your project membership or leave a project, use the "
link_to "My Account", account_url
text " page."
end
form(class: 'whitewashed') do
input type: 'search', id: 'find-project', placeholder: 'Find a project'
end
ul id: 'find-project-search-results', class: 'project-search-results'
end
end
end
end
end
| SquareSquash/web/app/views/projects/index.html.rb/0 | {
"file_path": "SquareSquash/web/app/views/projects/index.html.rb",
"repo_id": "SquareSquash",
"token_count": 1047
} | 94 |
---
strategy: password
registration_enabled: true
| SquareSquash/web/config/environments/common/authentication.yml/0 | {
"file_path": "SquareSquash/web/config/environments/common/authentication.yml",
"repo_id": "SquareSquash",
"token_count": 14
} | 95 |
---
exception_behavior_when_disabled: raise
| SquareSquash/web/config/environments/test/dogfood.yml/0 | {
"file_path": "SquareSquash/web/config/environments/test/dogfood.yml",
"repo_id": "SquareSquash",
"token_count": 13
} | 96 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.