当前位置: 首页>>代码示例>>PHP>>正文


PHP web\JqueryAsset类代码示例

本文整理汇总了PHP中yii\web\JqueryAsset的典型用法代码示例。如果您正苦于以下问题:PHP JqueryAsset类的具体用法?PHP JqueryAsset怎么用?PHP JqueryAsset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JqueryAsset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLayoutAssets

 /**
  * https://github.com/yiisoft/yii2/issues/1755
  */
 public function testLayoutAssets()
 {
     $view = $this->mockView();
     JqueryAsset::register($view);
     $content = $view->renderFile('@yiiunit/extensions/twig/views/layout.twig');
     $this->assertEquals(1, preg_match('#<script src="/assets/[0-9a-z]+/jquery\\.js"></script>\\s*</body>#', $content), 'content does not contain the jquery js:' . $content);
 }
开发者ID:rajanishtimes,项目名称:basicyii,代码行数:10,代码来源:ViewRendererTest.php

示例2: init

 public function init()
 {
     $this->sourcePath = __DIR__;
     $this->js = ['jquery.sortable.min.js'];
     $this->depends = [JqueryAsset::className()];
     parent::init();
 }
开发者ID:webvimark,项目名称:ybc-content,代码行数:7,代码来源:SortableAsset.php

示例3: init

 public function init()
 {
     parent::init();
     $this->sourcePath = __DIR__ . DIRECTORY_SEPARATOR . 'source';
     $this->depends[] = JqueryAsset::className();
     $this->depends[] = BootstrapThemeAsset::className();
 }
开发者ID:novokshonovev,项目名称:multi-string-widget,代码行数:7,代码来源:MultiStringAsset.php

示例4: actionForm

 /**
  * Returns form
  * Parameters can be passed to this method via POST method
  *
  * Form could have been generated using Yii::ActiveForm (@see http://www.yiiframework.com/doc-2.0/yii-widgets-activeform.html), however, as this is a test I am coding a custom form and custom javascript
  */
 protected function actionForm()
 {
     $params = Yii::$app->request->post();
     Yii::$app->view->registerJsFile('/js/jquery.validate.js', ['depends' => [JqueryAsset::className()]]);
     Yii::$app->view->registerJsFile('/js/site.js', ['depends' => [JqueryAsset::className()]]);
     return $this->renderPartial('form', ['params' => $params]);
 }
开发者ID:rajanrx,项目名称:vermilian-test,代码行数:13,代码来源:CommentController.php

示例5: registerAsset

 protected function registerAsset()
 {
     $jsData = Json::encode($this->data);
     $setupOptions = Json::encode($this->setupOptions);
     $js = "\n            google.charts.load('current', {packages:[\"orgchart\"]});\n            google.charts.setOnLoadCallback(drawChart);\n\n            function drawChart() {\n                var data = new google.visualization.DataTable();\n                data.addColumn('string', 'Name');\n                data.addColumn('string', 'Manager');\n                data.addColumn('string', 'ToolTip');\n\n                // For each orgchart box, provide the name, manager, and tooltip to show.\n                data.addRows(\n                    " . $jsData . "\n                );\n\n                // Create the chart.\n                var chart = new google.visualization.OrgChart(document.getElementById('" . $this->id . "'));\n                chart.draw(data, {allowHtml:true});\n            }\n        ";
     $this->view->registerJsFile('https://www.gstatic.com/charts/loader.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
     $this->view->registerJs($js, View::POS_READY);
 }
开发者ID:kongoon,项目名称:yii2-orgchart,代码行数:8,代码来源:OrgChart.php

示例6: init

 public function init()
 {
     $this->sourcePath = __DIR__ . '/language';
     $this->js = ['js/language.js'];
     $this->css = ['css/language.css'];
     $this->depends = [JqueryAsset::className()];
     parent::init();
 }
开发者ID:yeesoft,项目名称:yii2-yee-core,代码行数:8,代码来源:LanguagePillsAsset.php

示例7: init

 public function init()
 {
     $this->sourcePath = __DIR__ . '/source/language-selector';
     $this->js = [];
     $this->css = ['css/language-selector.css'];
     $this->depends = [JqueryAsset::className()];
     parent::init();
 }
开发者ID:yeesoft,项目名称:yii2-yee-core,代码行数:8,代码来源:LanguageSelectorAsset.php

示例8: init

 public function init()
 {
     $this->sourcePath = __DIR__ . '/admin';
     $this->js = ['js/admin.js'];
     $this->css = ['css/admin.css', 'css/widget.css', 'css/styler.css'];
     $this->depends = [JqueryAsset::className(), 'yii\\web\\YiiAsset', 'yii\\bootstrap\\BootstrapAsset', 'rmrevin\\yii\\fontawesome\\AssetBundle'];
     parent::init();
 }
开发者ID:yeesoft,项目名称:yii2-yee-core,代码行数:8,代码来源:YeeAsset.php

示例9: run

 public function run()
 {
     $asset = \Yii::$app->assetManager->publish("@ercling/loadingindicator/assets", ['forceCopy' => YII_DEBUG]);
     $this->getView()->registerCssFile($asset[1] . '/themes/' . $this->color . '/pace-theme-' . $this->theme . '.css');
     $this->getView()->registerJs('
         var yii2LoadingIndicator=' . json_encode($this->options) . ';
         ', \yii\web\View::POS_BEGIN);
     $this->getView()->registerJsFile($asset[1] . '/indicator.js', ['depends' => [JqueryAsset::className()]]);
 }
开发者ID:ercling,项目名称:yii2-loadingindicator,代码行数:9,代码来源:Indicator.php

示例10: init

 public function init()
 {
     parent::init();
     $this->isFollow = Tag::isFollow($this->tagId);
     if ($this->isFollow) {
         $this->label = "已关注";
     }
     $this->getView()->registerJsFile('/js/jquery.toggle.js', ['depends' => [JqueryAsset::className()]]);
     $this->getView()->registerJs("\$('.tagFollowToggle').toggle();");
 }
开发者ID:awebc,项目名称:web_xbf,代码行数:10,代码来源:FollowBtn.php

示例11: publishExtensionResources

 /**
  * @inheritdoc
  */
 protected function publishExtensionResources()
 {
     /** @var View $resourceManager */
     $resourceManager = $this->getResourceManager();
     // Initialization of extension resources
     $assetsExt = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . 'assets';
     $assetsPaths = \Yii::$app->getAssetManager()->publish($assetsExt);
     // [0] - path, [1] - URL
     $resourceManager->registerJsFile($assetsPaths[1] . '/resource-smart-load.js', ['depends' => [\yii\web\JqueryAsset::className(), \yii\web\YiiAsset::className()]]);
 }
开发者ID:istranger,项目名称:yii2-resource-smart-load,代码行数:13,代码来源:RSmartLoad.php

示例12: registerClientScripts

    /**
     * Registers the clientside widget files (css & js)
     */
    public function registerClientScripts()
    {
        $resources = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resources';
        $this->_baseUrl = Yii::$app->getAssetManager()->publish($resources);
        $this->getView()->registerJsFile($this->_baseUrl[1] . '/menu.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
        $this->getView()->registerJsFile($this->_baseUrl[1] . '/selectnav.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
        $this->getView()->registerJs('
			selectnav(\'myslidemenu\',\'insertHere\');
		', View::POS_END, 'selectnavstart');
        $this->getView()->registerCssFile($this->_baseUrl[1] . '/style.css', [], 'horizontal-menu-css');
    }
开发者ID:host33,项目名称:yii2-multilevel-horizontal-menu,代码行数:14,代码来源:MultilevelHorizontalMenu.php

示例13: registerJs

 /**
  * Registers the js code if necessary
  */
 protected function registerJs()
 {
     if (static::$JS_REGISTERED) {
         return;
     }
     JqueryAsset::register($this->getView());
     BootstrapAsset::register($this->getView());
     $js = new JsExpression("\n\t\t\tvar widgetClass = 'widget-memory-tabs';\n\t\t\tvar storageName = 'widget-memory-tabs';\n\n\t\t\tvar hasStorage = function() {\n\t\t\t\tvar test = 'test';\n\t\t\t\ttry {\n\t\t\t\t\tsessionStorage.setItem(test, test);\n\t\t\t\t\tsessionStorage.removeItem(test);\n\t\t\t\t\treturn true;\n\t\t\t\t} catch(e) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (hasStorage) {\n\n\t\t\t\tvar loadData = function() {\n\t\t\t\t\tvar dataStr = sessionStorage.getItem(storageName);\n\t\t\t\t\tif (dataStr == null) return {};\n\t\t\t\t\treturn JSON.parse(dataStr);\n\t\t\t\t};\n\n\t\t\t\tvar saveData = function(dataObj) {\n\t\t\t\t\tdataStr = JSON.stringify(dataObj);\n\t\t\t\t\tsessionStorage.setItem(storageName, dataStr);\n\t\t\t\t};\n\n\t\t\t\tvar activateIndex = function(tabId, index) {\n\t\t\t\t\tvar tab = \$('#' + tabId);\n\t\t\t\t\tvar items = tab.children('li');\n\t\t\t\t\tif (items.length <= index) return;\n\n\t\t\t\t\t\$('#' + tabId + ' li:eq(' + index + ') a').tab('show');\n\t\t\t\t};\n\n\t\t\t\tvar initIndexes = function() {\n\t\t\t\t\tvar data = loadData();\n\t\t\t\t\tvar curUrl = window.location.href;\n\t\t\t\t\tif (data[curUrl] == null) return;\n\n\t\t\t\t\tvar tabs = \$('.' + widgetClass);\n\t\t\t\t\ttabs.each(function(i, el) {\n\t\t\t\t\t\tvar tabId = \$(this).attr('id');\n\t\t\t\t\t\tif (tabId != null) {\n\t\t\t\t\t\t\tvar index = data[curUrl][tabId];\n\t\t\t\t\t\t\tactivateIndex(tabId, index);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\n\t\t\t\tvar setIndex = function(tabId, index) {\n\t\t\t\t\tvar curUrl = window.location.href;\n\t\t\t\t\tvar data = loadData();\n\t\t\t\t\tif (data[curUrl] == null) data[curUrl] = {};\n\t\t\t\t\tdata[curUrl][tabId] = index;\n\n\t\t\t\t\tsaveData(data);\n\t\t\t\t};\n\n\t\t\t\t\$('.widget-memory-tabs > li > a').mouseup(function(event) {\n\t\t\t\t\tvar tabs = \$(this).closest('.' + widgetClass);\n\t\t\t\t\tvar selectedIndex = \$(this).parent().prevAll().length;\n\n\t\t\t\t\tsetIndex(tabs.attr('id'), selectedIndex);\n\t\t\t\t});\n\n\t\t\t\tinitIndexes();\n\t\t\t}\n\t\t");
     $this->view->registerJs($js);
     static::$JS_REGISTERED = true;
 }
开发者ID:highestgoodlikewater,项目名称:yii2-toolbox,代码行数:14,代码来源:TabsWithMemory.php

示例14: registerClientScripts

    /**
     * Registers the clientside widget files (css & js)
     */
    public function registerClientScripts()
    {
        $resources = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $this->_baseUrl = Yii::$app->getAssetManager()->publish($resources);
        $this->getView()->registerJsFile($this->_baseUrl[1] . '/jquery.dlmenu.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
        $this->getView()->registerJsFile($this->_baseUrl[1] . '/modernizr.custom.js', ['position' => View::POS_HEAD]);
        $this->getView()->registerJs('
	    $(\'#dl-menu\').dlmenu({
	        animationClasses : { classin : \'dl-animate-in-' . $this->transition . '\', classout : \'dl-animate-out-' . $this->transition . '\' }
	    });
		', View::POS_END, 'menuscript');
        $this->getView()->registerCssFile($this->_baseUrl[1] . '/component.css', [], 'vertical-menu-css');
    }
开发者ID:host33,项目名称:yii2-multilevel-vertical-menu,代码行数:16,代码来源:MultilevelVerticalMenu.php

示例15: registerJs

    /**
     * @return void
     */
    private function registerJs()
    {
        $url = \yii\helpers\Url::to($this->url);
        \yii\web\JqueryAsset::register($this->getView());
        $this->getView()->registerJs(<<<JS
\$('#{$this->options['id']}').load('{$url}', function (response, textStatus, xhr) {
    if (textStatus == "error") {
        \$(this).html('{$this->errorContent}');
        \$(this).addCssClass('{$this->errorCssClass}');
    }
});
JS
);
    }
开发者ID:urbanindo,项目名称:yii2-core-widgets,代码行数:17,代码来源:AjaxLoadWidget.php


注:本文中的yii\web\JqueryAsset类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。