小编Phi*_*p M的帖子

用于Bootstrap Multiselect的令人敬畏的Bootstrap复选框

我正在使用http://davidstutz.github.io/bootstrap-multiselect/,我想设置我的复选框(http://flatlogic.github.io/awesome-bootstrap-checkbox/demo/)...但是某些原因我无法将其更改为所需的html结构.

默认的Bootstrap Multiselect HTML:

<ul class="multiselect-container dropdown-menu">
    <li class="active">
        <div class="checkbox">
            <label class="checkbox">
                <input value="AD" type="checkbox"> Andorra (AD)
            </label>
        </div>
    </li>
    ...
Run Code Online (Sandbox Code Playgroud)

这就是它应该如何

<ul class="multiselect-container dropdown-menu">
    <li class="active">
        <div class="checkbox">
            <input id="multiselect-0" value="vikings" type="checkbox">
            <label class="checkbox" for="multiselect-0"> Minnesota Vikings</label>
        </div>
    </li>
Run Code Online (Sandbox Code Playgroud)

这就是我初始化它的方式:

$('.test-select').multiselect({
    templates: { // Use the Awesome Bootstrap Checkbox structure
        li: '<li><div class="checkbox"><label></label></div></li>'
    }   
});
Run Code Online (Sandbox Code Playgroud)

这就是我想改变结构的方式:

$('.multiselect-container div.checkbox').each(function (index) {

    var id = 'multiselect-' + index,
        $input = $(this).find('input');

    $(this).find('label').attr('for', id);  
    $input.attr('id', id);

    $input.detach(); …
Run Code Online (Sandbox Code Playgroud)

javascript twitter-bootstrap

2
推荐指数
1
解决办法
2万
查看次数

TYPO3 Extbase-在单个视图中更改浏览器页面标题

在我的extbase扩展的单一视图中,我试图更改浏览器页面标题。我所有的尝试都失败了:

/**
 * action show
 *
 * @param \Vendor\Abc\Domain\Model\Abc $record
 * @return void
 */
public function showAction(\Vendor\Abc\Domain\Model\Abc $record) {
    $this->view->assign('record', $record);

    //$GLOBALS['TSFE']->page['title'] = $record->getAbc();
    //$GLOBALS['TSFE']->indexedDocTitle = $record->getAbc();        

    //$GLOBALS['TSFE']->page['title'] = $record;
    //$GLOBALS['TSFE']->indexedDocTitle = $record;  

    //$GLOBALS['TSFE']->additionalHeaderData['CustomUserIntTitle']
    //= '<title>' . $this->getAbc($record) . '</title>';

    //$myNewTitle = 'Title';
    //$title = '<title>' . $myNewTitle . '</title>';
    //$this->response->addAdditionalHeaderData($title);

    //$GLOBALS['TSFE']->content = preg_replace('#<title>.*<\/title>#', '<title>' . $record->getTitle() . '</title>', $GLOBALS['TSFE']->content);

    //$this->response->addAdditionalHeaderData('<title>Mein eigener Title</title>');
}
Run Code Online (Sandbox Code Playgroud)

我将动作注册为不可缓存(不确定是否确实需要这样做)

typo3 extbase typo3-7.6.x

2
推荐指数
3
解决办法
2591
查看次数

防止 jquery 自动完成在单击外部时关闭搜索结果框

如果我在搜索结果框之外单击,如果输入不为空并且结果> 0,我试图阻止 jquery 自动完成关闭搜索结果。这是我的小提琴:

http://jsfiddle.net/h16c0d67/

当单击搜索结果框外部时,它已经保持打开状态,而且如果我清除我显然不想要的输入,它也会保持打开状态。已经有一个类似的问题:JqueryUI Autocomplete Prevent close on click Outside

例如 .dialog() 函数有类似 clickOutside: false 的内容

这是我的设置:

html:

<div class="ui-widget">
  <label for="tags">Tags: </label>
  <input id="tags" />
  <button id="clear-search" >Clear</button>
</div>
Run Code Online (Sandbox Code Playgroud)

javascript:

 $(function () {
 $("#tags").autocomplete({
     source: availableTags,
     delay: 0,
     close:function(event, ui){
        if ( $('.ui-autocomplete > li').length > 0 ) {
             $("ul.ui-autocomplete, .ui-widget-content").filter(':hidden').show();
            } else {
        // I tried this:
        $('#tags').autocomplete( 'close' );
        $('ul.ui-autocomplete').remove();
        $('ul.ui-autocomplete').hide();
      } 
    }
 });
 });

$('#clear-search').on('click', function() { 
    $('#tags').val('');                                         
}); 

var availableTags = [ …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery jquery-ui autocomplete

2
推荐指数
1
解决办法
2068
查看次数

JQuery Datepicker - 从星期一开始选择每周范围

如何更改此每周jquery datepicker范围以周一开始一周?

http://jsfiddle.net/oykmv300/

$(function() {
var startDate;
var endDate;

var selectCurrentWeek = function() {
    window.setTimeout(function () {
        $('.week-picker').find('.ui-datepicker-current-day a').addClass('ui-state-active')
    }, 1);
}

$('.week-picker').datepicker( {
    showOtherMonths: true,
    selectOtherMonths: true,
    firstDay: 1,
    onSelect: function(dateText, inst) { 
        var date = $(this).datepicker('getDate');
        startDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay());
        endDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 6);
        var dateFormat = inst.settings.dateFormat || $.datepicker._defaults.dateFormat;
        $('#startDate').text($.datepicker.formatDate( dateFormat, startDate, inst.settings ));
        $('#endDate').text($.datepicker.formatDate( dateFormat, endDate, inst.settings ));

        selectCurrentWeek();
    },
    beforeShowDay: function(date) {
        var cssClass = …
Run Code Online (Sandbox Code Playgroud)

jquery datepicker jquery-ui-datepicker

2
推荐指数
1
解决办法
3262
查看次数

TYPO3 v9.5.0 - 错误信息:请求的页面不存在 /robots.txt

TYPO3 v9.5.0 - 错误信息:请求的页面不存在 /robots.txt

我有一个 TYPO3 9.5.0LTS 并使用引导程序包主题。似乎一切正常……但我经常收到这样的错误消息:

核心:异常处理程序 (WEB):未捕获的 TYPO3 异常:#1518472189:请求的页面不存在 | TYPO3\CMS\Core\Error\Http\PageNotFoundException 在第 82 行的文件 /is/www/typo3_src-9.5.0/typo3/sysext/frontend/Classes/Controller/ErrorController.php 中抛出。请求的 URL:domain/robots.txt

是什么导致了这种情况以及如何防止这种情况?或者如何在 v.9.5 中创建 robots.txt ?

typo3 url-routing typo3-9.x

2
推荐指数
1
解决办法
4557
查看次数

Node.js 错误 - AssertionError [ERR_ASSERTION]:模式不应使用全局或粘性模式......重新安装软件包后

我有两个 node.js 项目在 v10.14.2 上运行。两者都工作正常。

然后我删除了 package.json 中的所有包并像这样重新安装它们:

$ npm install <package01> <package02> <package03> ...
Run Code Online (Sandbox Code Playgroud)

安装成功。添加了 155 个贡献者的 228 个包并在 11.48 秒内审计了 393 个包发现 0 个漏洞

尝试运行它时,我现在收到一条错误消息:

$ nodemon project01
Run Code Online (Sandbox Code Playgroud)

错误信息:

[nodemon] starting `node project01.js`
/home/Project01/node_modules/hoek/lib/index.js:553
    throw new Assert.AssertionError({
    ^

AssertionError [ERR_ASSERTION]: pattern should not use global or sticky mode
    at new AssertionError (internal/assert.js:269:11)
    at Object.exports.assert (/home/Project01/node_modules/hoek/lib/index.js:553:11)
    at internals.String.regex (/home/Project01/node_modules/joi/lib/types/string/index.js:122:14)
    at Object.<anonymous> (/home/Project01/helpers/routeHelpers.js:58:27)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require …
Run Code Online (Sandbox Code Playgroud)

node.js

2
推荐指数
1
解决办法
3075
查看次数

TYPO3 - 如何通过 Viewhelper 获取 FE UID

如何通过 Viewhelper 获取和呈现 FE 用户的 uid?下面是通过控制器工作......但不是在 Viewhelper 中。区别在哪里?我正在使用 7.6.11,最后我希望拥有 FE 用户的 uid 和他的用户组 uid,并进一步在扩展的 html 和一般部分中使用它......

/typo3conf/ext/extension/Classes/ViewHelpers/UserViewHelper.php

<?php

namespace Vendor\Extension\ViewHelpers;

class UserViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {

/**
* User Repository
*
* @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
* @inject
*/
protected $userRepository;

/**
* @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserGroupRepository
* @inject
*/
protected $frontendUserGroupRepository;

public function render() {

    $userIDTest = $this->userRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']); 
    $this->view->assign('userIDTest', $userIDTest);

}   

}
Run Code Online (Sandbox Code Playgroud)

列表.html

<f:layout name="Default" />
<f:section name="main">

    {userIDTest.uid}

</f:section>
Run Code Online (Sandbox Code Playgroud)

按照 Dimitry 的建议,我替换了

$this->view->assign('userIDTest', $userIDTest);
Run Code Online (Sandbox Code Playgroud)

return $userIDTest;
Run Code Online (Sandbox Code Playgroud)

在 List.html 我有这个:

{namespace custom=Vendor\Extension\ViewHelpers}

<f:layout …
Run Code Online (Sandbox Code Playgroud)

php typo3 typo3-7.6.x

1
推荐指数
1
解决办法
1813
查看次数

Node.js puppeteer mysql - 使用 mysql 在循环内插入数据库中获取的值

我正在使用 node.js 和 puppeteer 来获取一些数据。...现在我想将获取的数据插入到数据库中...使用 mysql。下面似乎工作......但让我感到困惑的是在 console.log('DB 插入成功。记录:'+i); 总是落后,一段时间后它会停止......尽管仍有可用的记录表。

那是我的应用程序:

  let tableCell01;
  let tableCell01Val;
  let tableCell02;
  let tableCell02Val;

  const tableRows = await page.$$('table.tableFile2 > tbody > tr');

  for (let i=1; i < tableRows.length; i++){

    tableRow = tableRows[i];
    tableCell01 = await tableRow.$('td:nth-child(1) a');
    tableCell01Val = await page.evaluate( tableCell01 => tableCell01.innerText, tableCell01 );
    tableCell02 = await tableRow.$('td:nth-child(2)');
    tableCell02Val = await page.evaluate( tableCell02 => tableCell02.innerText, tableCell02 );

    tableCell02ValA.replace(/(^\s+|\s+$)/g,'');

    console.log('\n');
    console.log('ID: '+tableCell01Val);
    console.log('Company: '+tableCell02Val);
    console.log('Iterator: '+i);

    const insertCompanyList = "INSERT INTO companyList ( company_name, …
Run Code Online (Sandbox Code Playgroud)

javascript mysql node.js node-mysql puppeteer

1
推荐指数
1
解决办法
2285
查看次数