To get the context, you should get it from the page object like this
(from online_users block)
if (has_capability('block/online_users:viewlist', $this->page->context)) {
Lets start from that and see if that makes a difference.
If you feel like trying something even more exciting ...
You seem to be adding script and style tags. You should try and go 100% Moodle if you can.
If you put your CSS inside a file called "styles.css" in your block plugin's folder Moodle will load it automatically.
Javascript admittedly is a bit trickier, and you should be using AMD modules. Which does seem like overkill. Well, it will until some other plugin loads jquery into the global space like you are, and overwrites any jquery plugins you loaded and other bad things.
The way to load an AMD module in your block is like this:
//here we set up any info we need to pass into javascript
$opts =Array();
$opts['somedata']='blah';
$opts['moredate']='blah;
$this->page->requires->js_call_amd( "block_eportfolio/eportfoliostuff", 'init', array($opts));
Then make the js file in the following path in your plugin: amd/src/eportfoliostuff.js
Add some code like this:
define(['jquery','core/log'], function($,log) {
"use strict"; // jshint ;_;
log.debug('eportfolio: initialising');
return{
//pick up config data and use jquery
init: function(props){
$('#somecontrol').text(props.somedata);
}
};//end of return value
});
Then Moodle will run your init function shortly after the rest of the page has been loaded