Harigami
ログイン
1
anonymous タイトルなし
JavaScript
function onFormSubmit(e){
 var itemResponses = e.values;
}

var fromemail = itemResponses[2].getResponse();


// フォーム送信されたら起動され、最終行の内容をメールに記載して、送信する
function wmapp_contact_me_mail_send() {

  // 件名、本文
  var subject = '面接後アンケートが送信されました'; 
  var body    = '';

  // メール送信先(管理者等)
  var mail_admin = 'test@gmail.com';
  var mail_cc    = 'test@gmail.com';
  var mail_reply = fromemail;
  var mail_to    = 'test@gmail.com';

  try{    
    // スプレッドシートの操作
    var sh   = SpreadsheetApp.getActiveSheet();
    var rows = sh.getLastRow();
    var cols = sh.getLastColumn();
    var rg   = sh.getDataRange();
    Logger.log('rows='+rows+' cols='+cols);
    
    // メール本文作成
    for (var j = 1; j <= cols; j++ ) {
      var clmn_name  = rg.getCell(1, j).getValue();    // カラム名
      var clmn_value = rg.getCell(rows, j).getValue(); // 入力値 
      body += ( '【' + clmn_name + '】' + '\n' + clmn_value + '\n\n' );
      }
    
    // メール送信
    if ( mail_to ) {
      MailApp.sendEmail(mail_to, subject, body, {cc : mail_cc, replyTo : mail_reply});
    }else{
      MailApp.sendEmail(mail_admin, 'error spreadsheet none mailaddress', body);
    }
  }

  catch(e){
    MailApp.sendEmail(mail_admin, 'error spreadsheet func: wmapp_contact_me_mail_send()', e.message);
  } 
}
  • 0
  • 1
anonymous タイトルなし
JavaScript
document.addEventListener("DOMContentLoaded", function () {
  let lazyObjects = [].slice.call(document.querySelectorAll(".lazy img, .lazy"));
  // IntersectionObserver対応ブラウザのみ実行
  if ("IntersectionObserver" in window) {
    // IntersectionObserverオブジェクト生成
    let lazyObjectsObserver = new IntersectionObserver(function (entries, observer) {
      entries.forEach(function (entry) {
        // この要素が画面に入ってきた場合
        if (entry.isIntersecting) {
          let lazyObject = entry.target;
          if (lazyObject.dataset.hasOwnProperty('src')) {
            lazyObject.src = lazyObject.dataset.src;
            lazyObject.dataset.src = '';
            delete lazyObject.dataset.src;
          }
          if (lazyObject.dataset.hasOwnProperty('srcset')) {
            lazyObject.srcset = lazyObject.dataset.srcset;
            lazyObject.dataset.srcset = '';
            delete lazyObject.dataset.srcset;
          }
          if (lazyObject.dataset.hasOwnProperty('bnr01') || lazyObject.dataset.hasOwnProperty('bnr02')) {
            var loadBnr = new Promise((resolve, reject) => {
              load_bnrdata({
                json_bnr: './kanto/json/bnr_g.json',
                page_id: 'グランドトップ',
                pc_sp: 'sp'
              })
            })
            loadBnr
              .then(slickBnr())
              .catch(() => {
                console.log('Promise 失敗')
              })
          }
          if (lazyObject.dataset.hasOwnProperty('news')) {
            load_newsdata({
              json_news: './kanto/json/news.json',
              page_id: 'グランドトップ',
              pc_sp: 'sp'
            });
          }
          if (lazyObject.dataset.hasOwnProperty('product')) {
            $.insertHtml({
              jsonFiles: ['grand-top',],
              dataFolder: './kanto/json/',
              targetClass: 'jcom',
              theme: 0,
              minmax: 1
            });
          }
          lazyObject.classList.remove("lazy");
          lazyObjectsObserver.unobserve(lazyObject);
        }
      });
    });
    lazyObjects.forEach(function (lazyObject) {
      // 観察を開始します
      lazyObjectsObserver.observe(lazyObject);
    });
  }
});
  • 0
  • 0
anonymous タイトルなし
JavaScript
document.addEventListener("DOMContentLoaded", function () {
  let lazyObjects = [].slice.call(document.querySelectorAll(".lazy img, .lazy"));
  // IntersectionObserver対応ブラウザのみ実行
  if ("IntersectionObserver" in window) {
    // IntersectionObserverオブジェクト生成
    let lazyImageObserver = new IntersectionObserver(function (entries, observer) {
      entries.forEach(function (entry) {
        // この要素が画面に入ってきた場合
        if (entry.isIntersecting) {
          let lazyImage = entry.target;
          if (lazyImage.dataset.hasOwnProperty('src')) {
            lazyImage.src = lazyImage.dataset.src;
            lazyImage.dataset.src = '';
            delete lazyImage.dataset.src;
          }
          if (lazyImage.dataset.hasOwnProperty('srcset')) {
            lazyImage.srcset = lazyImage.dataset.srcset;
            lazyImage.dataset.srcset = '';
            delete lazyImage.dataset.srcset;
          }
          if (lazyImage.dataset.hasOwnProperty('bnr01') || lazyImage.dataset.hasOwnProperty('bnr02')) {
            var loadBnr = new Promise((resolve, reject) => {
              load_bnrdata({
                json_bnr: './kanto/json/bnr_g.json',
                page_id: 'グランドトップ',
                pc_sp: 'sp'
              })
            })
            loadBnr
              .then(slickBnr())
              .catch(() => {
                console.log('Promise 失敗')
              })
          }
          if (lazyImage.dataset.hasOwnProperty('news')) {
            load_newsdata({
              json_news: './kanto/json/news.json',
              page_id: 'グランドトップ',
              pc_sp: 'sp'
            });
          }
          if (lazyImage.dataset.hasOwnProperty('product')) {
            $.insertHtml({
              jsonFiles: ['grand-top',],
              dataFolder: './kanto/json/',
              targetClass: 'jcom',
              theme: 0,
              minmax: 1
            });
          }
          lazyImage.classList.remove("lazy");
          lazyImageObserver.unobserve(lazyImage);
        }
      });
    });
    lazyObjects.forEach(function (lazyImage) {
      // 観察を開始します
      lazyImageObserver.observe(lazyImage);
    });
  }
});
  • 0
  • 0
anonymous タイトルなし
JavaScript
💩
  • 0
  • 0
anonymous タイトルなし
JavaScript
import { DateTime } from 'luxon';
import { Container, Table } from 'react-bootstrap';
import { useState } from 'react';

interface Props {
  year?: number;
  month?: number;
};

export default function Calendar(props: Props) {
  let { year, month } = props;
  if (!year) year = DateTime.local().year;
  if (!month) month = DateTime.local().month;

  const firstDayOfThisMonth = DateTime.local(year, month, 1, 0, 0);
  const firstWeekDay = firstDayOfThisMonth.weekday;

  const firstDayLocation = (() => {
    switch (firstWeekDay) {
      case 1:
        return 2;
      case 2:
        return 3;
      case 3:
        return 4;
      case 4:
        return 5;
      case 5:
        return 6;
      case 6:
        return 7;
      case 7:
        return 1;
      default:
        return 1;
    }
  })();

  const daysOfMonth = (() => {
    if (month === 2) {
      if (year % 4 === 0) {
        if (year % 100 === 0 && year % 400 !== 0) {
          return 29;
        } else {
          return 28;
        }
      }
    } else if (month === 4 || month === 6 || month === 9 || month === 11) {
      return 30;
    } else {
      return 31;
    }
  })();

  interface Day {
    dateNum?: number;
  }

  const daysOfCalendar = (() => {
    const sixWeek = [];
    let dayCount = 1;
    const firstWeek = [];
    for (let i = 1; i <= 7; i++) {
      const day: Day = {};
      if (i >= firstDayLocation) {
        day.dateNum = dayCount;
        dayCount++;
      }
      firstWeek.push(day);
    }
    sixWeek.push(firstWeek);

    for (let i = 0; i < 5; i++) {
      const week = [];
      for (let i = 0; i < 7; i++) {
        const day: Day = {};
        if (dayCount <= daysOfMonth!) {
          day.dateNum = dayCount;
          dayCount++;
        }
        week.push(day)
      }
      sixWeek.push(week);
    }
    return sixWeek;
  })();
  console.log(daysOfCalendar)


  const [ schedules ] = useState(daysOfCalendar);

  function createDays() {
    return (schedules.map(scheduleArray => (
      <tr>
        {
          scheduleArray.map(day => (
            <td>{day.dateNum}</td>
          ))
        }
      </tr>
    )));
  }

  return (
    <Container>
      <Table className='table-bordered'>
        <thead>
          <tr>
            <th>日</th><th>月</th><th>火</th><th>水</th><th>木</th><th>金</th><th>土</th>
          </tr>
        </thead>
        <tbody>
          {createDays()}
        </tbody>
      </Table>
    </Container>
  );
}





export enum WeekDay {
  Sunday,
  Monday,
  Tuesday,
  Wednesday,
  Thursday,
  Friday,
  Saturday
}

  • 0
  • 1
anonymous タイトルなし
JavaScript
console.log("Hello World");
  • 0
  • 1
anonymous タイトルなし
JavaScript
a = {}
a.bbb = "ccc"
  • 0
  • 0
あなたもコードを投稿しませんか?
投稿する
1