Harigami
ログイン
1234578
anonymous タイトルなし
JavaScript
javascript:(function(){var c=location.hostname;var a=location.pathname;if(c=="tour.his-j.com"){host="dev-tour.his-j.com:8083";a=a.replace("trip/ciao/voyage","c47/booking")}else{if(c="dev-tour.his-j.com:8083"){host="tour.his-j.com";a=a.replace("c47/booking","trip/ciao/voyage")}}var b=window.location.search;url="http://"+host+a+b;location.href=url}());
  • 0
  • 0
anonymous タイトルなし
JavaScript
import * as React from "react";
import { useSelector, useDispatch } from "react-redux";
import { Form, Button } from "react-bootstrap";

import { getLoginState } from "../selectors/login_state";
import { query } from "../requests/query"

export const TagGroups = (): React.ReactElement => {
  const dispatch = useDispatch();

  const [name,setName] = React.useState("");

  const handleSubmit = (event) => {
    const makeTagGroupQuery = { //著者とかで何個もこういうの作るしバリデーション考えたら関数化した方がいいのかな?
      method: 'post',
      name: name
    };
    query(dispatch,makeTagGroupQuery);
    event.preventDefault();
  };

const ls = useSelector(getLoginState);//一応authorizedじゃないとボタン押せなくしたけどこれいる?

  return (
    <div className="card">
      <div className="card-body">
        <h1>タググループ作成</h1>
        <Form onSubmit={handleSubmit}>
          <Form.Group>
            <FormData.Label>タググループ名</FormData.Label>
            <FormData.Control type='text' value={name} onChange={(event) => setName(event.target.value)} />
          </Form.Group>
          <Button type="submit" disabled={ls !== "authorized"}>作成</Button>
        </Form>
      </div>
    </div>
  );
};
  • 0
  • 0
anonymous タイトルなし
JavaScript
        firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
            // TODO: Error対応
            if (error) {
                alert(error.message);
            }
            alert("error");
        });

        const userAuth = firebase.auth().currentUser;
        alert(userAuth)
  • 0
  • 0
anonymous タイトルなし
JavaScript
<template>
  <v-app id="inspire">
    <v-main>
      <v-container
        class="fill-height"
        fluid
      >
        <v-row
          align="center"
          justify="center"
        >
          <v-col
            cols="12"
            sm="8"
            md="4"
          >
            <v-card class="elevation-12">
              <v-toolbar
                color="primary"
                dark
                flat
              >
                <v-toolbar-title>Login form</v-toolbar-title>
                <v-spacer></v-spacer>
              </v-toolbar>
              <v-card-text>
                <v-form>
                  <v-text-field
                    label="Login"
                    name="login"
                    prepend-icon="mdi-account"
                    type="text"
                    v-model="email"
                  ></v-text-field>

                  <v-text-field
                    id="password"
                    label="Password"
                    name="password"
                    prepend-icon="mdi-lock"
                    type="password"
                    v-model="password"></v-text-field>
                </v-form>
              </v-card-text>
              <v-card-actions>
                <v-spacer></v-spacer>
                <v-btn color="primary" @click="signUp">Sign up</v-btn>
                <v-btn color="primary" @click="signIn">Sign in</v-btn>
              </v-card-actions>
            </v-card>
          </v-col>
        </v-row>
      </v-container>
    </v-main>
  </v-app>
</template>

<script>
  export default {
    data(){
      return {
        email: "",
        password: "",
      }
    },
    methods: {
      singUp() {
        alert('Sign In')
        try {
          this.$store.dispatch('login/signUp', {
            email: this.email, 
            password: this.password
          })
        } catch(e) {
          alert('Error')
        }
      },
      signIn() {
        alert('Hello')
        try {
          this.$store.dispatch('login/signUp', {
            email: this.email, 
            password: this.password
          })
        } catch(e) {
          alert('Error')
        }
      }
    }
  }
</script>
  • 0
  • 0
anonymous タイトルなし
JavaScript
function myFunction2_1() {
  const sheet = SpreadsheetApp.getActiveSheet();
  const data = sheet.getDataRange().getValues();
  let target = '';
  for(let i = 0; i < data.length; i ++){
    if(data[i][1] === 'keyword'){
      target = data[i][0];
      console.log(target);
    };
  };
}

function myFunction2_2() {
  const sheet = SpreadsheetApp.getActiveSheet();
  const data = sheet.getDataRange().getValues();
  let tmp = data.filter(function(x){
    return x[1] === 'keyword';
  });
  let target = tmp.map(function(y){
    return y[0];
  });
  console.log(target);
}
  • 0
  • 0
anonymous GAS
JavaScript
// 配列を使わない
function myFunction(){
  const sheet = SpreadsheetApp.getActiveSheet();
  let target = 0;
  for(let i = 1; i <= sheet.getLastRow(); i ++){
    if(sheet.getRange(i, 2).getValue() === 'keyword'){
      target = sheet.getRange(i, 1).getValue();
      console.log(target)
    };
  };
}

// 配列を使う
function myFunction2(){
  const sheet = SpreadsheetApp.getActiveSheet();
  const data = sheet.getDataRange().getValues();
  let target = data.filter(x => x[1] === 'keyword').map(y => y[0]);
  console.log(target);
}
  • 0
  • 0
anonymous タイトルなし
JavaScript
class SetTime{
	constructor(){
		this.currentTime = 0;
		this.newDiv = document.createElement("div");
		this.insertedEle = document.getElementsByClassName("ytp-left-controls")[0];
		this.targetEle = document.getElementsByClassName("ytp-time-current")[0];
		this.insertDiv = document.createElement("div");
		this.newDiv.style.cssText = "font-size: 109%;display: inline-block;vertical-align: top;padding: 0 5px;white-space: nowrap;line-height: 35px;"
		this.newContent = document.createTextNode("none"); 
    	this.newDiv.appendChild(this.newContent);
    	this.insertedEle.insertAdjacentElement("beforeend",this.newDiv);
	}
	converter(){
		var result;
		var hour,minute,second;
		var organizedTime = this.currentTime.match( /((?<hour>\d+):)?(?<minute>\d+):(?<second>\d+)/ );
		hour = Number(organizedTime.groups.hour);
		minute = Number(organizedTime.groups.minute);
		second = Number(organizedTime.groups.second);
		result = (hour?hour*3600:0)+(minute?minute*60:0)+(second?second:0);
		return result;
	}
	getUrl(){
		let url;
		const headTags = document.body.children;
		for(let tag of headTags){
			const attribute = tag.getAttribute('name');
			if(attribute == "twitter:url"){
				url = tag.getAttribute("content");
				console.log(url);
			}
		}
		return url;
	}
}

window.onload = function() {
	var setTime = new SetTime();
	setTime.targetEle.addEventListener('click', function(ele) {
	    setTime.currentTime = ele["path"][0].textContent;
	    convertedTime = setTime.converter();
	    const url =setTime.getUrl();
	    setTime.newContent.textContent = url + "&t=" + convertedTime;
	    document.getSelection().selectAllChildren(setTime.newDiv);
	    document.execCommand("copy");
	}, false);
}
  • 0
  • 0
anonymous タイトルなし
JavaScript
javascript:(function(){document.getElementsById("content-secondary")[0].firstChild.setAttribute("style", "witdh:1280px")})();
  • 0
  • 0
anonymous タイトルなし
JavaScript
{
  "teamA": {
    "agents": [
      {
        "id": 1,
        "command": "placement",
        "x": 5,
        "y": 6,
        "dx": null,
        "dy": null,
      },
      {
        "id": 2,
        "command": null,
        "x": null,
        "y": null,
        "dx": null,
        "dy": null,
      },
      {
        "id": 3,
        "command": "move",
        "x": null,
        "y": null,
        "dx": 1,
        "dy": -1,
      },
      {
        "id": 4,
        "command": "remove",
        "x": null,
        "y": null,
        "dx": -1,
        "dy": 0,
      },
    ]
  },
  "teamB": {
    "agents": [
      {
        "id": 1,
        "command": "move",
        "x": null,
        "y": null,
        "dx": 1,
        "dy": 1,
      },
      {
        "id": 2,
        "command": "move",
        "x": null,
        "y": null,
        "dx": 0,
        "dy": -1,
      },
      {
        "id": 3,
        "command": "remove",
        "x": null,
        "y": null,
        "dx": -1,
        "dy": -1,
      },
      {
        "id": 4,
        "command": "remove",
        "x": null,
        "y": null,
        "dx": -1,
        "dy": 0,
      },
    ]
  }
}
  • 0
  • 0
anonymous YoutubeLive絵文字コメント削除スクリプト
JavaScript
setInterval(function(){[].forEach.call(document.getElementById("chatframe").contentWindow.document.getElementsByTagName("yt-live-chat-text-message-renderer"),function(a){if(a.querySelector("#message img")!=null){a.style.display="none"}})},100);
  • 0
  • 0
あなたもコードを投稿しませんか?
投稿する
1234578