Tweeted twitter.com/StackTridion/status/972513228906532871
5 added 622 characters in body
source | link

UPDATE 2

I can now see the javascript file being used but the problem is that the iframe is not loaded yet when I try to use it (the TargetTypeList is inside an iframe).

I tried with this

$("#TargetTypeList_frame_details").load(function() {
    var targetCheckboxes = document.getElementById('TargetTypeList_frame_details').contentWindow.document.body.querySelectorAll('input[type="checkbox"]');
    for (var i = 0, len = targetCheckboxes.length; i < len; i++) {
        targetCheckboxes[i].checked = false;
    }
});

But I get: Uncaught TypeError: Cannot read property 'load' of undefined

Any ideas?

UPDATE 2

I can now see the javascript file being used but the problem is that the iframe is not loaded yet when I try to use it (the TargetTypeList is inside an iframe).

I tried with this

$("#TargetTypeList_frame_details").load(function() {
    var targetCheckboxes = document.getElementById('TargetTypeList_frame_details').contentWindow.document.body.querySelectorAll('input[type="checkbox"]');
    for (var i = 0, len = targetCheckboxes.length; i < len; i++) {
        targetCheckboxes[i].checked = false;
    }
});

But I get: Uncaught TypeError: Cannot read property 'load' of undefined

Any ideas?

4 edited body
source | link
$evt.addEventHandler($display, "start", onDisplayStarted);

function onDisplayStarted() {
    $evt.removeEventHandler($display, "start", onDisplayStarted);
    $("#TargetTypeList_frame_details").contents().find("input:checkbox").attrprop("checked"'checked', false);
}
$evt.addEventHandler($display, "start", onDisplayStarted);

function onDisplayStarted() {
    $evt.removeEventHandler($display, "start", onDisplayStarted);
    $("#TargetTypeList_frame_details").contents().find("input:checkbox").attr("checked", false);
}
$evt.addEventHandler($display, "start", onDisplayStarted);

function onDisplayStarted() {
    $evt.removeEventHandler($display, "start", onDisplayStarted);
    $("#TargetTypeList_frame_details").contents().find("input:checkbox").prop('checked', false);
}
3 Added code.
source | link

UPDATE

PublishDialogSettings.js (TargetTypeList_frame_details is the name of the iFrame where the name of the targets are along with its checkboxes)

$evt.addEventHandler($display, "start", onDisplayStarted);

function onDisplayStarted() {
    $evt.removeEventHandler($display, "start", onDisplayStarted);
    $("#TargetTypeList_frame_details").contents().find("input:checkbox").attr("checked", false);
}

PublishDialogSettings.config

<?xml version="1.0"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge"
    xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration"
    xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions"
    xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">
  <resources cache="true">
    <cfg:filters />
    <cfg:extensiongroups>
      <cfg:extensiongroup name="PublishDialogSettings">
        <cfg:extension target="Tridion.Web.UI.Editors.CME.Views.Popups.Publish">
          <cfg:insertafter>MyCompany.Resources.PublishDialogSettings</cfg:insertafter>
        </cfg:extension>
      </cfg:extensiongroup>
    </cfg:extensiongroups>
    <cfg:groups>
      <cfg:group name="MyCompany.Resources.PublishDialogSettings">
        <cfg:fileset>
          <cfg:file type="script">/Scripts/jquery-3.3.1.min.js</cfg:file>
          <cfg:file type="script">/Scripts/PublishDialogSettings.js</cfg:file>
        </cfg:fileset>
      </cfg:group>
    </cfg:groups>
  </resources>
  <definitionfiles/>
  <extensions>
    <ext:editorextensions>
      <ext:editorextension target="CME">
        <ext:editurls />
        <ext:listdefinitions />
        <ext:taskbars />
        <ext:commands />
        <ext:commandextensions />
        <ext:contextmenus />
        <ext:lists />
        <ext:tabpages />
        <ext:toolbars />
        <ext:ribbontoolbars/>
      </ext:editorextension>
    </ext:editorextensions>
    <ext:dataextenders />
  </extensions>
  <commands />
  <contextmenus/>
  <localization/>
  <settings>
    <defaultpage/>
    <navigatorurl/>
    <editurls/>
    <listdefinitions/>
    <itemicons/>
    <theme>
      <path />
    </theme>
    <resourceextensions>
      <resourceextension>PublishDialogSettings</resourceextension>
    </resourceextensions>
    <customconfiguration/>
  </settings>
</Configuration>

added in system.config

<editor name="PublishDialogSettings">
    <installpath>E:\Tridion\web\WebUI\Editors\PublishDialogSettings\</installpath>
    <configuration>Configuration\PublishDialogSettings.config</configuration>
    <vdir/>
</editor>

UPDATE

PublishDialogSettings.js (TargetTypeList_frame_details is the name of the iFrame where the name of the targets are along with its checkboxes)

$evt.addEventHandler($display, "start", onDisplayStarted);

function onDisplayStarted() {
    $evt.removeEventHandler($display, "start", onDisplayStarted);
    $("#TargetTypeList_frame_details").contents().find("input:checkbox").attr("checked", false);
}

PublishDialogSettings.config

<?xml version="1.0"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge"
    xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration"
    xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions"
    xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">
  <resources cache="true">
    <cfg:filters />
    <cfg:extensiongroups>
      <cfg:extensiongroup name="PublishDialogSettings">
        <cfg:extension target="Tridion.Web.UI.Editors.CME.Views.Popups.Publish">
          <cfg:insertafter>MyCompany.Resources.PublishDialogSettings</cfg:insertafter>
        </cfg:extension>
      </cfg:extensiongroup>
    </cfg:extensiongroups>
    <cfg:groups>
      <cfg:group name="MyCompany.Resources.PublishDialogSettings">
        <cfg:fileset>
          <cfg:file type="script">/Scripts/jquery-3.3.1.min.js</cfg:file>
          <cfg:file type="script">/Scripts/PublishDialogSettings.js</cfg:file>
        </cfg:fileset>
      </cfg:group>
    </cfg:groups>
  </resources>
  <definitionfiles/>
  <extensions>
    <ext:editorextensions>
      <ext:editorextension target="CME">
        <ext:editurls />
        <ext:listdefinitions />
        <ext:taskbars />
        <ext:commands />
        <ext:commandextensions />
        <ext:contextmenus />
        <ext:lists />
        <ext:tabpages />
        <ext:toolbars />
        <ext:ribbontoolbars/>
      </ext:editorextension>
    </ext:editorextensions>
    <ext:dataextenders />
  </extensions>
  <commands />
  <contextmenus/>
  <localization/>
  <settings>
    <defaultpage/>
    <navigatorurl/>
    <editurls/>
    <listdefinitions/>
    <itemicons/>
    <theme>
      <path />
    </theme>
    <resourceextensions>
      <resourceextension>PublishDialogSettings</resourceextension>
    </resourceextensions>
    <customconfiguration/>
  </settings>
</Configuration>

added in system.config

<editor name="PublishDialogSettings">
    <installpath>E:\Tridion\web\WebUI\Editors\PublishDialogSettings\</installpath>
    <configuration>Configuration\PublishDialogSettings.config</configuration>
    <vdir/>
</editor>
2 deleted 13 characters in body; edited tags
source | link
1
source | link