I'm trying to build a music search using Amazon mp3 widgets to play each result. Instead of building a page full of these widgets, I'd like the user to click the album art and then the widget would load.
The code that I have looks like this:
function loadPlayer(asin) {
var amzn_wdgt={widget:'MP3Clips'};
amzn_wdgt.tag='widgetsamazon-20';
amzn_wdgt.widgetType='ASINList';
amzn_wdgt.ASIN=asin;
amzn_wdgt.title='What I\'ve been listening to lately...';
amzn_wdgt.width='250';
amzn_wdgt.height='250';
amzn_wdgt.shuffleTracks='True';
amzn_wdgt.marketPlace='US';
}
In their documentation (https://widgets.amazon.com/Widget-Source/), they have a script to load the widget:
<script type='text/javascript' src='http://wms.assoc-amazon.com/20070822/US/js/swfobject_1_5.js'></script>
The issue that I'm running into is that I can't seem to find a way to load that script dynamically. The script loads the widget into the element that contains the code, so I don't knw how to do this with jQuery or javascript. Any help would be appreciated.
Check out jquery's getScript: http://api.jquery.com/jQuery.getScript/
Update To answer your question below, the script expects a global variable, so you'll need something more like:
var amzn_wdgt;
function loadPlayer(asin) {
amzn_wdgt={widget:'MP3Clips'};
amzn_wdgt.tag='widgetsamazon-20';
...yada yada...
$.getScript(...)
}
Related
We are using the Easy Video Player in on a WordPress website in combination with FacetWP. This is software we use to filter. This filter is working with AJAX and there is no page refresh after an interaction with the filter, it is done with AJAX.
This is causing problems with the Video player we are using. We think some Javascript is not loaded because of the AJAX refresh with the filter.
We allready know this from FacetWP in order to reinitialize Javascript after interaction with the filter:
facetwp-loaded Event
We also found the PHP script that enqueue the CSS and JS files.
function easy_video_player_enqueue_scripts() {
if (!is_admin()) {
$plugin_url = plugins_url('', __FILE__);
$enable_jquery = get_option('evp_enable_jquery');
if ($enable_jquery) {
wp_enqueue_script('jquery');
}
//wp_register_style('plyr-css', 'https://cdn.plyr.io/3.6.7/plyr.css');
wp_register_style('plyr-css', $plugin_url . '/lib/plyr.css');
wp_enqueue_style('plyr-css');
//wp_register_script('plyr-js', 'https://cdn.plyr.io/3.6.7/plyr.js');
wp_register_script('plyr-js', $plugin_url . '/lib/plyr.js');
wp_enqueue_script('plyr-js');
}
}
But to be very honest, I can't figure out what I have to load in the FacetWP function in order to re-run the JS to get the player working with filtering.
Anyone can help me a step furder in order to fix this?
EDIT
Got it to work with the help of John:)
const player = Plyr.setup('video', { ratio: '16:9', });
Complete code looks like this:
<script>
document.addEventListener('facetwp-loaded', function() {
const player = Plyr.setup('video', { ratio: '16:9', });
});
</script>
It´s just a wild guess by looking into the videoplayersource and combine with the facetwp-loaded event.
maybe it works when you add this handler to the bottom of your page (not the content loaded with ajax):
document.addEventListener('facetwp-loaded', function() {
const players = Plyr.setup('video');
});
if you are getting $ is not defined, try replace $ with jQuery
PS: i just realize that your version of easy-video-player differs from the link i posted above, maybe you should upgrade it to the latest version so it uses flowplayer like in this answer
Is there a way I can wrap an external JS script embed with lazy-load behavior to only execute when the embed is in the viewport?
Context: I have an external javascript embed that when run, generates an iframe with a scheduling widget. Works pretty well, except that when the script executes, it steals focus and scrolls you down to the widget when it’s done executing. The vendor has been looking at a fix for a couple weeks, but it’s messing up my pages. I otherwise like the vendor.
Javascript embed call:
<a href=https://10to8.com/book/zgdmlguizqqyrsxvzo/ id="TTE-871dab0c-4011-4293-bee3-7aabab857cfd" target="_blank">See
Online Booking Page</a>
<script src=https://d3saea0ftg7bjt.cloudfront.net/embed/js/embed.min.js> </script> <script>
window.TTE.init({
targetDivId: "TTE-871dab0c-4011-4293-bee3-7aabab857cfd",
uuid: "871dab0c-4011-4293-bee3-7aabab857cfd",
service: 1158717
});
</script>
While I'm waiting for the vendor to fix their js, I wondered if lazy-loading the JS embed may practically eliminate the poor user experience. Warning: I'm a JS/webdev noob, so probably can't do anything complicated. A timer-based workaround is not ideal because users may still be looking at other parts of the page when the timer runs out. Here are the things I’ve tried and what happens:
I tried:
What happened:
Add async to one or both of the script declarations above
Either only shows the link or keeps stealing focus.
Adding type=”module” to one or both script declarations above
Only rendered the link.
Wrapping the above code in an iframe with the appropriate lazy-loading tags
When I tried, it rendered a blank space.
Also, I realize it's basically the same question as this, but it didn't get any workable answers.
I actually also speak french but I'll reply in english for everybody.
Your question was quite interesting because I also wanted to try out some lazy loading so I had a play on Codepen with your example (using your booking id).
I used the appear.js library because I didn't really want to spend time trying some other APIs (perhaps lighter so to take in consideration).
The main JS part I wrote is like this:
// The code to init the appear.js lib and add our logic for the booking links.
(function(){
// Perhaps these constants could be put in the generated HTML. I don't really know
// where they come from but they seem to be related to an account.
const VENDOR_LIB_SRC = "https://d3saea0ftg7bjt.cloudfront.net/embed/js/embed.min.js";
const UUID = "871dab0c-4011-4293-bee3-7aabab857cfd";
const SERVICE = 1158717;
let vendorLibLoaded = false; // Just to avoid loading several times the vendor's lib.
appear({
elements: function() {
return document.querySelectorAll('a.booking-link');
},
appear: function(bookingLink) {
console.log('booking link is visible', bookingLink);
/**
* A function which we'll be able to execute once the vendor's
* script has been loaded or later when we see other booking links
* in the page.
*/
function initBookingLink(bookingLink) {
window.TTE.init({
targetDivId: bookingLink.getAttribute('id'),
uuid: UUID,
service: SERVICE
});
}
if (!vendorLibLoaded) {
// Load the vendor's JS and once it's loaded then init the link.
let script = document.createElement('script');
script.onload = function() {
vendorLibLoaded = true;
initBookingLink(bookingLink);
};
script.src = VENDOR_LIB_SRC;
document.head.appendChild(script);
} else {
initBookingLink(bookingLink);
}
},
reappear: false
});
})();
I let you try my codepen here: https://codepen.io/patacra/pen/gOmaKev?editors=1111
Tell me when to delete it if it contains sensitive data!
Kind regards,
Patrick
This method will Lazy Load HTML Elements only when it is visible to User, If the Element is not scrolled into viewport it will not be loaded, it works like Lazy Loading an Image.
Add LazyHTML script to Head.
<script async src="https://cdn.jsdelivr.net/npm/lazyhtml#1.0.0/dist/lazyhtml.min.js" crossorigin="anonymous" debug></script>
Wrap Element in LazyHTML Wrapper.
<div class="lazyhtml" data-lazyhtml onvisible>
<script type="text/lazyhtml">
<!--
<a href=https://10to8.com/book/zgdmlguizqqyrsxvzo/ id="TTE-871dab0c-4011-4293-bee3-7aabab857cfd" target="_blank">See
Online Booking Page</a>
<script src=https://d3saea0ftg7bjt.cloudfront.net/embed/js/embed.min.js>
</script>
<script>
window.TTE.init({
targetDivId: "TTE-871dab0c-4011-4293-bee3-7aabab857cfd",
uuid: "871dab0c-4011-4293-bee3-7aabab857cfd",
service: 1158717
});
</script>
-->
</script>
</div>
I have an Angular2 web application which loads a ul/li-list from a remote JSON object when a button is clicked.
The generated div and list looks like this:
<div class="jstree jstree-1 jstree-default jstree-leaf" role="tree" aria-multiselectable="true" tabindex="0" aria-activedescendant="j1_loading" aria-busy="false" ng-reflect-inner-h-t-m-l="<ul class=".actual"><li>Windows<ul><li>setupact.log</li><li>Tasks<ul><li>SCHEDLGU.TXT</li></ul></li><li>Logs<ul><li>CBS<ul><li>CBS.log</li></ul></li><li>DPX<ul><li>setupact.log</li></ul></li></ul></li><li>AppCompat<ul><li>Programs<ul><li>AEINV_PREVIOUS.xml</li><li>RecentFileCache.bcf</li><li>AEINV_WER_{91399519-4D7E-4F2D-8E40-5C55523C2307}_20160914_210543.xml</li></ul></li></ul></li><li>winsxs<ul><li>ManifestCache<ul><li>702349c5b78f9a04_blobs.bin</li></ul></li><li>poqexec.log</li></ul></li><li>rescache<ul><li>ResCache.mni</li></ul></li><li>System32<ul><li>Microsoft<ul><li>Protect<ul><li>S-1-5-19<ul><li>Preferred</li></ul></li></ul></li></ul></li><li>7B296FB0-376B-497e-B012-9C450E1B7327-5P-1.C7483456-A289-439d-8115-601632D005A0</li><li>winevt<ul><li>Logs<ul><li>Security.evtx</li><li>Microsoft-Windows-Windows Firewall With Advanced Security%4Firewall.evtx</li><li>Windows PowerShell.evtx</li><li>Microsoft-Windows-Dhcpv6-Client%4Admin.evtx</li><li>System.evtx</li><li>Microsoft-Windows-Application-Experience%4Program-Telemetry.evtx</li><li>Microsoft-Windows-Kernel-WHEA%4Operational.evtx</li><li>Microsoft-Windows-Resource-Exhaustion-Detector%4Operational.evtx</li><li>Microsoft-Windows-NetworkLocationWizard%4Operational.evtx</li><li>Microsoft-Windows-LanguagePackSetup%4Operational.evtx</li><li>Microsoft-Windows-OfflineFiles%4Operational.evtx</li><li>Microsoft-Windows-WindowsBackup%4ActionCenter.evtx</li><li>Microsoft-Windows-International%4Operational.evtx</li><li>Microsoft-Windows-WindowsUpdateClient%4Operational.evtx</li><li>Microsoft-Windows-MUI%4Operational.evtx</li><li>Microsoft-Windows-Diagnostics-Performance%4Operational.evtx</li><li>Microsoft-Windows-Compat-Appraiser%4Operational.evtx</li><li>Microsoft-Windows-Diagnosis-DPS%4Operational.evtx</li><li>Application.evtx</li><li>Microsoft-Windows-BranchCacheSMB%4Operational.evtx</li><li>Microsoft-Windows-Bits-Client%4Operational.evtx</li><li>Microsoft-Windows-GroupPolicy%4Operational.evtx</li><li>Microsoft-Windows-Windows Defender%4Operational.evtx</li><li>Microsoft-Windows-Known Folders API Service.evtx</li><li>Microsoft-Windows-Windows Defender%4WHC.evtx</li><li>Microsoft-Windows-HomeGroup Provider Service%4Operational.evtx</li><li>Microsoft-Windows-ReliabilityAnalysisComponent%4Operational.evtx</li><li>Microsoft-Windows-CodeIntegrity%4Operational.evtx</li><li>Microsoft-Windows-TerminalServices-RemoteConnectionManager%4Operational.evtx</li><li>Microsoft-Windows-User Profile Service%4Operational.evtx</li><li>Microsoft-Windows-WinRM%4Operational.evtx</li><li>Microsoft-Windows-NetworkProfile%4Operational.evtx</li><li>Microsoft-Windows-Application-Experience%4Program-Inventory.evtx</li><li>Microsoft-Windows-TerminalServices-LocalSessionManager%4Operational.evtx</li><li>Setup.evtx</li><li>Microsoft-Windows-CAPI2%4Operational.evtx</li></ul></li></ul></li><li>7B296FB0-376B-497e-B012-9C450E1B7327-5P-0.C7483456-A289-439d-8115-601632D005A0</li><li>wdi<ul><li>{86432a0b-3c7d-4ddf-a89c-172faa90485d}<ul><li>S-1-5-21-1426688081-248760799-3800414735-1001_UserData.bin</li></ul></li><li>ShutdownPerformanceDiagnostics_SystemData.bin</li><li>BootPerformanceDiagnostics_SystemData.bin</li><li>LogFiles<ul><li>WdiContextLog.etl.003</li><li>WdiContextLog.etl.002</li><li>WdiContextLog.etl.001</li><li>BootCKCL.etl</li><li>ShutdownCKCL.etl</li></ul></li></ul></li><li>LogFiles<ul><li>Scm<ul><li>a1cfa52f-06f2-418d-addb-cd6456d66f43</li><li>2c59ecaf-3a27-4640-9f4b-519b05bdd70f</li><li>5b184694-64c3-4633-94c5-945b3fa561d6</li><li>6b7ac694-8d6d-481b-9dd8-2a3a741ada6d</li><li>956981f2-9434-4ac7-92d1-255484e54e4d</li><li>bba67ad0-4ba0-4b44-827b-ff419b70c057</li><li>b9bee219-c29e-4310-819c-147a5a0e045e</li><li>731e9c62-95b5-4c8c-ab64-4cc591c9ff5b</li><li>9334c323-f100-4656-9ba0-e4aa69c0f9c2</li><li>d21f6024-191f-4454-bbbc-09a650da2549</li><li>a316e645-1c56-45a6-bd6a-7dca79778090</li><li>a6394592-54ce-4e93-8d64-1a068f462632</li><li>f1369a11-e983-4458-b390-712efa1cba44</li><li>38279e40-3dc1-4c28-a688-148aed61ff69</li><li>1ec9510d-a439-4950-9399-b6399edf9ea7</li><li>de8bae53-2809-4f75-85ef-427d364b9b2c</li><li>9b75c702-ea13-406a-badb-6c588ee4375b</li><li>de8699d2-8a05-42f7-8a85-5162af47d26a</li></ul></li><li>WMI<ul><li>RtBackup<ul><li>EtwRTDiagLog.etl</li><li>EtwRTEventLog-Application.etl</li><li>EtwRTEventLog-System.etl</li></ul></li></ul></li></ul></li><li>spool<ul><li>drivers<ul><li>w32x86<ul><li>3<ul><li>mxdwdui.BUD</li></ul></li><li>PCC<ul><li>tsprint.inf_x86_neutral_c48d421ad2c1e3e3.cab</li></ul></li></ul></li></ul></li></ul></li><li>Tasks<ul><li>Microsoft<ul><li>Windows Defender<ul><li>MP Scheduled Scan</li></ul></li></ul></li></ul></li><li>DriverStore<ul><li>INFCACHE.1</li><li>FileRepository<ul><li>prnep00l.inf_x86_neutral_3323920c1a72a42d<ul><li>prnep00l.PNF</li></ul></li><li>prnbr009.inf_x86_neutral_3f6b69c8d1091fd8<ul><li>prnbr009.PNF</li></ul></li><li>prnkm002.inf_x86_neutral_ded1a36701bddc86<ul><li>prnkm002.PNF</li></ul></li><li>prnca003.inf_x86_neutral_f0a023edfd5cd833<ul><li>prnca003.PNF</li></ul></li><li>prnca00d.inf_x86_neutral_8883e3ab4a33bfbb<ul><li>prnca00d.PNF</li></ul></li><li>prnbr006.inf_x86_neutral_331a0c6df1c9d3e1<ul><li>prnbr006.PNF</li></ul></li><li>prnep004.inf_x86_neutral_25623e649d146f5d<ul><li>prnep004.PNF</li></ul></li><li>prnkm003.inf_x86_neutral_ea465b3729b37f54<ul><li>prnkm003.PNF</li></ul></li><li>prnbr005.inf_x86_neutral_407befecac90c7f1<ul><li>prnbr005.PNF</li></ul></li><li>prnrc003.inf_x86_neutral_e9198ff5f961d947<ul><li>prnrc003.PNF</li></ul></li><li>bth.inf_x86_neutral_a6bf6d613b46f6a5<ul><li>bth.PNF</li></ul></li><li>prnin004.inf_x86_neutral_2aba7beb4ab9a9e8<ul><li>prnin004.PNF</li></ul></li><li>prnnr004.inf_x86_neutral_15e7dc89d102e928<ul><li>prnnr004.PNF</li></ul></li><li>prnin002.inf_x86_neutral_b9fa18a8d63d5294<ul><li>prnin002.PNF</li></ul></li><li>prnca00g.inf_x86_neutral_b19defbd7969a7c7<ul><li>prnca00g.PNF</li></ul></li><li>prnhp005.inf_x86_neutral_9307c57b91a7985e<ul><li>prnhp005.PNF</li></ul></li><li>prnrc006.inf_x86_neutral_404ca57b9d9c1e47<ul><li>prnrc006.PNF</li></ul></li><li>amdsata.inf_x86_neutral_5c3d0d1e97e99e10<ul><li>amdsata.PNF</li></ul></li><li>prnrc005.inf_x86_neutral_73b01a2655fdb5c5<ul><li>prnrc005.PNF</li></ul></li><li>prnca00f.inf_x86_neutral_b94365c0e502f290<ul><li>prnca00f.PNF</li></ul></li><li>prnep00a.inf_x86_neutral_d4494950448771ed<ul><li>prnep00a.PNF</li></ul></li><li>prnge001.inf_x86_neutral_51cbe14e4cdde8c2<ul><li>prnge001.PNF</li></ul></li><li>prnkm004.inf_x86_neutral_b456c14d5367f83c<ul><li>prnkm004.PNF</li></ul></li><li>prnbr008.inf_x86_neutral_87aae9d395393afd<ul><li>prnbr008.PNF</li></ul></li><li>prnok002.inf_x86_neutral_436ff5d24333cca0<ul><li>prnok002.PNF</li></ul></li><li>prnin003.inf_x86_neutral_dca922447801904c<ul><li>prnin003.PNF</li></ul></li><li>prnsa002.inf_x86_neutral_db272f9cd17a383f<ul><li>prnsa002.PNF</li></ul></li><li>prnbr007.inf_x86_neutral_af94d26aafd1ca3a<ul><li>prnbr007.PNF</li></ul></li><li>prnep003.inf_x86_neutral_342be98eb74e1449<ul><li>prnep003.PNF</li></ul></li><li>prnep005.inf_x86_neutral_f4a4a2a89cb57323<ul><li>prnep005.PNF</li></ul></li><li>prnrc004.inf_x86_neutral_7d5665e9e43f678d<ul><li>prnrc004.PNF</li></ul></li><li>prnhp003.inf_x86_neutral_8685826a5ca37e6b<ul><li>prnhp003.PNF</li></ul></li><li>iastorv.inf_x86_neutral_0bcee2057afcc090<ul><li>iastorv.PNF</li></ul></li><li>prnca00b.inf_x86_neutral_c675b60dd45218c1<ul><li>prnca00b.PNF</li></ul></li><li>prnrc007.inf_x86_neutral_cfebba21b1c02dd7<ul><li>prnrc007.PNF</li></ul></li><li>prnle003.inf_x86_neutral_a8106f7f3af21d88<ul><li>prnle003.PNF</li></ul></li><li>prnbr002.inf_x86_neutral_1d14699bf2d4d936<ul><li>prnbr002.PNF</li></ul></li><li>prnnr003.inf_x86_neutral_02802729a95f0eed<ul><li>prnnr003.PNF</li></ul></li><li>prnep00c.inf_x86_neutral_92ff44dcbf1c760c<ul><li>prnep00c.PNF</li></ul></li><li>prnsv003.inf_x86_neutral_2011fa0a7f786266<ul><li>prnsv003.PNF</li></ul></li><li>prnnr002.inf_x86_neutral_b9a1c43c0cb6c940<ul><li>prnnr002.PNF</li></ul></li><li>faxcn002.inf_x86_neutral_29a66691dd7a46a5<ul><li>faxcn002.PNF</li></ul></li><li>prnod002.inf_x86_neutral_c36a5fe1ac15a734<ul><li>prnod002.PNF</li></ul></li><li>prnrc00b.inf_x86_neutral_354df7938905aa3b<ul><li>prnrc00b.PNF</li></ul></li><li>prnep00b.inf_x86_neutral_d0e9433101a2df79<ul><li>prnep00b.PNF</li></ul></li><li>prnsv004.inf_x86_neutral_3ee5a15023f3b3ed<ul><li>prnsv004.PNF</li></ul></li><li>prngt002.inf_x86_neutral_a10ecaa46786286d<ul><li>prngt002.PNF</li></ul></li><li>nvraid.inf_x86_neutral_0276fc3b3ea60d41<ul><li>nvraid.PNF</li></ul></li><li>prnbr004.inf_x86_neutral_a976dec554a0be13<ul><li>prnbr004.PNF</li></ul></li><li>prnep002.inf_x86_neutral_9111d9b86cbd3f64<ul><li>prnep002.PNF</li></ul></li><li>prnrc002.inf_x86_neutral_3fb2e6c401a9c7d8<ul><li>prnrc002.PNF</li></ul></li><li>prnbr003.inf_x86_neutral_21c4516754f2bda5<ul><li>prnbr003.PNF</li></ul></li><li>prnle004.inf_x86_neutral_60637fb8287b0bdb<ul><li>prnle004.PNF</li></ul></li><li>prnkm005.inf_x86_neutral_a2013031e279b6f6<ul><li>prnkm005.PNF</li></ul></li><li>prngt004.inf_x86_neutral_f7b569fe96e4f7ae<ul><li>prngt004.PNF</li></ul></li><li>prnhp002.inf_x86_neutral_e6daa9c39ac001a3<ul><li>prnhp002.PNF</li></ul></li><li>prnfx002.inf_x86_neutral_f83f67e1c22e557b<ul><li>prnfx002.PNF</li></ul></li><li>prnhp004.inf_x86_neutral_95288ae6f32f1fe7<ul><li>prnhp004.PNF</li></ul></li></ul></li></ul></li><li>SMI<ul><li>Store<ul><li>Machine<ul><li>SCHEMA.DAT{f74722ed-7b07-11e6-b6ad-0800273c6b02}.TM.blf</li><li>SCHEMA.DAT.LOG1</li><li>SCHEMA.DAT{f74722ed-7b07-11e6-b6ad-0800273c6b02}.TMContainer00000000000000000001.regtrans-ms</li><li>SCHEMA.DAT</li></ul></li></ul></li></ul></li><li>CodeIntegrity<ul><li>bootcat.cache</li></ul></li><li>wbem<ul><li>Repository<ul><li>MAPPING1.MAP</li><li>MAPPING2.MAP</li><li>MAPPING3.MAP</li><li>OBJECTS.DATA</li><li>INDEX.BTR</li></ul></li></ul></li><li>wfp<ul><li>wfpdiag.etl</li></ul></li><li>config<ul><li>SOFTWARE.LOG1</li><li>SECURITY.LOG1</li><li>SAM</li><li>DEFAULT.LOG1</li><li>COMPONENTS.LOG1</li><li>systemprofile<ul><li>AppData<ul><li>LocalLow<ul><li>Microsoft<ul><li>CryptnetUrlCache<ul><li>MetaData<ul><li>7396C420A8E1BC1DA97F1AF0D10BAD21</li><li>57C8EDB95DF3F0AD4EE2DC2B8CFD4157</li><li>37C951188967C8EB88D99893D9D191FE</li><li>21253908F3CB05D51B1C2DA8B681A785</li><li>A1377F7115F1F126A15360369B165211</li><li>F90F18257CBB4D84216AC1E1F3BB2C76</li><li>A583E2A51BFBDC1E492A57B7C8325850</li><li>3130B1871A126520A8C47861EFE3ED4D</li><li>696F3DE637E6DE85B458996D49D759AD</li><li>4C7F163ED126D5C3CB9457F68EC64E9E</li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li>SYSTEM</li><li>DEFAULT</li><li>COMPONENTS{6cced2ed-6e01-11de-8bed-001e0bcd1824}.TM.blf</li><li>SAM.LOG1</li><li>SYSTEM.LOG1</li><li>COMPONENTS</li><li>SECURITY</li><li>COMPONENTS{6cced2ed-6e01-11de-8bed-001e0bcd1824}.TMContainer00000000000000000002.regtrans-ms</li><li>COMPONENTS{6cced2ed-6e01-11de-8bed-001e0bcd1824}.TMContainer00000000000000000001.regtrans-ms</li><li>TxR<ul><li>{6cced300-6e01-11de-8bed-001e0bcd1824}.TxR.0.regtrans-ms</li><li>{6cced300-6e01-11de-8bed-001e0bcd1824}.TxR.2.regtrans-ms</li><li>{6cced300-6e01-11de-8bed-001e0bcd1824}.TxR.blf</li><li>{6cced301-6e01-11de-8bed-001e0bcd1824}.TM.blf</li><li>{6cced301-6e01-11de-8bed-001e0bcd1824}.TMContainer00000000000000000001.regtrans-ms</li></ul></li><li>SOFTWARE</li></ul></li><li>NetworkList<ul><li>Icons<ul><li>{1ED31542-AA58-4CD5-A56A-B9007AB965C3}_16.bin</li><li>{1ED31542-AA58-4CD5-A56A-B9007AB965C3}_24.bin</li><li>{1ED31542-AA58-4CD5-A56A-B9007AB965C3}_48.bin</li><li>{1ED31542-AA58-4CD5-A56A-B9007AB965C3}_32.bin</li></ul></li></ul></li><li>catroot2<ul><li>{F750E6C3-38EE-11D1-85E5-00C04FC295EE}<ul><li>catdb</li></ul></li><li>{127D0A1D-4EF2-11D1-8608-00C04FC295EE}<ul><li>catdb</li></ul></li><li>edb.log</li><li>edb004E5.log</li><li>edb.chk</li><li>edb004E4.log</li></ul></li></ul></li><li>SoftwareDistribution<ul><li>DataStore<ul><li>DataStore.edb</li><li>Logs<ul><li>edb.chk</li><li>edb.log</li></ul></li></ul></li><li>ReportingEvents.log</li></ul></li><li>ServiceProfiles<ul><li>NetworkService<ul><li>NTUSER.DAT.LOG1</li><li>NTUSER.DAT</li><li>AppData<ul><li>Roaming<ul><li>Microsoft<ul><li>SoftwareProtectionPlatform<ul><li>Cache<ul><li>cache.dat</li></ul></li><li>tokens.dat</li></ul></li></ul></li></ul></li><li>Local<ul><li>Microsoft<ul><li>Media Player<ul><li>CurrentDatabase_372.wmdb</li></ul></li></ul></li><li>Temp<ul><li>MpCmdRun.log</li></ul></li></ul></li></ul></li></ul></li><li>LocalService<ul><li>NTUSER.DAT.LOG1</li><li>NTUSER.DAT</li><li>AppData<ul><li>Roaming<ul><li>PeerNetworking<ul><li>idstore.sst</li><li>idstore.sst.new</li></ul></li><li>Microsoft<ul><li>Crypto<ul><li>RSA<ul><li>S-1-5-19<ul><li>7e22207fe9846926e18c29d3e675240e_f98e9ddc-0e1b-4293-b1aa-bc41c96b9f31</li></ul></li></ul></li></ul></li></ul></li></ul></li><li>Local<ul><li>FontCache-S-1-5-21-1426688081-248760799-3800414735-1001.dat</li><li>FontCache-System.dat</li><li>FontCache-FontFace.dat</li></ul></li></ul></li></ul></li></ul></li><li>bootstat.dat</li><li>servicing<ul><li>Sessions<ul><li>Sessions.xml</li><li>Sessions.back.xml</li><li>30543655_539879863.xml</li></ul></li></ul></li><li>Temp<ul><li>MpCmdRun.log</li><li>MpSigStub.log</li></ul></li><li>inf<ul><li>setupapi.ev1</li><li>setupapi.dev.log</li><li>setupapi.app.log</li></ul></li><li>Microsoft.NET<ul><li>Framework<ul><li>v4.0.30319<ul><li>ngen.log</li><li>ngen_service.log</li></ul></li></ul></li></ul></li><li>WindowsUpdate.log</li></ul></li><li>System Volume Information<ul><li>Syscache.hve</li><li>Syscache.hve.LOG1</li><li>{ebac27bb-7b10-11e6-a5bc-0800273c6b02}{3808876b-c176-4e48-b7ae-04046e6cc752}</li></ul></li><li>pagefile.sys</li><li>Users<ul><li>vagrant<ul><li>ntuser.dat.LOG1</li><li>NTUSER.DAT</li><li>AppData<ul><li>LocalLow<ul><li>Microsoft<ul><li>CryptnetUrlCache<ul><li>Content<ul><li>B912B2C6928A18B8CD7D50CF08BEA95B_87708DAABE1AF38B603CEFBE5F2B3276</li></ul></li><li>MetaData<ul><li>EDC238BFF48A31D55A97E1E93892934B_C20E0DA2D0F89FE526E1490F4A2EE5AB</li><li>B912B2C6928A18B8CD7D50CF08BEA95B_87708DAABE1AF38B603CEFBE5F2B3276</li><li>40E450F7CE13419A2CCC2A5445035A0A_97482851B9CF8FBB790FA8AEAB0C772D</li><li>C0018BB1B5834735BFA60CD063B31956</li><li>7396C420A8E1BC1DA97F1AF0D10BAD21</li><li>57C8EDB95DF3F0AD4EE2DC2B8CFD4157</li><li>DCE3BDBF5BDD86E2AB5B471CB90709B4_A7704BF276C97AA4D70879F611AA7DB9</li><li>37C951188967C8EB88D99893D9D191FE</li><li>C46E7B0F942663A1EDC8D9D6D7869173_42820CDFEA41DC84AAB89A6B63561873</li><li>21253908F3CB05D51B1C2DA8B681A785</li><li>FB788E090BC1F3AA2FBC9E8FB2859601</li><li>F90F18257CBB4D84216AC1E1F3BB2C76</li><li>696F3DE637E6DE85B458996D49D759AD</li></ul></li></ul></li></ul></li></ul></li><li>Roaming<ul><li>Microsoft<ul><li>Windows<ul><li>Recent<ul><li>CustomDestinations<ul><li>d93f411851d7c929.customDestinations-ms</li></ul></li><li>AutomaticDestinations<ul><li>7e4dca80246863e3.automaticDestinations-ms</li><li>1b4dd67f29cb1962.automaticDestinations-ms</li></ul></li></ul></li></ul></li></ul></li></ul></li><li>Local<ul><li>Microsoft<ul><li>Windows<ul><li>Explorer<ul><li>thumbcache_256.db</li><li>thumbcache_32.db</li><li>thumbcache_idx.db</li></ul></li><li>Temporary Internet Files<ul><li>counters.dat</li></ul></li><li>WebCache<ul><li>V01.log</li><li>WebCacheV01.dat</li><li>V01.chk</li></ul></li><li>UsrClass.dat</li><li>UsrClass.dat.LOG1</li><li>Caches<ul><li>cversions.1.db</li></ul></li></ul></li><li>Internet Explorer<ul><li>MSIMGSIZ.DAT</li><li>Tiles<ul><li>pin-2845162440<ul><li>msapplication.xml</li></ul></li></ul></li><li>Recovery<ul><li>High<ul><li>Last Active<ul><li>RecoveryStore.{AC08E291-7B19-11E6-917C-0800273C6B02}.dat</li></ul></li></ul></li></ul></li></ul></li><li>Feeds<ul><li>FeedsStore.feedsdb-ms</li><li>{5588ACFD-6436-411B-A5CE-666AE6A92D3D}~<ul><li>WebSlices~<ul><li>Suggested Sites~.feed-ms</li></ul></li></ul></li></ul></li><li>Media Player<ul><li>CurrentDatabase_372.wmdb</li></ul></li></ul></li><li>IconCache.db</li></ul></li></ul></li></ul></li><li>Public<ul><li>Libraries<ul><li>RecordedTV.library-ms</li></ul></li></ul></li></ul></li><li>ProgramData<ul><li>Microsoft<ul><li>Windows Defender<ul><li>Support<ul><li>MPLog-07132009-215552.log</li></ul></li><li>Scans<ul><li>History<ul><li>Service<ul><li>Unknown.Log</li></ul></li></ul></li></ul></li></ul></li><li>Search<ul><li>Data<ul><li>Applications<ul><li>Windows<ul><li>MSS.log</li><li>Windows.edb</li><li>GatherLogs<ul><li>SystemIndex<ul><li>SystemIndex.2.gthr</li><li>SystemIndex.2.Crwl</li><li>SystemIndex.1.Crwl</li><li>SystemIndex.1.gthr</li></ul></li></ul></li><li>MSS.chk</li><li>Projects<ul><li>SystemIndex<ul><li>PropMap<ul><li>CiPT0000.000</li></ul></li><li>SecStore<ul><li>CiST0000.002</li><li>CiST0000.001</li><li>CiST0000.000</li></ul></li><li>Indexer<ul><li>CiFiles<ul><li>CiAD0002.000</li><li>CiAD0002.001</li><li>00010001.ci</li><li>00010008.wid</li><li>00010004.wid</li><li>INDEX.002</li><li>INDEX.001</li><li>INDEX.000</li><li>00010001.dir</li><li>00010006.wid</li><li>CiAB0002.001</li><li>CiAB0002.000</li><li>CiAB0002.002</li><li>00010003.wid</li><li>CiAD0002.002</li><li>00010005.wid</li><li>00010007.ci</li><li>00010009.wid</li><li>00010005.ci</li><li>00010001.wid</li><li>00010005.dir</li><li>00010009.ci</li><li>00010007.wid</li><li>00010009.dir</li><li>00010002.wid</li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li><li>RAC<ul><li>PublishedData<ul><li>RacWmiDatabase.sdf</li></ul></li><li>StateData<ul><li>RacWmiEventData.dat</li><li>RacWmiDataBookmarks.dat</li><li>RacDatabase.sdf</li></ul></li></ul></li><li>Windows<ul><li>DRM<ul><li>drmstore.hds</li></ul></li></ul></li><li>Diagnosis<ul><li>ETLLogs<ul><li>ShutdownLogger<ul><li>AutoLogger-Diagtrack-Listener.etl</li></ul></li></ul></li><li>events01.rbs</li></ul></li><li>IlsCache<ul><li>ilrcache.xml</li><li>imcrcache.xml</li></ul></li><li>Network<ul><li>Downloader<ul><li>qmgr1.dat</li><li>qmgr0.dat</li></ul></li></ul></li></ul></li></ul></li></ul>"><ul class=".actual"><li>Windows<ul><li>setupact.log</li><li>Tasks<ul><li>SCHEDLGU.TXT</li></ul> .... etc.
My Javascript code:
<script>
$(function () {
$('button').on('click', function() {
$('.jstree').jstree();
});
});
</script>
My problem: When the dom of this UL/LI-list is being built and generated by Angular2, the jstree is not getting applied. Instead I receive a normal list.
I tried several ways, having the jstree also loaded on the document ready function, without success:
<script>
$(function () {
$(".jstree").jstree();
}
</script>
Appreciate any help or hint.
Thanks
If you really invoke the code like you shown, Angular app is not in the DOM yet when document ready is called. If you need to use a jQuery plugin inside Angular 2, you should invoke it in a component's ngOnInit. Refer here for sample angular2 component.
I've been struggling with query for some time. I have a CMS that I want to use on my site, but I cant use PHP includes so I decided to use jquery. I have made all the necessary includes and when I open the webpage it doesn't load all the files... Rarely does load() function load every file. Any ideas to solve the problem or alternatives? thanks.
<script type="text/javascript">
$(document).ready(function () {
// find element with ID of "target" and put file contents into it
$('#welcome-container').load('admin/data/blocks/Slider/Text.html');
$('#slides').load('admin/data/blocks/Slider/Imagini.html');
$('#acasa-continut').load('admin/data/blocks/Acasa/Continut.html');
$('#sidebar').load('admin/data/blocks/Sidebar/Continut.html');
$('#sidebar-v1').load('admin/data/blocks/Sidebar/Video-1.html');
$('#sidebar-v2').load('admin/data/blocks/Sidebar/Video-2.html');
$('#principii').load('admin/data/blocks/Despre/Principii.html');
$('#echipa').load('admin/data/blocks/Despre/Echipa.html');
$('#echipament').load('admin/data/blocks/Despre/Echipament.html');
$('#contact-t').load('admin/data/blocks/Contact/Contact.html');
});
</script>
Im doing an embed code for our clients, so the clients could have multiple embed of our code (cant do it over iframe). I would want to try requirejs to do it, so my question is if i have multiple requirejs on the same page, both load different js with different paths+shims, will the oncomplete function for both of them work?
like the client would have on the main content (on their cms on specific page)
<script src="myexample.com/video.js?key=123"></script>
and on the sidebar (on their cms on all pages)
<script src="myexample.com/content.js?key=123"></script>
so my video.js would have
require.config({path: { video : '' }..., shim : {} ....});
require(['video','utils'], function(){ do something on video });
and the content.js would have
require.config({path: { content : '' }..., shim : {} ....});
require(['content','dom'], function(){ do something on content });
From what i go from here https://groups.google.com/forum/?fromgroups=#!topic/requirejs/MwQ-CNHxGKc it seems not possible that the 2 functions would be executed, meaning it would only process one of them.
If its not possible in requirejs can someone point me to other amd loaders where its possible. Thanks
You could use one loader with a minimal function that start both of your modules:
require(['video','content'], function(video, content){
video.start();
content.start();
});
Have a look at how Shootitlive solved it with their widget
One can pass arbitrary parameters to each embed
The embed code is short
It loads asynchronously
One can have multiple players on one page
http://shootitlive.com/2012/07/developing-an-embeddable-javascript-widget/