DoCoMoで端末製造番号等を取得するためのリンクを返す。
433926
def docomo_utn_link_to(str, options = {})
      url = options
      if options.is_a?(Hash)
        options = options.symbolize_keys
        options[:only_path] = false
        url = url_for(options)
      end
      %(<a href="#{url}" utn>#{str}</a>).html_safe
    end
657922
function BaseHeaderView(_owner, _options) {
                var _this = _super.call(this, _options = $.extend({
                    el: _owner.$page.find("[data-role='header']"),
                    backCommandSelector: ".command-back",
                    backCommandKind: "pageback",
                }, _options)) || this;
                _this._owner = _owner;
                _this._options = _options;
                // template 設定
                if (_options.baseTemplate) {
                    _this._template = _options.baseTemplate;
                }
                else {
                    _this._template = Template.getJST("\n                    <script type='text/template'>\n                        <header class='ui-header-base ui-body-{{theme}}'>\n                            <div class='ui-fixed-back-indicator'></div>\n                        </header>\n                    </script>\n                ");
                }
                // Backbone.View 用の初期化
                _this.setElement(_this.$el, true);
                return _this;
            }
1194436
function _class(config) {
    _classCallCheck(this, _class);

    // オーディオソースのタイプ定数
    this.TYPE_HDS = 'hds';
    this.TYPE_HLS = 'hls';
    this.TYPE_MSE = 'mse';
    this.TYPE_FILE = 'file';

    // デフォルト設定
    var defaults = {
      hds: {
        protcol: 'http://',
        playlist: '/manifest.f4m'
      },
      hls: {
        protcol: 'http://',
        playlist: '/playlist.m3u8'
      },
      mse: {
        protcol: 'http://',
        playlist: '/manifest.mpd',
        autoplay: false
      }
    };
    // 設定反映
    this.opt = _Object$assign(defaults, config);

    this.audio = new Audio(); // HTML5 Audio
    this.dash_player = null; // dash.js のインスタンス
    this.is_support_hds = false; // HDSを再生できるか
    this.is_support_hls = false; // HLSを再生できるか
    this.is_support_mse = false; // MedisSourceExtensionに対応しているか
    this.now_type = null; // ソースとして設定されたタイプ。TYPE_HDS ... TYPE_FILE などが入る

    this.$_check_support_result = null; // check_support() の実行結果
  }
456287
function TabHostView(options) {
                var _this = _super.call(this, options) || this;
                _this._tabs = []; // ITabView を格納
                _this._activeTabIndex = 0; // active tab
                _this._flipsnap = null; // flipsnap オブジェクト
                _this._flipEndEventHandler = null; // "fstouchend"
                _this._flipMoveEventHandler = null; // "fstouchmove"
                _this._flipDeltaCache = 0; // "flip 距離のキャッシュ"
                _this._scrollEndEventHandler = null; // tabview "scrollstop"
                _this._scrollMoveEventHandler = null; // tabview "scroll"
                _this._refreshTimerId = null; // refresh() 反映確認用
                // check runtime condition
                if (null == UI.global.Flipsnap) {
                    console.error(TAG + "flipsnap module doesn't load.");
                    return _this;
                }
                _this._settings = $.extend({
                    tabContexts: [],
                    tabMoveHandler: function (delta) { },
                    tabStopHandler: function (newIndex, moved) { }
                }, options);
                // setup event handlers
                _this._flipEndEventHandler = function (event) {
                    var fsEvent = event.originalEvent;
                    _this._flipDeltaCache = 0;
                    _this.onTabChanged(fsEvent.newPoint, fsEvent.moved);
                };
                _this._flipMoveEventHandler = function (event) {
                    var fsEvent = event.originalEvent;
                    _this._flipDeltaCache += fsEvent.delta;
                    // bounce のガード
                    if (!_this._settings.enableBounce && ((-1 === fsEvent.direction && 0 === _this._activeTabIndex && 0 < _this._flipDeltaCache) ||
                        (1 === fsEvent.direction && _this._activeTabIndex === _this._tabs.length - 1 && _this._flipDeltaCache < 0))) {
                        event.preventDefault();
                        _this._flipsnap.moveToPoint(fsEvent.newPoint);
                    }
                    else {
                        _this.onTabMoving(fsEvent.delta);
                        _this._tabs.forEach(function (tabview) {
                            tabview.onTabScrolling(_this._activeTabIndex, fsEvent.delta);
                        });
                        _this.preprocess(_this._activeTabIndex);
                    }
                };
                _this._scrollEndEventHandler = function (event) {
                    _this.onScrollStop();
                };
                _this._scrollMoveEventHandler = function (event) {
                    _this.onScroll();
                };
                // setup tabs
                if (_this._settings.initialWidth) {
                    _this.$el.width(_this._settings.initialWidth);
                }
                if (_this._settings.initialHeight) {
                    _this.$el.height(_this._settings.initialHeight);
                }
                var initialWidth = _this._settings.initialWidth;
                var initialHeight = _this.$el.height();
                var tabContexts = _this._settings.tabContexts.slice();
                if (0 < tabContexts.length) {
                    tabContexts.forEach(function (context) {
                        /* tslint:disable:no-unused-expression */
                        new context.ctor($.extend({
                            initialHeight: initialHeight,
                        }, context.options, { host: _this, delayRegister: false }));
                        /* tslint:enable:no-unused-expression */
                    });
                }
                else {
                    // ITabView インスタンス化要求
                    _this.onTabViewSetupRequest(initialHeight);
                }
                if (_this._settings.initImmediate) {
                    _this.initializeTabViews();
                }
                // Flipsnap
                _this.setFlipsnapCondition($.extend({}, {
                    distance: initialWidth,
                }, _this._settings));
                _this.setActiveTab(_this._activeTabIndex, 0, true);
                return _this;
            }
943733
function reporter(context) {
    let { Syntax, RuleError, report, fixer, getSource } = context;
    return {
        [Syntax.Str](node) {
            if (!isUserWrittenNode(node, context)) {
                return;
            }
            const text = getSource(node);
            // 全角同士の間は半角スペースを入れない
            const matchReg = rx`${japaneseRegExp}( )${japaneseRegExp}`;
            const katakakana = /[ァ-ヶ]( )[ァ-ヶ]/;
            matchAll(text, matchReg).forEach(match => {
                const { input, captureGroups } = match;
                // ただしカタカナ複合語の場合を除きます。
                if (katakakana.test(input)) {
                    return;
                }
                captureGroups.forEach(captureGroup => {
                    const index = captureGroup.index;
                    report(
                        node,
                        new RuleError("原則として、全角文字どうしの間にスペースを入れません。", {
                            index: index,
                            fix: fixer.replaceTextRange([index, index + 1], "")
                        })
                    );
                });
            });
        }
    };
}
864721
public function search(
        string $preset = null,
        Request $request,
        SearchService $service,
        CustomerFinderGroup $finderGroup
    ) {
        // キーワードセット
        $keyword = $request->input('keyword', null);
        $service->setKeyword($keyword);

        $finder = ($preset)
            ? $finderGroup->getFinder($preset)
            : null;

        if (!$finder) {
            $default_finder = $finderGroup->getDefault();
            if (!$default_finder) {
                throw new NotFoundHttpException();
            }

            return redirect()->route('glitter.office.customer.search', ['preset' => $default_finder->getName()]);
        }

        $customers = $service->search($finder);

        return view('glitter.office::customer.search',
            compact('keyword', 'customers', 'preset', 'finder', 'finderGroup'));
    }
870212
function open(opts, callback) {
        var that = void 0;
        jQuery(document.body).append(getContent.call(this, opts.id, opts));

        this.activeModal = jQuery("#" + opts.id);
        // 파트수집
        this.$ = {
          root: this.activeModal,
          header: this.activeModal.find('[data-modal-els="header"]'),
          body: this.activeModal.find('[data-modal-els="body"]')
        };

        if (opts.iframe) {
          this.$["iframe-wrap"] = this.activeModal.find('[data-modal-els="iframe-wrap"]');
          this.$["iframe"] = this.activeModal.find('[data-modal-els="iframe"]');
          this.$["iframe-form"] = this.activeModal.find('[data-modal-els="iframe-form"]');
          this.$["iframe-loading"] = this.activeModal.find('[data-modal-els="iframe-loading"]');
        } else {
          this.$["body-frame"] = this.activeModal.find('[data-modal-els="body-frame"]');
        }

        //- position 정렬
        this.align();

        that = {
          self: this,
          id: opts.id,
          theme: opts.theme,
          width: opts.width,
          height: opts.height,
          state: "open",
          $: this.$
        };

        if (opts.iframe) {
          this.$["iframe-wrap"].css({ height: opts.height });
          this.$["iframe"].css({ height: opts.height });

          // iframe content load
          this.$["iframe-form"].attr({ method: opts.iframe.method });
          this.$["iframe-form"].attr({ target: opts.id + "-frame" });
          this.$["iframe-form"].attr({ action: opts.iframe.url });
          this.$["iframe"].on("load", function () {
            that.state = "load";
            if (opts.iframeLoadingMsg) {
              this.$["iframe-loading"].hide();
            }
            onStateChanged.call(this, opts, that);
          }.bind(this));
          if (!opts.iframeLoadingMsg) {
            this.$["iframe"].show();
          }
          this.$["iframe-form"].submit();
        }

        if (callback) callback.call(that, that);

        if (!this.watingModal) {
          onStateChanged.call(this, opts, that);
        }

        // bind key event
        if (opts.closeToEsc) {
          jQuery(window).bind("keydown.ax-modal", function (e) {
            onkeyup.call(this, e || window.event);
          }.bind(this));
        }

        jQuery(window).bind("resize.ax-modal", function (e) {
          this.align(null, e || window.event);
        }.bind(this));

        this.$.header.off(ENM["mousedown"]).off("dragstart").on(ENM["mousedown"], function (e) {
          /// 이벤트 필터링 추가 : 버튼엘리먼트로 부터 발생된 이벤트이면 moveModal 시작하지 않도록 필터링
          var isButton = U.findParentNode(e.target, function (_target) {
            if (_target.getAttribute("data-modal-header-btn")) {
              return true;
            }
          });

          if (!opts.isFullScreen && !isButton && opts.disableDrag != true) {
            self.mousePosition = getMousePosition(e);
            moveModal.on.call(self);
          }
          if (isButton) {
            btnOnClick.call(self, e || window.event, opts);
          }
        }).on("dragstart", function (e) {
          U.stopEvent(e.originalEvent);
          return false;
        });

        this.activeModal.off(ENM["mousedown"]).off("dragstart").on(ENM["mousedown"], "[data-ax5modal-resizer]", function (e) {
          if (opts.disableDrag || opts.isFullScreen) return false;
          self.mousePosition = getMousePosition(e);
          resizeModal.on.call(self, this.getAttribute("data-ax5modal-resizer"));
        }).on("dragstart", function (e) {
          U.stopEvent(e.originalEvent);
          return false;
        });
      }
570841
function ScrollManager(options) {
                var _this = this;
                this._$root = null; //!< Scroll 対象のルートオブジェクト
                this._$map = null; //!< Scroll Map element を格納
                this._mapHeight = 0; //!< Scroll Map の高さを格納 (_$map の状態に依存させない)
                this._scroller = null; //!< Scroll に使用する IScroller インスタンス
                this._settings = null; //!< ScrollManager オプションを格納
                this._active = true; //!< UI 表示中は true に指定
                this._scrollEventHandler = null; //!< Scroll Event Handler
                this._scrollStopEventHandler = null; //!< Scroll Stop Event Handler
                this._baseHeight = 0; //!< 高さの基準値
                this._lines = []; //!< 管理下にある LineProfile 配列
                this._pages = []; //!< 管理下にある PageProfile 配列
                //! 最新の表示領域情報を格納 (Scroll 中の更新処理に使用)
                this._lastActivePageContext = {
                    index: 0,
                    from: 0,
                    to: 0,
                    pos: 0,
                };
                this._backup = {}; //!< データの backup 領域. key と _lines を格納。派生クラスで拡張可能。
                // ListViewOptions 既定値
                var defOptions = {
                    scrollerFactory: UI.ScrollerElement.getFactory(),
                    enableHiddenPage: false,
                    enableTransformOffset: false,
                    scrollMapRefreshInterval: 200,
                    scrollRefreshDistance: 200,
                    pagePrepareCount: 3,
                    pagePreloadCount: 1,
                    enableAnimation: true,
                    animationDuration: 0,
                    baseDepth: "auto",
                    itemTagName: "li",
                    removeItemWithTransition: true,
                    useDummyInactiveScrollMap: false,
                };
                // 設定格納
                this._settings = $.extend({}, defOptions, options);
                // スクロールイベント
                this._scrollEventHandler = function (event) {
                    _this.onScroll(_this._scroller.getPos());
                };
                // スクロール停止イベント
                this._scrollStopEventHandler = function (event) {
                    _this.onScrollStop(_this._scroller.getPos());
                };
            }
1357589
public static function FileOpen ($file_path, $mode, $use_include_path = false, $context = null, $options = []) {
		//==============================================
		//オプション展開
		//==============================================
		$raise_exception	= isset($options['raise_exception']) ? $options['raise_exception'] : true;
		$name				= isset($options['name']) ? $options['name'] : '';

		if (preg_match("/[rwaxc]\+?[tb]?/", $mode) === false) {
			return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルへのストリームアクセス形式が誤っています。mode:%s, file:%s', [$name, $mode, $file_path]), $raise_exception);
		}

		$mode_set = str_split($mode);

		$valid_readable	= false;
		$valid_writable	= false;
		$valid_exists	= false;

		switch ($mode_set[0]) {
			case 'r':
				$valid_readable	= true;
				break;
			case 'x':
				$valid_exists	= true;
			case 'w':
			case 'a':
			case 'c':
				$valid_writable	= true;
				break;
			default:
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルへのストリームアクセス形式が誤っています。mode:%s, file:%s', [$name, $mode, $file_path]), $raise_exception);
				break;
		}

		if (isset($mode_set[1]) && $mode_set[1] === '+') {
			$valid_readable	= true;
			$valid_writable	= true;
		}

		$parent_dir = dirname($file_path);
		clearstatcache(true, $parent_dir);
		if (!file_exists($parent_dir)) {
			return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルの親ディレクトリが存在しません。file:%s', [$name, $file_path]), $raise_exception);
		}

		if (!is_readable($parent_dir)) {
			return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルの親ディレクトリを開けません。file:%s', [$name, $file_path]), $raise_exception);
		}

		clearstatcache(true, $file_path);
		$file_exists = file_exists($file_path);

		if ($valid_writable) {
			if (!is_writable($parent_dir)) {
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルの親ディレクトリに書き込み権がありません。。file:%s', [$name, $file_path]), $raise_exception);
			}

			if ($valid_exists) {
				if ($file_exists) {
					return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルが既に存在しています。file:%s', [$name, $file_path]), $raise_exception);
				}
			}
			if ($file_exists && !is_writable($file_path)) {
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルに対する書き込み権がありません。file:%s', [$name, $file_path]), $raise_exception);
			}
		}

		if ($valid_readable) {
			if (!$file_exists) {
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルが存在しません。file:%s', [$name, $file_path]), $raise_exception);
			}

			if (!is_readable($file_path)) {
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルに対する読み込み権がありません。file:%s', [$name, $file_path]), $raise_exception);
			}
		}

		return $context === null ? fopen($file_path, $mode, $use_include_path) : fopen($file_path, $mode, $use_include_path, $context);
	}
262544
function render(req, res, data){
	var shohousen = new Shohousen();
	if( data["hakkou-kikan"] ){
		var hakkouKikan = data["hakkou-kikan"];
		shohousen.setHakkouKikan(hakkouKikan[0], hakkouKikan[1], hakkouKikan[2], hakkouKikan[3])
	}
	if( data["doctor"] ){
		shohousen.setDoctor(data["doctor"]);
	}
	if( data["koufu-date"] ){
		var koufuDate = data["koufu-date"];
		shohousen.setKoufuDate("" + koufuDate[0], "" + koufuDate[1], "" + koufuDate[2]);
	}
	if( data["hokensha-bangou"] ){
		shohousen.setHokenshaBangou("" + data["hokensha-bangou"]);
	}
	if( data["kubun-hihokensha"] ){
		shohousen.setKubunHihokensha();
	}
	if( data["kubun-hifuyousha"] ){
		shohousen.setKubunHifuyousha();
	}
	if( data["hihokensha"] ){
		shohousen.setHihokensha(data["hihokensha"]);
	}
	if( data["kouhi-1-futansha"] ){
		shohousen.setKouhi1Futansha("" + data["kouhi-1-futansha"]);
	}
	if( data["kouhi-1-jukyuusha"] ){
		shohousen.setKouhi1Jukyuusha("" + data["kouhi-1-jukyuusha"]);
	}
	if( data["kouhi-2-futansha"] ){
		shohousen.setKouhi2Futansha("" + data["kouhi-2-futansha"]);
	}
	if( data["kouhi-2-jukyuusha"] ){
		shohousen.setKouhi2Jukyuusha("" + data["kouhi-2-jukyuusha"]);
	}
	if( data["shimei"] ){
		shohousen.setShimei(data["shimei"]);
	}
	if( data["birthday"] ){
		var birthday = data["birthday"];
		shohousen.setBirthday("" + birthday[0], "" + birthday[1], "" + birthday[2]);
	}
	if( data["sex"] ){
		var sex = data["sex"].toUpperCase();
		if( sex === "M" ){
			shohousen.setSexMale();
		} else if( sex === "F" ){
			shohousen.setSexFemale();
		}
	}
	if( "futan-wari" in data ){
		shohousen.setFutanwari("" + data["futan-wari"]);
	}
	if( data["valid-upto"] ){
		var validUpto = data["valid-upto"];
		shohousen.setValidUptoDate("" + validUpto[0], "" + validUpto[1], "" + validUpto[2])
	}
	if( data["drugs"] ){
		shohousen.setDrugs(data["drugs"]);
	}
	var ops = shohousen.getOps();
	var drawerPage = JSON.stringify([ops]);
	var printManageUrl = "/printer/";
	res.end(indexTmpl.render({
		drawerPage: drawerPage, 
		printManageUrl: printManageUrl,
		// printServerPort: printServerPort,
		base: req.baseUrl
	})); 
}
825797
function curveRegisterInfoUpdate(){
    //レジスタ値の取得 複数取得は返り値がObject
    KMB.cmdReadRegister([KMMotorOneWebBLE.cmdReadRegister_COMMAND.curveType,KMMotorOneWebBLE.cmdReadRegister_COMMAND.acc,KMMotorOneWebBLE.cmdReadRegister_COMMAND.dec]).then(function(val){
        let str="";
        Object.keys(val).forEach(function(k){str+=k+":"+val[k]+" "});
        $("#curveRegisterInfo").text(str);
    }).catch(function(msg){
        console.log(msg);
    });
}
1135902
private int calcFu() {
        if (normalYakuList.size() == 0) {
            return 0;
        }
        if (personalSituation == null || generalSituation == null) {
            return 20;
        }
        // 特例の平和ツモと七対子の符
        if (normalYakuList.contains(PINFU) && normalYakuList.contains(TSUMO)) {
            return 20;
        }
        if (normalYakuList.contains(CHITOITSU)) {
            return 25;
        }

        int tmpFu = 20;
        // 門前ロンなら+10
        tmpFu += calcFuByAgari();

        // 各メンツの種類による加符
        for (Mentsu mentsu : comp.getAllMentsu()) {
            tmpFu += mentsu.getFu();
        }

        tmpFu += calcFuByWait(comp, hands.getLast());
        tmpFu += calcFuByJanto();

        return tmpFu;
    }
639060
function(){
		var loopcount = 0;

		while(1){
			var Rdeg = ((Math.random() * 384)|0)-64; if(Rdeg<0){Rdeg=0;} if(Rdeg>255){Rdeg=255;}
			var Gdeg = ((Math.random() * 384)|0)-64; if(Gdeg<0){Gdeg=0;} if(Gdeg>255){Gdeg=255;}
			var Bdeg = ((Math.random() * 384)|0)-64; if(Bdeg<0){Bdeg=0;} if(Bdeg>255){Bdeg=255;}

			// HLSの各組成値を求める
			var Cmax = Math.max(Rdeg,Math.max(Gdeg,Bdeg));
			var Cmin = Math.min(Rdeg,Math.min(Gdeg,Bdeg));

			var Hdeg = 0;
			var Ldeg = (Cmax+Cmin)*0.5 / 255;
			var Sdeg = (Cmax===Cmin?0:(Cmax-Cmin)/((Ldeg<=0.5)?(Cmax+Cmin):(2*255-Cmax-Cmin)) );

			if(Cmax===Cmin){ Hdeg = 0;}
			else if(Rdeg>=Gdeg && Rdeg>=Bdeg){ Hdeg = (    60*(Gdeg-Bdeg)/(Cmax-Cmin)+360)%360;}
			else if(Gdeg>=Rdeg && Gdeg>=Bdeg){ Hdeg = (120+60*(Bdeg-Rdeg)/(Cmax-Cmin)+360)%360;}
			else if(Bdeg>=Gdeg && Bdeg>=Rdeg){ Hdeg = (240+60*(Rdeg-Gdeg)/(Cmax-Cmin)+360)%360;}

			// YCbCrのYを求める
			var Ydeg = (0.29891*Rdeg + 0.58661*Gdeg + 0.11448*Bdeg) / 255;

			if( (this.minYdeg<Ydeg && Ydeg<this.maxYdeg) && (Math.abs(this.lastYdeg-Ydeg)>0.15) && (Sdeg<0.02 || 0.40<Sdeg) &&
				 (((360+this.lastHdeg-Hdeg)%360>=45)&&((360+this.lastHdeg-Hdeg)%360<=315)) ){
				this.lastHdeg = Hdeg;
				this.lastYdeg = Ydeg;
				//alert("rgb("+Rdeg+", "+Gdeg+", "+Bdeg+")\nHLS("+(Hdeg|0)+", "+(""+((Ldeg*1000)|0)*0.001).slice(0,5)+", "+(""+((Sdeg*1000|0))*0.001).slice(0,5)+")\nY("+(""+((Ydeg*1000)|0)*0.001).slice(0,5)+")");
				return "rgb("+Rdeg+","+Gdeg+","+Bdeg+")";
			}

			loopcount++;
			if(loopcount>100){ return "rgb("+Rdeg+","+Gdeg+","+Bdeg+")";}
		}
	}
577411
public function handle()
    {
        $store = \Glitter\Eloquent\Models\Store::firstOrCreate([
            'name'           => 'Highday Store',
            'account_email'  => 'store@example.com',
            'customer_email' => 'store@example.com',
            'timezone'       => 'Asia/Tokyo',
            'currency'       => 'JPY',
        ]);

        $role = \Glitter\Eloquent\Models\Role::firstOrCreate([
            'store_id'    => $store->getKey(),
            'built_in'    => true,
            'name'        => 'ストアオーナー',
            'description' => 'ストアアカウントの所有者',
        ]);

        $role2 = \Glitter\Eloquent\Models\Role::firstOrCreate([
            'store_id'    => $store->getKey(),
            'built_in'    => false,
            'name'        => 'ストアスタッフ',
            'description' => '店員用アカウント',
        ]);

        $policy = \Glitter\Eloquent\Models\Policy::firstOrNew([
            'store_id'    => $store->getKey(),
            'name'        => 'バックオフィス',
            'description' => 'バックオフィスにアクセス可能',
        ]);
        if (!$policy->exists) {
            $policy->save();
            $role->policies()->attach($policy);
            $role2->policies()->attach($policy);
        }

        $member = \Glitter\Eloquent\Models\Member::firstOrNew([
            'first_name' => 'Keisuke',
            'last_name'  => 'Nemoto',
            'email'      => 'member@example.com',
        ]);
        if (!$member->exists) {
            $member->password = bcrypt('password');
            $member->save();
            $member->stores()->attach($store);
            $member->roles()->attach($role);
        }

        $customer = \Glitter\Eloquent\Models\Customer::firstOrNew([
            'first_name'        => 'Keisuke',
            'last_name'         => 'Nemoto',
            'email'             => 'customer@example.com',
            'mailmagazine_flag' => 1,
        ]);
        if (!$customer->exists) {
            // $customer->password = bcrypt('password');
            $customer->save();
            $customer->stores()->attach($store);
        }

        $product = \Glitter\Eloquent\Models\Product::firstOrCreate([
            'store_id'    => $store->getKey(),
            'name'        => 'Highday original t-shirt',
            'description' => 'My first sample product.',
            'option1'     => 'Color',
            'option2'     => 'Size',
            'option3'     => null,
        ]);

        $variant[] = \Glitter\Eloquent\Models\Variant::firstOrCreate([
            'product_id'            => $product->getKey(),
            'option1'               => 'Black',
            'option2'               => 'S',
            'option3'               => null,
            'sku'                   => null,
            'barcode'               => null,
            'price'                 => 3000,
            'reference_price'       => null,
            'taxes_included'        => 1,
            'inventory_management'  => 'glitter',
            'inventory_quantity'    => 100,
            'out_of_stock_purchase' => 1,
            'requires_shipping'     => true,
            'fulfillment_service'   => 1,
        ]);

        $variant[] = \Glitter\Eloquent\Models\Variant::firstOrCreate([
            'product_id'            => $product->getKey(),
            'option1'               => 'Black',
            'option2'               => 'M',
            'option3'               => null,
            'sku'                   => null,
            'barcode'               => null,
            'price'                 => 3000,
            'reference_price'       => null,
            'taxes_included'        => 1,
            'inventory_management'  => 'glitter',
            'inventory_quantity'    => 100,
            'out_of_stock_purchase' => 1,
            'requires_shipping'     => true,
            'fulfillment_service'   => 1,
        ]);

        $variant[] = \Glitter\Eloquent\Models\Variant::firstOrCreate([
            'product_id'            => $product->getKey(),
            'option1'               => 'Black',
            'option2'               => 'L',
            'option3'               => null,
            'sku'                   => null,
            'barcode'               => null,
            'price'                 => 3000,
            'reference_price'       => null,
            'taxes_included'        => 1,
            'inventory_management'  => 'glitter',
            'inventory_quantity'    => 100,
            'out_of_stock_purchase' => 1,
            'requires_shipping'     => true,
            'fulfillment_service'   => 1,
        ]);

        $variant[] = \Glitter\Eloquent\Models\Variant::firstOrCreate([
            'product_id'            => $product->getKey(),
            'option1'               => 'White',
            'option2'               => 'S',
            'option3'               => null,
            'sku'                   => null,
            'barcode'               => null,
            'price'                 => 3000,
            'reference_price'       => null,
            'taxes_included'        => 1,
            'inventory_management'  => 'glitter',
            'inventory_quantity'    => 100,
            'out_of_stock_purchase' => 1,
            'requires_shipping'     => true,
            'fulfillment_service'   => 1,
        ]);

        $variant[] = \Glitter\Eloquent\Models\Variant::firstOrCreate([
            'product_id'            => $product->getKey(),
            'option1'               => 'White',
            'option2'               => 'M',
            'option3'               => null,
            'sku'                   => null,
            'barcode'               => null,
            'price'                 => 3000,
            'reference_price'       => null,
            'taxes_included'        => 1,
            'inventory_management'  => 'glitter',
            'inventory_quantity'    => 100,
            'out_of_stock_purchase' => 1,
            'requires_shipping'     => true,
            'fulfillment_service'   => 1,
        ]);

        $variant[] = \Glitter\Eloquent\Models\Variant::firstOrCreate([
            'product_id'            => $product->getKey(),
            'option1'               => 'White',
            'option2'               => 'L',
            'option3'               => null,
            'sku'                   => null,
            'barcode'               => null,
            'price'                 => 3000,
            'reference_price'       => null,
            'taxes_included'        => 1,
            'inventory_management'  => 'glitter',
            'inventory_quantity'    => 100,
            'out_of_stock_purchase' => 1,
            'requires_shipping'     => true,
            'fulfillment_service'   => 1,
        ]);
    }
741431
public function createBroccoliInitOptions(){
		$broccoliInitializeOptions = array();
		$px2ce = $this;

		$page_path = $this->page_path;
		$px2conf = $this->px2conf;
		$pageInfo = $this->pageInfo;
		$contRoot = $this->contRoot;
		$documentRoot = $this->documentRoot;
		$realpathDataDir = $this->realpathDataDir;
		$pathResourceDir = $this->pathResourceDir;
		$pathsModuleTemplate = array();
		$bindTemplate = function(){};

		$customFields = array();
		$page_content = $this->page_path;
		if( strlen(@$pageInfo->content) ){
			$page_content = $pageInfo->content;
		}

		// フィールドを拡張

		// px2ce が拡張するフィールド
		$customFields['table'] = 'broccoliHtmlEditor\\broccoliFieldTable\\main';

		// 呼び出し元アプリが拡張するフィールド
		foreach( $this->options['customFields'] as $idx=>$customField ){
			$customFields[$idx] = $this->options['customFields'][$idx];
		}

		// プロジェクトが拡張するフィールド
		$confCustomFields = @$px2conf->plugins->px2dt->guieditor->custom_fields;
		if(is_object($confCustomFields)){
			foreach( $confCustomFields as $fieldName=>$field ){
				if( @$confCustomFields->{$fieldName}->backend->class ){
					$customFields[$fieldName] = $confCustomFields->{$fieldName}->backend->class;
				}
			}
		}

		// var_dump($customFields);

		// モジュールテンプレートを収集
		// (指定モジュールをロード)
		if( $this->target_mode == 'theme_layout' ){
			// テーマ編集ではスキップ
		}else{
			$tmp_paths_module_template = @$px2conf->plugins->px2dt->paths_module_template;
			if( is_array($tmp_paths_module_template) || is_object($tmp_paths_module_template) ){
				foreach( $tmp_paths_module_template as $idx=>$path_module_template ){
					$pathsModuleTemplate[$idx] = $this->fs()->get_realpath( $path_module_template.'/', dirname($this->entryScript) );
				}
			}
		}

		// モジュールテンプレートを収集
		// (モジュールフォルダからロード)
		$pathModuleDir = @$px2conf->plugins->px2dt->path_module_templates_dir;
		if( $this->target_mode == 'theme_layout' ){
			// テーマ編集では `broccoli_module_packages` をロードする。
			$pathModuleDir = $this->documentRoot.$this->theme_id.'/broccoli_module_packages/';
		}
		if( !is_string($pathModuleDir) ){
			// モジュールフォルダの指定がない場合
		}else{
			$pathModuleDir = $this->fs()->get_realpath( $pathModuleDir.'/', dirname($this->entryScript) );
			if( !is_dir($pathModuleDir) ){
				// 指定されたモジュールフォルダが存在しない場合
			}else{
				// info.json を読み込み
				$infoJson = array();
				if( is_file($pathModuleDir.'/info.json') ){
					$srcInfoJson = file_get_contents($pathModuleDir.'/info.json');
					$infoJson = json_decode($srcInfoJson);
				}
				if( is_array(@$infoJson->sort) ){
					// 並び順の指定がある場合
					foreach( $infoJson->sort as $idx=>$row ){
						if( @$pathsModuleTemplate[$infoJson->sort[$idx]] ){
							// 既に登録済みのパッケージIDは上書きしない
							// (= paths_module_template の設定を優先)
							continue;
						}
						if( is_dir($pathModuleDir.$infoJson->sort[$idx]) ){
							$pathsModuleTemplate[$infoJson->sort[$idx]] = $pathModuleDir.$infoJson->sort[$idx];
						}
					}
				}

				// モジュールディレクトリ中のパッケージをスキャンして一覧に追加
				$fileList = $this->fs()->ls($pathModuleDir);
				sort($fileList); // sort
				foreach( $fileList as $idx=>$row){
					if( @$pathsModuleTemplate[$fileList[$idx]] ){
						// 既に登録済みのパッケージIDは上書きしない
						// (= paths_module_template の設定を優先)
						continue;
					}
					if( is_dir($pathModuleDir.$fileList[$idx]) ){
						$pathsModuleTemplate[$fileList[$idx]] = $pathModuleDir.$fileList[$idx];
					}
				}
			}
		}

		if( $this->target_mode == 'theme_layout' ){
			$bindTemplate = function($htmls){
				$fin = '';
				foreach( $htmls as $bowlId=>$html ){
					if( $bowlId == 'main' ){
						$fin .= $htmls['main'];
					}else{
						$fin .= "\n";
						$fin .= "\n";
						$fin .= '<'.'?php ob_start(); ?'.'>'."\n";
						$fin .= (strlen($htmls[$bowlId]) ? $htmls[$bowlId]."\n" : '');
						$fin .= '<'.'?php $px->bowl()->send( ob_get_clean(), '.json_encode($bowlId).' ); ?'.'>'."\n";
						$fin .= "\n";
					}
				}
				$template = '<'.'%- body %'.'>';
				$pathThemeLayout = $this->documentRoot.$this->theme_id.'/broccoli_module_packages/_layout.html';
				if(is_file($pathThemeLayout)){
					$template = file_get_contents( $pathThemeLayout );
				}else{
					$template = file_get_contents( __DIR__.'/tpls/broccoli_theme_layout.html' );
				}
				// PHP では ejs は使えないので、単純置換することにした。
				// $fin = $ejs.render($template, {'body': $fin}, {'delimiter': '%'});
				$fin = str_replace('<'.'%- body %'.'>', $fin, $template);

				$baseDir = $this->documentRoot.$this->theme_id.'/theme_files/';
				$this->fs()->mkdir_r( $baseDir );
				$CssJs = $this->getModuleCssJsSrc($this->theme_id);

				$this->fs()->save_file($baseDir.'modules.css', $CssJs['css']);
				$this->fs()->save_file($baseDir.'modules.js', $CssJs['js']);
				return $fin;
			};
		}else{
			$bindTemplate = function($htmls){
				$fin = '';
				foreach( $htmls as $bowlId=>$html ){
					if( $bowlId == 'main' ){
						$fin .= $htmls['main'];
					}else{
						$fin .= "\n";
						$fin .= "\n";
						$fin .= '<'.'?php ob_start(); ?'.'>'."\n";
						$fin .= (strlen($htmls[$bowlId]) ? $htmls[$bowlId]."\n" : '');
						$fin .= '<'.'?php $px->bowl()->send( ob_get_clean(), '.json_encode($bowlId).' ); ?'.'>'."\n";
						$fin .= "\n";
					}
				}
				return $fin;
			};
		}

		$broccoliInitializeOptions = array(
			'appMode' => $this->get_app_mode() ,
			'paths_module_template' => $pathsModuleTemplate ,
			'documentRoot' => $documentRoot,// realpath
			'pathHtml' => $this->fs()->get_realpath($this->contRoot.'/'.$page_content),
			'pathResourceDir' => $this->pathResourceDir,
			'realpathDataDir' =>  $this->realpathDataDir,
			'contents_bowl_name_by' => @$px2conf->plugins->px2dt->contents_bowl_name_by,
			'customFields' => $customFields ,
			'bindTemplate' => $bindTemplate,
			'log' => function($msg){
				// エラー発生時にコールされます。
				// px2ce.log(msg);
			}
		);

		return $broccoliInitializeOptions;
	}
234315
protected function _updateIndexes ($table_name) {
		$this->_indexes[$table_name] = [];

		//スキーマからインデックス情報を抜く
		//プライマリキーの取得
		foreach ($this->getColumns($table_name, true) as $column_info) {
			if ($column_info['primary_key']) {
				$seq_in_index = 1;
				foreach (explode(',', $column_info['column_name']) as $column_name) {
					$this->_indexes[$table_name]['PRIMARY'][] = [
						'table_name'		=> $table_name,
						'temporary'			=> null,
						'unique'			=> null,
						'if_not_exists'		=> null,
						'key_name'			=> 'PRIMARY',
						'column_name'		=> $column_name,
						'seq_in_index'		=> $seq_in_index++,
						'collation'			=> null,
						'cardinality'		=> null,
						'comment'			=> null,
						'index_comment'		=> null,
						'order'				=> null,
						'index_type'		=> null,
						'sub_part'			=> null,
						'raw_data'			=> null,
					];
				}
			}
		}

		//インデックスの取得
		$stmt	= $this->prepare('SELECT tbl_name, name, sql FROM sqlite_master WHERE type = ? AND tbl_name = ?');
		$stmt->execute(['index', $table_name]);
		$stmt->setFetchMode(\PDO::FETCH_ASSOC);
		foreach ($stmt as $index_schema) {
			$tbl_name = $index_schema['tbl_name'];
			$name = $index_schema['name'];
			$schema = preg_replace("/^\s*CREATE\s+|\s*\)\s*/i", '', str_replace(["\r\n", "\r", "\n"], '', $index_schema['sql']));

			if (false !== $temporary = preg_match("/^(?:TEMP|TEMPORARY)\s+(.+)/i", $schema, $matches) !== 0) {
				$schema = $matches[1];
			}

			if (false !== $unique = preg_match("/^UNIQUE\s+(.+)/i", $schema, $matches) !== 0) {
				$schema = $matches[1];
			}

			$schema = preg_replace("/^INDEX\s+/i", '', $schema);

			if (false !== $if_not_exists = preg_match("/^IF\s+NOT\s+EXISTS\s+(.+)/i", $schema, $matches) !== 0) {
				$schema = $matches[1];
			}

			$schema = preg_replace(sprintf("/^%s\s+ON\s+%s\s*\(/i", $name, $tbl_name), '', $schema);

			$indexed_column = [];
			$seq_in_index = 1;
			foreach (explode(',', $schema) as $element) {
				if ($element === '') {
					continue;
				}
				preg_match("/^\s*([^\s]+)(.*)/i", $element, $matches);

				$column_name = $matches[1];
				$schema = $matches[2];

				$collection_name = null;
				$order = null;

				if (preg_match("/^\s+COLLATE\s+([^\s]+)(.*)/i", $schema, $matches) !== 0) {
					$collection_name = $matches[1];
					$schema = $matches[2];
				}
				if (preg_match("/^\s+(ASC|DESC)/i", $schema, $matches) !== 0) {
					$order = $matches[1];
				}

				$this->_indexes[$table_name][$name][] = [
					'table_name'		=> $table_name,
					'temporary'			=> $temporary,
					'unique'			=> $unique,
					'if_not_exists'		=> $if_not_exists,
					'key_name'			=> $name,
					'column_name'		=> $column_name,
					'seq_in_index'		=> $seq_in_index++,
					'collation'			=> $collection_name,
					'cardinality'		=> null,
					'comment'			=> null,
					'index_comment'		=> null,
					'order'				=> $order,
					'index_type'		=> null,
					'sub_part'			=> null,
					'raw_data'			=> null,
				];
			}
		}
	}
761127
function(e){
		this.btn = pzpr.util.getMouseButton(e);
		
		// SHIFTキー/Commandキーを押している時は左右ボタン反転
		var kc = this.puzzle.key;
		kc.checkmodifiers(e);
		if(((kc.isSHIFT || kc.isMETA) !== this.inversion) || this.inputMode==='number-'){
			if     (this.btn==='left'){ this.btn = 'right';}
			else if(this.btn==='right'){ this.btn = 'left';}
		}
	}